]> git.eshelyaron.com Git - emacs.git/commitdiff
* bookmark.el (bookmark-handle-bookmark): When relocating a bookmark,
authorKarl Fogel <kfogel@red-bean.com>
Mon, 5 Oct 2009 02:38:35 +0000 (02:38 +0000)
committerKarl Fogel <kfogel@red-bean.com>
Mon, 5 Oct 2009 02:38:35 +0000 (02:38 +0000)
  don't use a file dialog, because they usually don't know how to read
  a directory target from the user.  (Bug#4230)
  Also, make sure the prompt can display directories as well as files.

lisp/ChangeLog
lisp/bookmark.el

index c037112507252717fe2264a344eba022a255cdb1..846c66595a52a48470a5dfc35b14f35a7541c042 100644 (file)
@@ -1,3 +1,10 @@
+2009-10-04  Karl Fogel  <kfogel@red-bean.com>
+
+       * bookmark.el (bookmark-handle-bookmark): When relocating a bookmark,
+       don't use a file dialog, because they usually don't know how to read
+       a directory target from the user.  (Bug#4230)
+       Also, make sure the prompt can display directories as well as files.
+
 2009-10-04  Karl Fogel  <kfogel@red-bean.com>
 
        * bookmark.el (bookmark-set, bookmark-buffer-name):
index b5a3158e272046e00d8d75dec01c5c717cd7d55e..eef888288ce319469ca85d9ea988bd4c373e3d1b 100644 (file)
@@ -1075,23 +1075,29 @@ BOOKMARK may be a bookmark name (a string) or a bookmark record."
        ;; `bookmark' can either be a bookmark name (found in
        ;; `bookmark-alist') or a bookmark object.  If it's an object, we
        ;; assume it's a bookmark used internally by some other package.
-       (let ((file (bookmark-get-filename bookmark)))
+       (let* ((file (bookmark-get-filename bookmark))
+              ;; If file is not a directory, this should be a no-op.
+              (display-name (directory-file-name file)))
          (when file        ;Don't know how to relocate if there's no `file'.
-           (setq file (expand-file-name file))
            (ding)
-           (if (y-or-n-p (concat (file-name-nondirectory file)
-                                 " nonexistent.  Relocate \""
-                                 bookmark
-                                 "\"? "))
-               (progn
-                 (bookmark-relocate bookmark)
-                 ;; Try again.
-                 (funcall (or (bookmark-get-handler bookmark)
-                              'bookmark-default-handler)
-                          (bookmark-get-bookmark bookmark)))
-             (message
-              "Bookmark not relocated; consider removing it \(%s\)." bookmark)
-             (signal (car err) (cdr err))))))))
+           ;; Dialog boxes can accept a file target, but usually don't
+           ;; know how to accept a directory target (at least, this
+           ;; was true in Gnome on GNU/Linux, and Bug#4230 says it's
+           ;; true on Windows as well).  Thus, suppress file dialogs
+           ;; when relocating.
+           (let ((use-dialog-box nil)
+                 (use-file-dialog nil))
+             (if (y-or-n-p (concat display-name " nonexistent.  Relocate \""
+                                   bookmark "\"? "))
+                 (progn
+                   (bookmark-relocate bookmark)
+                   ;; Try again.
+                   (funcall (or (bookmark-get-handler bookmark)
+                                'bookmark-default-handler)
+                            (bookmark-get-bookmark bookmark)))
+               (message
+                "Bookmark not relocated; consider removing it \(%s\)." bookmark)
+               (signal (car err) (cdr err)))))))))
   ;; Added by db.
   (when (stringp bookmark)
     (setq bookmark-current-bookmark bookmark))