diff lisp/minibuffer.el @ 105664:6a6fcf3e8e4d

* minibuffer.el (read-file-name): Check for repeat before putting a default argument in file-name-history (Bug#4657). * emacs-lisp/lisp-mode.el (preceding-sexp): Recognize hash table read syntax (Bug#4737). * textmodes/sgml-mode.el (sgml-delete-tag): Use sgml-looking-back-at.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 18 Oct 2009 22:25:36 +0000
parents 68686d39c93a
children 136cf2d23c90
line wrap: on
line diff
--- a/lisp/minibuffer.el	Sun Oct 18 19:47:38 2009 +0000
+++ b/lisp/minibuffer.el	Sun Oct 18 22:25:36 2009 +0000
@@ -1289,12 +1289,16 @@
 
           (if replace-in-history
               ;; Replace what Fcompleting_read added to the history
-              ;; with what we will actually return.
+              ;; with what we will actually return.  As an exception,
+              ;; if that's the same as the second item in
+              ;; file-name-history, it's really a repeat (Bug#4657).
               (let ((val1 (minibuffer--double-dollars val)))
                 (if history-delete-duplicates
                     (setcdr file-name-history
                             (delete val1 (cdr file-name-history))))
-                (setcar file-name-history val1))
+		(if (string= val1 (cadr file-name-history))
+		    (pop file-name-history)
+		  (setcar file-name-history val1)))
             (if add-to-history
                 ;; Add the value to the history--but not if it matches
                 ;; the last value already there.