emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [RFC] Sloppy `org-element-context'?
Date: Wed, 23 Apr 2014 22:35:32 +0200	[thread overview]
Message-ID: <87tx9jlr6z.fsf@gmail.com> (raw)
In-Reply-To: <871twteltj.fsf@bzg.ath.cx> (Bastien's message of "Sat, 19 Apr 2014 10:47:38 +0200")

Hello,

Bastien <bzg@gnu.org> 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

  parent reply	other threads:[~2014-04-23 20:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 15:28 [RFC] Sloppy `org-element-context'? Nicolas Goaziou
2014-03-27 21:34 ` Rasmus
2014-03-28  9:26   ` Nicolas Goaziou
2014-04-19  8:47 ` Bastien
2014-04-19  9:15   ` Nicolas Richard
2014-04-19  9:30     ` Bastien
2014-04-23 20:35   ` Nicolas Goaziou [this message]
2014-04-29 21:20     ` Nicolas Goaziou
2014-05-06  9:25       ` Bastien
2014-05-26 15:50         ` Bastien

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87tx9jlr6z.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@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/org-mode.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).