diff options
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r-- | lisp/progmodes/sql.el | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 3d5abc4df62..64b87d9e436 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -2802,8 +2802,12 @@ each line with INDENT." doc)) ;;;###autoload -(defun sql-help () - "Show short help for the SQL modes. +(eval + ;; FIXME: This dynamic-docstring-function trick doesn't work for byte-compiled + ;; functions, because of the lazy-loading of docstrings, which strips away + ;; text properties. + '(defun sql-help () + #("Show short help for the SQL modes. Use an entry function to open an interactive SQL buffer. This buffer is usually named `*SQL*'. The name of the major mode is SQLi. @@ -2834,32 +2838,23 @@ anything. The name of the major mode is SQL. In this SQL buffer (SQL mode), you can send the region or the entire buffer to the interactive SQL buffer (SQLi mode). The results are appended to the SQLi buffer without disturbing your SQL buffer." + 0 1 (dynamic-docstring-function sql--make-help-docstring)) (interactive) + (describe-function 'sql-help))) - ;; Insert references to loaded products into the help buffer string - (let ((doc (documentation 'sql-help t)) - changedp) - (setq changedp nil) - - ;; Insert FREE software list - (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) - (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) - t t doc 0) - changedp t)) - - ;; Insert non-FREE software list - (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) - (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) - t t doc 0) - changedp t)) - - ;; If we changed the help text, save the change so that the help - ;; sub-system will see it - (when changedp - (put 'sql-help 'function-documentation doc))) - - ;; Call help on this function - (describe-function 'sql-help)) +(defun sql--make-help-docstring (doc _fun) + "Insert references to loaded products into the help buffer string." + + ;; Insert FREE software list + (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) + (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) + t t doc 0))) + + ;; Insert non-FREE software list + (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) + (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) + t t doc 0))) + doc) (defun sql-read-passwd (prompt &optional default) "Read a password using PROMPT. Optional DEFAULT is password to start with." |