[Top][All Lists]

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

enhancement to bookmark.el

From: David J. Biesack
Subject: enhancement to bookmark.el
Date: Tue, 8 Jun 2004 16:33:46 -0400 (EDT)

I have an enhancement request for bookmark.el.

Bookmark's menu mode does not have a key/command for moving the file.
The below adds this, as well as an interactive bookmark-move command.
I'm not particularly happy with the key binding, but 'm' (for 'move) 
and 'r' (rename0 are already taken.

;; Add a "Move" action to bookmark-bmenu, to move a bookmark to a new file
;; address@hidden

(defun bookmark-bmenu-move ()
  "Move bookmark on current line.  Prompts for a new filename."
  (if (bookmark-bmenu-check-position)
      (let ((bmrk (bookmark-bmenu-bookmark))
            (thispoint (point)))
        ;; could also invoke
        ;(bookmark-relocate bmrk)
        ;; but that only prompts for the directory name; sometimes
        ;; bookmarked file names change as well.
        (bookmark-move bmrk)
        (goto-char thispoint))))

(defun bookmark-move (name &optional to)
  (interactive (bookmark-completing-read "Move bookmark: "))

  (setq bookmark-current-point (point))
  (setq bookmark-yank-point (point))
  (setq bookmark-current-buffer (current-buffer))
  (let ((newname
         (or to   ; use second arg, if non-nil
              "Move to: "
              (bookmark-get-filename name)
              (let ((now-map (copy-keymap minibuffer-local-map)))
                (define-key now-map  "\C-w" 'bookmark-yank-word)
    (bookmark-set-filename name newname)
    (setq bookmark-current-bookmark name)
    (setq bookmark-alist-modification-count
          (1+ bookmark-alist-modification-count))
    (if (bookmark-time-to-save-p)

(define-key bookmark-bmenu-mode-map "M" 'bookmark-bmenu-move)

David J. Biesack     SAS Institute Inc.
R&D Java Strategist  SAS Campus Drive Cary, NC 27513
(919) 531-7771       http://www.sas.com

reply via email to

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