unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Yuri Khan <yuri.v.khan@gmail.com>,
	Emacs developers <emacs-devel@gnu.org>
Subject: RE: [PATCH] Make eshell ‘ls’ output clickable.
Date: Fri, 7 Jul 2017 11:25:37 -0700 (PDT)	[thread overview]
Message-ID: <2a3fbf34-1f39-4698-9de4-422436e71eca@default> (raw)
In-Reply-To: <CAP_d_8VxB9xZVkbX+66ouefrEvZ-99RtXCPQ176bMhw_QhwieA@mail.gmail.com>

> > I feel this indicates a wider need, not specific to eshell, to dig out
> > "things" from text and act on them, guessing their proper handler.
> > Maybe it already exists?
> 
> ‘find-file-at-point’ comes to mind. Maybe it could be extended, or
> made one of backends, to ‘dwim-at-point’.

1. The general way to handle grabbing something at point is
to use `thingatpt.el'.  For file names and URLS, however,
`ffap.el' (specifically `ffap-guesser') works better, IMO.

The thing-at-point approach requires only that you define,
for any given type of <THING>, a `forward-<THING>' function
or both a `beginning-<THING>' and `end-<THING>' function.

Emacs comes with several such functions predefined, e.g.,
`forward-sexp'.


2. Your suggestion of `dwim-at-point' would mean doing the
right thing either (1) in general (a compromise, picked
to fit many common contexts) or (2) in a context-dependent
way.


3. FWIW, I've suggested before that Emacs do what Icicles
does: Let you use a key from the minibuffer (Icicles uses
`M-.') to grab something from some text at or near point
and append it to the minibuffer input.

(This is available whether or not completion is available
for the minibuffer input - it has nothing to do with
completion.)

Icicles `M-.' (`icicle-insert-string-at-point') is a
bit fancy (but Emacs need not do likewise):

For repetitions of `M-.', you have a choice: either
(1) successive things of the same type are inserted
from the buffer (more of the same) or (2) a different
type of thing from the buffer replaces the thing just
inserted (alternative things).

You choose via option `icicle-default-thing-insertion'.
(When you use `M-.', a plain prefix arg (`C-u') flips
the behavior of the option.)

Option `icicle-thing-at-point-functions' is where you
specify (a) the function used for #1, above, i.e.,
what type of thing to grab and (b) a list of alternative
thing-grabbing functions, for #2, above.

The behavior of a _numeric_ prefix arg N with `M-.'
depends on the default-insertion behavior you choose.
If it is #1, above, then N things of the given type are
inserted.  If it is #2, above, then the text at point is
grabbed as a Lisp sexp, evaluated, and the return value
is inserted.

[If you also use library `thingatpt+.el' then #2 with
a numeric prefix arg is handy if you are editing Lisp
code, since by default the grabbing alternatives
include 3 functions that retrieve different levels of
list near point.]

https://www.emacswiki.org/emacs/Icicles_-_Inserting_Text_from_Cursor



  reply	other threads:[~2017-07-07 18:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  4:31 [PATCH] Make eshell ‘ls’ output clickable Matthew Bauer
2017-07-07 15:08 ` Nicolas Petton
2017-07-07 16:10   ` Ted Zlatanov
2017-07-07 16:30     ` Yuri Khan
2017-07-07 18:25       ` Drew Adams [this message]
2017-07-08  1:54       ` Ted Zlatanov
2017-07-07 15:15 ` Nicolas Petton
2017-07-07 15:47   ` Eli Zaretskii

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=2a3fbf34-1f39-4698-9de4-422436e71eca@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=yuri.v.khan@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.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).