From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.bugs Subject: bug#15746: 24.3; [PATCH] bookmark should confirm when overwrite Date: Tue, 29 Oct 2013 13:24:07 -0500 Message-ID: <87iowg9bqw.fsf@floss.red-bean.com> References: Reply-To: Karl Fogel NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1383071129 5861 80.91.229.3 (29 Oct 2013 18:25:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Oct 2013 18:25:29 +0000 (UTC) Cc: 15746@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 29 19:25:32 2013 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 1VbDym-0000ht-E8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2013 19:25:24 +0100 Original-Received: from localhost ([::1]:48780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbDyl-00072G-Nk for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2013 14:25:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbDyb-000727-Kj for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2013 14:25:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbDyS-0007fY-4O for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2013 14:25:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbDyR-0007eB-So for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2013 14:25:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VbDyR-0007kB-A2 for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2013 14:25:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Karl Fogel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2013 18:25:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15746 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15746-submit@debbugs.gnu.org id=B15746.138307105729694 (code B ref 15746); Tue, 29 Oct 2013 18:25:03 +0000 Original-Received: (at 15746) by debbugs.gnu.org; 29 Oct 2013 18:24:17 +0000 Original-Received: from localhost ([127.0.0.1]:51474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbDxg-0007ir-D7 for submit@debbugs.gnu.org; Tue, 29 Oct 2013 14:24:16 -0400 Original-Received: from mail-ie0-f170.google.com ([209.85.223.170]:61462) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbDxe-0007ic-Rs for 15746@debbugs.gnu.org; Tue, 29 Oct 2013 14:24:15 -0400 Original-Received: by mail-ie0-f170.google.com with SMTP id at1so442201iec.29 for <15746@debbugs.gnu.org>; Tue, 29 Oct 2013 11:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:reply-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=N5SMmjU4dIOtpc0P+cecBz287Mhidz+nbyywQ8/31xY=; b=EvZikhyLDbIurCC+gFLr6SnG3YpUrjq6CKmTjH/CqzUP5s9SNRfAruFJV38vH/zOvL ugwOCwfReRZRm/cUaSWVfXbqX0tE9v3bRbu1rMR+8uLKpG6aaBoZ0B7+KJzWopgF4EtZ 0ATNd0c2vmyFcJlBUICjRoVOHyscFRLwIQraE8G+w/p5mqSHwQ3FkchNJvdZ00pf6Fop nCf1krqOSgBzakT6ZfYIRTHkffzAzcj5ftwPZCV5+A9vIMRRrG5Elacm4hKr5Qeem1wI L71in25eoJvNO4a8nY0mlUPv4sWCwD9F1Yn4yHLc2DTC2vTMLiEHZZ62j8Na2qegqeJK 1RCw== X-Received: by 10.50.120.10 with SMTP id ky10mr13705304igb.29.1383071049117; Tue, 29 Oct 2013 11:24:09 -0700 (PDT) Original-Received: from floss.red-bean.com (64-145-114-106.client.dsl.net. [64.145.114.106]) by mx.google.com with ESMTPSA id i11sm3440656igh.0.2013.10.29.11.24.07 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 29 Oct 2013 11:24:08 -0700 (PDT) In-Reply-To: (Leo Liu's message of "Tue, 29 Oct 2013 11:32:58 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:79757 Archived-At: Leo Liu writes: >Occationally I have overwritten bookmarks with regrets. So maybe >something along the following lines is needed. > >=== modified file 'lisp/bookmark.el' >--- lisp/bookmark.el 2013-09-11 03:31:56 +0000 >+++ lisp/bookmark.el 2013-10-29 03:27:15 +0000 >@@ -811,6 +811,12 @@ > bookmark-minibuffer-read-name-map > nil nil defaults)))) > (and (string-equal str "") (setq str default)) >+ (when (and (not no-overwrite) >+ (bookmark-get-bookmark str) >+ (called-interactively-p 'interactive) >+ (not (yes-or-no-p >+ (format "Bookmark `%s' exists; overwrite? " str)))) >+ (user-error "Aborted")) > (bookmark-store str (cdr record) no-overwrite) > > ;; Ask for an annotation buffer for this bookmark This is interesting. I saw Drew's followup; there are good arguments on both sides, but on balance I think Leo's general idea is right. I think most users would expect that that *interactively* setting a bookmark would confirm when overriding a previous bookmark of the same name, instead of just silently overwriting it. Drew might be right that `bookmark-set' should not include this functionality itself, but then there should be a wrapper function, and every interactive key (C-x r m) currently default bound to `bookmark-set' should be instead set to that wrapper function, then. IOW, that question is just a matter of internal code orgainzation, not of user-visible functionality. (I'm tempted to just build the check directly into `bookmark-set' as Leo does, though, because people already have custom bindings for that, and anyway, testing `call-interactively' is enough -- it leaves `bookmark-set's programmatic functionality unchanged.) Leo, there would need to be a patch to the doc string too, but I can write that. I would probably also change the `user-error' behavior along the lines Drew suggested. First, I'd like to know if anyone else has thoughts on the overall behavior...? -Karl