From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Org Minor Mode (was Re: Low level trickery for changing character syntax?) Date: Wed, 09 Apr 2014 15:01:13 +0200 Message-ID: <87ppkq3bdy.fsf@gnu.org> References: <87lhvfzrgt.fsf@gmail.com> <87eh173roe.fsf@gnu.org> <877g6yj355.fsf_-_@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1397048551 24552 80.91.229.3 (9 Apr 2014 13:02:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Apr 2014 13:02:31 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thorsten Jolitz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 09 15:02:23 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WXs91-0005EJ-3B for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Apr 2014 15:02:23 +0200 Original-Received: from localhost ([::1]:46062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXs8x-0001Jz-PK for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Apr 2014 09:02:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXs8f-0001Je-1M for help-gnu-emacs@gnu.org; Wed, 09 Apr 2014 09:02:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXs8X-0003IR-EU for help-gnu-emacs@gnu.org; Wed, 09 Apr 2014 09:02:00 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:52336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXs8X-0003Hh-7y for help-gnu-emacs@gnu.org; Wed, 09 Apr 2014 09:01:53 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id D41C31A8419; Wed, 9 Apr 2014 15:01:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3cS34URGK6f6; Wed, 9 Apr 2014 15:01:51 +0200 (CEST) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad-t440p (dhcp181.uni-koblenz.de [141.26.71.181]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 795841A841B; Wed, 9 Apr 2014 15:01:51 +0200 (CEST) In-Reply-To: <877g6yj355.fsf_-_@gmail.com> (Thorsten Jolitz's message of "Wed, 09 Apr 2014 10:52:38 +0200") User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97062 Archived-At: Thorsten Jolitz writes: Hi Thorsten, > The major "flaw" of Org-mode that inhibits its use as minor-mode is > the wide-spread use of hard-coded regexps, i.e. regexps of this form > > ,-------------- > | "^\\*+ ... $" > `-------------- > > in many many variants all over the place. Those three elements "^" > (bol), "$" (eol) and "*" (star) are not portable, Yeah, I've quickly looked into org.el, and that's indeed very much hard-coded. You could add around-advices to the basic regexp functions like `looking-at' and `re-search-forward' that modify the given regex. Changing "^something" to "^;; something" is easy, but if you also want to change the outlining character from * to something else, it will become quite hard. Changing org.el is also quite hard. I mean, you could define org-prefix-rx: "" org-bullet-rx: "\\*" org-heading-start-rx: (concat org-prefix-rx "\\(" org-bullet-rx "\\)+") somehow systematically so that in theory, lisp modes could set org-prefix-rx to ";; " and be done. However, it's quite unlikely that in the future, every quick regex in some org function will be composed of all those predefined parts in the correct way. Maybe a better approach was to have some `org-rx' macro that's like `rx' except that `bol' and `line-start' would mean (concat "^" org-prefix-rx) instead of just "^", and there was some additional `*' element that would mean org-bullet-rx. Then the org-heading-start-rx could be defined as (org-rx bol (group (+ *))) which is a bit less of a pain. Bye, Tassilo