emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Michael Brand <michael.ch.brand@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>, Nicolas Goaziou <n.goaziou@gmail.com>
Subject: Context of interaction vs. literal syntactic interpretation (was: link interfering with brackets when abbreviated)
Date: Mon, 03 Mar 2014 10:50:57 +0100	[thread overview]
Message-ID: <87siqzhapq.fsf@bzg.ath.cx> (raw)
In-Reply-To: <CALn3zogLPBQ4o6NmVf_Z5h3VOQAQvvFigJ8MZMGr-Z-yKWP9xA@mail.gmail.com>	(Michael Brand's message of "Mon, 3 Mar 2014 06:54:29 +0100")

Hi Gustav, Josiah and Michael,

thanks *a lot* for your feedback, it triggered an idea I want to turn
into a proposal.  I changed the subject of this thread to better frame
the issue at stake, and explain my proposal.

Emacs commands depend on their context: this is the modal approach we
love.  For example, M-; will behave differently whether we are in an
org-mode buffer or in a html-mode buffer.  The context of interaction
is the relevant syntactic environment that Emacs needs to know about
when a command is called.

By essence, a parser is very strict about the inclusion model of
syntactic elements: e.g., a tag cannot be part of a paragraph, a TODO
keyword cannot be part of a timestamp, a timestamp cannot be part of
a property value, a link cannot be part of a comment, etc.

This is *good* to have such a strict parser and it must be as strict
and consistent as possible -- we all agree on that.

For most commands, the first literal syntactic interpretation is the
only relevant context of interaction: e.g., it would not make sense to
try updating a tag outside of a headline (i.e. outside of where a tag
is a tag, from the parser's view.)

For some commands, another higher context can also be relevant: e.g.,
when the point is on a heading and the user hit C-c C-o, Org needs to
know whether we are on a link (in this case it will open the link).  If
not, it checks for a higher context: when we are on a heading, it will
look for multiple links and prompt the user for which one to open.

(A generalization of this "links-in-a-heading" behavior for something
like "links-in-a-paragraph", as suggested by Gustav, is a good idea.)

For handling comments, my suggestion is this to let the user decide if
she wants to activate C-c C-o in comments by temporarily considering the
contents of a comment as a paragraph.

  Something like

  (let ((comment-contents
         (org-element-property :value (org-element-context))))
    (with-temp-buffer
      (insert comment-contents)
      (org-open-at-point)))

  provided we preserve the relative point position.

(Another route is to change the syntactic meaning of comments: they
could contain paragraphs and be contained within subtrees.)

Note that this suggestion does not deviate from what we already do:
see the example of C-c C-o checking for a higher context when hit in
headlines.

So while I suggest a change for handling links in paragraphs (I do
support Gustav suggestion) and in comments (see the proposal above),
I don't suggest a change in the role the parser has: I only describe
a frame in which what seems inconsistent is not anymore.

For example, it may seem inconsistent to allow using S-<right> to
update a timestamp in a property drawer, since property drawers don't
allow timestamps.  But it is not inconsistent if S-<right> is allowed
to refer to a higher context (the subtree's content instead of the
property drawer.)

For sure, such flexibility should be the exception, not the norm, but
considering it is very important in terms of user experience IMO.

I hope this is clear enough and can help us moving forward.

Thanks,

-- 
 Bastien

  reply	other threads:[~2014-03-03  9:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 12:11 link interfering with brackets when abbreviated Michael Brand
2014-02-26 15:10 ` Michael Brand
2014-02-26 15:25   ` Nicolas Goaziou
2014-02-26 15:44     ` Michael Brand
2014-02-26 15:54       ` Nicolas Goaziou
2014-02-26 16:22         ` Michael Brand
2014-02-26 16:41           ` Nicolas Goaziou
2014-02-26 17:03             ` Michael Brand
2014-02-26 17:20               ` Bastien
2014-02-26 19:02                 ` Nicolas Goaziou
2014-02-26 22:54                   ` Bastien
2014-02-27 10:28                     ` Nicolas Goaziou
2014-02-27 11:04                       ` Bastien
2014-02-27 20:01                       ` Michael Brand
2014-02-27 22:08                         ` Bastien
2014-02-27 23:43                           ` Nicolas Goaziou
2014-03-01 18:44                             ` Yasushi SHOJI
2014-03-01 20:20                               ` Nicolas Goaziou
2014-03-01 20:54                                 ` Bastien
2014-03-01 20:57                                   ` Bastien
2014-03-01 21:35                                   ` Nicolas Goaziou
2014-03-01 21:50                                     ` Bastien
2014-03-01 22:14                                       ` Nicolas Goaziou
2014-03-02 13:35                                         ` Bastien
2014-03-03 14:12                                           ` Matt Lundin
2014-03-02  0:22                                 ` Yasushi SHOJI
2014-03-02  9:05                                   ` Nicolas Goaziou
2014-03-02 13:22                                     ` Bastien
2014-03-02 14:27                                       ` Nicolas Goaziou
2014-03-02 15:49                                         ` Bastien
2014-03-02 16:32                                           ` Thorsten Jolitz
2014-03-03  3:41                                           ` Josiah Schwab
2014-03-03  5:54                                           ` Michael Brand
2014-03-03  9:50                                             ` Bastien [this message]
2014-03-03 16:09                                               ` Context of interaction vs. literal syntactic interpretation Matt Lundin
2014-03-03 18:00                                                 ` Nick Dokos
2014-03-03 18:13                                                 ` Jonathan Leech-Pepin
2014-03-14 13:46                                                 ` Sebastien Vauban
2014-03-21  8:44                                                 ` Bastien
2014-03-21 13:17                                                   ` Nicolas Goaziou
2014-03-23 22:51                                                     ` Bastien
2014-03-24 13:12                                                       ` Nicolas Goaziou
2014-03-01 18:44                             ` link interfering with brackets when abbreviated Yasushi SHOJI
2014-02-26 17:42   ` Bastien
2014-02-26 21:15     ` Nicolas Goaziou
2014-02-26 22:21       ` 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=87siqzhapq.fsf@bzg.ath.cx \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@gmail.com \
    --cc=n.goaziou@gmail.com \
    /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).