emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Chunyang Xu <xuchunyang.me@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-capture: Adapt user-error for aborting by user
Date: Sun, 01 May 2016 14:11:43 +0800	[thread overview]
Message-ID: <m2vb2ygvds.fsf@MBA.local> (raw)

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]


Hi,

Sometimes I turn on lisp debugger with M-x toggle-debug-on-error for
some reason, then aborting org-capture with 'q' or 'C-g' enters the
debugger, which is annoying. I think `user-error' is better than `error'
in this case.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1197 bytes --]

From 9d950e96c48b8e1a0dad779cdf34a4f8a76621db Mon Sep 17 00:00:00 2001
From: Chunyang Xu <xuchunyang56@gmail.com>
Date: Sun, 1 May 2016 12:47:14 +0800
Subject: [PATCH] org-capture: Adapt user-error for aborting by user

When `org-capture` is aborted by user with 'q' or 'C-g', `user-error' is
better than `error' to use to exit.
---
 lisp/org-capture.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 008f0a6..34a6817 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -590,7 +590,7 @@ of the day at point (if any) or the current HH:MM time."
        ((equal entry "C")
 	(customize-variable 'org-capture-templates))
        ((equal entry "q")
-	(error "Abort"))
+	(user-error "Abort"))
        (t
 	(org-capture-set-plist entry)
 	(org-capture-get-template)
@@ -1504,7 +1504,7 @@ only the bare key is returned."
 	    (setq pressed (char-to-string (read-char-exclusive))))
 	  (when (equal pressed "\C-g")
 	    (kill-buffer buffer)
-	    (error "Abort"))
+	    (user-error "Abort"))
 	  (when (and (not (assoc pressed table))
 		     (not (member pressed des-keys))
 		     (assoc pressed specials))
-- 
2.8.0


             reply	other threads:[~2016-05-01  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01  6:11 Chunyang Xu [this message]
2016-05-03 17:20 ` [PATCH] org-capture: Adapt user-error for aborting by user Nicolas Goaziou

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.orgmode.org/

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

  git send-email \
    --in-reply-to=m2vb2ygvds.fsf@MBA.local \
    --to=xuchunyang.me@gmail.com \
    --cc=emacs-orgmode@gnu.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/org-mode.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).