From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#15746: 24.3; [PATCH] bookmark should confirm when overwrite Date: Tue, 29 Oct 2013 11:32:58 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1383017660 3178 80.91.229.3 (29 Oct 2013 03:34:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Oct 2013 03:34:20 +0000 (UTC) Cc: Karl Fogel To: 15746@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 29 04:34:23 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 1Vb04V-0000Xm-8F for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Oct 2013 04:34:23 +0100 Original-Received: from localhost ([::1]:44100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb04U-0006Uk-R4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Oct 2013 23:34:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb04J-0006Ub-VN for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:34:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb04B-0005N8-IR for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:34:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb04B-0005N2-Fm for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vb04A-0000fk-U2; Mon, 28 Oct 2013 23:34:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: kfogel@red-bean.com, bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2013 03:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15746 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Karl Fogel Original-Received: via spool by submit@debbugs.gnu.org id=B.13830176182546 (code B ref -1); Tue, 29 Oct 2013 03:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Oct 2013 03:33:38 +0000 Original-Received: from localhost ([127.0.0.1]:50392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vb03l-0000f0-KR for submit@debbugs.gnu.org; Mon, 28 Oct 2013 23:33:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42063) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vb03i-0000el-Bl for submit@debbugs.gnu.org; Mon, 28 Oct 2013 23:33:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb03U-0005CR-NM for submit@debbugs.gnu.org; Mon, 28 Oct 2013 23:33:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb03U-0005CN-KK for submit@debbugs.gnu.org; Mon, 28 Oct 2013 23:33:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb03M-0006Nw-6T for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:33:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb03D-0005AH-P6 for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:33:12 -0400 Original-Received: from mail-pd0-x236.google.com ([2607:f8b0:400e:c02::236]:52966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb03D-0005A4-G7 for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2013 23:33:03 -0400 Original-Received: by mail-pd0-f182.google.com with SMTP id q10so7976313pdj.13 for ; Mon, 28 Oct 2013 20:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=4LURxbcVWOezOuZZCMpJBIha6/x7WeSs3xeqg45fMW4=; b=b0gX2Ir0vQkp1AtI1Wj4x4IgbCGIJ5VFtwDUkz7COZPzIiojQH8SHXR5S6JvE7Tc2k 40/zv3/2tJYVSkxYyhrwVGSXoAdSryKlSCsQyqPXTyUChRta+zUIKhASUteZRNaagZzf l9uieviuVtYfg39o9Kxb+DY4wTgk6KO9K5jb7bpwPp8R8RwyXpKgwdRzh/d7+AZ0izbq nRchSr8D50qoBoZs0qfryiUKuglSDW3JO1ccXGSwMj75YpSinxPud4UF9Jm7LXXii4z9 MWOJV025uCBZ27f4Z/n5Z7wWbXAz93j339UsnZf0ehpD90iOD5BbuSvfLOj3T7NegckR CKcw== X-Received: by 10.68.254.105 with SMTP id ah9mr19518862pbd.87.1383017581840; Mon, 28 Oct 2013 20:33:01 -0700 (PDT) Original-Received: from localhost ([222.130.176.76]) by mx.google.com with ESMTPSA id lm2sm39096570pab.2.2013.10.28.20.33.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Oct 2013 20:33:01 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:79742 Archived-At: 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