emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-capture: Adapt user-error for aborting by user
@ 2016-05-01  6:11 Chunyang Xu
  2016-05-03 17:20 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Chunyang Xu @ 2016-05-01  6:11 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] org-capture: Adapt user-error for aborting by user
  2016-05-01  6:11 [PATCH] org-capture: Adapt user-error for aborting by user Chunyang Xu
@ 2016-05-03 17:20 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2016-05-03 17:20 UTC (permalink / raw)
  To: Chunyang Xu; +Cc: emacs-orgmode

Hello,

Chunyang Xu <xuchunyang.me@gmail.com> writes:

> 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.
>
> 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.

Applied. Thank you.

I added TINYCHANGE at the end of the commit message.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-03 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-01  6:11 [PATCH] org-capture: Adapt user-error for aborting by user Chunyang Xu
2016-05-03 17:20 ` Nicolas Goaziou

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).