GNU bug report logs - #15568
Lookup this-command-keys without a prefix argument

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 8 Oct 2013 23:23:01 UTC

Severity: normal

Done: Juri Linkov <juri <at> jurta.org>

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 15568 in the body.
You can then email your comments to 15568 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#15568; Package emacs. (Tue, 08 Oct 2013 23:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 08 Oct 2013 23:23:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Lookup this-command-keys without a prefix argument
Date: Wed, 09 Oct 2013 02:21:10 +0300
As discovered in bug#15200, (lookup-key isearch-mode-map (this-command-keys))
can't decide whether the key sequence is bound to an isearch command or not.

(lookup-key isearch-mode-map (kbd "C-u C-l")) => 1
(lookup-key isearch-mode-map (kbd "C-u C-w")) => 1

both return 1.

The length of universal-argument-num-events was used to remove
the prefix from this-command-keys to lookup a key without prefix,
but since universal-argument-num-events is gone it's unclear
what could replace it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Wed, 09 Oct 2013 18:15:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> jurta.org>
Cc: 15568 <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Wed, 09 Oct 2013 14:14:27 -0400
> As discovered in bug#15200, (lookup-key isearch-mode-map (this-command-keys))
> can't decide whether the key sequence is bound to an isearch command or not.

Actually, this is easy to fix: use this-single-command-keys.


        Stefan




Reply sent to Juri Linkov <juri <at> jurta.org>:
You have taken responsibility. (Wed, 09 Oct 2013 23:59:01 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> jurta.org>:
bug acknowledged by developer. (Wed, 09 Oct 2013 23:59:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 15568-done <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Thu, 10 Oct 2013 02:57:18 +0300
>> As discovered in bug#15200, (lookup-key isearch-mode-map (this-command-keys))
>> can't decide whether the key sequence is bound to an isearch command or not.
>
> Actually, this is easy to fix: use this-single-command-keys.

Ah, I expected such a command, but missed it when looked
at the list of commands with the prefix "this-command-...".

Also I discovered that to support a key sequence like
`C-s C-u C-u C-l' requires adding the command `universal-argument-more'
(and `universal-argument-minus' for completeness).

I installed a fix for these problems.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Thu, 10 Oct 2013 01:03:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 15568-done <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Wed, 09 Oct 2013 21:02:57 -0400
> Also I discovered that to support a key sequence like
> `C-s C-u C-u C-l' requires adding the command `universal-argument-more'
> (and `universal-argument-minus' for completeness).

Indeed, tho I think your fix is a workaround rather than a real fix:
Basically after the first C-u we're in some kind of transient
"universal-argument mode" and isearch shouldn't have to know the list of
commands that can be run in this mode, it should instead just "wait for
the mode to exit".

This is a general issue regarding interaction between various uses of
set-temporary-overlay-map (and friends, since isearch doesn't actually
use set-temporary-overlay-map).  There should be some kind of notion of
nesting, where the outer set-temporary-overlay-map should not exit as
long as the inner one is still active.

> I installed a fix for these problems.

Thanks.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Fri, 11 Oct 2013 00:32:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15568 <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Fri, 11 Oct 2013 02:58:35 +0300
>> Also I discovered that to support a key sequence like
>> `C-s C-u C-u C-l' requires adding the command `universal-argument-more'
>> (and `universal-argument-minus' for completeness).
>
> Indeed, tho I think your fix is a workaround rather than a real fix:
> Basically after the first C-u we're in some kind of transient
> "universal-argument mode" and isearch shouldn't have to know the list of
> commands that can be run in this mode, it should instead just "wait for
> the mode to exit".
>
> This is a general issue regarding interaction between various uses of
> set-temporary-overlay-map (and friends, since isearch doesn't actually
> use set-temporary-overlay-map).  There should be some kind of notion of
> nesting, where the outer set-temporary-overlay-map should not exit as
> long as the inner one is still active.

Maybe `universal-argument--mode' should be defined as a minor mode
and provide a variable with the same name that can be checked by isearch.
This mode can be disabled using `on-exit'.  Something like:

(defun universal-argument--mode ()
  (setq universal-argument--mode t)
  (set-temporary-overlay-map
   universal-argument-map nil
   (lambda () (setq universal-argument--mode nil))))

and in isearch.el:

          (and isearch-allow-prefix
	       (or (memq this-command '(universal-argument
					digit-argument
					negative-argument))
		   universal-argument--mode))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Fri, 11 Oct 2013 02:31:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 15568 <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Thu, 10 Oct 2013 22:30:03 -0400
> Maybe `universal-argument--mode' should be defined as a minor mode
> and provide a variable with the same name that can be checked by isearch.

No, isearch shouldn't need to know anything about universal-argument,
other than "it follows the convention for set-temporary-overlay-map".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Fri, 11 Oct 2013 12:51:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: 15568 <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Fri, 11 Oct 2013 08:50:54 -0400
>> Maybe `universal-argument--mode' should be defined as a minor mode
>> and provide a variable with the same name that can be checked by isearch.
> No, isearch shouldn't need to know anything about universal-argument,
> other than "it follows the convention for set-temporary-overlay-map".

Here's an idea: check if (eq overriding-terminal-local-map isearch-mode-map)


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15568; Package emacs. (Sat, 12 Oct 2013 00:16:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15568 <at> debbugs.gnu.org
Subject: Re: bug#15568: Lookup this-command-keys without a prefix argument
Date: Sat, 12 Oct 2013 02:49:50 +0300
> Here's an idea: check if (eq overriding-terminal-local-map isearch-mode-map)

I tried this approach and it passes my tests:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-10-09 23:52:46 +0000
+++ lisp/isearch.el	2013-10-11 23:49:42 +0000
@@ -2240,10 +2240,12 @@ (defun isearch-pre-command-hook ()
       (setq this-command 'isearch-edit-string))
      ;; Handle a scrolling function or prefix argument.
      ((or (and isearch-allow-prefix
-	       (memq this-command '(universal-argument
-				    universal-argument-more
-				    universal-argument-minus
-				    digit-argument negative-argument)))
+	       (or (memq this-command '(universal-argument
+					digit-argument
+					negative-argument))
+		   ;; Check if a prefix arg added a nested map.
+		   (and overriding-terminal-local-map
+			(not (eq overriding-terminal-local-map isearch-mode-map)))))
 	  (and isearch-allow-scroll
 	       (or (eq (get this-command 'isearch-scroll) t)
 		   (eq (get this-command 'scroll-command) t))))





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 09 Nov 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 178 days ago.

Previous Next


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