[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 38697a07c0 1/2: Add :safe property to ffap-machine-p-* variables
From: |
Stefan Kangas |
Subject: |
master 38697a07c0 1/2: Add :safe property to ffap-machine-p-* variables |
Date: |
Fri, 8 Jul 2022 06:19:46 -0400 (EDT) |
branch: master
commit 38697a07c0f2b99b76c41cb1096543681342a405
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Add :safe property to ffap-machine-p-* variables
* lisp/ffap.el (ffap--accept-or-reject-p): New predicate defun.
(ffap-machine-p-local, ffap-machine-p-known)
(ffap-machine-p-unknown): Add :safe property using above new
predicate.
---
lisp/ffap.el | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 8628222936..20929c659d 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -377,6 +377,11 @@ Actual search is done by the function `ffap-next-guess'."
;;; Machines (`ffap-machine-p'):
+(defun ffap--accept-or-reject-p (symbol)
+ "Return non-nil if SYMBOL is `accept' or `reject'.
+Otherwise, return nil."
+ (memq symbol '(accept reject)))
+
;; I cannot decide a "best" strategy here, so these are variables. In
;; particular, if `Pinging...' is broken or takes too long on your
;; machine, try setting these all to accept or reject.
@@ -385,16 +390,20 @@ Actual search is done by the function `ffap-next-guess'."
Value should be a symbol, one of `ping', `accept', and `reject'."
:type '(choice (const ping)
(const accept)
- (const reject))
+ (const reject))
+ :safe #'ffap--accept-or-reject-p
:group 'ffap)
+
(defcustom ffap-machine-p-known 'ping ; `accept' for higher speed
"What `ffap-machine-p' does with hostnames that have a known domain.
Value should be a symbol, one of `ping', `accept', and `reject'.
See `mail-extr.el' for the known domains."
:type '(choice (const ping)
(const accept)
- (const reject))
+ (const reject))
+ :safe #'ffap--accept-or-reject-p
:group 'ffap)
+
(defcustom ffap-machine-p-unknown 'reject
"What `ffap-machine-p' does with hostnames that have an unknown domain.
Value should be a symbol, one of `ping', `accept', and `reject'.
@@ -402,6 +411,7 @@ See `mail-extr.el' for the known domains."
:type '(choice (const ping)
(const accept)
(const reject))
+ :safe #'ffap--accept-or-reject-p
:group 'ffap)
(defun ffap-what-domain (domain)