diff options
| author | Stefan Monnier | 2012-11-08 23:10:16 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2012-11-08 23:10:16 -0500 |
| commit | 57618ecf3358e49ab3c380330e82ca8d2078cc63 (patch) | |
| tree | cb031b879ebeb162179f5718c015f70a5e31c755 /lisp/progmodes/sql.el | |
| parent | 67dd8ad119474d5c403e3410b4465baef2647609 (diff) | |
| download | emacs-57618ecf3358e49ab3c380330e82ca8d2078cc63.tar.gz emacs-57618ecf3358e49ab3c380330e82ca8d2078cc63.zip | |
New property dynamic-docstring-function for docstrings.
* src/doc.c (Fdocumentation): Handle new property
dynamic-docstring-function to replace the old ad-advice-info.
* lisp/emacs-lisp/advice.el: Use new dynamic docstrings.
(ad-make-advised-definition-docstring, ad-advised-definition-p):
Use dynamic-docstring-function instead of ad-advice-info.
(ad--make-advised-docstring): New function extracted from
ad-make-advised-docstring.
(ad-make-advised-docstring): Use it.
* lisp/progmodes/sql.el (sql--make-help-docstring): New function, extracted
from sql-help.
(sql-help): Use it with dynamic-docstring-function.
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." | |||
| 2802 | doc)) | 2802 | doc)) |
| 2803 | 2803 | ||
| 2804 | ;;;###autoload | 2804 | ;;;###autoload |
| 2805 | (defun sql-help () | 2805 | (eval |
| 2806 | "Show short help for the SQL modes. | 2806 | ;; FIXME: This dynamic-docstring-function trick doesn't work for byte-compiled |
| 2807 | ;; functions, because of the lazy-loading of docstrings, which strips away | ||
| 2808 | ;; text properties. | ||
| 2809 | '(defun sql-help () | ||
| 2810 | #("Show short help for the SQL modes. | ||
| 2807 | 2811 | ||
| 2808 | Use an entry function to open an interactive SQL buffer. This buffer is | 2812 | Use an entry function to open an interactive SQL buffer. This buffer is |
| 2809 | usually named `*SQL*'. The name of the major mode is SQLi. | 2813 | usually named `*SQL*'. The name of the major mode is SQLi. |
| @@ -2834,32 +2838,23 @@ anything. The name of the major mode is SQL. | |||
| 2834 | In this SQL buffer (SQL mode), you can send the region or the entire | 2838 | In this SQL buffer (SQL mode), you can send the region or the entire |
| 2835 | buffer to the interactive SQL buffer (SQLi mode). The results are | 2839 | buffer to the interactive SQL buffer (SQLi mode). The results are |
| 2836 | appended to the SQLi buffer without disturbing your SQL buffer." | 2840 | appended to the SQLi buffer without disturbing your SQL buffer." |
| 2841 | 0 1 (dynamic-docstring-function sql--make-help-docstring)) | ||
| 2837 | (interactive) | 2842 | (interactive) |
| 2843 | (describe-function 'sql-help))) | ||
| 2838 | 2844 | ||
| 2839 | ;; Insert references to loaded products into the help buffer string | 2845 | (defun sql--make-help-docstring (doc _fun) |
| 2840 | (let ((doc (documentation 'sql-help t)) | 2846 | "Insert references to loaded products into the help buffer string." |
| 2841 | changedp) | 2847 | |
| 2842 | (setq changedp nil) | 2848 | ;; Insert FREE software list |
| 2843 | 2849 | (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) | |
| 2844 | ;; Insert FREE software list | 2850 | (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) |
| 2845 | (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*\n" doc 0) | 2851 | t t doc 0))) |
| 2846 | (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t) | 2852 | |
| 2847 | t t doc 0) | 2853 | ;; Insert non-FREE software list |
| 2848 | changedp t)) | 2854 | (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) |
| 2849 | 2855 | (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) | |
| 2850 | ;; Insert non-FREE software list | 2856 | t t doc 0))) |
| 2851 | (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*\n" doc 0) | 2857 | doc) |
| 2852 | (setq doc (replace-match (sql-help-list-products (match-string 1 doc) nil) | ||
| 2853 | t t doc 0) | ||
| 2854 | changedp t)) | ||
| 2855 | |||
| 2856 | ;; If we changed the help text, save the change so that the help | ||
| 2857 | ;; sub-system will see it | ||
| 2858 | (when changedp | ||
| 2859 | (put 'sql-help 'function-documentation doc))) | ||
| 2860 | |||
| 2861 | ;; Call help on this function | ||
| 2862 | (describe-function 'sql-help)) | ||
| 2863 | 2858 | ||
| 2864 | (defun sql-read-passwd (prompt &optional default) | 2859 | (defun sql-read-passwd (prompt &optional default) |
| 2865 | "Read a password using PROMPT. Optional DEFAULT is password to start with." | 2860 | "Read a password using PROMPT. Optional DEFAULT is password to start with." |