diff options
| author | Johan Claesson | 2019-06-26 16:05:54 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-06-26 16:06:42 +0200 |
| commit | 699fce296b13d7db386b1cb5cecf2710e5196691 (patch) | |
| tree | 759d67004057ed48ac1558de6638ddfc0166f8b8 | |
| parent | 4e302630ae050ce13455519e8e72e43c8ea45a81 (diff) | |
| download | emacs-699fce296b13d7db386b1cb5cecf2710e5196691.tar.gz emacs-699fce296b13d7db386b1cb5cecf2710e5196691.zip | |
help-C-file-name shouldn't error out if we can't find the name
* lisp/help-fns.el (help-C-file-name): Make help-C-file-name
return nil instead of signalling an error if we can't find the
file name (bug#17250).
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/help-fns.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 949def1bbe7..baef5a789ae 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -196,7 +196,8 @@ When called from lisp, FUNCTION may also be a function object." | |||
| 196 | ;;;###autoload | 196 | ;;;###autoload |
| 197 | (defun help-C-file-name (subr-or-var kind) | 197 | (defun help-C-file-name (subr-or-var kind) |
| 198 | "Return the name of the C file where SUBR-OR-VAR is defined. | 198 | "Return the name of the C file where SUBR-OR-VAR is defined. |
| 199 | KIND should be `var' for a variable or `subr' for a subroutine." | 199 | KIND should be `var' for a variable or `subr' for a subroutine. |
| 200 | If we can't find the file name, nil is returned." | ||
| 200 | (let ((docbuf (get-buffer-create " *DOC*")) | 201 | (let ((docbuf (get-buffer-create " *DOC*")) |
| 201 | (name (if (eq 'var kind) | 202 | (name (if (eq 'var kind) |
| 202 | (concat "V" (symbol-name subr-or-var)) | 203 | (concat "V" (symbol-name subr-or-var)) |
| @@ -208,19 +209,24 @@ KIND should be `var' for a variable or `subr' for a subroutine." | |||
| 208 | (expand-file-name internal-doc-file-name doc-directory))) | 209 | (expand-file-name internal-doc-file-name doc-directory))) |
| 209 | (let ((file (catch 'loop | 210 | (let ((file (catch 'loop |
| 210 | (while t | 211 | (while t |
| 211 | (let ((pnt (search-forward (concat "\^_" name "\n")))) | 212 | (let ((pnt (search-forward (concat "\^_" name "\n") |
| 212 | (re-search-backward "\^_S\\(.*\\)") | 213 | nil t))) |
| 213 | (let ((file (match-string 1))) | 214 | (if (not pnt) |
| 214 | (if (member file build-files) | 215 | (throw 'loop nil) |
| 215 | (throw 'loop file) | 216 | (re-search-backward "\^_S\\(.*\\)") |
| 216 | (goto-char pnt)))))))) | 217 | (let ((file (match-string 1))) |
| 217 | (if (string-match "^ns.*\\(\\.o\\|obj\\)\\'" file) | 218 | (if (member file build-files) |
| 218 | (setq file (replace-match ".m" t t file 1)) | 219 | (throw 'loop file) |
| 219 | (if (string-match "\\.\\(o\\|obj\\)\\'" file) | 220 | (goto-char pnt))))))))) |
| 220 | (setq file (replace-match ".c" t t file)))) | 221 | (if (not file) |
| 221 | (if (string-match "\\.\\(c\\|m\\)\\'" file) | 222 | nil |
| 222 | (concat "src/" file) | 223 | (if (string-match "^ns.*\\(\\.o\\|obj\\)\\'" file) |
| 223 | file))))) | 224 | (setq file (replace-match ".m" t t file 1)) |
| 225 | (if (string-match "\\.\\(o\\|obj\\)\\'" file) | ||
| 226 | (setq file (replace-match ".c" t t file)))) | ||
| 227 | (if (string-match "\\.\\(c\\|m\\)\\'" file) | ||
| 228 | (concat "src/" file) | ||
| 229 | file)))))) | ||
| 224 | 230 | ||
| 225 | (defcustom help-downcase-arguments nil | 231 | (defcustom help-downcase-arguments nil |
| 226 | "If non-nil, argument names in *Help* buffers are downcased." | 232 | "If non-nil, argument names in *Help* buffers are downcased." |