unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Modern Conventions for Emacs Lisp files?
Date: Mon, 15 Apr 2013 13:16:44 +0200	[thread overview]
Message-ID: <87d2tw59ib.fsf@gmail.com> (raw)
In-Reply-To: 834nf86u79.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Thorsten Jolitz <tjolitz@gmail.com>
>> Date: Mon, 15 Apr 2013 10:37:21 +0200
>> Cc: Bastien <bzg@gnu.org>
>> 
>> | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> | ;;
>> | ;;; Commentary:
>> | ;;
>> | 
>> | [...]
>> `------------------------------------------------------------------------------
>> 
>> I would prefer in this case not to investigate why this line causes such
>> problems but rather to consider writing such a line a bug. 
>> 
>> So maybe Bastien could consider this a bug-report and remove this line?
>> Because otherwise org.el with its more than 23000 lines is just a
>> perfect example were the use of outline/outshine and navi-mode for file
>> structuring, high-level (over)views on the file and easy navigation
>> makes sense.
>
> There are about 60 non-Org *.el files in Emacs which have similar
> lines, and about 40 in lisp/org/.  So IMO asking people not to use
> that runs a risk of being a quixotic battle.

This line actually shows another disadvantage of using only
comment-chars for signalling headlines (^;;;+ ): people feel free to do
whatever they want with comment-chars, even drawing ascii art or invent
their own section separators or so, which then interferes with the
matching of headlines.

I don't want to take the risk of fighting a quixotic battle. The problem
lies in the following function from outshine.el which is actually copied
from Fabrice Niessen who probably copied/adapted it from Org-mode:

,---------------------------------------------------------------------------------
| (defun outshine-fontify-headlines (outline-regexp)
|   ;; highlight the headings
|   ;; see http://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html
|   ;; use `M-x customize-apropos-faces' to customize faces
|   ;; to find the corresponding face for each outline level, see
|   ;; `org-faces.el'
| 
|   ;; Added `\n?', after having read the following chunk of code (from org.el):
|   ;; `(,(if org-fontify-whole-heading-line
|   ;;        "^\\(\\**\\)\\(\\* \\)\\(.*\n?\\)"
|   ;;      "^\\(\\**\\)\\(\\* \\)\\(.*\\)")
| 
|   (let ((outshine-fontify-whole-heading-line "") ; "\n?")
|         (heading-1-regexp
|          (concat (substring outline-regexp 0 -1) 
|                  "\\{1\\} \\(.*" outshine-fontify-whole-heading-line "\\)"))
|          [... snip ...]
|         (heading-8-regexp
|          (concat (substring outline-regexp 0 -1)
|                  "\\{8,\\} \\(.*" outshine-fontify-whole-heading-line "\\)")))
|     (font-lock-add-keywords
|      nil
|      `((,heading-1-regexp 1 'outshine-level-1 t)
|         [... snip ...]
|        (,heading-8-regexp 1 'outshine-level-8 t)))))
`---------------------------------------------------------------------------------

Its the '-1' that causes the problem:

,----------------------------------------
| (concat (substring outline-regexp 0 -1)
`----------------------------------------

=> Result: "^;;[;]+\\{1\\} \\(.*\\)"

When I delete it

,----------------------------------------
| (concat (substring outline-regexp 0)
`----------------------------------------

=> Result: "^;;[;]+ \\{1\\} \\(.*\\)"

the problem is gone - but fontification doesn't work anymore. 

This is probably more suited for emacs-help, because I would need some
help on this, but since this thread is already on emacs-devel I ask it
here:

How can I get the best of both worlds in this case (no infinite loops
but working fontification)?

-- 
cheers,
Thorsten




  reply	other threads:[~2013-04-15 11:16 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  0:23 Modern Conventions for Emacs Lisp files? Thorsten Jolitz
2013-04-08  9:32 ` Alan Mackenzie
2013-04-08 20:05   ` Thorsten Jolitz
2013-04-08 13:22 ` Stefan Monnier
2013-04-08 13:54   ` Andreas Röhler
2013-04-08 19:51     ` Thorsten Jolitz
2013-04-09  6:05       ` Andreas Röhler
2013-04-08 19:47   ` Thorsten Jolitz
2013-04-08 20:07     ` Stefan Monnier
2013-04-08 20:37       ` Thorsten Jolitz
2013-04-08 21:26         ` Stefan Monnier
2013-04-08 22:21           ` Thorsten Jolitz
2013-04-09  7:29           ` Bastien
2013-04-09 12:27             ` Stefan Monnier
2013-04-09 13:11               ` Bastien
2013-04-09 13:36                 ` Andreas Röhler
2013-04-09 13:41                   ` Bastien
2013-04-13 23:41           ` Thorsten Jolitz
2013-04-14  0:24             ` Stefan Monnier
2013-04-14  3:06             ` Stefan Monnier
2013-04-14  8:16               ` Thorsten Jolitz
2013-04-15  8:37             ` Thorsten Jolitz
2013-04-15  9:04               ` Eli Zaretskii
2013-04-15 11:16                 ` Thorsten Jolitz [this message]
2013-04-15 13:13                   ` Stefan Monnier
2013-04-15  9:09               ` Bastien
2013-04-08 20:55       ` Naming internal functions (was: Modern Conventions for Emacs Lisp files?) Christopher Schmidt
2013-04-08 21:28         ` Naming internal functions Stefan Monnier
2013-04-15 13:46           ` Christopher Schmidt
2013-04-15 14:07             ` Eli Zaretskii
2013-04-15 14:14               ` Christopher Schmidt
2013-04-15 14:25                 ` Eli Zaretskii
2013-04-15 17:08                   ` Christopher Schmidt
2013-04-15 14:16               ` xfq
2013-04-08 22:41   ` Modern Conventions for Emacs Lisp files? Pascal J. Bourguignon
2013-04-08 23:42     ` Thorsten Jolitz
2013-04-09  2:11     ` Stefan Monnier
2013-04-09  8:04       ` Thorsten Jolitz
2013-04-09 12:23         ` Stefan Monnier
2013-04-10 19:06       ` Pascal J. Bourguignon
2013-04-10 20:04         ` Thorsten Jolitz
2013-04-09  9:18 ` Leo Liu
  -- strict thread matches above, loose matches on Subject: below --
2013-04-09 14:00 Barry OReilly
2013-04-09 14:39 ` Nicolas Richard

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2tw59ib.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-devel@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.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).