all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Contradiction between code and doc as regards commented lines
@ 2012-10-27 19:04 Rafael Laboissiere
  2012-10-27 19:44 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael Laboissiere @ 2012-10-27 19:04 UTC (permalink / raw)
  To: emacs-orgmode

Before Git commit e8046d2, lines like this were treated as comments in 
org-mode:

     ### This used to be a comment

At present, lines as the above are not highlighted as comments and will 
be exported verbatim.  Only lines like the following are considered to be 
comments, currently:

     # Only this is now a comment

This behavior is clearly in contradiction with the documentation, 
according to this relevant part of doc/org.texi:

     @node Comment lines,  , Horizontal rules, Structural markup elements
     [snip]
     Lines starting with zero or more whitespace characters followed by @samp{#}
     are treated as comments and will never be exported.

Please, fix the documentation (or restore the previous behavior, if the 
documentation is meant to be correct).

Cheers,

Rafael

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

* Re: Contradiction between code and doc as regards commented lines
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-10-27 19:44 UTC (permalink / raw)
  To: Rafael Laboissiere; +Cc: emacs-orgmode

Rafael Laboissiere <rafael@laboissiere.net> writes:

> Please, fix the documentation (or restore the previous behavior, if the
> documentation is meant to be correct).

Done, thanks.

-- 
 Bastien

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

* Re: Contradiction between code and doc as regards commented lines
  2012-10-27 19:44 ` Bastien
@ 2012-10-27 21:50   ` Rafael Laboissiere
  2012-10-28 10:10     ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael Laboissiere @ 2012-10-27 21:50 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

* Bastien <bzg@altern.org> [2012-10-27 21:44]:

> Rafael Laboissiere <rafael@laboissiere.net> writes:
>
>> Please, fix the documentation (or restore the previous behavior, if the 
>> documentation is meant to be correct).
>
> Done, thanks.

Thanks.

You might be interested in applying the patch attached below, which fixes 
the comments in the *Remember* buffer, allowing them to get correctly 
fontified.

Rafael


[-- Attachment #2: 0001-org-remember.el-Start-the-commented-lines-with-the-a.patch --]
[-- Type: text/x-diff, Size: 1660 bytes --]

From b1ae1021338a156dc7f65256cc6f085b6b2bf103 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <rafael@laboissiere.net>
Date: Sat, 27 Oct 2012 23:40:39 +0200
Subject: [PATCH] org-remember.el: Start the commented lines with the
 appropriate characters

* org-remember.el (org-remember-apply-template): Start the commented
  lines in the Remember temporary buffer with the appropriate
  characters.

TINYCHANGE
---
 lisp/org-remember.el |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index d555ca6..bfbca73 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -472,12 +472,12 @@ to be run from that hook to function properly."
 	(erase-buffer)
 	(insert (substitute-command-keys
 		 (format
-		  "## %s  \"%s\" -> \"* %s\"
-## C-u C-c C-c  like C-c C-c, and immediately visit note at target location
-## C-0 C-c C-c  \"%s\" -> \"* %s\"
-## %s  to select file and header location interactively.
-## C-2 C-c C-c  as child (C-3: as sibling) of the currently clocked item
-## To switch templates, use `\\[org-remember]'.  To abort use `C-c C-k'.\n\n"
+		  "# %s  \"%s\" -> \"* %s\"
+# C-u C-c C-c  like C-c C-c, and immediately visit note at target location
+# C-0 C-c C-c  \"%s\" -> \"* %s\"
+# %s  to select file and header location interactively.
+# C-2 C-c C-c  as child (C-3: as sibling) of the currently clocked item
+# To switch templates, use `\\[org-remember]'.  To abort use `C-c C-k'.\n\n"
 		  (if org-remember-store-without-prompt "    C-c C-c" "    C-1 C-c C-c")
 		  (abbreviate-file-name (or file org-default-notes-file))
 		  (or headline "")
-- 
1.7.10.4


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

* Re: Contradiction between code and doc as regards commented lines
  2012-10-27 21:50   ` Rafael Laboissiere
@ 2012-10-28 10:10     ` Bastien
  2012-10-28 16:50       ` Rafael Laboissiere
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2012-10-28 10:10 UTC (permalink / raw)
  To: Rafael Laboissiere; +Cc: emacs-orgmode

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!

-- 
 Bastien

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

* Re: Contradiction between code and doc as regards commented lines
  2012-10-28 10:10     ` Bastien
@ 2012-10-28 16:50       ` Rafael Laboissiere
  2012-10-29  5:30         ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael Laboissiere @ 2012-10-28 16:50 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- 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


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

* Re: Contradiction between code and doc as regards commented lines
  2012-10-28 16:50       ` Rafael Laboissiere
@ 2012-10-29  5:30         ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2012-10-29  5:30 UTC (permalink / raw)
  To: Rafael Laboissiere; +Cc: emacs-orgmode

Hi Rafael,

Rafael Laboissiere <rafael@laboissiere.net> writes:

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

Applied, thanks.  I just added the TINYCHANGE cookie to your patch.

-- 
 Bastien

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

end of thread, other threads:[~2012-10-29  6:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-10-29  5:30         ` Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.