]> code.delx.au - gnu-emacs/blobdiff - lisp/bookmark.el
*** empty log message ***
[gnu-emacs] / lisp / bookmark.el
index 3ed66f229a87e9ae03c621aee15adb4fb8e905b0..0696f929584aa0b0efbae5ab244c026c4cb63b80 100644 (file)
@@ -376,7 +376,11 @@ That is, all information but the name."
     (if cell
         (setcdr cell filename)
       (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'filename filename))))))
+             (list (cons 'filename filename))))
+    (setq bookmark-alist-modification-count
+          (1+ bookmark-alist-modification-count))
+    (if (bookmark-time-to-save-p)
+        (bookmark-save))))
 
 
 (defun bookmark-get-position (bookmark)
@@ -1045,6 +1049,8 @@ of the old one in the permanent bookmark record."
   (interactive
    (list (bookmark-completing-read "Jump to bookmark"
                                   bookmark-current-bookmark)))
+  (unless bookmark
+    (error "No bookmark specified"))
   (bookmark-maybe-historicize-string bookmark)
   (let ((cell (bookmark-jump-noselect bookmark)))
     (and cell
@@ -1349,7 +1355,9 @@ for a file, defaulting to the file defined by variable
                ((eq 'nospecial bookmark-version-control) version-control)
                (t
                 t))))
-         (write-file file)
+          (condition-case nil
+              (write-file file)
+            (file-error (message "Can't write %s" file)))
          (kill-buffer (current-buffer))
          (if (>= baud-rate 9600)
              (message "Saving bookmarks to file %s...done" file)))))))
@@ -1491,6 +1499,7 @@ method buffers use to resolve name collisions."
   (define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark)
   (define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load)
   (define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename)
+  (define-key bookmark-bmenu-mode-map "R" 'bookmark-bmenu-relocate)
   (define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames)
   (define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation)
   (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations)
@@ -1589,6 +1598,7 @@ Bookmark names preceded by a \"*\" have annotations.
   so the bookmark menu bookmark remains visible in its window.
 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark.
 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\).
+\\[bookmark-bmenu-relocate] -- relocate this bookmark's file \(prompts for new file\).
 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down.
 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up.
 \\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'.
@@ -2041,6 +2051,15 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\
       (let ((bmrk (bookmark-bmenu-bookmark)))
         (message (bookmark-location bmrk)))))
 
+(defun bookmark-bmenu-relocate ()
+  "Change the file path of the bookmark on the current line,
+  prompting with completion for the new path."
+  (interactive)
+  (if (bookmark-bmenu-check-position)
+      (let ((bmrk (bookmark-bmenu-bookmark))
+            (thispoint (point)))
+        (bookmark-relocate bmrk)
+        (goto-char thispoint))))
 
 \f
 ;;; Menu bar stuff.  Prefix is "bookmark-menu".
@@ -2094,12 +2113,12 @@ strings returned are not."
     (define-key map [write]    '("Save Bookmarks As..." . bookmark-write))
     (define-key map [save]     '("Save Bookmarks" . bookmark-save))
     (define-key map [edit]     '("Edit Bookmark List" . bookmark-bmenu-list))
-    (define-key map [delete]   '("Delete Bookmark" . bookmark-delete))
-    (define-key map [rename]   '("Rename Bookmark" . bookmark-rename))
-    (define-key map [locate]   '("Insert Location" . bookmark-locate))
-    (define-key map [insert]   '("Insert Contents" . bookmark-insert))
-    (define-key map [set]      '("Set Bookmark" . bookmark-set))
-    (define-key map [jump]     '("Jump to Bookmark" . bookmark-jump))
+    (define-key map [delete]   '("Delete Bookmark..." . bookmark-delete))
+    (define-key map [rename]   '("Rename Bookmark..." . bookmark-rename))
+    (define-key map [locate]   '("Insert Location..." . bookmark-locate))
+    (define-key map [insert]   '("Insert Contents..." . bookmark-insert))
+    (define-key map [set]      '("Set Bookmark..." . bookmark-set))
+    (define-key map [jump]     '("Jump to Bookmark..." . bookmark-jump))
     map))
 
 ;;;###autoload