emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mb-pos.el (was: Minibuffer default values list)


From: Juri Linkov
Subject: mb-pos.el (was: Minibuffer default values list)
Date: Sun, 25 Nov 2007 17:18:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>     +   (run-hooks 'goto-history-element-pre-hook)
>
> How about running this hook only when moving into the "future"?
>
> Why preserve any ambient binding?  I think it should bbe completely
> superseded.
>
> For that reason, maybe it should be `goto-history-element-pre-function'
> and its value should be just one function.
>
> A better name would be `goto-history-defaults-function'.

The reason I added a new hook `goto-history-element-pre-hook' is to add
later another symmetric hook `goto-history-element-post-hook' necessary
for implementing another feature: with the recent improvements in the
minibuffer functionality it became essential for the user to know the
current minibuffer position in the history list or in the "future" values
list.  To indicate the current minibuffer position I've created a new file
mb-pos.el attached below based in the existing file mb-depth.el with the
very similar functionality.  Since both files are very short, perhaps
we should even rename mb-depth.el to mb-ind.el (minibuffer indications),
and merge mb-pos.el into this common file.

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.889
diff -u -r1.889 simple.el
--- lisp/simple.el      15 Nov 2007 16:42:43 -0000      1.889
+++ lisp/simple.el      25 Nov 2007 15:18:27 -0000
@@ -1302,6 +1302,7 @@
   "Puts element of the minibuffer history in the minibuffer.
 The argument NABS specifies the absolute history position."
   (interactive "p")
+  (run-hooks 'goto-history-element-pre-hook)
   (let ((minimum (if minibuffer-default
                     (- (if (listp minibuffer-default)
                            (length minibuffer-default)
@@ -1344,7 +1345,8 @@
         (let ((print-level nil))
           (prin1-to-string elt))
        elt))
-    (goto-char (or minibuffer-temporary-goal-position (point-max)))))
+    (goto-char (or minibuffer-temporary-goal-position (point-max)))
+    (run-hooks 'goto-history-element-post-hook)))
 
 (defun next-history-element (n)
   "Puts next element of the minibuffer history in the minibuffer.

Attachment: mb-pos.el
Description: application/emacs-lisp

-- 
Juri Linkov
http://www.jurta.org/emacs/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]