emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rafael Laboissiere <rafael@laboissiere.net>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Contradiction between code and doc as regards commented lines
Date: Sun, 28 Oct 2012 17:50:21 +0100	[thread overview]
Message-ID: <20121028165021.GR31999@laboissiere.net> (raw)
In-Reply-To: <87ehkikits.fsf@bzg.ath.cx>

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

* Bastien <bzg@altern.org> [2012-10-28 11:10]:

> Rafael Laboissiere <rafael@laboissiere.net> writes:
>
>> You might be interested in applying the patch attached below, which fixes 
>> the comments in the *Remember* buffer, allowing them to get correctly 
>> fontified.
>
> Applied, thanks!

Thanks.

I just noticed that my patch have a bad side effect, since the commented 
lines at the beginning of the *Remember* buffer are not filtered out 
before inclusion into the destination org file.  The patch attached below 
fixes this.  Also, the org-remember-handler function attempts to strip 
comment lines at the end of the buffer.  I changed the code such that 
only lines that really respect the definition of comment lines (as per 
the documentation) are actually stripped.

Rafael




[-- Attachment #2: 0002-org-remember.el-Correctly-strip-the-comment-lines-in.patch --]
[-- Type: text/x-diff, Size: 1285 bytes --]

From 72ad3f6f97a87da5b5dfd0df03ca2aed147a61af Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <rafael@laboissiere.net>
Date: Sun, 28 Oct 2012 17:38:19 +0100
Subject: [PATCH 2/2] org-remember.el: Correctly strip the comment lines in
 remember buffer

* org-remember.el (org-remember-handler): Correctly strip the comment lines
  in the temporary buffer *Remember* when handling a remember note.
---
 lisp/org-remember.el |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index bfbca73..5cfe70f 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -840,12 +840,12 @@ See also the variable `org-reverse-note-order'."
       (if (= end beg) (setq beg (1- beg)))
       (put-text-property beg end 'org-position-cursor t)))
   (goto-char (point-min))
-  (while (looking-at "^[ \t]*\n\\|^##.*\n")
+  (while (looking-at "^[ \t]*\n\\|^# .*\n")
     (replace-match ""))
   (when org-remember-delete-empty-lines-at-end
     (goto-char (point-max))
     (beginning-of-line 1)
-    (while (and (looking-at "[ \t]*$\\|##.*") (> (point) 1))
+    (while (and (looking-at "[ \t]*$\\|[ \t]*# .*") (> (point) 1))
       (delete-region (1- (point)) (point-max))
       (beginning-of-line 1)))
   (catch 'quit
-- 
1.7.10.4


  reply	other threads:[~2012-10-28 16:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-27 19:04 Contradiction between code and doc as regards commented lines Rafael Laboissiere
2012-10-27 19:44 ` Bastien
2012-10-27 21:50   ` Rafael Laboissiere
2012-10-28 10:10     ` Bastien
2012-10-28 16:50       ` Rafael Laboissiere [this message]
2012-10-29  5:30         ` Bastien

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=20121028165021.GR31999@laboissiere.net \
    --to=rafael@laboissiere.net \
    --cc=bzg@altern.org \
    --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).