emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Is this (error (error ...)) form intentional?
@ 2016-03-19 10:28 Marcin Borkowski
  2016-03-19 12:19 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2016-03-19 10:28 UTC (permalink / raw)
  To: Org-Mode mailing list

From org.el:

--8<---------------cut here---------------start------------->8---
(defun org-back-to-heading (&optional invisible-ok)
  "Call `outline-back-to-heading', but provide a better error message."
  (condition-case nil
      (outline-back-to-heading invisible-ok)
    (error (error "Before first headline at position %d in buffer %s"
		  (point) (current-buffer)))))
--8<---------------cut here---------------end--------------->8---

Frankly, I don't see the point of nesting `error'.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

* Re: Is this (error (error ...)) form intentional?
  2016-03-19 10:28 Is this (error (error ...)) form intentional? Marcin Borkowski
@ 2016-03-19 12:19 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2016-03-19 12:19 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> From org.el:
>
> (defun org-back-to-heading (&optional invisible-ok)
>   "Call `outline-back-to-heading', but provide a better error message."
>   (condition-case nil
>       (outline-back-to-heading invisible-ok)
>     (error (error "Before first headline at position %d in buffer %s"
> 		  (point) (current-buffer)))))
>
> Frankly, I don't see the point of nesting `error'.

One is matching the signaled error, and the other is re-throwing the
error with position and buffer information included.

--
Kyle

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

end of thread, other threads:[~2016-03-19 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-19 10:28 Is this (error (error ...)) form intentional? Marcin Borkowski
2016-03-19 12:19 ` Kyle Meyer

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