unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Karl Fogel <kfogel@red-bean.com>
Cc: Tassilo Horn <tassilo@member.fsf.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Reiner Steib <reiner.steib@gmx.de>,
	emacs-devel@gnu.org
Subject: Re: bookmark.el and lisp/gnus/gnus-bookmark.el
Date: Fri, 07 Mar 2008 17:20:22 +0000	[thread overview]
Message-ID: <87skz2lacp.fsf@bzg.ath.cx> (raw)
In-Reply-To: <87ablamphg.fsf@red-bean.com> (Karl Fogel's message of "Fri, 07 Mar 2008 12:08:11 -0500")

Karl Fogel <kfogel@red-bean.com> 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




  reply	other threads:[~2008-03-07 17:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 18:06 bookmark.el and lisp/gnus/gnus-bookmark.el Karl Fogel
2008-03-06 18:45 ` Stefan Monnier
2008-03-06 19:51   ` Bastien
2008-03-06 20:29     ` Karl Fogel
2008-03-06 20:39       ` Bastien
2008-03-06 20:42         ` Karl Fogel
     [not found]           ` <87iqzz7xr8.fsf@member.fsf.org>
2008-03-07 17:05             ` Karl Fogel
2008-03-07 17:25               ` Bastien
2008-03-06 21:27     ` Stefan Monnier
2008-03-06 23:15       ` Bastien
2008-03-07  8:24         ` Tassilo Horn
2008-03-07 12:29           ` Bastien
2008-03-07 14:07             ` Tassilo Horn
2008-03-07 14:13               ` Bastien
2008-03-07 15:12                 ` Tassilo Horn
2008-03-07 17:08                   ` Karl Fogel
2008-03-07 17:20                     ` Bastien [this message]
2008-03-07 17:34                       ` Karl Fogel
2008-03-07 17:45                         ` Bastien Guerry
2008-03-07 18:08                           ` Karl Fogel
2008-03-07 18:19                             ` Bastien
2008-03-07 19:34                               ` Bastien Guerry
2008-03-07 21:51                           ` Stefan Monnier
2008-03-07 22:40                             ` Stefan Monnier
2008-03-08  1:31                             ` Bastien
2008-03-08  2:38                               ` Stefan Monnier
2008-03-08  2:43                                 ` Karl Fogel
2008-03-08 10:06                                 ` Bastien
2008-03-08 19:54                                   ` Stefan Monnier
2008-03-08 20:47                                     ` Bastien
2008-03-08 23:20                                       ` Stefan Monnier
2008-03-10  2:29                                         ` Karl Fogel
2008-03-08 11:35                               ` Reiner Steib
2008-03-08 11:56                                 ` Bastien
2008-03-07 12:23         ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skz2lacp.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-devel@gnu.org \
    --cc=kfogel@red-bean.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=reiner.steib@gmx.de \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).