emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [RFC] Sloppy `org-element-context'?


From: Nicolas Goaziou
Subject: Re: [O] [RFC] Sloppy `org-element-context'?
Date: Wed, 23 Apr 2014 22:35:32 +0200

Hello,

Bastien <address@hidden> writes:

> I don't think `org-element-context' should be sloppy *at all*.

[...]

> For example, on a comment, (eq 'comment (car (org-element-at-point)))

*coughs* (eq 'comment (org-element-type (org-element-at-point)))

> should always return `t'.  But if the user wants to open bracket links
> from comments (or in a property), then something like this would do:
>
> (defun org-open-links-in-comment-and-properties ()
>   "Open links in a comment or in a property."
>   (interactive)
>   (let ((string-ahead (and (looking-at ".+") (match-string 0)))

  (buffer-substring (point) (line-end-position))
                        
>       (value (org-element-property :value (org-element-at-point))))
>     (with-temp-buffer
>       (org-mode)

  (let ((org-inhibit-startup t)) (org-mode))

>       (insert value)
>       (goto-char (point-min))
>       (search-forward string-ahead)
>       (org-open-at-point))))
>
> which do work right now.

Indeed.

> Of course this could be generalized, provided the property to
> consider is always named ":value", which is not the case IIUC:
> sometimes it's :raw-data, right?

No, :raw-value are different and shouldn't get in the way in this case.

> Last but not least: the spirit of the solution shown above does
> not prevent amending the syntax if we *really* need to amend it,
> but that's where I'd be as conservative as possible -- that is,
> as *you* :)

Indeed.

> Hope this all makes sense -- let me know what you think.

I agree. We can ignore the patch.


Regards,

-- 
Nicolas Goaziou



reply via email to

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