emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* nicer error message when accessing killed buffer.
@ 2015-02-27 12:16 Nicolas Richard
  2015-02-27 23:53 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Richard @ 2015-02-27 12:16 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I often kill org buffers and then Org agenda throws errors at me when i
want to access a line which was that buffer :

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (let* ((marker (or (org-get-at-bol (quote org-marker)) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker))) (org-pop-to-buffer-same-window buffer) (and delete-other-windows (delete-other-windows)) (widen) (goto-char pos) (org-back-to-heading t) (if (derived-mode-p (quote org-mode)) (progn (org-show-context (quote agenda)) (save-excursion (and (outline-next-heading) (org-flag-heading nil))) (if (outline-invisible-p) (progn (show-entry))) (run-hooks (quote org-agenda-after-show-hook)))))
  (if (and org-return-follows-link (not (org-get-at-bol (quote org-marker))) (org-in-regexp org-bracket-link-regexp)) (org-open-link-from-string (match-string 0)) (let* ((marker (or (org-get-at-bol (quote org-marker)) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker))) (org-pop-to-buffer-same-window buffer) (and delete-other-windows (delete-other-windows)) (widen) (goto-char pos) (org-back-to-heading t) (if (derived-mode-p (quote org-mode)) (progn (org-show-context (quote agenda)) (save-excursion (and (outline-next-heading) (org-flag-heading nil))) (if (outline-invisible-p) (progn (show-entry))) (run-hooks (quote org-agenda-after-show-hook))))))
  org-agenda-switch-to()
  funcall-interactively(org-agenda-switch-to)
  call-interactively(org-agenda-switch-to nil nil)
  command-execute(org-agenda-switch-to)

I'd like to suggest the following trivial patch:


From 7c1f9a9f966057a68ae34d1dfc0431aec553142e Mon Sep 17 00:00:00 2001
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Date: Fri, 27 Feb 2015 13:12:45 +0100
Subject: [PATCH] * lisp/org-agenda.el (org-agenda-switch-to): Throw an error
 if marker points to no buffer.

---
 lisp/org-agenda.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 29313a1..53a2c2b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8583,6 +8583,8 @@ (defun org-agenda-switch-to (&optional delete-other-windows)
 		       (org-agenda-error)))
 	   (buffer (marker-buffer marker))
 	   (pos (marker-position marker)))
+      (unless buffer
+	(user-error "Trying to switch to non-existent buffer."))
       (org-pop-to-buffer-same-window buffer)
       (and delete-other-windows (delete-other-windows))
       (widen)
-- 
2.1.4

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

* Re: nicer error message when accessing killed buffer.
  2015-02-27 12:16 nicer error message when accessing killed buffer Nicolas Richard
@ 2015-02-27 23:53 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2015-02-27 23:53 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Hello,

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> I'd like to suggest the following trivial patch:

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-02-27 23:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 12:16 nicer error message when accessing killed buffer Nicolas Richard
2015-02-27 23:53 ` 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).