[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC] Org Minor Mode?

From: Bastien
Subject: Re: [O] [RFC] Org Minor Mode?
Date: Thu, 29 May 2014 20:57:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi Thorsten,

Thorsten Jolitz <address@hidden> 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))))
     (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))
       (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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]