[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108512: * tmm.el (tmm-prompt): Use s
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108512: * tmm.el (tmm-prompt): Use string-prefix-p. |
Date: |
Thu, 07 Jun 2012 12:35:00 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108512
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2012-06-07 12:35:00 -0400
message:
* tmm.el (tmm-prompt): Use string-prefix-p.
(tmm-completion-delete-prompt): Don't affect current-buffer outside.
(tmm-add-prompt): Use minibuffer-completion-help.
(tmm-delete-map): Remove.
modified:
lisp/ChangeLog
lisp/tmm.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-06-07 16:20:28 +0000
+++ b/lisp/ChangeLog 2012-06-07 16:35:00 +0000
@@ -1,5 +1,10 @@
2012-06-07 Stefan Monnier <address@hidden>
+ * tmm.el (tmm-prompt): Use string-prefix-p.
+ (tmm-completion-delete-prompt): Don't affect current-buffer outside.
+ (tmm-add-prompt): Use minibuffer-completion-help.
+ (tmm-delete-map): Remove.
+
* subr.el (kbd): Make it its own function.
2012-06-07 Stefan Merten <address@hidden>
=== modified file 'lisp/tmm.el'
--- a/lisp/tmm.el 2012-04-10 20:12:07 +0000
+++ b/lisp/tmm.el 2012-06-07 16:35:00 +0000
@@ -229,8 +229,7 @@
(- (* 2 history-len) index-of-default))))))))
(setq choice (cdr (assoc out tmm-km-list)))
(and (null choice)
- (> (length out) (length tmm-c-prompt))
- (string= (substring out 0 (length tmm-c-prompt)) tmm-c-prompt)
+ (string-prefix-p tmm-c-prompt out)
(setq out (substring out (length tmm-c-prompt))
choice (cdr (assoc out tmm-km-list))))
(and (null choice) out
@@ -330,9 +329,9 @@
(use-local-map (append map (current-local-map))))))
(defun tmm-completion-delete-prompt ()
- (set-buffer standard-output)
+ (with-current-buffer standard-output
(goto-char (point-min))
- (delete-region (point) (search-forward "Possible completions are:\n")))
+ (delete-region (point) (search-forward "Possible completions are:\n"))))
(defun tmm-remove-inactive-mouse-face ()
"Remove the mouse-face property from inactive menu items."
@@ -351,38 +350,24 @@
(set-buffer-modified-p nil)))
(defun tmm-add-prompt ()
- (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t)
(unless tmm-c-prompt
(error "No active menu entries"))
(setq tmm-old-mb-map (tmm-define-keys t))
;; Get window and hide it for electric mode to get correct size
- (save-window-excursion
- (let ((completions
- (mapcar 'car minibuffer-completion-table)))
- (or tmm-completion-prompt
- (add-hook 'completion-setup-hook
- 'tmm-completion-delete-prompt 'append))
- (unwind-protect
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list completions))
- (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)))
- (set-buffer "*Completions*")
+ (or tmm-completion-prompt
+ (add-hook 'completion-setup-hook
+ 'tmm-completion-delete-prompt 'append))
+ (unwind-protect
+ (minibuffer-completion-help)
+ (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))
+ (with-current-buffer "*Completions*"
(tmm-remove-inactive-mouse-face)
(when tmm-completion-prompt
- (let ((buffer-read-only nil))
- (goto-char (point-min))
- (insert tmm-completion-prompt))))
- (save-selected-window
- (other-window 1) ; Electric-pop-up-window does
- ; not work in minibuffer
- (Electric-pop-up-window "*Completions*"))
+ (let ((inhibit-read-only t))
+ (goto-char (point-min))
+ (insert tmm-completion-prompt))))
(insert tmm-c-prompt))
-(defun tmm-delete-map ()
- (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t)
- (if tmm-old-mb-map
- (use-local-map tmm-old-mb-map)))
-
(defun tmm-shortcut ()
"Choose the shortcut that the user typed."
(interactive)
@@ -520,6 +505,10 @@
(progn
;; Otherwise, it is a prefix, so make a list of the subcommands.
;; Make a list of all the bindings in all the keymaps.
+ ;; FIXME: we'd really like to just use `key-binding' now that it
+ ;; returns a keymap that contains really all the bindings under that
+ ;; prefix, but `keyseq' is always [menu-bar], so the desired order of
+ ;; the bindings is difficult to recover.
(setq minorbind (mapcar 'cdr (minor-mode-key-binding keyseq)))
(setq localbind (local-key-binding keyseq))
(setq globalbind (copy-sequence (cdr (global-key-binding keyseq))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108512: * tmm.el (tmm-prompt): Use string-prefix-p.,
Stefan Monnier <=