From: "Drew Adams" <drew.adams@oracle.com>
To: "'Karl Fogel'" <kfogel@red-bean.com>, <12504@debbugs.gnu.org>
Subject: bug#12504: `bookmark-rename' and `bookmark-maybe-historicize-string'
Date: Sun, 30 Sep 2012 21:29:13 -0700 [thread overview]
Message-ID: <8B5272B140EB45FB822FEA3D45F3FB46@us.oracle.com> (raw)
In-Reply-To: <87lifqhmj2.fsf@floss.red-bean.com>
> I agree there is a bug, or maybe a buglet, here, for the reasons you
> describe, but I'm not sure how to solve it.
>
> Does invoking functions through a menu result in an environment where
> `called-interactively-p' returns non-nil? In that case, the premise
> behind `bookmark-maybe-historicize-string' is all wrong
> anyway, and the macro should be rewritten to:
>
> `(when (called-interactively-p 'interactive)
> (setq bookmark-history (cons ,string bookmark-history))))
I think the problem that the code comment refers to, namely that invoking it
from a menu will not add it to the history, is a real problem, albeit a minor
one. And as you say, it has nothing to do with bookmarks in particular.
I would suggest removing this workaround to try to make it DTRT for bookmark.el
menu commands, and just kick the question up to emacs-devel. There might be a
good general answer. In any case, it is a general question. And I don't see a
crying need for bookmark renaming etc. to handle this specially.
There was some discussion on emacs-devel a few years back about optionally
(i.e., a user could choose) adding commands invoked using menus to the command
history (which is a bit different, but which could cover this case as well).
I implemented that in Icicles, with user option
`icicle-menu-items-to-history-flag':
"Non-nil means to add menu-item commands to the command history.
This history is `extended-command-history'."
FWIW, I do that by adding/removing this function to/from `pre-command-hook',
according to the option value:
(defun icicle-add-menu-item-to-cmd-history ()
"Add `this-command' to command history, if it is a menu item.
Menu items that are not associated with a command symbol are ignored.
Used on `pre-command-hook'."
(condition-case nil ; Just in case, since this is on `pre-command-hook'.
(when (and (> (length (this-command-keys-vector)) 0)
(equal '(menu-bar) (elt (this-command-keys-vector) 0))
;; Exclude uninterned symbols such as `menu-function-356'.
(symbolp this-command)
(intern-soft this-command))
(pushnew (symbol-name this-command) extended-command-history))
(error nil)))
> The issue is larger than just `bookmark-rename', obviously.
Yup. I don't think bookmark.el should try to deal with it. How important is it
for menu access to add such stuff to the history?
> By the way, your guess is right: it's useful (I think) to have the old
> name in the history for `bookmark-rename', because someone may want to
> use it or a variant of it in another bookmark soon. History is cheap
> that way: it's better to have a little junk than to *not*
> have the thing the user needs when they need it.
I agree about the usefulness, but I think it should be done only when
`bookmark-rename' is invoked interactively.
(In my code, there is, in some contexts, some automatic bookmark renaming, and
it makes no sense in such non-interactive calls to add the old names to the
history. Anyway, that's my problem, but for bookmark.el I still don't think it
helps to add to the history unless invoked interactively.)
> Let's tackle the larger issue with
> `bookmark-maybe-historicize-string',
See above. Any solution to satisfy this need should, in any case, not be adding
to the history "if caller non-interactive". That's a bad workaround if the goal
is to add to the history when the user uses the menu: non-interactively is not
the same thing as interactively-using-a-menu.
> and then figure out whether `bookmark-rename' is doing the
> right thing.
See above for my opinion.
HTH - Drew
next prev parent reply other threads:[~2012-10-01 4:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 17:04 bug#12504: 24.2.50; `bookmark-rename' and `bookmark-maybe-historicize-string' Drew Adams
2012-10-01 3:57 ` bug#12504: " Karl Fogel
2012-10-01 4:29 ` Drew Adams [this message]
2012-10-01 21:27 ` Karl Fogel
2012-10-01 21:34 ` Drew Adams
2012-10-01 22:31 ` Karl Fogel
2021-12-04 4:58 ` bug#12504: 24.2.50; " Lars Ingebrigtsen
2021-12-04 20:08 ` Karl Fogel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8B5272B140EB45FB822FEA3D45F3FB46@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=12504@debbugs.gnu.org \
--cc=kfogel@red-bean.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.