all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RE: [External] : Re: help doesn't buttonize some functions
@ 2021-08-27  5:52 Drew Adams
  2021-08-27  6:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2021-08-27  5:52 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 2489 bytes --]

> Maybe some regexp somewhere where functions that contain
> non-alphanums aren't buttonized?
> 
> E.g., `string=' isn't buttonized

Yes, it is.

Quoted names beginning with non-word chars aren't
buttonized.  Other names are.

The fault (but by design, I'm sure) is with this
variable defined in `help-mode.el':

(defconst help-xref-symbol-regexp
  (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|"  ; Link to var
 		    "\\(function\\|command\\|call\\)\\|"   ; Link to function
 		    "\\(face\\)\\|"			   ; Link to face
 		    "\\(symbol\\|program\\|property\\)\\|" ; Don't link
		    "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
		    "[ \t\n]+\\)?"
		    ;; Note starting with word-syntax character:
		    "['`']\\(\\sw\\(\\sw\\|\\s_\\)+\\|`\\)['']"))
  "Regexp matching doc string references to symbols.

The words preceding the quoted symbol can be used in doc strings to
distinguish references to variables, functions and symbols.")

This is the culprit - it says that the quoted name
must begin with a word-constituent char (\sw):

 ;; Note starting with word-syntax character:
 "['`']\\(\\sw\\(\\sw\\|\\s_\\)+\\|`\\)['']"
          ^^^^

You need to change that to this (and remove the call
to `purecopy'):

 "['`']\\(\\(\\sw\\|\\s_\\)+\\|`\\)['']"

But first `M-x load-library help-mode.el' (not .elc),
then redefine var `help-xref-symbol-regexp' as above.

You can use setq or defconst - doesn't matter:

(setq help-xref-symbol-regexp
      (concat "\\(\\<\\(\\(variable\\|option\\)\\|"	 ; Link to var
 	      "\\(function\\|command\\|call\\)\\|" ; Link to function
 	      "\\(face\\)\\|"			   ; Link to face
 	      "\\(symbol\\|program\\|property\\)\\|" ; Don't link
	      "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
	      "[ \t\n]+\\)?"
	      ;; Note starting with word-syntax character:
	      "['`']\\(\\(\\sw\\|\\s_\\)+\\|`\\)['']"))

Then you can test with this:

(defun test-fun ()
  "`=foo' is not `foo=' or `string='." )
(defun =foo () "EEEEEEEEEEEEEE" 42)
(defun foo= () "OOOOOOOOOOOOOO" "42")

Then `C-h f test-fun' buttonizes all of those.

This is using the Emacs 27.2 version of that var.
Other Emacs versions use different regexps for it,
but they all insist that the function, variable,
etc. name start with a word-constituent char.

The likely reason is that otherwise stuff gets
buttonized that shouldn't be.  IOW, starting with
a word char is a heuristic/trade-off.


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 14031 bytes --]

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

* Re: [External] : Re: help doesn't buttonize some functions
  2021-08-27  5:52 [External] : Re: help doesn't buttonize some functions Drew Adams
@ 2021-08-27  6:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-27  6:39   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-27 16:10   ` Drew Adams
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-08-27  6:19 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>> Maybe some regexp somewhere where functions that contain
>> non-alphanums aren't buttonized?
>> 
>> E.g., `string=' isn't buttonized
>
> Yes, it is.

Not in ERC. `string-equal' is.

> Quoted names beginning with non-word chars aren't
> buttonized. Other names are.
>
> The fault (but by design, I'm sure) is with this variable
> defined in `help-mode.el' [...]
>
> The likely reason is that otherwise stuff gets buttonized
> that shouldn't be.

What stuff?

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: [External] : Re: help doesn't buttonize some functions
  2021-08-27  6:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-08-27  6:39   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-27 16:10   ` Drew Adams
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-08-27  6:39 UTC (permalink / raw)
  To: help-gnu-emacs

>>> E.g., `string=' isn't buttonized
>>
>> Yes, it is.
>
> Not in ERC. `string-equal' is.

An idea would be to have the regexps that control
buttonization be the same for help and ERC.

And perhaps other modes as well, e.g. `gnus-article-mode'
where it doesn't happen at all (well, for URLs it does, but
not for Emacs symbols).

-- 
underground experts united
https://dataswamp.org/~incal




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

* RE: [External] : Re: help doesn't buttonize some functions
  2021-08-27  6:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-27  6:39   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-08-27 16:10   ` Drew Adams
  2021-08-28  1:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2021-08-27 16:10 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

> > Quoted names beginning with non-word chars aren't
> > buttonized. Other names are.
> >
> > The fault (but by design, I'm sure) is with this variable
> > defined in `help-mode.el' [...]
> >
> > The likely reason is that otherwise stuff gets buttonized
> > that shouldn't be.
> 
> What stuff?

Dunno.  I gave you the key.  Unlock and see for
yourself, if you're curious.  Or wait for Emacs 28.

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13219 bytes --]

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

* Re: [External] : Re: help doesn't buttonize some functions
  2021-08-27 16:10   ` Drew Adams
@ 2021-08-28  1:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-28  4:14       ` Drew Adams
  2021-08-31  8:01       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-08-28  1:55 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>>> The likely reason is that otherwise stuff gets buttonized
>>> that shouldn't be.
>> 
>> What stuff?
>
> Dunno. I gave you the key. Unlock and see for yourself, if
> you're curious.

I don't think people use `this' notation so often so "false
buttons" I don't think will be be a concern, but if it is,
cannot one simply look for a symbol, if it exists or not?
As there isn't a `this' symbol here, it doesn't have to
be buttonized, can't one do it like that, simply/better?

Let's confirm with (symbolp 'this) ; t

Hm ... maybe one can just use `when'?

> Or wait for Emacs 28.

Well, good that "they" fixed it but please tell me what
version number Emacs 28 will start on since mine

  GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, cairo
  version 1.16.0) of 2021-08-27

is somewhere in (27, 28) limbo.

-- 
underground experts united
https://dataswamp.org/~incal




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

* RE: [External] : Re: help doesn't buttonize some functions
  2021-08-28  1:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-08-28  4:14       ` Drew Adams
  2021-08-31  8:01       ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 7+ messages in thread
From: Drew Adams @ 2021-08-28  4:14 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

> > Or wait for Emacs 28.
> 
> Well, good that "they" fixed it but please tell me what
> version number Emacs 28 will start on since mine
> 
>   GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, cairo
>   version 1.16.0) of 2021-08-27
> 
> is somewhere in (27, 28) limbo.

Someone else will have to tell you that.  My
Emacs 28 is the latest - and only - MS Windows
binary posted by GNU Emacs, and it dates from
2021-01-15:

https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-28/

So ... older than yours by almost 8 months.

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13739 bytes --]

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

* Re: [External] : Re: help doesn't buttonize some functions
  2021-08-28  1:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-08-28  4:14       ` Drew Adams
@ 2021-08-31  8:01       ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-08-31  8:01 UTC (permalink / raw)
  To: help-gnu-emacs

> I don't think people use `this' notation so often so "false
> buttons" I don't think will be be a concern, but if it is,
> cannot one simply look for a symbol, if it exists or not?
> As there isn't a `this' symbol here, it doesn't have to be
> buttonized, can't one do it like that, simply/better?

This already happens with help and docstrings,
`undefined-symbol' isn't buttonized.

With ERC an `undefined-symbol' will instead be a button
to `apropos'!

-- 
underground experts united
https://dataswamp.org/~incal




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

end of thread, other threads:[~2021-08-31  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-27  5:52 [External] : Re: help doesn't buttonize some functions Drew Adams
2021-08-27  6:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-27  6:39   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-27 16:10   ` Drew Adams
2021-08-28  1:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-28  4:14       ` Drew Adams
2021-08-31  8:01       ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.