emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John J Foerch <jjfoerch@earthlink.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-log-note-headings buffer-local value
Date: Tue, 20 Nov 2012 15:41:45 -0500	[thread overview]
Message-ID: <878v9wvwfq.fsf@hecubus.retroj.net> (raw)

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

Hello,

I am exploring org-mode's potential for collaborative editing, and I
found that the main difficulty with this is that different users editing
the same document may have different org-mode configurations.  Most of
the important options that I have found so far can be dealt with by
setting buffer-local values on the file to be jointly edited.  One that
could not was org-log-note-headings.  I found that this is because when
its value is taken, in org-store-log-note, the current buffer is the
"*Org Note*" buffer, rather than the document buffer.  A patch is
attached that addresses this.  Note, for clarity's sake, the patch does
not reindent org-store-log-note.

As an aside, I do realize that org-log-note-headings is a somewhat
fragile variable, with some known problems (with agenda, iirc)
associated with changing its value.  However, I do find it useful to
change its value for my use, and this patch will obviate one little
difficulty with collaborative editing.

Thank you,
John Foerch


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: allow buffer-local value for org-log-note-headings --]
[-- Type: text/x-diff, Size: 1692 bytes --]

From 7703373e55d760911e01f7c622203b4a4d8ea6a7 Mon Sep 17 00:00:00 2001
From: John Foerch <jjfoerch@earthlink.net>
Date: Tue, 20 Nov 2012 15:25:04 -0500
Subject: [PATCH] org-store-log-note: access org-log-note-headings in org
 buffer

This change allows org-mode to respect a buffer-local value of
org-log-note-headings, by accessing its value in the org buffer
instead of in the "*Org Note*" buffer.
---
 lisp/org.el |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e3354c6..2ae3b90 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12732,10 +12732,10 @@ EXTRA is additional text that will be inserted into the notes buffer."
 (defvar org-note-abort nil) ; dynamically scoped
 (defun org-store-log-note ()
   "Finish taking a log note, and insert it to where it belongs."
-  (let ((txt (buffer-string))
-	(note (cdr (assq org-log-note-purpose org-log-note-headings)))
-	lines ind bul)
+  (let ((txt (buffer-string)))
     (kill-buffer (current-buffer))
+    (let ((note (cdr (assq org-log-note-purpose org-log-note-headings)))
+	  lines ind bul)
     (while (string-match "\\`# .*\n[ \t\n]*" txt)
       (setq txt (replace-match "" t t txt)))
     (if (string-match "\\s-+\\'" txt)
@@ -12802,7 +12802,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
 	      (insert (pop lines))))
 	  (message "Note stored")
 	  (org-back-to-heading t)
-	  (org-cycle-hide-drawers 'children)))))
+	  (org-cycle-hide-drawers 'children))))))
   (set-window-configuration org-log-note-window-configuration)
   (with-current-buffer (marker-buffer org-log-note-return-to)
     (goto-char org-log-note-return-to))
-- 
1.7.10.4


             reply	other threads:[~2012-11-20 20:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 20:41 John J Foerch [this message]
2012-11-25 18:49 ` [PATCH] org-log-note-headings buffer-local value Nicolas Goaziou
2012-11-25 19:13   ` John J Foerch

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=878v9wvwfq.fsf@hecubus.retroj.net \
    --to=jjfoerch@earthlink.net \
    --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).