branch: externals/hyperbole commit f098816abd7a13af62e226d43d81f2edf5a70002 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Add hsys-flymake.el; fix text-toc actype and {C-u C-h A} --- ChangeLog | 39 +++++++++++++ MANIFEST | 1 + Makefile | 6 +- hact.el | 30 +++++----- hactypes.el | 21 ++++--- hbdata.el | 10 ++-- hbut.el | 34 +++++++++--- hib-debbugs.el | 16 +++--- hibtypes.el | 23 ++++++-- hmail.el | 4 +- hmouse-drv.el | 31 +++++++---- hmouse-key.el | 4 +- hsys-flymake.el | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ hui-mouse.el | 80 ++++++++++++++++----------- hui.el | 5 +- hyperbole.el | 4 +- kotl/kfill.el | 4 +- man/hkey-help.txt | 1 + man/hyperbole.texi | 11 +++- man/version.texi | 4 +- 20 files changed, 377 insertions(+), 111 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00ed751672..5bf51c6255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2024-01-03 Bob Weiner <r...@gnu.org> + +* hib-debbugs.el (declare-function): Revert declarations to use + "ext:debbugs-gnu" from "ext:debbugs" since the newer package + does not have many of the functions that Hyperbole presently uses. + +* MANIFEST: + man/hkey-help.txt: + man/hyperbole.texi (Implicit Button Types): + hibtypes.el (hsys-flymake): + Makefile (EL_COMPILE): Add "hsys-flymake.el" to Hyperbole. + +2024-01-02 Bob Weiner <r...@gnu.org> + +* hibtypes.el (text-toc): Fix doc on whitespace handling before and after + TOC header and TOC entry lines. + hactypes.el (text-toc): Fix not handling different whitespace in TOC + entry vs. section header. + +* hui.el (hui:hbut-help): Return custom button help function symbol if any; + otherwise, return the function used, 'hbut:report. This is used in + Smart Key help which previously was not displaying the proper action + for the Assist Key when on a Hyperbole button. + hmouse-drv.el (hkey-help): Update to display proper Assist Key help. + 2024-01-01 Bob Weiner <r...@gnu.org> * hypb-ert.el (hypb-ert-def-at-p): Update doc. Fix grouping ref that was @@ -6,6 +31,20 @@ 2023-12-31 Bob Weiner <r...@gnu.org> +* hbut.el (ibut:create, ibut:at-p): Change to call 'smart-eolp' instead of + 'eolp' so can handle flymake issues where an overlay/char-property is + added at the end of a line only and we want an implicit button created + for this. + +* hui-mouse.el (hkey-alist): Add logic for new hsys-flymake library to handle + diag issues at the end of the line where we want an implicit button to + fire rather than typicaly eol handling. + +* hbut.el (ibtype:test-p, ibtype:act): Add these to mirror actype functions. + (ibtype:elisp-symbol): Add alias similar to existing actype one. So + that (ibtype:act <ibtype-sym-or-name>) executes the ibtype action if the + current buffer context supports it. + * hyrolo.el (hyrolo-file-list): Add 'hyrolo-set-file-list' after loading the hyrolo library (at the end of the file) if 'hyrolo-file-list' has been set by the user or the customization system prior to loading HyRolo. diff --git a/MANIFEST b/MANIFEST index 071a9be605..3b57d005ab 100644 --- a/MANIFEST +++ b/MANIFEST @@ -99,6 +99,7 @@ topwin.py - Python script to find the topmost macOS app window at a s .hypb & _hypb - Button data files used by the GNU Hyperbole DEMO file * --- EXTERNAL SYSTEM ENCAPSULATIONS --- +hsys-flymake.el - Add missing source buffer keymap to flymake linter hsys-org.el - GNU Hyperbole support functions for Org mode hsys-org-roam.el - GNU Hyperbole support functions for Org Roam hsys-www.el - GNU Hyperbole support for Emacs W3 World-Wide Web (WWW) browsing diff --git a/Makefile b/Makefile index f4582528e8..291cf6300a 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Author: Bob Weiner # # Orig-Date: 15-Jun-94 at 03:42:38 -# Last-Mod: 4-Dec-23 at 01:18:04 by Bob Weiner +# Last-Mod: 3-Jan-24 at 03:06:38 by Bob Weiner # # Copyright (C) 1994-2023 Free Software Foundation, Inc. # See the file HY-COPY for license information. @@ -182,8 +182,8 @@ EL_COMPILE = hact.el hactypes.el hargs.el hbdata.el hbmap.el hbut.el \ hib-social.el hibtypes.el \ hinit.el hload-path.el hmail.el hmh.el hmoccur.el hmouse-info.el \ hmouse-drv.el hmouse-key.el hmouse-mod.el hmouse-sh.el hmouse-tag.el \ - hpath.el hrmail.el hsettings.el hsmail.el hsys-org.el hsys-org-roam.el \ - hsys-www.el hsys-youtube.el htz.el \ + hpath.el hrmail.el hsettings.el hsmail.el hsys-flymake.el hsys-org.el \ + hsys-org-roam.el hsys-www.el hsys-youtube.el htz.el \ hycontrol.el hui-jmenu.el hui-menu.el hui-mini.el hui-mouse.el hui-select.el \ hui-treemacs.el hui-window.el hui.el hvar.el hversion.el hypb.el hyperbole.el \ hyrolo-demo.el hyrolo-logic.el hyrolo-menu.el hyrolo.el hywconfig.el set.el hypb-ert.el \ diff --git a/hact.el b/hact.el index 75ff81dc20..516b8ed5b7 100644 --- a/hact.el +++ b/hact.el @@ -3,11 +3,11 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 18-Sep-91 at 02:57:09 -;; Last-Mod: 7-Nov-23 at 21:38:28 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 02:32:30 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; -;; Copyright (C) 1991-2022 Free Software Foundation, Inc. +;; Copyright (C) 1991-2024 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. ;; ;; This file is part of GNU Hyperbole. @@ -25,10 +25,10 @@ ;;; Public declarations ;;; ************************************************************************ -(declare-function hattr:get "hypb") -(declare-function hattr:list "hypb") -(declare-function hattr:set "hypb") -(declare-function hbut:is-p "hypb") +(declare-function hattr:get "hbut") +(declare-function hattr:list "hbut") +(declare-function hattr:set "hbut") +(declare-function hbut:is-p "hbut") (declare-function hpath:absolute-arguments "hpath") (declare-function hypb:indirect-function "hypb") @@ -126,7 +126,8 @@ with the `ibtypes::' prefix and one without. The value for both keys is the Elisp symbol for the type, which includes the prefix.") (defsubst symtable:actype-p (symbol-or-name) - "Return SYMBOL-OR-NAME if a Hyperbole action type or Elisp function, else nil." + "Return Elisp symbol for SYMBOL-OR-NAME if a Hyperbole action type. +May also be an Elisp function. Otherwise, return nil." (when (or (symbolp symbol-or-name) (stringp symbol-or-name)) (or (symtable:get symbol-or-name symtable:actypes) (and (stringp symbol-or-name) (fboundp (intern-soft symbol-or-name)) @@ -134,14 +135,14 @@ keys is the Elisp symbol for the type, which includes the prefix.") (and (functionp symbol-or-name) symbol-or-name)))) (defsubst symtable:hyperbole-actype-p (symbol-or-name) - "Return SYMBOL-OR-NAME if a Hyperbole action type, else nil. + "Return Elisp symbol for SYMBOL-OR-NAME if a Hyperbole action type, else nil. This excludes Emacs Lisp functions which may be used as action types. Use `actype:elisp-symbol' to include these." (when (or (symbolp symbol-or-name) (stringp symbol-or-name)) (or (symtable:get symbol-or-name symtable:actypes)))) (defsubst symtable:ibtype-p (symbol-or-name) - "Return SYMBOL-OR-NAME if it is a Hyperbole implicit button type, else nil." + "Return Elisp symbol for SYMBOL-OR-NAME if it is a Hyperbole ibtype, else nil." (when (or (symbolp symbol-or-name) (stringp symbol-or-name)) (symtable:get symbol-or-name symtable:ibtypes))) @@ -154,8 +155,9 @@ Caller must ensure SYMBOL-OR-NAME is a symbol or string." (defalias 'symtable:delete #'symtable:remove) (defun symtable:get (symbol-or-name symtable) - "Return Hyperbole SYMBOL-OR-NAME if it is in SYMTABLE, else nil. -Caller must ensure SYMBOL-OR-NAME is a symbol or string." + "Return Elisp symbol for Hyperbole SYMBOL-OR-NAME if it is in SYMTABLE. +Otherwise, return nil. Caller must ensure SYMBOL-OR-NAME is a symbol +or string." (symtable:operate #'gethash symbol-or-name symtable)) (defun symtable:remove (symbol-or-name symtable) @@ -419,9 +421,6 @@ performing ACTION." t) (hhist:add hist-elt)))))) -;; Return the full Elisp symbol for ACTYPE, which may be a string or symbol. -(defalias 'actype:elisp-symbol #'symtable:actype-p) - (defun actype:def-symbol (actype) "Return the abbreviated symbol for ACTYPE used in its `defact'. ACTYPE must be a symbol or string that begins with `actype::' or nil @@ -432,6 +431,9 @@ is returned." (when (string-match "\\`actypes::" name) (make-symbol (substring name (match-end 0)))))) +;; Return the full Elisp symbol for ACTYPE, which may be a string or symbol. +(defalias 'actype:elisp-symbol #'symtable:actype-p) + (defun actype:eval (actype &rest args) "Perform action formed from ACTYPE and rest of ARGS and return value. This differs from `actype:act' in that it can return nil and does not diff --git a/hactypes.el b/hactypes.el index f881cca010..6c937a4233 100644 --- a/hactypes.el +++ b/hactypes.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 23-Sep-91 at 20:34:36 -;; Last-Mod: 28-Dec-23 at 11:55:42 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 01:34:28 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -749,13 +749,18 @@ Optional SECTIONS-START limits toc entries to those after that point." SECTION is a string and can be just the leading part of a section heading." (interactive "sGo to section named: ") (when (stringp section) - (actypes::link-to-regexp-match - (concat "^[ \t]*" (regexp-quote section)) - 2 (current-buffer) t)) - (while (and (= (forward-line -1) 0) - (looking-at "[ \t]*[-=][-=]"))) - (forward-line 1) - (recenter 0)) + (setq section (string-trim section)) + (if (string-match "\\`\\(\\*+\\)[ \t]*" section) + (actypes::link-to-regexp-match + (concat "^[ \t]*" (regexp-quote (match-string 1 section)) + "[ \t]*" (regexp-quote (substring section (match-end 0)))) + 2 (current-buffer) t) + (actypes::link-to-regexp-match (concat "^[ \t]*" (regexp-quote section)) + 2 (current-buffer) t)) + (while (and (= (forward-line -1) 0) + (looking-at "[ \t]*[-=][-=]"))) + (forward-line 1) + (recenter 0))) (provide 'hactypes) diff --git a/hbdata.el b/hbdata.el index 884ba82579..3aab8020c9 100644 --- a/hbdata.el +++ b/hbdata.el @@ -3,11 +3,11 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 2-Apr-91 -;; Last-Mod: 22-Oct-23 at 14:42:47 by Mats Lidell +;; Last-Mod: 3-Jan-24 at 02:27:47 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; -;; Copyright (C) 1991-2021 Free Software Foundation, Inc. +;; Copyright (C) 1991-2024 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. ;; ;; This file is part of GNU Hyperbole. @@ -76,9 +76,9 @@ (declare-function ebut:label-to-key "hbut") ;; Functions from abstract mail and news interface. See "hmail.el" -(declare-function lmail:to nil) -(declare-function rmail:to nil) -(declare-function rmail:summ-msg-to nil) +(declare-function lmail:to "hmail") +(declare-function rmail:to "hmail") +(declare-function rmail:summ-msg-to "hmail") ;;; ************************************************************************ ;;; Public functions diff --git a/hbut.el b/hbut.el index 7b9bd40a65..1b6d5862b0 100644 --- a/hbut.el +++ b/hbut.el @@ -3,11 +3,11 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 18-Sep-91 at 02:57:09 -;; Last-Mod: 30-Dec-23 at 01:38:30 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 02:31:24 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; -;; Copyright (C) 1991-2023 Free Software Foundation, Inc. +;; Copyright (C) 1991-2024 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. ;; ;; This file is part of GNU Hyperbole. @@ -15,6 +15,7 @@ ;;; Commentary: ;;; Code: + ;;; ************************************************************************ ;;; Other required Elisp libraries ;;; ************************************************************************ @@ -1709,8 +1710,9 @@ Any named implicit button must contain at least two characters, excluding delimiters, not just one." ;; Since the Smart Keys handle end-of-line separately from whether ;; point is within an implicit button, always report not within one - ;; when point is at the end of a line. -- RSW, 02-16-2020 - (unless (eolp) + ;; when point is at the end of a line unless `flymake-mode' has added + ;; an issue annotation there. -- RSW 02-16-2020, 12-31-2023 + (unless (smart-eolp) ;; Check for an implicit button at current point, record its ;; attributes in memory and return a button symbol for it. (when (ibut:create) @@ -1875,9 +1877,10 @@ If a new button is created, store its attributes in the symbol, (setq name-and-lbl-key-flag nil)) ;; Since the Smart Keys handle end-of-line and end-of-buffer ;; separately from whether point is within an implicit button, - ;; always report not within one when point is at the end of a line. - ;; -- RSW, 02-16-2020 and 07-17-2022 - (unless (or is-type (eolp) (eobp)) + ;; always report not within one when point is at the end of a line + ;; except when there is a `flymake-mode' issue annotation there. + ;; -- RSW 02-16-2020, 07-17-2022 and 12-31-2023 + (unless (or is-type (smart-eolp) (eobp)) (unwind-protect (progn (when (or but-sym-flag name-and-lbl-key-flag) (setq text-start (or (hattr:get 'hbut:current 'lbl-start) @@ -2889,6 +2892,12 @@ type for ibtype is presently undefined." [&optional ["&optional" arg &rest arg]] &optional ["&rest" arg]))) +(defun ibtype:act (ibtype) + "Execute IBTYPE's action in contexts where `ibtype:test-p' is true." + (let ((elisp-sym (ibtype:elisp-symbol ibtype))) + (when elisp-sym + (funcall elisp-sym)))) + (defalias 'ibtype:create #'defib) (defun ibtype:activate-link (referent) @@ -3075,6 +3084,13 @@ Return TYPE's symbol if it existed, else nil." (symtable:delete type symtable:ibtypes) (htype:delete type 'ibtypes)) -(provide 'hbut) +;; Return the full Elisp symbol for IBTYPE, which may be a string or symbol. +(defalias 'ibtype:elisp-symbol #'symtable:ibtype-p) -;;; hbut.el ends here +(defun ibtype:test-p (ibtype) + "Return t if IBTYPE would activate in the current buffer context, else nil." + (let ((elisp-sym (ibtype:elisp-symbol ibtype)) + (hrule:action #'actype:identity)) + (and elisp-sym (funcall elisp-sym) t))) + +(provide 'hbut) diff --git a/hib-debbugs.el b/hib-debbugs.el index 78d17f5d87..4898bcc713 100644 --- a/hib-debbugs.el +++ b/hib-debbugs.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Jun-16 at 14:24:53 -;; Last-Mod: 30-Dec-23 at 00:13:19 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 03:06:43 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -11,7 +11,7 @@ ;; See the "HY-COPY" file for license information. ;; ;; This file is part of Hyperbole. It requires the Emacs package -;; Debbugs 0.9.7 or higher; there were bugs in earlier versions +;; debbugs-gnu 0.9.7 or higher; there were bugs in earlier versions ;; that made it incompatible with the queries Hyperbole issues. ;; ;;; Commentary: @@ -77,11 +77,11 @@ ;;; Public declarations ;;; ************************************************************************ -(declare-function debbugs-get-status "ext:debbugs") -(declare-function debbugs-gnu-bugs "ext:debbugs") -(declare-function debbugs-gnu-current-id "ext:debbugs") -(declare-function debbugs-gnu-select-report "ext:debbugs") -(declare-function debbugs-gnu-show-reports "ext:debbugs") +(declare-function debbugs-get-status "ext:debbugs-gnu") +(declare-function debbugs-gnu-bugs "ext:debbugs-gnu") +(declare-function debbugs-gnu-current-id "ext:debbugs-gnu") +(declare-function debbugs-gnu-select-report "ext:debbugs-gnu") +(declare-function debbugs-gnu-show-reports "ext:debbugs-gnu") (defvar debbugs-gnu-current-query) (defvar debbugs-port) @@ -263,7 +263,7 @@ Return t unless no attributes are printed." "Return t iff debbugs version is sufficient for use with Hyperbole. Must be greater than equal to 0.9.7." (save-excursion - (let* ((debbugs-src (locate-file "debbugs" load-path '(".el"))) + (let* ((debbugs-src (locate-file "debbugs-gnu" load-path '(".el"))) (visiting-debbugs-src (when debbugs-src (get-file-buffer debbugs-src))) debbugs-src-buffer version) diff --git a/hibtypes.el b/hibtypes.el index 00ccf856d9..a3e81f9ed7 100644 --- a/hibtypes.el +++ b/hibtypes.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Sep-91 at 20:45:31 -;; Last-Mod: 28-Dec-23 at 18:27:19 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 01:38:08 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -87,6 +87,16 @@ ;; them. Use load instead to ensure are reloaded when resetting ;; ibtype priorities. +;;; ======================================================================== +;;; Keymap with repeat and source buffer control for flymake code linter +;;; ======================================================================== + +(load "hsys-flymake") + +;;; ======================================================================== +;;; Jumps to source line from Python traceback lines +;;; ======================================================================== + (defib python-tb-previous-line () "Move to prior line with potential Python line ref. In Python, tracebacks may be on a line just below the source @@ -623,11 +633,12 @@ anything." "Jump to the text file section referenced by a table of contents entry at point. Buffer must be in a text mode or must contain DEMO, README or TUTORIAL and there must be a `Table of Contents' or `Contents' -label on a line by itself (it may begin with an asterisk), -preceding the table of contents. Each toc entry must begin with -some whitespace followed by one or more asterisk characters. -Each section header linked to by the toc must start with one or -more asterisk characters at the very beginning of the line." +label on a line by itself (it optionally may begin with an +asterisk), preceding the table of contents. Each toc entry must +begin with optional whitespace followed by one or more asterisks. +Each section header linked to by the toc must start with optional +whitespace and then one or more asterisks at the beginning of the +line." (let (section) (when (and (or (derived-mode-p 'text-mode) (string-match "DEMO\\|README\\|TUTORIAL" (buffer-name))) diff --git a/hmail.el b/hmail.el index cce7a37d3d..877b4dc25a 100644 --- a/hmail.el +++ b/hmail.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 9-Oct-91 at 18:38:05 -;; Last-Mod: 3-Oct-23 at 23:30:56 by Mats Lidell +;; Last-Mod: 3-Jan-24 at 02:26:11 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -35,7 +35,7 @@ ;;; Public declarations ;;; ************************************************************************ -(declare-function rmail:msg-widen nil) +(declare-function rmail:msg-widen "hmail") (declare-function hypb:insert-region "hypb") ;;; ************************************************************************ diff --git a/hmouse-drv.el b/hmouse-drv.el index 8029f951b5..fa7f3822f4 100644 --- a/hmouse-drv.el +++ b/hmouse-drv.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-90 -;; Last-Mod: 27-Dec-23 at 00:52:16 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 02:24:39 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -59,7 +59,7 @@ (defvar action-key-default-function) ; defcustom hui-mouse (defvar assist-key-default-function) ; defcustom hui-mouse -(declare-function mouse-drag-frame nil) ;; Obsolete from Emacs 28 +(declare-function mouse-drag-frame "mouse") ;; Obsolete from Emacs 28 (declare-function hkey-quit-window "hmouse-drv") ; Alias defined in this file. @@ -1146,7 +1146,8 @@ documentation is found." (if (eq categ 'explicit) actype categ)) (if (eq categ 'explicit) "EXPLICIT" "IMPLICIT"))) (hattr:report attributes) - (unless (or (eq categ 'explicit) + (unless (or assisting + (eq categ 'explicit) (null categ) (not (fboundp categ)) (null (documentation categ))) @@ -1154,13 +1155,23 @@ documentation is found." (princ (format "\n%s\n" (replace-regexp-in-string "^" " " (documentation categ) nil t)))) - (when (and (symbolp actype) - (fboundp actype) - (documentation actype)) - (princ (format "\n%s ACTION SPECIFICS:\n%s\n" - (or (actype:def-symbol actype) actype) - (replace-regexp-in-string "^" " " (documentation actype) - nil t)))))) + (if assisting + (let ((type-help-func (or (intern-soft + (concat (htype:names 'ibtypes categ) + ":help")) + 'hbut:report))) + (princ (format "\n%s ASSIST SPECIFICS:\n%s\n" + type-help-func + (replace-regexp-in-string + "^" " " (documentation type-help-func) + nil t)))) + (when (and (symbolp actype) + (fboundp actype) + (documentation actype)) + (princ (format "\n%s ACTION SPECIFICS:\n%s\n" + (or (actype:def-symbol actype) actype) + (replace-regexp-in-string "^" " " (documentation actype) + nil t))))))) ;; Print Emacs push-button attributes (when (memq cmd-sym '(smart-push-button smart-push-button-help)) diff --git a/hmouse-key.el b/hmouse-key.el index 8934c9f3f2..11005a2e79 100644 --- a/hmouse-key.el +++ b/hmouse-key.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 30-May-94 at 00:11:57 -;; Last-Mod: 3-Oct-23 at 17:10:05 by Mats Lidell +;; Last-Mod: 3-Jan-24 at 02:29:03 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -37,7 +37,7 @@ (defvar hyperbole-mode-map) ; "hyperbole.el" -(declare-function hkey-initialize "hbut") +(declare-function hkey-initialize "hyperbole") (declare-function hmouse-get-bindings "hmouse-sh") (declare-function hmouse-unshifted-setup "hmouse-sh") (declare-function hmouse-shifted-setup "hmouse-sh") diff --git a/hsys-flymake.el b/hsys-flymake.el new file mode 100644 index 0000000000..a4a1ce61d5 --- /dev/null +++ b/hsys-flymake.el @@ -0,0 +1,160 @@ +;;; hsys-flymake.el --- Add missing source buffer keymap to flymake linter -*- lexical-binding: t; -*- +;; Usage: GNU Emacs Lisp Library +;; Keywords: tools +;; +;; Author: Bob Weiner +;; Org: RWorks +;; E-mail: r...@gnu.org +;; +;; Orig-Date: 31-Dec-23 at 13:54:08 +;; Last-Mod: 3-Jan-24 at 03:19:44 by Bob Weiner +;; +;; SPDX-License-Identifier: GPL-3.0-or-later +;; +;; Copyright (C) 2023-2024 Free Software Foundation, Inc. +;; Licensed under the GNU General Public License, version 3. +;; +;; This file is part of GNU Hyperbole. +;; +;;; Commentary: +;; +;; These functions all work in the source code buffer, not the flymake +;; diagnostics buffer. +;; +;; We want to load this so the implicit button type defined herein +;; takes effect, but we don't require `flymake-mode' or +;; `repeat-mode'. Instead we leave it to each function to check +;; whether it is enabled and active in the current buffer. This way, +;; if the user never uses `flymake-mode' that library is never loaded +;; and the implicit button type never triggers. +;; +;;; Code: + +;;; ************************************************************************ +;;; Public functions +;;; ************************************************************************ + +(defib hsys-flymake-issue-at-point () + "Display the flymake diagnostic issue at source buffer point, if any." + (let ((issue (hsys-flymake-get-issue-at-position))) + (when issue + (ibut:label-set issue) + (hact 'message issue)))) + +(defun hsys-flymake-issue-at-point:help (ibut) + "With flymake enabled and point on its highlighted text, insert the issue." + (interactive) + (let ((issue (car (hattr:get ibut 'args)))) + (when issue + (save-excursion + (end-of-visible-line) + (insert "\n" issue "\n"))))) + +(defun hsys-flymake-display-issue-at-point () + "Display the flymake diagnostic issue at source buffer point, if any." + (interactive) + (let ((issue (hsys-flymake-get-issue-at-position))) + (when issue + (message issue)))) + +(defun hsys-flymake-display-log-buffer () + "For flymake backend developers: Display a technical log of flymake actions." + (interactive) + (when (and (featurep 'flymake) flymake-mode) + (display-buffer (get-buffer-create "*Flymake log*")))) + +(defun hsys-flymake-get-issue-at-position (&optional pos) + "With flymake enabled and POS on its highlighted text, return the issue. +If no issue at POS, return nil. POS is optional and defaults to point." + (when (and (featurep 'flymake) flymake-mode) + (let* ((diag (get-char-property (or pos (point)) 'flymake-diagnostic)) + (issue (when diag (flymake--diag-text diag)))) + issue))) + +(defun hsys-flymake-display-this-or-next-issue () + "Display the source buffer flymake diagnostic at point or else the next one." + (interactive) + (or (hsys-flymake-display-issue-at-point) + (call-interactively 'flymake-goto-next-error))) + +(defun hsys-flymake-insert-issue-at-point () + "With flymake enabled and point on its highlighted text, insert the issue. +Issue is inserted into the buffer after the current visible line." + (interactive) + (let ((issue (hsys-flymake-get-issue-at-position))) + (when issue + (save-excursion + (end-of-visible-line) + (insert "\n" issue "\n"))))) + +(defun hsys-flymake-toggle () + "Toggle flymake minor mode on or off in the current buffer." + (interactive) + (flymake-mode 'toggle) + (when (called-interactively-p 'interactive) + (message "%s flymake-mode" (if flymake-mode "Enabled" "Disabled")))) + +(defun hsys-flymake-toggle-wraparound () + "Toggle flymake minor mode on or off in the current buffer." + (interactive) + (when (and (featurep 'flymake) flymake-mode) + (setq flymake-wrap-around (not flymake-wrap-around)) + (when (called-interactively-p 'interactive) + (message "%s flymake-mode next and previous issue search wraparound to buffer start" + (if flymake-wrap-around "Enabled" "Disabled"))))) + +;;; ************************************************************************ +;;; Key bindings +;;; ************************************************************************ + +;; flymake-mode does not bind any keys; it has only menu bindings. +;; Add key bindings for use in the source buffer on the C-c C-l prefix. +;; Each time these keys are changed, need to disable repeat-mode and +;; then re-enable it to read the updated key bindings. +(defvar hsys-flymake-mode-control-l-prefix-map + (let ((map (make-sparse-keymap))) + (define-key map "d" 'flymake-show-buffer-diagnostics) + (define-key map "g" 'hsys-flymake-display-this-or-next-issue) + (define-key map "i" 'hsys-flymake-insert-issue-at-point) + (define-key map "l" 'flymake-switch-to-log-buffers) + (define-key map "n" 'flymake-goto-next-error) + (define-key map "p" 'flymake-goto-prev-error) + (define-key map "s" 'flymake-start) + (define-key map "w" 'hsys-flymake-toggle-wraparound) + map)) + +;; Use repeat-mode for appropriate flymake commands so can repeat them +;; with their last keystroke, e.g. repeat {C-c C-l n} by pressing {n} +;; repeatedly. +(defvar hsys-flymake-repeat-map + (let ((map (make-sparse-keymap))) + (mapc (lambda (cmd) + (define-key map + (where-is-internal cmd hsys-flymake-mode-control-l-prefix-map t) + cmd) + (put cmd 'repeat-map 'hsys-flymake-repeat-map)) + '(flymake-goto-next-error + flymake-goto-prev-error + hsys-flymake-toggle-wraparound)) + map)) + +(defvar hsys-flymake-mode-control-c-prefix-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-l" hsys-flymake-mode-control-l-prefix-map) + map)) + +(global-set-key "\C-c\C-lt" 'hsys-flymake-toggle) + +(add-hook 'flymake-mode-hook + (lambda () (when flymake-mode + (define-key flymake-mode-map "\C-c" + hsys-flymake-mode-control-c-prefix-map) + (repeat-mode 1)))) +;; If flymake-mode is already enabled, re-enable it to ensure +;; repeat-mode gets enabled. +(when (and (featurep 'flymake) flymake-mode) + (flymake-mode 1)) + +(provide 'hsys-flymake) + +;;; hsys-flymake.el ends here diff --git a/hui-mouse.el b/hui-mouse.el index 3f8aa1529f..9ebe758b01 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 29-Dec-23 at 23:43:11 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 02:22:25 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -14,26 +14,25 @@ ;;; Commentary: ;; -;; This code is machine independent. It works best with a pointing device but -;; may also be used from a keyboard. When used with a pointing device it +;; This code is machine independent. It works best with a pointing device +;; but may also be used from a keyboard. When used with a pointing device it ;; requires an Emacs command that sets point to the location of the pointing ;; device's cursor. ;; ;; If you want to use your shift-middle mouse button to select Hyperbole menu ;; items and Hyperbole buttons, follow these instructions. ;; -;; If you plan to use a mouse only with the X window system or macOS -;; and you want to use the shift-middle and shift-right buttons, you -;; need not do any mouse configuration. Your Emacs executable must -;; have been built so as to include the mouse support files for your -;; window system, however. These are in the Emacs "src" directory: -;; for X - "x*.c", for macOS - "ns*.c". +;; If you plan to use a mouse only with the X window system or macOS and you +;; want to use the shift-middle and shift-right buttons, you need not do any +;; mouse configuration. Your Emacs executable must have been built so as to +;; include the mouse support files for your window system, however. These +;; are in the Emacs "src" directory: for X - "x*.c", for macOS - "ns*.c". ;; ;; To use a different mouse key or a different window system, modify the ;; mouse key bindings in "hmouse-sh.el". ;; -;; Using the Action Mouse Key to browse through and delete files from -;; Dired listings is exceptionally nice, just as it is when reading mail. +;; Using the Action Mouse Key to browse through and delete files from Dired +;; listings is exceptionally nice, just as it is when reading mail. ;;; Code: ;;; ************************************************************************ @@ -50,7 +49,7 @@ (require 'hmouse-tag)) (require 'imenu) (eval-when-compile - (require 'eieio)) + (require 'eieio)) ;; magit uses this and thus smart-magit does (eval-when-compile (require 'tar-mode)) @@ -58,20 +57,7 @@ ;;; Public declarations ;;; ************************************************************************ -;; Functions from abstract mail and news interface. See "hmail.el" -(declare-function lmail:delete nil) -(declare-function lmail:undelete nil) -(declare-function rmail:msg-prev nil) -(declare-function lmail:goto nil) -(declare-function lmail:expunge nil) -(declare-function rmail:msg-next nil) -(declare-function lmail:undelete-all nil) - -(declare-function helm-get-actions-from-current-source "ext:helm-core") -(declare-function helm-get-default-action "ext:helm-core") - -(defvar helm-selection-point) - +;; Functions from optional, external ert-results package (declare-function ert-results-filter "ext:ert-results") (declare-function ert-results-filter-status-p "ext:ert-results") (declare-function ert-results-display "ext:ert-results") @@ -80,6 +66,27 @@ (declare-function ert-results-toggle "ext:ert-results") (declare-function ert-results-describe-test-at-point "ext:ert-results") +;; Functions from Hyperbole's abstract mail and news interface. +;; See "hmail.el" +(declare-function lmail:delete "hmail") +(declare-function lmail:undelete "hmail") +(declare-function rmail:msg-prev "hmail") +(declare-function lmail:goto "hmail") +(declare-function lmail:expunge "hmail") +(declare-function rmail:msg-next "hmail") +(declare-function lmail:undelete-all "hmail") + +;; Functions and variables from the helm package +(declare-function helm-get-actions-from-current-source "ext:helm-core") +(declare-function helm-get-default-action "ext:helm-core") + +(defvar helm-selection-point) + +;; Functions from Hyperbole's Koutliner +(declare-function kotl-mode:eobp "kotl-mode") +(declare-function kotl-mode:eolp "kotl-mode") + +;; Emacs functions (declare-function tar-flag-deleted "tar") (declare-function tar-unflag "tar") (declare-function tar-extract-other-window "tar") @@ -302,9 +309,7 @@ Its default value is `smart-scroll-down'. To disable it, set it to . ((xref-goto-xref) . (xref-show-location-at-point))) ;; ;; If at the end of a line (eol), invoke the associated Smart Key handler EOL handler. - ((if (eq major-mode 'kotl-mode) - (and (not (kotl-mode:eobp)) (kotl-mode:eolp t)) - (smart-eolp)) + ((smart-eolp) . ((funcall action-key-eol-function) . (funcall assist-key-eol-function))) ;; ;; The Smart Menu system is an attractive in-buffer menu system @@ -2076,10 +2081,19 @@ If key is pressed: (defun smart-eolp () "Return t if point is at the end of a visible line but not the end of the buffer." ;; smart-helm handles eol for helm buffers - (unless (and (smart-helm-alive-p) (equal (helm-buffer-get) (buffer-name))) - (and (not (smart-eobp)) (eolp) - (or (not (smart-outline-char-invisible-p)) - (not (smart-outline-char-invisible-p (1- (point)))))))) + (unless (or (and (smart-helm-alive-p) (equal (helm-buffer-get) (buffer-name))) + (and (featurep 'hsys-flymake) + (boundp 'flymake-mode) + flymake-mode + (eolp) + ;; If there is a flymake diagnostic issue at eol, + ;; drop through this clause to handle it later. + (hsys-flymake-get-issue-at-point))) + (if (eq major-mode 'kotl-mode) + (and (not (kotl-mode:eobp)) (kotl-mode:eolp t)) + (and (not (smart-eobp)) (eolp) + (or (not (smart-outline-char-invisible-p)) + (not (smart-outline-char-invisible-p (1- (point))))))))) ;;; ************************************************************************ ;;; smart-push-button functions diff --git a/hui.el b/hui.el index 07d98fc489..987864f5e6 100644 --- a/hui.el +++ b/hui.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Sep-91 at 21:42:03 -;; Last-Mod: 28-Dec-23 at 21:34:45 by Bob Weiner +;; Last-Mod: 2-Jan-24 at 23:02:06 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -876,7 +876,8 @@ BUT defaults to the button whose label point is within." (if (functionp type-help-func) (funcall type-help-func but) (let ((total (hbut:report but))) - (when total (hui:help-ebut-highlight)))))) + (when total (hui:help-ebut-highlight)))) + (or type-help-func 'hbut:report))) (defun hui:hbut-label (default-label func-name &optional prompt) "Read button label from user using DEFAULT-LABEL and caller's FUNC-NAME. diff --git a/hyperbole.el b/hyperbole.el index 415b473e33..6e7e7f8dc1 100644 --- a/hyperbole.el +++ b/hyperbole.el @@ -8,7 +8,7 @@ ;; Maintainer: Mats Lidell <ma...@gnu.org> ;; Maintainers: Robert Weiner <r...@gnu.org>, Mats Lidell <ma...@gnu.org> ;; Created: 06-Oct-92 at 11:52:51 -;; Last-Mod: 23-Dec-23 at 01:50:36 by Bob Weiner +;; Last-Mod: 3-Jan-24 at 02:27:05 by Bob Weiner ;; Released: 03-Dec-23 ;; Version: 9.0.0 ;; Keywords: comm, convenience, files, frames, hypermedia, languages, mail, matching, mouse, multimedia, outlines, tools, wp @@ -172,7 +172,7 @@ Info documentation at \"(hyperbole)Top\". (declare-function hmouse-install "hmouse-key") (declare-function hui-search-web "hui-mini") (declare-function hkey-operate "hmouse-drv") -(declare-function facemenu-keymap nil) ; Where is this defined? +(declare-function facemenu-keymap "facemenu") (declare-function hkey-help "hmouse-drv") (declare-function hkey-either "hmouse-drv") diff --git a/kotl/kfill.el b/kotl/kfill.el index e575a7bbb5..759f703c85 100644 --- a/kotl/kfill.el +++ b/kotl/kfill.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 23-Jan-94 -;; Last-Mod: 3-Oct-23 at 23:27:17 by Mats Lidell +;; Last-Mod: 3-Jan-24 at 02:28:36 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -20,7 +20,7 @@ ;;; Public declarations ;;; ************************************************************************ -(declare-function kcell-view:indent "kcell") +(declare-function kcell-view:indent "kview") ;;; ************************************************************************ ;;; Public variables diff --git a/man/hkey-help.txt b/man/hkey-help.txt index a9371c9c62..e8505266f6 100644 --- a/man/hkey-help.txt +++ b/man/hkey-help.txt @@ -114,6 +114,7 @@ Hyperbole Key Press/Click in Special Modes Man Pages Follows cross refs, file refs and C code refs I/Buffer Menu Saves, deletes and displays buffers Todotxt Mode Toggles item completion Edit and archive items + Flymake Mode Display issue at point Insert issue on newline Emacs Info Reader Menu Entry or Cross Ref Jumps to referent <- same diff --git a/man/hyperbole.texi b/man/hyperbole.texi index f155f75238..489bb94f35 100644 --- a/man/hyperbole.texi +++ b/man/hyperbole.texi @@ -7,7 +7,7 @@ @c Author: Bob Weiner @c @c Orig-Date: 6-Nov-91 at 11:18:03 -@c Last-Mod: 29-Dec-23 at 23:27:32 by Bob Weiner +@c Last-Mod: 3-Jan-24 at 03:13:18 by Bob Weiner @c %**start of header (This is for running Texinfo on a region.) @setfilename hyperbole.info @@ -156,7 +156,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P> <PRE> Edition 9.0.0 -Printed December 29, 2023. +Printed January 3, 2024. Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -198,7 +198,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @example Edition 9.0.0 -December 29, 2023 +January 3, 2024 Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -2906,6 +2906,11 @@ framework. The @code{test-selector} argument is as described in Recognize Action Buttons of the form @code{<hyperbole-run-test test-name>} which when activated run individual Hyperbole tests, each given by the @code{<test-name>} argument, an unquoted name. + +@findex ibtypes hsys-flymake-issue-at-point +@item hsys-flymake-issue-at-point +Display the flymake linter diagnostic issue at source buffer point, +if any. @end table diff --git a/man/version.texi b/man/version.texi index a01e194cba..417330efc0 100644 --- a/man/version.texi +++ b/man/version.texi @@ -1,4 +1,4 @@ -@set UPDATED December, 2023 -@set UPDATED-MONTH December 2023 +@set UPDATED January, 2024 +@set UPDATED-MONTH January 2024 @set EDITION 9.0.0 @set VERSION 9.0.0