From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Make `C-x {' and `C-x }' repeatable Date: Fri, 24 May 2013 01:30:05 +0300 Organization: JURTA Message-ID: <87txltpcsv.fsf@mail.jurta.org> References: <87mwrombc3.fsf@mail.jurta.org> <87r4gyondh.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369348559 25390 80.91.229.3 (23 May 2013 22:35:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 May 2013 22:35:59 +0000 (UTC) Cc: Gauthier =?iso-8859-1?Q?=D6sterva?= =?iso-8859-1?Q?ll?= , Drew Adams , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 24 00:35:58 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ufe72-0003rK-UF for ged-emacs-devel@m.gmane.org; Fri, 24 May 2013 00:35:57 +0200 Original-Received: from localhost ([::1]:39879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufe72-0008EP-In for ged-emacs-devel@m.gmane.org; Thu, 23 May 2013 18:35:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufe6v-0008BG-1Z for emacs-devel@gnu.org; Thu, 23 May 2013 18:35:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufe6p-0002yG-So for emacs-devel@gnu.org; Thu, 23 May 2013 18:35:48 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:55081 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufe6p-0002y4-JQ for emacs-devel@gnu.org; Thu, 23 May 2013 18:35:43 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 19D35258B9E939; Thu, 23 May 2013 15:35:41 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 22 May 2013 17:47:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 69.163.218.105 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159755 Archived-At: > So the right fix for it is to introduce a new keymap (call it > "overriding-temporary-local-map" or something) which is like > overriding-terminal-local-map except that it doesn't disable other > keymaps (it just has higher precedence). Adding it to the pseudo-code in (info "(elisp) Searching Keymaps") is this what you meant? (or (FIND-IN overriding-temporary-local-map) (cond (overriding-terminal-local-map (FIND-IN overriding-terminal-local-map)) (overriding-local-map (FIND-IN overriding-local-map)) ((or (FIND-IN (get-char-property (point) 'keymap)) (FIND-IN TEMP-MAP) (FIND-IN-ANY emulation-mode-map-alists) (FIND-IN-ANY minor-mode-overriding-map-alist) (FIND-IN-ANY minor-mode-map-alist) (if (get-text-property (point) 'local-map) (FIND-IN (get-char-property (point) 'local-map)) (FIND-IN (current-local-map)))))) (FIND-IN (current-global-map))) > Isearch might benefit from being changed to use such a new > overriding-temporary-local-map as well. It might let us drop the > isearch-other-char command (which has the drawback of putting things > back onto unread-command-event, which is inherently unreliable in the > presence of some function-key-map bindings, among other problems). > Of course, such a change might also bump into new problems. I tried to do this for isearch to implement key sequences like `M-s C-f C-f M-f C-M-f C-e M-}' that moves point and at the same time adds the passed text to the search string: (defvar isearch-yank-jump-keymap (let ((map (make-sparse-keymap))) (define-key map "\C-f" 'isearch-yank-jump) ;; next char (define-key map "\M-f" 'isearch-yank-jump) ;; next word (define-key map "\C-\M-f" 'isearch-yank-jump) ;; next sexp (define-key map "\C-n" 'isearch-yank-jump) ;; next line (define-key map "\C-e" 'isearch-yank-jump) ;; end-of-line (define-key map "\M-}" 'isearch-yank-jump) ;; next paragraph map) "Keymap to yank text from jumped positions.") ;; Use prefix key `M-s' to activate yanking key sequences. (define-key isearch-mode-map "\M-s\C-f" 'isearch-yank-jump) (define-key isearch-mode-map "\M-s\M-f" 'isearch-yank-jump) (define-key isearch-mode-map "\M-s\C-\M-f" 'isearch-yank-jump) (define-key isearch-mode-map "\M-s\C-n" 'isearch-yank-jump) (define-key isearch-mode-map "\M-s\C-e" 'isearch-yank-jump) (define-key isearch-mode-map "\M-s\M-}" 'isearch-yank-jump) (defun isearch-yank-jump (&optional arg) (interactive "p") (let* ((keys last-command-event) (overriding-terminal-local-map nil) (binding (key-binding (vector keys)))) (when binding (setq prefix-arg arg) (isearch-yank-internal (lambda () (command-execute binding) (point)))) (set-temporary-overlay-map isearch-yank-jump-keymap))) But `set-temporary-overlay-map' has no effect. Could the new `overriding-temporary-local-map' help in this case?