Browse Source

org-macs: Allow for nil ffap-url-regexp

* lisp/org-macs.el (org-url-p): `ffap-url-regexp' is allowed to be nil,
which is taken to mean urls should not be matched.  When this is set,
`string-match-p' errors.  To consider this case correctly, we check that
`ffap-url-regexp' is non-nil before calling `string-match-p'.

Reported-by: "Peder Stray" <peder.stray@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2021-09/msg00004.html>
TEC 3 years ago
parent
commit
d70f280678
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lisp/org-macs.el

+ 1 - 1
lisp/org-macs.el

@@ -811,7 +811,7 @@ return nil."
 (defun org-url-p (s)
   "Non-nil if string S is a URL."
   (require 'ffap)
-  (string-match-p ffap-url-regexp s))
+  (and ffap-url-regexp (string-match-p ffap-url-regexp s)))
 
 
 ;;; String manipulation