diff options
| author | Lars Ingebrigtsen | 2016-04-29 18:22:58 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-04-29 18:22:58 +0200 |
| commit | 1a3a1f709d43836772bc0a84fa67694ff8123df5 (patch) | |
| tree | 36886f4f0a347318934a9a8e384800e71d3edaf6 | |
| parent | 35fb7897f161d5e5a87e039dc1e427094640b0c8 (diff) | |
| download | emacs-1a3a1f709d43836772bc0a84fa67694ff8123df5.tar.gz emacs-1a3a1f709d43836772bc0a84fa67694ff8123df5.zip | |
Add a sanity check to apropos-documentation-internal
* lisp/apropos.el (apropos-documentation-internal): Add a
sanity check to be less fragile in the presence of invalid
data (bug#16725).
| -rw-r--r-- | lisp/apropos.el | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index eb145bdc571..6009f30f7a8 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el | |||
| @@ -867,19 +867,23 @@ Returns list of symbols and documentation found." | |||
| 867 | symbol))))) | 867 | symbol))))) |
| 868 | 868 | ||
| 869 | (defun apropos-documentation-internal (doc) | 869 | (defun apropos-documentation-internal (doc) |
| 870 | (if (consp doc) | 870 | (cond |
| 871 | (apropos-documentation-check-elc-file (car doc)) | 871 | ((consp doc) |
| 872 | (if (and doc | 872 | (apropos-documentation-check-elc-file (car doc))) |
| 873 | (string-match apropos-all-words-regexp doc) | 873 | ((and doc |
| 874 | (apropos-true-hit-doc doc)) | 874 | ;; Sanity check in case bad data has snuck into the |
| 875 | (when apropos-match-face | 875 | ;; documentation slot. |
| 876 | (setq doc (substitute-command-keys (copy-sequence doc))) | 876 | (stringp doc) |
| 877 | (if (or (string-match apropos-pattern-quoted doc) | 877 | (string-match apropos-all-words-regexp doc) |
| 878 | (string-match apropos-all-words-regexp doc)) | 878 | (apropos-true-hit-doc doc)) |
| 879 | (put-text-property (match-beginning 0) | 879 | (when apropos-match-face |
| 880 | (match-end 0) | 880 | (setq doc (substitute-command-keys (copy-sequence doc))) |
| 881 | 'face apropos-match-face doc)) | 881 | (if (or (string-match apropos-pattern-quoted doc) |
| 882 | doc)))) | 882 | (string-match apropos-all-words-regexp doc)) |
| 883 | (put-text-property (match-beginning 0) | ||
| 884 | (match-end 0) | ||
| 885 | 'face apropos-match-face doc)) | ||
| 886 | doc)))) | ||
| 883 | 887 | ||
| 884 | (defun apropos-format-plist (pl sep &optional compare) | 888 | (defun apropos-format-plist (pl sep &optional compare) |
| 885 | (setq pl (symbol-plist pl)) | 889 | (setq pl (symbol-plist pl)) |