* bug#24309: 25.1; Problem in variable reference in docstrings.
@ 2016-08-25 23:07 Nathanael Schweers
2016-08-26 8:55 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Nathanael Schweers @ 2016-08-25 23:07 UTC (permalink / raw)
To: 24309
This bug applies to both the version given in the description
(i.e. 25.1-RC2) and version 24.5 distributed on fedora.
These are the steps to reproduce the bug:
- Start Emacs with “emacs -Q”.
- evaluate these forms:
(defvar var "var" "docstring of var")
(defvar var* "var*" "docstring of var*")
(defvar *var "*var" "docstring of *var")
(defvar *var* "*var*" "docstring of *var*")
(defun fun0 () "see variable ‘var’." var)
(defun fun1 () "see var*iable ‘var*’." var*)
(defun fun2 () "see *variable ‘*var’." *var)
(defun fun3 () "see *var*iable ‘*var*’." *var*)
- See the docstrings of the defined functions. For fun0 and fun1 the
reference to the variable is correct, for fun2 and fun3 they are not.
In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
of 2016-08-22 built on reisefreund.localdomain
Windowing system distributor 'Fedora Project', version 11.0.11803000
Configured using:
'configure --with-xml2 --with-imagemagick --with-x-toolkit=gtk3
'CFLAGS=-O3 -march=native''
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=none
locale-coding-system: utf-8
Major mode: Outline
Minor modes in effect:
goto-address-mode: t
semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode) S)))
TeX-PDF-mode: t
TeX-source-correlate-mode: t
schweers-global-bindings-mode: t
schweers-bindings-mode: t
projectile-global-mode: t
projectile-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
helm-mode: t
jabber-activity-mode: t
erc-highlight-nicknames-mode: t
erc-list-mode: t
erc-menu-mode: t
erc-autojoin-mode: t
erc-ring-mode: t
erc-networks-mode: t
erc-pcomplete-mode: t
erc-track-mode: t
erc-track-minor-mode: t
erc-match-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-netsplit-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
erc-move-to-prompt-mode: t
erc-readonly-mode: t
pyvenv-mode: t
magit-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
shell-dirtrack-mode: t
global-auto-complete-mode: t
guide-key-mode: t
desktop-save-mode: t
diff-auto-refine-mode: t
global-subword-mode: t
subword-mode: t
winner-mode: t
savehist-mode: t
recentf-mode: t
delete-selection-mode: t
xterm-mouse-mode: t
show-paren-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
auto-fill-function: do-auto-fill
transient-mark-mode: t
view-mode: t
Recent messages:
nnimap read 0k from imap.mailbox.org
Decrypt (PGP) part? (y or n) y
nnimap read 0k from imap.mailbox.org
Decrypt (PGP) part? (y or n) y [7 times]
View mode: type C-h for help, h for commands, q to quit.
command-execute: Buffer is read-only: #<buffer *info*>
Type "q" in help window to restore its previous buffer.
Quit
Mark set
Auto-saving...
Load-path shadows:
/home/schweers/.emacs.d/elpa/helm-20160824.2154/helm-multi-match hides /home/schweers/.emacs.d/elpa/helm-core-20160821.110/helm-multi-match
/home/schweers/.emacs.d/code/misc hides /usr/local/share/emacs/25.1/lisp/misc
/home/schweers/.emacs.d/elpa/seq-2.16/seq hides /usr/local/share/emacs/25.1/lisp/emacs-lisp/seq
Features:
(shadow emacsbug goto-addr tramp-cache url-queue shr dom mailalias
smtpmail nnir flow-fill sort smiley gnus-cite mail-extr gnus-async
gnus-bcklg gnus-ml disp-table el-reader eieio-opt qp mm-archive url-http
url-gw url-cache url-auth url-handlers nnrss nndraft nnmh nnfolder utf-7
bbdb-gnus bbdb-mua bbdb-com bbdb-message sendmail epa-file epa
network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp
gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range gnus-win ert debug helm-command helm-elisp helm-eval tabify
face-remap calc calc-loaddefs calc-macs repeat misearch multi-isearch
linum texmathp macrostep-c cmacexp macrostep view ruby-mode-expansions
ruby-mode smie company-oddmuse company-keywords company-etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-capf company-cmake company-xcode company-clang company-semantic
company-eclim company-template company-css company-nxml company-bbdb
asm-mode org-rmail org-mhe org-irc org-info org-gnus org-docview
doc-view image-mode org-bibtex bibtex org-bbdb org-w3m jka-compr preview
prv-emacs flyspell tex-buf font-latex latex-mode-expansions latex
tex-style tex tex-mode setup-binding-mode setup-projectile
helm-projectile projectile ibuf-ext ibuffer setup-clojure cider
cider-debug cider-browse-ns cider-inspector cider-mode cider-interaction
cider-repl cider-resolve cider-test cider-overlays cider-stacktrace
cider-doc org-table cider-grimoire cider-popup cider-eldoc cider-client
cider-common cider-util nrepl-client queue nrepl-dict cider-compat
spinner clojure-mode-expansions clojure-mode align setup-diminish
setup-undo-tree-mode undo-tree diff forth-mode info-look speedbar
sb-image ezimage dframe setup-dired setup-gud setup-clhs
setup-ace-jump-mode ace-jump-mode diminish setup-helm helm-mode
helm-files image-dired dired-x dired-aux helm-buffers helm-elscreen
helm-tags helm-bookmark helm-adaptive helm-info bookmark helm-locate
helm-grep helm-regexp helm-external helm-net helm-utils helm-help
helm-types helm-config helm-easymenu helm helm-source eieio-compat
helm-multi-match helm-lib jabber jabber-notifications notifications
jabber-libnotify dbus jabber-awesome jabber-osd jabber-wmii
jabber-xmessage jabber-festival jabber-sawfish jabber-ratpoison
jabber-tmux jabber-screen jabber-socks5 jabber-ft-server
jabber-si-server jabber-ft-client jabber-ft-common jabber-si-client
jabber-si-common jabber-feature-neg jabber-truncate jabber-time
jabber-autoaway jabber-vcard-avatars jabber-chatstates jabber-events
jabber-vcard jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion hippie-exp jabber-browse jabber-search
jabber-register jabber-roster jabber-presence jabber-muc
jabber-bookmarks jabber-private jabber-muc-nick-coloring hexrgb
jabber-widget jabber-disco jabber-chat jabber-history jabber-chatbuffer
jabber-alert jabber-iq jabber-core jabber-console ewoc jabber-keymap
jabber-sasl sasl sasl-anonymous sasl-login sasl-plain fsm jabber-logon
jabber-conn srv dns starttls tls gnutls jabber-xml xml jabber-menu
jabber-util setup-eldoc setup-expand-region expand-region
text-mode-expansions cc-mode-expansions the-org-mode-expansions
python-el-fgallina-expansions js-mode-expansions html-mode-expansions
er-basic-expansions expand-region-core expand-region-custom setup-geiser
geiser setup-slime slime-repl slime-parse ac-slime slime arc-mode
archive-mode hyperspec browse-url setup-browse-kill-ring
browse-kill-ring derived cl setup-ace-link ace-link setup-erc
erc-highlight-nicknames erc-list erc-menu erc-join erc-ring erc-networks
erc-pcomplete erc-track erc-match erc-button erc-fill erc-stamp
erc-netsplit erc-goodies erc erc-backend erc-compat pp
setup-multiple-cursors multiple-cursors mc-hide-unmatched-lines-mode
mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more
mc-cycle-cursors mc-edit-lines setup-gnus mm-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap gnus gnus-ems nnheader setup-bbdb bbdb bbdb-site
timezone setup-auctex setup-ispell ispell setup-org ox-man ox-md ox-odt
rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse
nxml-ns nxml-enc xmltok nxml-util ox-texinfo ox-beamer ox-latex
ox-icalendar ox-html ox-ascii ox-publish ox org-element org org-macro
org-footnote org-pcomplete org-list org-faces org-entities org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs setup-ace-window ace-window setup-elpy yasnippet
highlight-indentation company elpy pyvenv elpy-refactor python ido grep
files-x cus-edit cus-start cus-load setup-keybindings windmove
setup-magit magit-blame magit-stash magit-bisect magit-remote
magit-commit magit-sequence magit magit-apply magit-wip magit-log
magit-diff smerge-mode magit-core magit-autorevert autorevert filenotify
magit-process magit-popup magit-mode magit-git crm magit-section
magit-utils git-commit log-edit message dired rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor async-bytecomp async tramp-sh tramp tramp-compat
tramp-loaddefs trampver shell pcomplete format-spec server
setup-autocomplete flymake compile comint ansi-color
auto-complete-config auto-complete popup setup-lispy lispy swiper ivy
ffap url-parse auth-source gnus-util mm-util mail-prsvr password-cache
url-vars iedit edmacro kmacro iedit-lib multiple-cursors-core rect
lispy-inline avy semantic/db eieio-base semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
find-func cedet noutline outline etags xref cl-seq project eieio
eieio-core cl-macs ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util ediff edebug help-fns lispy-tags
setup-guide-keys guide-key popwin saveplace misc desktop frameset vc-git
diff-mode easy-mmode setup-hydra hydra lv setup-dash dash-functional pc
json-mode json-reformat subr-x json-snatcher rx js sgml-mode json map
imenu thingatpt cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs f s ucs-normalize setup-package dash
sane-defaults advice cap-words superword subword winner ring savehist
recentf tree-widget wid-edit delsel appearance xt-mouse paren finder-inf
tex-site slime-autoloads info package epg-config seq byte-opt gv
bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs
pcase cl-lib time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 1323413 404955)
(symbols 48 84988 20)
(miscs 40 3946 6791)
(strings 32 496951 44309)
(string-bytes 1 10118029)
(vectors 16 128038)
(vector-slots 8 2696037 232959)
(floats 8 1833 4761)
(intervals 56 25719 3193)
(buffers 976 154)
(heap 1024 176436 45161))
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2016-08-25 23:07 bug#24309: 25.1; Problem in variable reference in docstrings Nathanael Schweers
@ 2016-08-26 8:55 ` Eli Zaretskii
2019-11-08 3:48 ` Stefan Kangas
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2016-08-26 8:55 UTC (permalink / raw)
To: Nathanael Schweers; +Cc: 24309
> From: Nathanael Schweers <NSchweers@mailbox.org>
> Date: Fri, 26 Aug 2016 01:07:06 +0200
>
>
> This bug applies to both the version given in the description
> (i.e. 25.1-RC2) and version 24.5 distributed on fedora.
Actually, Emacs has behaved like that since creation of hyper-links to
quoted symbols in doc strings was introduced in Emacs 20.3.
> - Start Emacs with “emacs -Q”.
> - evaluate these forms:
> (defvar var "var" "docstring of var")
> (defvar var* "var*" "docstring of var*")
> (defvar *var "*var" "docstring of *var")
> (defvar *var* "*var*" "docstring of *var*")
>
> (defun fun0 () "see variable ‘var’." var)
> (defun fun1 () "see var*iable ‘var*’." var*)
> (defun fun2 () "see *variable ‘*var’." *var)
> (defun fun3 () "see *var*iable ‘*var*’." *var*)
> - See the docstrings of the defined functions. For fun0 and fun1 the
> reference to the variable is correct, for fun2 and fun3 they are not.
See help-xref-symbol-regexp, it requires that the first character
after the opening quote has the word syntax, not the symbol syntax. I
don't know why is that, perhaps to avoid too many false positives or
something. The comment there says this was done deliberately.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2016-08-26 8:55 ` Eli Zaretskii
@ 2019-11-08 3:48 ` Stefan Kangas
2020-12-27 19:51 ` Basil L. Contovounesios
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-11-08 3:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Nathanael Schweers, 24309
tags 24309 + wontfix
close 24309
thanks
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Nathanael Schweers <NSchweers@mailbox.org>
>> Date: Fri, 26 Aug 2016 01:07:06 +0200
>>
>>
>> This bug applies to both the version given in the description
>> (i.e. 25.1-RC2) and version 24.5 distributed on fedora.
>
> Actually, Emacs has behaved like that since creation of hyper-links to
> quoted symbols in doc strings was introduced in Emacs 20.3.
>
>> - Start Emacs with “emacs -Q”.
>> - evaluate these forms:
>> (defvar var "var" "docstring of var")
>> (defvar var* "var*" "docstring of var*")
>> (defvar *var "*var" "docstring of *var")
>> (defvar *var* "*var*" "docstring of *var*")
>>
>> (defun fun0 () "see variable ‘var’." var)
>> (defun fun1 () "see var*iable ‘var*’." var*)
>> (defun fun2 () "see *variable ‘*var’." *var)
>> (defun fun3 () "see *var*iable ‘*var*’." *var*)
>> - See the docstrings of the defined functions. For fun0 and fun1 the
>> reference to the variable is correct, for fun2 and fun3 they are not.
>
> See help-xref-symbol-regexp, it requires that the first character
> after the opening quote has the word syntax, not the symbol syntax. I
> don't know why is that, perhaps to avoid too many false positives or
> something. The comment there says this was done deliberately.
That was three years ago, and this discussion has seen no further
replies. I take the above to mean that we don't want to change the
current behaviour, and I'm therefore closing this bug.
If anyone feels that this is indeed something we would like to
reconsider, please reopen the bug report.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2019-11-08 3:48 ` Stefan Kangas
@ 2020-12-27 19:51 ` Basil L. Contovounesios
2020-12-27 20:01 ` Basil L. Contovounesios
2020-12-27 22:15 ` Lars Ingebrigtsen
0 siblings, 2 replies; 7+ messages in thread
From: Basil L. Contovounesios @ 2020-12-27 19:51 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Nathanael Schweers, 24309
[-- Attachment #1: Type: text/plain, Size: 2396 bytes --]
forcemerge 24309 6601
tags 24309 - wontfix
tags 24309 + patch
quit
Stefan Kangas <stefan@marxist.se> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Nathanael Schweers <NSchweers@mailbox.org>
>>> Date: Fri, 26 Aug 2016 01:07:06 +0200
>>>
>>>
>>> This bug applies to both the version given in the description
>>> (i.e. 25.1-RC2) and version 24.5 distributed on fedora.
>>
>> Actually, Emacs has behaved like that since creation of hyper-links to
>> quoted symbols in doc strings was introduced in Emacs 20.3.
>>
>>> - Start Emacs with “emacs -Q”.
>>> - evaluate these forms:
>>> (defvar var "var" "docstring of var")
>>> (defvar var* "var*" "docstring of var*")
>>> (defvar *var "*var" "docstring of *var")
>>> (defvar *var* "*var*" "docstring of *var*")
>>>
>>> (defun fun0 () "see variable ‘var’." var)
>>> (defun fun1 () "see var*iable ‘var*’." var*)
>>> (defun fun2 () "see *variable ‘*var’." *var)
>>> (defun fun3 () "see *var*iable ‘*var*’." *var*)
>>> - See the docstrings of the defined functions. For fun0 and fun1 the
>>> reference to the variable is correct, for fun2 and fun3 they are not.
>>
>> See help-xref-symbol-regexp, it requires that the first character
>> after the opening quote has the word syntax, not the symbol syntax. I
>> don't know why is that, perhaps to avoid too many false positives or
>> something. The comment there says this was done deliberately.
>
> That was three years ago, and this discussion has seen no further
> replies. I take the above to mean that we don't want to change the
> current behaviour, and I'm therefore closing this bug.
>
> If anyone feels that this is indeed something we would like to
> reconsider, please reopen the bug report.
I would like valid symbol names to be recognised more reliably, and I
don't see why allowing xrefs to start with symbol syntax would lead to
too many false positives, so long as help-make-xrefs filters matches
appropriately.
My personal motivation is that I would like functions from the Dash
package (that start with hyphens), as well as built-in arithmetic
operators, hyperlinked in Help buffers.
The attached patch matches quoted symbol names with one or more
characters starting with either word or symbol syntax in Lisp docstrings
and Help buffers. WDYT?
Thanks,
--
Basil
[-- Attachment #2: 0001-Hyperlink-symbol-names-without-word-syntax-in-Help.patch --]
[-- Type: text/x-diff, Size: 4180 bytes --]
From 90213663582a9be9853209a49b2a9f977ead48c8 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sun, 27 Dec 2020 14:21:50 +0000
Subject: [PATCH] Hyperlink symbol names without word syntax in Help
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2): Allow single-character symbol names.
* lisp/help-mode.el (help-xref-symbol-regexp): Also match symbol
names starting with symbol syntax (bug#6601, bug#24309).
* test/lisp/help-mode-tests.el (help-mode-tests-xref-button): Test
hyperlink creation for function names without symbol syntax.
---
lisp/emacs-lisp/lisp-mode.el | 6 ++----
lisp/help-mode.el | 3 +--
test/lisp/help-mode-tests.el | 22 ++++++++++++++--------
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index e477ef1700..85309b3501 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -456,8 +456,7 @@ lisp--match-confusable-symbol-character
("\\(\\\\\\)\\([^\"\\]\\)"
(1 (elisp--font-lock-backslash) prepend))
;; Words inside ‘’ and `' tend to be symbol names.
- (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)"
- lisp-mode-symbol-regexp "\\)['’]")
+ (,(concat "[`‘]\\(" lisp-mode-symbol-regexp "\\)['’]")
(1 font-lock-constant-face prepend))
;; Constant values.
(,(concat "\\_<:" lisp-mode-symbol-regexp "\\_>")
@@ -507,8 +506,7 @@ lisp--match-confusable-symbol-character
(,(concat "(" cl-errs-re "\\_>")
(1 font-lock-warning-face))
;; Words inside ‘’ and `' tend to be symbol names.
- (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)"
- lisp-mode-symbol-regexp "\\)['’]")
+ (,(concat "[`‘]\\(" lisp-mode-symbol-regexp "\\)['’]")
(1 font-lock-constant-face prepend))
;; Uninterned symbols, e.g., (defpackage #:my-package ...)
;; must come before keywords below to have effect
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 025a67016b..e99df4a971 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -357,8 +357,7 @@ help-xref-symbol-regexp
"\\(symbol\\|program\\|property\\)\\|" ; Don't link
"\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
"[ \t\n]+\\)?"
- ;; Note starting with word-syntax character:
- "['`‘]\\(\\sw\\(\\sw\\|\\s_\\)+\\|`\\)['’]"))
+ "['`‘]\\(\\(?:\\sw\\|\\s_\\)+\\|`\\)['’]"))
"Regexp matching doc string references to symbols.
The words preceding the quoted symbol can be used in doc strings to
diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el
index 2b9552a8d8..016f4d4965 100644
--- a/test/lisp/help-mode-tests.el
+++ b/test/lisp/help-mode-tests.el
@@ -72,14 +72,20 @@ help-mode-tests-make-xrefs
#'info)))))
(ert-deftest help-mode-tests-xref-button ()
- (with-temp-buffer
- (insert "See also the function ‘interactive’.")
- (string-match help-xref-symbol-regexp (buffer-string))
- (help-xref-button 8 'help-function)
- (should-not (button-at 22))
- (should-not (button-at 35))
- (let ((button (button-at 30)))
- (should (eq (button-type button) 'help-function)))))
+ (let* ((fmt "See also the function ‘%s’.")
+ ;; 1+ translates string index to buffer position.
+ (beg (1+ (string-search "%" fmt))))
+ (with-temp-buffer
+ ;; (display-buffer (current-buffer))
+ (dolist (fn '(interactive \` = + - * / %))
+ (erase-buffer)
+ (insert (format fmt fn))
+ (goto-char (point-min))
+ (re-search-forward help-xref-symbol-regexp)
+ (help-xref-button 8 'help-function)
+ (should-not (button-at (1- beg)))
+ (should-not (button-at (+ beg (length (symbol-name fn)))))
+ (should (eq (button-type (button-at beg)) 'help-function))))))
(ert-deftest help-mode-tests-insert-xref-button ()
(with-temp-buffer
--
2.29.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2020-12-27 19:51 ` Basil L. Contovounesios
@ 2020-12-27 20:01 ` Basil L. Contovounesios
2020-12-27 22:15 ` Lars Ingebrigtsen
1 sibling, 0 replies; 7+ messages in thread
From: Basil L. Contovounesios @ 2020-12-27 20:01 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Nathanael Schweers, 24309
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> (ert-deftest help-mode-tests-xref-button ()
> - (with-temp-buffer
> - (insert "See also the function ‘interactive’.")
> - (string-match help-xref-symbol-regexp (buffer-string))
> - (help-xref-button 8 'help-function)
> - (should-not (button-at 22))
> - (should-not (button-at 35))
> - (let ((button (button-at 30)))
> - (should (eq (button-type button) 'help-function)))))
> + (let* ((fmt "See also the function ‘%s’.")
> + ;; 1+ translates string index to buffer position.
> + (beg (1+ (string-search "%" fmt))))
> + (with-temp-buffer
> + ;; (display-buffer (current-buffer))
Oops, will remove this debugging leftover.
--
Basil
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2020-12-27 19:51 ` Basil L. Contovounesios
2020-12-27 20:01 ` Basil L. Contovounesios
@ 2020-12-27 22:15 ` Lars Ingebrigtsen
2021-01-10 13:50 ` Basil L. Contovounesios
1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-27 22:15 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Nathanael Schweers, 24309, Stefan Kangas
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> My personal motivation is that I would like functions from the Dash
> package (that start with hyphens), as well as built-in arithmetic
> operators, hyperlinked in Help buffers.
>
> The attached patch matches quoted symbol names with one or more
> characters starting with either word or symbol syntax in Lisp docstrings
> and Help buffers. WDYT?
Makes sense to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#24309: 25.1; Problem in variable reference in docstrings.
2020-12-27 22:15 ` Lars Ingebrigtsen
@ 2021-01-10 13:50 ` Basil L. Contovounesios
0 siblings, 0 replies; 7+ messages in thread
From: Basil L. Contovounesios @ 2021-01-10 13:50 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Nathanael Schweers, Stefan Kangas, 24309-done
tags 24309 fixed
close 24309 28.1
quit
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> My personal motivation is that I would like functions from the Dash
>> package (that start with hyphens), as well as built-in arithmetic
>> operators, hyperlinked in Help buffers.
>>
>> The attached patch matches quoted symbol names with one or more
>> characters starting with either word or symbol syntax in Lisp docstrings
>> and Help buffers. WDYT?
>
> Makes sense to me.
Thanks, pushed to master.
Hyperlink symbol names without word syntax in Help
25dadca0d1 2021-01-10 13:37:38 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=25dadca0d175aa7f9f1654314f90af64cdcb68fd
--
Basil
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-01-10 13:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 23:07 bug#24309: 25.1; Problem in variable reference in docstrings Nathanael Schweers
2016-08-26 8:55 ` Eli Zaretskii
2019-11-08 3:48 ` Stefan Kangas
2020-12-27 19:51 ` Basil L. Contovounesios
2020-12-27 20:01 ` Basil L. Contovounesios
2020-12-27 22:15 ` Lars Ingebrigtsen
2021-01-10 13:50 ` Basil L. Contovounesios
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).