From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [RFC] Org Minor Mode? Date: Thu, 29 May 2014 20:57:04 +0200 Message-ID: <87y4xks9a7.fsf@bzg.ath.cx> References: <87ha61f4rk.fsf@gmail.com> <8738hlkn64.fsf@gmail.com> <87zjj9g87k.fsf@gmail.com> <877g5znrgl.fsf@bzg.ath.cx> <87y4xnzif9.fsf@gmail.com> <8738ft379k.fsf@bzg.ath.cx> <878uplim22.fsf@gmail.com> <87y4xl1mh5.fsf@bzg.ath.cx> <87zji0xysn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wq5Vw-0008Ce-Iz for emacs-orgmode@gnu.org; Thu, 29 May 2014 14:57:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wq5Vm-0005eC-V3 for emacs-orgmode@gnu.org; Thu, 29 May 2014 14:57:20 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:40693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wq5Vm-0005dh-PJ for emacs-orgmode@gnu.org; Thu, 29 May 2014 14:57:10 -0400 Received: by mail-we0-f181.google.com with SMTP id w61so897986wes.12 for ; Thu, 29 May 2014 11:57:09 -0700 (PDT) In-Reply-To: <87zji0xysn.fsf@gmail.com> (Thorsten Jolitz's message of "Thu, 29 May 2014 19:47:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Hi Thorsten, Thorsten Jolitz writes: > This is quite low level and I haven't done anything on this level yet, > but it might be a way to stick with performant constant regexp strings, > but make them more general. That's an idea -- but the one I wanted to explore is this: instead of running Org functions in the current buffer (e.g., an emacs-lisp-mode buffer), the functions would run transparently in a temporary buffer before updating the current one. For example, see this code in `org-open-at-point': ;; Exception n°2: links in comments. ((eq type 'comment) (let ((string-rear (replace-regexp-in-string "^[ \t]*# [ \t]*" "" (buffer-substring (point) (line-beginning-position)))) (string-front (buffer-substring (point) (line-end-position)))) (with-temp-buffer (let ((org-inhibit-startup t)) (org-mode)) (insert value) (goto-char (point-min)) (when (and (search-forward string-rear nil t) (search-forward string-front (line-end-position) t)) (goto-char (match-beginning 0)) (org-open-at-point) (when (string= string-rear "") (forward-char)))))) Obviously, this is a bit fragile and just "good enough" for this defun, but we could generalize it and make it more robust. To illustrate this way of approaching the problem of "using Org in non-Org buffers", consider `org-move-item-up': in an elisp comment, we would copy the comment paragraph at point in `with-temp-buffer', uncomment the buffer, call `org-move-item-up', then comment out the content and send it back to the original buffer as a replacement. I've not studied this idea thoroughly, and this may feels clumsy first, but if it spares us with the need to generalize org-mode to the point that org-mode is not really a separate mode anymore, it might be worst digging into this direction. Hope this is clearer now! -- Bastien