bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20785: user-error for mark-inactive


From: Juri Linkov
Subject: bug#20785: user-error for mark-inactive
Date: Thu, 11 Jun 2015 02:34:06 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)

A single remaining case that is too annoying is when the debugger is
called due to a user error while accidentally typing `C-w' (kill-region)
when there is no active mark in the buffer:

Debugger entered--Lisp error: (mark-inactive)
  signal(mark-inactive nil)
  mark()
  byte-code("\300 `\301E\207" [mark region] 3)
  call-interactively(kill-region nil nil)
  command-execute(kill-region)

The following patch avoids this in both cases:

1. when mark-even-if-inactive is non-nil, displays the message:
   "user-error: The mark is not set now, so there is no region"

2. when mark-even-if-inactive is nil, displays the message:
   "mark: The mark is not active now"

diff --git a/lisp/simple.el b/lisp/simple.el
index 1eb0643..31810a4 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4017,7 +4021,7 @@ (defun kill-region (beg end &optional region)
   ;; calling `kill-append'.
   (interactive (list (mark) (point) 'region))
   (unless (and beg end)
-    (error "The mark is not set now, so there is no region"))
+    (user-error "The mark is not set now, so there is no region"))
   (condition-case nil
       (let ((string (if region
                         (funcall region-extract-function 'delete)

diff --git a/lisp/bindings.el b/lisp/bindings.el
index b658914..3672812 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -633,7 +633,7 @@ (setq debug-ignored-errors
       ;; file-supersession should all be user-errors!
       `(beginning-of-line beginning-of-buffer end-of-line
        end-of-buffer end-of-file buffer-read-only
-       file-supersession
+       file-supersession mark-inactive
         user-error ;; That's the main one!
         ))
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]