[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bookmark.el and lisp/gnus/gnus-bookmark.el
From: |
Bastien |
Subject: |
Re: bookmark.el and lisp/gnus/gnus-bookmark.el |
Date: |
Fri, 07 Mar 2008 17:20:22 +0000 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) |
Karl Fogel <address@hidden> writes:
>> Yeah, but I think Karl missed the second one (make-cell) while renaming.
>> I've already sent him a mail.
>
> Tassilo is right.
He is right about the fact that you forget to rename the variable, but
renaming this variable is not enough - sorry to insist.
We also need to update `bookmark-buffer-name' so that it returns a
sensible value in *any* mode: for now it only returns a value in a
buffer visiting a file, in dired and in info mode.
My proposal is to add this:
(defvar bookmark-make-name-function nil
"A function that should be called to return the name of the bookmark.
Modes may set this variable buffer-locally to enable a default name to
be proposed when calling `bookmark-set'.")
I thought your mistake about not renaming `bookmark-make-cell-function'
was not a mistake about renaming, but a mistake about forgetting to make
`bookmark-buffer-name'.handle this new variable.
I think we should:
1. Update `bookmark-buffer-name' like this:
(defun bookmark-buffer-name ()
"Return the name of the current buffer's file, non-directory.
In Info, return the current node."
(cond
;; Is the mode defining it's own bookmark name?
(bookmark-make-name-function
(funcall bookmark-make-name-function))
;; Are we in Info?
((derived-mode-p 'Info-mode) Info-current-node)
;; Or are we a file?
(buffer-file-name (file-name-nondirectory buffer-file-name))
;; Or are we a directory?
((and (boundp 'dired-directory) dired-directory)
(let* ((dirname (if (stringp dired-directory)
dired-directory
(car dired-directory)))
(idx (1- (length dirname))))
;; Strip the trailing slash.
(if (= ?/ (aref dirname idx))
(file-name-nondirectory (substring dirname 0 idx))
;; Else return the current-buffer
(buffer-name (current-buffer)))))
;; If all else fails, use the buffer's name.
(t
(buffer-name (current-buffer)))))
2. Use `bookmark-make-name-function' function in `bookmark-set' instead
of `bookmark-make-record-function':
...
(or
(local-variable-p 'bookmark-make-name-function)
(bookmark-buffer-file-name)
(error "Buffer not visiting a file or directory"))
...
If you agree, I will make those changes. They are required for the
rewrite of gnus-bookmark.el.
Thanks for considering this, and for your patience!
--
Bastien
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, (continued)
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Stefan Monnier, 2008/03/06
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien, 2008/03/06
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Tassilo Horn, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Tassilo Horn, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Tassilo Horn, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Karl Fogel, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el,
Bastien <=
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Karl Fogel, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien Guerry, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Karl Fogel, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien Guerry, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Stefan Monnier, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Stefan Monnier, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Bastien, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Stefan Monnier, 2008/03/07
- Re: bookmark.el and lisp/gnus/gnus-bookmark.el, Karl Fogel, 2008/03/07