aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-06-02 11:52:41 -0400
committerStefan Monnier2019-06-02 11:52:41 -0400
commite3029eaadf967e9c753c79d91a65f38a744bf4e4 (patch)
tree6d16ac02d0cf203bca8349275a2b4eaf2852bf18
parent30b0c5bf42efb27b7afc5a7cf715bae2fe09923c (diff)
downloademacs-e3029eaadf967e9c753c79d91a65f38a744bf4e4.tar.gz
emacs-e3029eaadf967e9c753c79d91a65f38a744bf4e4.zip
* lisp/help-fns.el: Make hyperlink for the "first release" info
* lisp/help-fns.el (help-fns--first-release): Return a "button". (help-fns--mention-first-release): Preserve the string's text-properties. * lisp/help-mode.el (help-news): New button type.
-rw-r--r--lisp/help-fns.el31
-rw-r--r--lisp/help-mode.el12
2 files changed, 27 insertions, 16 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index de69168330d..47bbefbf010 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -592,6 +592,7 @@ FILE is the file where FUNCTION was probably defined."
592 (let* ((name (symbol-name symbol)) 592 (let* ((name (symbol-name symbol))
593 (re (concat "\\_<" (regexp-quote name) "\\_>")) 593 (re (concat "\\_<" (regexp-quote name) "\\_>"))
594 (news (directory-files data-directory t "\\`NEWS.[1-9]")) 594 (news (directory-files data-directory t "\\`NEWS.[1-9]"))
595 (place nil)
595 (first nil)) 596 (first nil))
596 (with-temp-buffer 597 (with-temp-buffer
597 (dolist (f news) 598 (dolist (f news)
@@ -600,17 +601,20 @@ FILE is the file where FUNCTION was probably defined."
600 (goto-char (point-min)) 601 (goto-char (point-min))
601 (search-forward "\n*") 602 (search-forward "\n*")
602 (while (re-search-forward re nil t) 603 (while (re-search-forward re nil t)
603 (save-excursion 604 (let ((pos (match-beginning 0)))
604 ;; Almost all entries are of the form "* ... in Emacs NN.MM." 605 (save-excursion
605 ;; but there are also a few in the form "* Emacs NN.MM is a bug 606 ;; Almost all entries are of the form "* ... in Emacs NN.MM."
606 ;; fix release ...". 607 ;; but there are also a few in the form "* Emacs NN.MM is a bug
607 (if (not (re-search-backward "^\\*.* Emacs \\([0-9.]+[0-9]\\)" 608 ;; fix release ...".
608 nil t)) 609 (if (not (re-search-backward "^\\*.* Emacs \\([0-9.]+[0-9]\\)"
609 (message "Ref found in non-versioned section in %S" 610 nil t))
610 (file-name-nondirectory f)) 611 (message "Ref found in non-versioned section in %S"
611 (let ((version (match-string 1))) 612 (file-name-nondirectory f))
612 (when (or (null first) (version< version first)) 613 (let ((version (match-string 1)))
613 (setq first version)))))))) 614 (when (or (null first) (version< version first))
615 (setq place (list f pos))
616 (setq first version)))))))))
617 (make-text-button first nil 'type 'help-news 'help-args place)
614 first)) 618 first))
615 619
616(add-hook 'help-fns-describe-function-functions 620(add-hook 'help-fns-describe-function-functions
@@ -620,8 +624,9 @@ FILE is the file where FUNCTION was probably defined."
620(defun help-fns--mention-first-release (object) 624(defun help-fns--mention-first-release (object)
621 (let ((first (if (symbolp object) (help-fns--first-release object)))) 625 (let ((first (if (symbolp object) (help-fns--first-release object))))
622 (when first 626 (when first
623 (princ (format " Probably introduced at or before Emacs version %s.\n" 627 (with-current-buffer standard-output
624 first))))) 628 (insert (format " Probably introduced at or before Emacs version %s.\n"
629 first))))))
625 630
626(defun help-fns-short-filename (filename) 631(defun help-fns-short-filename (filename)
627 (let* ((abbrev (abbreviate-file-name filename)) 632 (let* ((abbrev (abbreviate-file-name filename))
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 6cc3f0d4f71..dc2992cd4a5 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -287,12 +287,12 @@ The format is (FUNCTION ARGS...).")
287 287
288(define-button-type 'help-theme-def 288(define-button-type 'help-theme-def
289 :supertype 'help-xref 289 :supertype 'help-xref
290 'help-function 'find-file 290 'help-function #'find-file
291 'help-echo (purecopy "mouse-2, RET: visit theme file")) 291 'help-echo (purecopy "mouse-2, RET: visit theme file"))
292 292
293(define-button-type 'help-theme-edit 293(define-button-type 'help-theme-edit
294 :supertype 'help-xref 294 :supertype 'help-xref
295 'help-function 'customize-create-theme 295 'help-function #'customize-create-theme
296 'help-echo (purecopy "mouse-2, RET: edit this theme file")) 296 'help-echo (purecopy "mouse-2, RET: edit this theme file"))
297 297
298(define-button-type 'help-dir-local-var-def 298(define-button-type 'help-dir-local-var-def
@@ -302,7 +302,13 @@ The format is (FUNCTION ARGS...).")
302 ;; local variable was defined. 302 ;; local variable was defined.
303 (find-file file)) 303 (find-file file))
304 'help-echo (purecopy "mouse-2, RET: open directory-local variables file")) 304 'help-echo (purecopy "mouse-2, RET: open directory-local variables file"))
305 305(define-button-type 'help-news
306 :supertype 'help-xref
307 'help-function
308 (lambda (file pos)
309 (pop-to-buffer (find-file-noselect file))
310 (goto-char pos))
311 'help-echo (purecopy "mouse-2, RET: show corresponding NEWS announcement"))
306 312
307(defvar bookmark-make-record-function) 313(defvar bookmark-make-record-function)
308 314