diff options
| author | Thierry Volpiatto | 2013-04-19 01:11:16 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-04-19 01:11:16 -0400 |
| commit | 7d6883367a54b4eee342aa861ef73e4191151ef0 (patch) | |
| tree | e5302c9935bad85459c56162d54353f215ea3a72 | |
| parent | 31dcede0c7fc852d6f05bda476a99bb37661371b (diff) | |
| download | emacs-7d6883367a54b4eee342aa861ef73e4191151ef0.tar.gz emacs-7d6883367a54b4eee342aa861ef73e4191151ef0.zip | |
* lisp/bookmark.el (bookmark-completing-read): Improve handling of empty
string.
Fixes: debbugs:14176
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/bookmark.el | 27 |
2 files changed, 16 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 97ee66dcc01..a09d37352f7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-04-19 Thierry Volpiatto <thierry.volpiatto@gmail.com> | ||
| 2 | |||
| 3 | * bookmark.el (bookmark-completing-read): Improve handling of empty | ||
| 4 | string (bug#14176). | ||
| 5 | |||
| 1 | 2013-04-19 Stefan Monnier <monnier@iro.umontreal.ca> | 6 | 2013-04-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 7 | ||
| 3 | * vc/vc-dispatcher.el (vc-do-command): Get rid of default sentinel msg. | 8 | * vc/vc-dispatcher.el (vc-do-command): Get rid of default sentinel msg. |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index c1d8a4a0a5e..482cdf92752 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -427,8 +427,8 @@ just return it." | |||
| 427 | "Prompting with PROMPT, read a bookmark name in completion. | 427 | "Prompting with PROMPT, read a bookmark name in completion. |
| 428 | PROMPT will get a \": \" stuck on the end no matter what, so you | 428 | PROMPT will get a \": \" stuck on the end no matter what, so you |
| 429 | probably don't want to include one yourself. | 429 | probably don't want to include one yourself. |
| 430 | Optional second arg DEFAULT is a string to return if the user enters | 430 | Optional arg DEFAULT is a string to return if the user input is empty. |
| 431 | the empty string." | 431 | If DEFAULT is nil then return empty string for empty input." |
| 432 | (bookmark-maybe-load-default-file) ; paranoia | 432 | (bookmark-maybe-load-default-file) ; paranoia |
| 433 | (if (listp last-nonmenu-event) | 433 | (if (listp last-nonmenu-event) |
| 434 | (bookmark-menu-popup-paned-menu t prompt | 434 | (bookmark-menu-popup-paned-menu t prompt |
| @@ -437,22 +437,17 @@ the empty string." | |||
| 437 | 'string-lessp) | 437 | 'string-lessp) |
| 438 | (bookmark-all-names))) | 438 | (bookmark-all-names))) |
| 439 | (let* ((completion-ignore-case bookmark-completion-ignore-case) | 439 | (let* ((completion-ignore-case bookmark-completion-ignore-case) |
| 440 | (default default) | 440 | (default (unless (equal "" default) default)) |
| 441 | (prompt (concat prompt (if default | 441 | (prompt (concat prompt (if default |
| 442 | (format " (%s): " default) | 442 | (format " (%s): " default) |
| 443 | ": "))) | 443 | ": ")))) |
| 444 | (str | 444 | (completing-read prompt |
| 445 | (completing-read prompt | 445 | (lambda (string pred action) |
| 446 | (lambda (string pred action) | 446 | (if (eq action 'metadata) |
| 447 | (if (eq action 'metadata) | 447 | '(metadata (category . bookmark)) |
| 448 | '(metadata (category . bookmark)) | 448 | (complete-with-action |
| 449 | (complete-with-action | 449 | action bookmark-alist string pred))) |
| 450 | action bookmark-alist string pred))) | 450 | nil 0 nil 'bookmark-history default)))) |
| 451 | nil | ||
| 452 | 0 | ||
| 453 | nil | ||
| 454 | 'bookmark-history))) | ||
| 455 | (if (string-equal "" str) default str)))) | ||
| 456 | 451 | ||
| 457 | 452 | ||
| 458 | (defmacro bookmark-maybe-historicize-string (string) | 453 | (defmacro bookmark-maybe-historicize-string (string) |