From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#12504: `bookmark-rename' and `bookmark-maybe-historicize-string' Date: Sun, 30 Sep 2012 21:29:13 -0700 Message-ID: <8B5272B140EB45FB822FEA3D45F3FB46@us.oracle.com> References: <736CB5A93DF64F6BB3FDF32A163C35B3@us.oracle.com> <87lifqhmj2.fsf@floss.red-bean.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1349065783 26593 80.91.229.3 (1 Oct 2012 04:29:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2012 04:29:43 +0000 (UTC) To: "'Karl Fogel'" , <12504@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 01 06:29:49 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TIXdb-0003wK-QD for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2012 06:29:48 +0200 Original-Received: from localhost ([::1]:37141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIXdW-0002gS-7J for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Oct 2012 00:29:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIXdT-0002gM-Ip for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 00:29:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIXdS-0000iF-Di for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 00:29:39 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIXdS-0000i5-AM for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 00:29:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TIXdp-00020m-V1 for bug-gnu-emacs@gnu.org; Mon, 01 Oct 2012 00:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Oct 2012 04:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12504 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12504-submit@debbugs.gnu.org id=B12504.13490657957700 (code B ref 12504); Mon, 01 Oct 2012 04:30:01 +0000 Original-Received: (at 12504) by debbugs.gnu.org; 1 Oct 2012 04:29:55 +0000 Original-Received: from localhost ([127.0.0.1]:35399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TIXdi-000209-K6 for submit@debbugs.gnu.org; Mon, 01 Oct 2012 00:29:54 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:39986) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TIXdh-000202-1q for 12504@debbugs.gnu.org; Mon, 01 Oct 2012 00:29:53 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q914TRE4023806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 1 Oct 2012 04:29:28 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q914TQSq018144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Oct 2012 04:29:27 GMT Original-Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q914TQhi005765; Sun, 30 Sep 2012 23:29:26 -0500 Original-Received: from dradamslap1 (/10.159.219.231) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 30 Sep 2012 21:29:26 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87lifqhmj2.fsf@floss.red-bean.com> Thread-Index: Ac2fiQxXfJykwfmXQneZlZq4efcyqQAAeFOg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65049 Archived-At: > 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