>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)iskon.hr> writes:
Hrvoje> I'm not sure that patch is right. The DEFAULT argument
Hrvoje> didn't exist in pre-21.2 XEmacs, and this patch leaves it
Hrvoje> in. That looks wrong.
Hi Hrvoje, Andreas, Yoshiki!
upon further examination I agree with Hrvoje. My quick patch is
wrong.
Doing it right (following Kyle's suggestion) would in this particular
case lead to awkward code bloat compared to the version before
Yoshiki's patch. The new feature of `completing-read', the DEFAULT
argument, cannot be relied upon (because XEmacs-21.1.8 does not have
it). Consequently the defaulting of an empty completion has to be
done just as before. Only, handling a possible
wrong-number-of-arguments makes the code unnecessarily hard to read
and understand.
I vote for reverting to the `bookmark-completing-read' version of
bookmark.el revision 1.2.
Please advise,
Adrian
Possible new version (bad, bad, bad):
(defun bookmark-completing-read (prompt &optional default)
"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."
(bookmark-maybe-load-default-file) ; paranoia
(let* ((completion-ignore-case bookmark-completion-ignore-case)
(default default)
(prompt (if default
(concat prompt (format " (%s): " default))
(concat prompt ": ")))
(str
(condition-case nil
(completing-read prompt
bookmark-alist
nil
0
nil
'bookmark-history
default)
(wrong-number-of-arguments
(completing-read prompt
bookmark-alist
nil
0
nil
'bookmark-history)))))
(if (string-equal "" str)
(list default)
(list str))))
`bookmark-completing-read' of version 1.2 of bookmark.el:
(defun bookmark-completing-read (prompt &optional default)
"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."
(bookmark-maybe-load-default-file) ; paranoia
(let* ((completion-ignore-case bookmark-completion-ignore-case)
(default default)
(prompt (if default
(concat prompt (format " (%s): " default))
(concat prompt ": ")))
(str
(completing-read prompt
bookmark-alist
nil
0
nil
'bookmark-history)))
(if (string-equal "" str)
(list default)
(list str))))
--
Adrian Aichner <adrian(a)xemacs.org>