unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Any word in mail-mode is recognized as (thing-at-point 'symbol)
@ 2023-01-02 10:12 Jean Louis
  2023-01-02 11:39 ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Louis @ 2023-01-02 10:12 UTC (permalink / raw)
  To: Help GNU Emacs; +Cc: Drew Adams

Dear Drew,

I find that any word I inspect in mail-mode and probably then in other
modes is detected as (thing-at-point 'symbol) even if it is not
symbol.

What I expect is that (thing-at-point 'symbol) detects only Emacs Lisp
defined symbols.


--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Any word in mail-mode is recognized as (thing-at-point 'symbol)
  2023-01-02 10:12 Any word in mail-mode is recognized as (thing-at-point 'symbol) Jean Louis
@ 2023-01-02 11:39 ` Michael Heerdegen
  2023-01-02 16:46   ` Jean Louis
  2023-01-02 17:08   ` [External] : " Drew Adams
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Heerdegen @ 2023-01-02 11:39 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> Dear Drew,
>
> I find that any word I inspect in mail-mode and probably then in other
> modes is detected as (thing-at-point 'symbol) even if it is not
> symbol.
>
> What I expect is that (thing-at-point 'symbol) detects only Emacs Lisp
> defined symbols.

That's not what it does.  Whatever you mean by "defined symbol" you have
to check yourself (e.g. using `intern-soft').

Michael.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Any word in mail-mode is recognized as (thing-at-point 'symbol)
  2023-01-02 11:39 ` Michael Heerdegen
@ 2023-01-02 16:46   ` Jean Louis
  2023-01-03 10:39     ` Michael Heerdegen
  2023-01-02 17:08   ` [External] : " Drew Adams
  1 sibling, 1 reply; 6+ messages in thread
From: Jean Louis @ 2023-01-02 16:46 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

* Michael Heerdegen <michael_heerdegen@web.de> [2023-01-02 14:41]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > Dear Drew,
> >
> > I find that any word I inspect in mail-mode and probably then in other
> > modes is detected as (thing-at-point 'symbol) even if it is not
> > symbol.
> >
> > What I expect is that (thing-at-point 'symbol) detects only Emacs Lisp
> > defined symbols.
> 
> That's not what it does.  Whatever you mean by "defined symbol" you have
> to check yourself (e.g. using `intern-soft').

It becomes confusing. Is any word in any text buffer than "symbol"?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [External] : Re: Any word in mail-mode is recognized as (thing-at-point 'symbol)
  2023-01-02 11:39 ` Michael Heerdegen
  2023-01-02 16:46   ` Jean Louis
@ 2023-01-02 17:08   ` Drew Adams
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2023-01-02 17:08 UTC (permalink / raw)
  To: Michael Heerdegen, help-gnu-emacs@gnu.org

> > I find that any word I inspect in mail-mode and probably then in other
> > modes is detected as (thing-at-point 'symbol) even if it is not
> > symbol.
> >
> > What I expect is that (thing-at-point 'symbol) detects only Emacs Lisp
> > defined symbols.
> 
> That's not what it does.  Whatever you mean by "defined symbol" you have
> to check yourself (e.g. using `intern-soft').

"Symbol" has two meanings in Emacs: (1) any text
with symbol syntax (_ or w), (2) a Lisp symbol.

Vanilla Emacs `symbol-at-point' returns a Lisp
symbol created from the text at point that has
"symbol" syntax (in any mode).  And yes, in most
modes any "word" has symbol syntax.

`tap-symbol-at-point' (from `thingatpt+.el')
returns an Elisp symbol that's named at point.
That is, the text has symbol syntax according to
`emacs-lisp-mode-syntax-table' (not the syntax of
whatever mode you're in), and the object returned
is a Lisp symbol.

See the Commentary of `thingatpt+.el' for how to
optionally use the `tap-' functions in place of
the vanilla Emacs functions that make use of the
`thing-at-point' and `bounds-of-thing-at-point'
symbol properties for standard thing types (e.g.
`list').  See the Commentary also for how to
use the `tap-' versions everywhere in place of
the vanilla versions.  Both of these are optional.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Any word in mail-mode is recognized as (thing-at-point 'symbol)
  2023-01-02 16:46   ` Jean Louis
@ 2023-01-03 10:39     ` Michael Heerdegen
  2023-01-03 13:17       ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2023-01-03 10:39 UTC (permalink / raw)
  To: help-gnu-emacs

Jean Louis <bugs@gnu.support> writes:

> > That's not what it does.  Whatever you mean by "defined symbol" you
> > have to check yourself (e.g. using `intern-soft').
>
> It becomes confusing. Is any word in any text buffer than "symbol"?

Drew explained a lot of background that should help.  The short answer
is more or less "yes".

Michael.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Any word in mail-mode is recognized as (thing-at-point 'symbol)
  2023-01-03 10:39     ` Michael Heerdegen
@ 2023-01-03 13:17       ` Jean Louis
  0 siblings, 0 replies; 6+ messages in thread
From: Jean Louis @ 2023-01-03 13:17 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

* Michael Heerdegen <michael_heerdegen@web.de> [2023-01-03 13:41]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > > That's not what it does.  Whatever you mean by "defined symbol" you
> > > have to check yourself (e.g. using `intern-soft').
> >
> > It becomes confusing. Is any word in any text buffer than "symbol"?
> 
> Drew explained a lot of background that should help.  The short answer
> is more or less "yes".

Thank you, I have clarified some confusion. For now I have
improved. It will get fun when I start designing various impact by
using prefixes like C-1 C-2 etc.

(defun hyperscope-action-button ()
  (interactive)
  (cond ((thing-at-point 'uuid) (rcd-db-uuid-action (thing-at-point 'uuid)))
	((thing-at-point 'url) (browse-url (thing-at-point 'url)))
	((thing-at-point 'email) (rcd-write-email user-full-name user-mail-address (thing-at-point 'email) (thing-at-point 'email)))
	((and (thing-at-point 'symbol) (boundp (symbol-at-point))) (find-variable (symbol-at-point)))
	((and (thing-at-point 'symbol) (fboundp (symbol-at-point))) (find-function (symbol-at-point)))
	((thing-at-point 'number) (hyperscope-isolate (thing-at-point 'number)))
	((thing-at-point 'word) (funcall (cond ((fboundp 'wordnut-search) 'wordnut-search)
					       ((fboundp 'dictionary-search) 'dictionary-search))
					 (thing-at-point 'word)))
	(t (rcd-message "Hyperscope action not defined."))))

By using prefixes like C-1, C-2, I can tell for example

for (thing-at-point 'word):

- without prefix, look up in local or remote server dictionary
- for C-0 try to expand the word
- for C-1 is to quote the word with single quotes
- for C-2 is to quote the word with double quotes
- for C-3 look up the word in online WWW dictionary like Wiktionary or Duden
- etc. etc.



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-03 13:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 10:12 Any word in mail-mode is recognized as (thing-at-point 'symbol) Jean Louis
2023-01-02 11:39 ` Michael Heerdegen
2023-01-02 16:46   ` Jean Louis
2023-01-03 10:39     ` Michael Heerdegen
2023-01-03 13:17       ` Jean Louis
2023-01-02 17:08   ` [External] : " Drew Adams

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).