emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org, Thierry Volpiatto <thierry.volpiatto@gmail.com>
Subject: Re: [BUG] org remember broken
Date: Fri, 16 Jul 2010 17:25:45 +0200	[thread overview]
Message-ID: <8739vjbg92.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <EB5967ED-A1DA-4D2C-A43A-DA7253033C18@gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1227 bytes --]

Carsten Dominik wrote:
>Hi Thierry,


>I cannot easily see why org-decrypt-entry is being called, and if it
>is being called in
>the remember buffer or where?

>Anyway, most of us are moving to org-capture, so I would be more
>inclined to look into this if this is still an issue in
>org-capture....

Looks like this is not a problem of org-remember.  After archiving
DONE items (C-u C-c C-x C-s) I get a similar error:

,----
| Debugger entered--Lisp error: (error "Before first headline at position 1 in buffer projects.org")
|   signal(error ("Before first headline at position 1 in buffer projects.org"))
|   error("Before first headline at position %d in buffer %s" 1 #<buffer projects.org>)
|   byte-code("\300\301`p#\207" [error "Before first headline at position %d in buffer %s"] 4)
|   org-back-to-heading(t)
|   org-decrypt-entry()
|   run-hooks(org-reveal-start-hook)
|   org-reveal()
|   org-advertized-archive-subtree((4))
|   call-interactively(org-advertized-archive-subtree nil nil)
`----

Attached patch fixes this by modifying `org-decrypt-entry' to silently
do nothing if point is before first heading.

HTH
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.1.2: 0001-Don-t-throw-error-when-not-inside-a-subtree.patch --]
[-- Type: text/plain, Size: 2026 bytes --]

From aab3300517e3f3bd6a2807713bfc964bb7c3d8c5 Mon Sep 17 00:00:00 2001
From: David Maus <dmaus@ictsoc.de>
Date: Fri, 16 Jul 2010 17:23:31 +0200
Subject: [PATCH] Don't throw error when not inside a subtree

* org-crypt.el (org-decrypt-entry): Don't throw error when not inside
a subtree.
---
 lisp/org-crypt.el |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index 6411171..8b25213 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -137,25 +137,26 @@ This setting can also be overridden in the CRYPTKEY property."
   "Decrypt the content of the current headline."
   (interactive)
   (require 'epg)
-  (save-excursion
-    (org-back-to-heading t)
-    (forward-line)
-    (when (looking-at "-----BEGIN PGP MESSAGE-----")
-      (let* ((beg (point))
-             (end (save-excursion
-                    (search-forward "-----END PGP MESSAGE-----")
-                    (forward-line)
-                    (point)))
-             (epg-context (epg-make-context nil t t))
-             (decrypted-text
-	      (decode-coding-string
-	       (epg-decrypt-string
-		epg-context
-		(buffer-substring-no-properties beg end))
-	       'utf-8)))
-        (delete-region beg end)
-        (insert decrypted-text)
-        nil))))
+  (unless (org-before-first-heading-p)
+    (save-excursion
+      (org-back-to-heading t)
+      (forward-line)
+      (when (looking-at "-----BEGIN PGP MESSAGE-----")
+	(let* ((beg (point))
+	       (end (save-excursion
+		      (search-forward "-----END PGP MESSAGE-----")
+		      (forward-line)
+		      (point)))
+	       (epg-context (epg-make-context nil t t))
+	       (decrypted-text
+		(decode-coding-string
+		 (epg-decrypt-string
+		  epg-context
+		  (buffer-substring-no-properties beg end))
+		 'utf-8)))
+	  (delete-region beg end)
+	  (insert decrypted-text)
+	  nil)))))
 
 (defun org-encrypt-entries ()
   "Encrypt all top-level entries in the current buffer."
-- 
1.7.1


[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  parent reply	other threads:[~2010-07-16 15:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-10  6:36 [BUG] org remember broken Thierry Volpiatto
2010-07-14 20:35 ` Carsten Dominik
2010-07-15  4:59   ` Thierry Volpiatto
2010-07-16 15:25   ` David Maus [this message]
2010-07-18  5:22     ` Patchwork: Patch 139 Accepted Carsten Dominik
2010-07-18  9:52     ` [BUG] org remember broken Carsten Dominik

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=8739vjbg92.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=thierry.volpiatto@gmail.com \
    /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).