GNU bug report logs - #20785
user-error for mark-inactive

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 10 Jun 2015 23:37:02 UTC

Severity: minor

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20785 in the body.
You can then email your comments to 20785 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20785; Package emacs. (Wed, 10 Jun 2015 23:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 10 Jun 2015 23:37:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: user-error for mark-inactive
Date: Thu, 11 Jun 2015 02:34:06 +0300
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!
         ))
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20785; Package emacs. (Thu, 11 Jun 2015 03:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 20785 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> linkov.net>
Cc: 20785 <at> debbugs.gnu.org
Subject: Re: bug#20785: user-error for mark-inactive
Date: Wed, 10 Jun 2015 23:11:06 -0400
> 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:

Looks OK to me (maybe we could also just signal `mark-inactive' instead
of calling user-error, but either way is OK for me),


        Stefan




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Thu, 11 Jun 2015 23:20:04 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Thu, 11 Jun 2015 23:20:05 GMT) Full text and rfc822 format available.

Message #13 received at 20785-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 20785-done <at> debbugs.gnu.org
Subject: Re: bug#20785: user-error for mark-inactive
Date: Fri, 12 Jun 2015 02:17:56 +0300
>> 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:
>
> Looks OK to me

Installed.

> (maybe we could also just signal `mark-inactive' instead
> of calling user-error, but either way is OK for me),

I see that `mark-inactive' and user-error in `kill-region'
have different messages:

`mark-inactive' signaled in the function `mark'
has the message only about the mark:

  "The mark is not active now"

whereas the user-error message in `kill-region'
is specific about the region:

  "The mark is not set now, so there is no region"

and I don't see how to merge these messages.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20785; Package emacs. (Fri, 12 Jun 2015 05:41:03 GMT) Full text and rfc822 format available.

Message #16 received at 20785-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> linkov.net>
Cc: 20785-done <at> debbugs.gnu.org
Subject: Re: bug#20785: user-error for mark-inactive
Date: Fri, 12 Jun 2015 01:40:11 -0400
> `mark-inactive' signaled in the function `mark'
> has the message only about the mark:

>   "The mark is not active now"

> whereas the user-error message in `kill-region'
> is specific about the region:

>   "The mark is not set now, so there is no region"

I'm not sure how important is this difference (or even if it's intentional).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20785; Package emacs. (Mon, 22 Jun 2015 22:48:02 GMT) Full text and rfc822 format available.

Message #19 received at 20785 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 20785 <at> debbugs.gnu.org
Subject: Re: bug#20785: user-error for mark-inactive
Date: Tue, 23 Jun 2015 01:46:17 +0300
>> `mark-inactive' signaled in the function `mark'
>> has the message only about the mark:
>
>>   "The mark is not active now"
>
>> whereas the user-error message in `kill-region'
>> is specific about the region:
>
>>   "The mark is not set now, so there is no region"
>
> I'm not sure how important is this difference (or even if it's intentional).

I noticed another occurrence in ‘shell-command-on-region’, so maybe better
to leave the mention of the region in all region-related commands.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 21 Jul 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.