[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Make `C-x {' and `C-x }' repeatable
From: |
Juri Linkov |
Subject: |
Re: [PATCH] Make `C-x {' and `C-x }' repeatable |
Date: |
Fri, 24 May 2013 01:30:05 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
> 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?
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, (continued)
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, chad, 2013/05/22
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Drew Adams, 2013/05/23
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/23
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Drew Adams, 2013/05/23
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Stephen J. Turnbull, 2013/05/24
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Drew Adams, 2013/05/24
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Stephen J. Turnbull, 2013/05/24
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/22
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/22
- RE: [PATCH] Make `C-x {' and `C-x }' repeatable, Drew Adams, 2013/05/22
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable,
Juri Linkov <=
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/23
Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/22
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Gauthier Östervall, 2013/05/23
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Stefan Monnier, 2013/05/23
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Juri Linkov, 2013/05/23
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Alan Mackenzie, 2013/05/24
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Juri Linkov, 2013/05/24
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Alan Mackenzie, 2013/05/25
- Re: [PATCH] Make `C-x {' and `C-x }' repeatable, Juri Linkov, 2013/05/25