emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112330: * lisp/bookmark.el (bookmark


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112330: * lisp/bookmark.el (bookmark-completing-read): Improve handling of empty
Date: Fri, 19 Apr 2013 01:11:16 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112330
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14176
author: Thierry Volpiatto <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2013-04-19 01:11:16 -0400
message:
  * lisp/bookmark.el (bookmark-completing-read): Improve handling of empty
  string.
modified:
  lisp/ChangeLog
  lisp/bookmark.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-19 04:09:08 +0000
+++ b/lisp/ChangeLog    2013-04-19 05:11:16 +0000
@@ -1,3 +1,8 @@
+2013-04-19  Thierry Volpiatto  <address@hidden>
+
+       * bookmark.el (bookmark-completing-read): Improve handling of empty
+       string (bug#14176).
+
 2013-04-19  Stefan Monnier  <address@hidden>
 
        * vc/vc-dispatcher.el (vc-do-command): Get rid of default sentinel msg.

=== modified file 'lisp/bookmark.el'
--- a/lisp/bookmark.el  2013-04-04 01:59:09 +0000
+++ b/lisp/bookmark.el  2013-04-19 05:11:16 +0000
@@ -427,8 +427,8 @@
   "Prompting with PROMPT, read a bookmark name in completion.
 PROMPT will get a \": \" stuck on the end no matter what, so you
 probably don't want to include one yourself.
-Optional second arg DEFAULT is a string to return if the user enters
-the empty string."
+Optional arg DEFAULT is a string to return if the user input is empty.
+If DEFAULT is nil then return empty string for empty input."
   (bookmark-maybe-load-default-file) ; paranoia
   (if (listp last-nonmenu-event)
       (bookmark-menu-popup-paned-menu t prompt
@@ -437,22 +437,17 @@
                                                'string-lessp)
                                        (bookmark-all-names)))
     (let* ((completion-ignore-case bookmark-completion-ignore-case)
-          (default default)
+           (default (unless (equal "" default) default))
           (prompt (concat prompt (if default
                                       (format " (%s): " default)
-                                    ": ")))
-          (str
-           (completing-read prompt
-                            (lambda (string pred action)
-                               (if (eq action 'metadata)
-                                   '(metadata (category . bookmark))
-                                 (complete-with-action
-                                  action bookmark-alist string pred)))
-                            nil
-                            0
-                            nil
-                            'bookmark-history)))
-      (if (string-equal "" str) default str))))
+                                    ": "))))
+      (completing-read prompt
+                       (lambda (string pred action)
+                         (if (eq action 'metadata)
+                             '(metadata (category . bookmark))
+                             (complete-with-action
+                              action bookmark-alist string pred)))
+                       nil 0 nil 'bookmark-history default))))
 
 
 (defmacro bookmark-maybe-historicize-string (string)


reply via email to

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