branch: externals-release/org
commit 849f2498284ee7173499be143121a5829324354f
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    Fix incorrect values of :safe t and :safe nil
    
    * lisp/ob-csharp.el (org-babel-csharp-compiler):
    (org-babel-csharp-default-target-framework):
    (org-babel-csharp-generate-compile-command):
    (org-babel-csharp-generate-restore-command):
    (org-babel-csharp-additional-project-flags):
    * lisp/ob-ditaa.el (org-ditaa-default-exec-mode):
    (org-ditaa-exec):
    (org-ditaa-java-exec):
    * lisp/ob-latex.el (org-babel-latex-preamble):
    (org-babel-latex-process-alist):
    * lisp/ob-lisp.el (org-babel-lisp-dir-fmt):
    * lisp/ob-tangle.el (org-babel-tangle-lang-exts):
    * lisp/oc-bibtex.el (org-cite-bibtex-bibliography-style):
    * lisp/ol.el (org-link-parameters):
    (org-link-frame-setup):
    (org-link-preview-delay):
    (org-link-preview-batch-size):
    (org-image-max-width):
    * lisp/org-archive.el (org-archive-save-context-info):
    (org-archive-hook):
    (org-archive-finalize-hook):
    * lisp/org-capture.el (org-capture-templates):
    * lisp/org-cycle.el (org-cycle-link-previews-display):
    * lisp/org-id.el (org-id-completion-targets):
    * lisp/org-keys.el (org-speed-commands):
    * lisp/org-plot.el (org-plot/preset-plot-types):
    * lisp/org-src.el (org-src-lang-modes):
    * lisp/org.el (org-edit-keep-region):
    (org-priority-highest):
    (org-priority-lowest):
    (org-priority-default):
    (org-timestamp-custom-formats):
    (org-tags-sort-function):
    (org-preview-latex-process-alist):
    (org-latex-mathml-directory):
    * lisp/ox-html.el (org-html-style-default):
    (org-html-datetime-formats):
    (org-html-head):
    (org-html-head-extra):
    * lisp/ox-md.el (org-md-link-org-files-as-md):
    * lisp/ox-odt.el (org-odt-with-forbidden-chars):
    (org-odt-with-latex):
    Use function as a value of :safe.  Use :risky t instead of :safe nil.
    
    Reported-by: Kyle Meyer <[email protected]>
    Link: https://orgmode.org/list/[email protected]
---
 lisp/ob-csharp.el   | 10 +++++-----
 lisp/ob-ditaa.el    |  6 +++---
 lisp/ob-latex.el    |  4 ++--
 lisp/ob-lisp.el     |  2 +-
 lisp/ob-tangle.el   |  2 +-
 lisp/oc-bibtex.el   |  2 +-
 lisp/ol.el          | 10 +++++-----
 lisp/org-archive.el |  6 +++---
 lisp/org-capture.el |  2 +-
 lisp/org-cycle.el   |  2 +-
 lisp/org-id.el      |  2 +-
 lisp/org-keys.el    |  2 +-
 lisp/org-plot.el    |  2 +-
 lisp/org-src.el     |  2 +-
 lisp/org.el         | 16 ++++++++--------
 lisp/ox-html.el     |  8 ++++----
 lisp/ox-md.el       |  2 +-
 lisp/ox-odt.el      |  4 ++--
 18 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/lisp/ob-csharp.el b/lisp/ob-csharp.el
index 1d22e48bc2..7bd30e1514 100644
--- a/lisp/ob-csharp.el
+++ b/lisp/ob-csharp.el
@@ -52,7 +52,7 @@
   :group 'org-babel
   :package-version '(Org. "9.8")
   :type 'string
-  :safe nil)
+  :risky t)
 
 (defun org-babel-csharp--default-compile-command (dir-proj-sln bin-dir)
   "Construct the default compilation command for C#.
@@ -92,7 +92,7 @@ takes effect."
   :group 'org-babel
   :package-version '(Org. "9.8")
   :type 'string
-  :safe t)
+  :safe #'stringp)
 
 (defcustom org-babel-csharp-generate-compile-command
   #'org-babel-csharp--default-compile-command
@@ -103,7 +103,7 @@ a .sln file, .csproj file, or a base directory where either 
can be found."
   :group 'org-babel
   :package-version '(Org. "9.8")
   :type 'function
-  :safe nil)
+  :risky t)
 
 (defcustom org-babel-csharp-generate-restore-command
   #'org-babel-csharp--default-restore-command
@@ -113,7 +113,7 @@ It must take one parameter defining the project to perform 
a restore on."
   :group 'org-babel
   :package-version '(Org. "9.8")
   :type 'function
-  :safe nil)
+  :risky t)
 
 (defcustom org-babel-csharp-additional-project-flags nil
   "Will be passed in the \"PropertyGroup\" defining the project.
@@ -122,7 +122,7 @@ This is taken as-is. It should be a string in XML-format."
   :group 'org-babel
   :package-version '(Org. "9.8")
   :type '(choice string (const nil))
-  :safe t)
+  :safe (lambda (x) (or (eq x nil) (stringp x))))
 
 (defun org-babel-csharp--generate-project-file (refs framework)
   "Generate the file content to be used in a csproj-file.
diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index 839e4c2529..55d375a858 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -98,21 +98,21 @@ The executable can be configured via `org-ditaa-exec'."
   :package-version '(Org . "9.8")
   :type '(choice (const :tag "Use java together with a JAR file." jar)
                  (const :tag "Use ditaa executable." ditaa))
-  :safe t)
+  :safe (lambda (x) (memq x '(jar ditaa))))
 
 (defcustom org-ditaa-exec "ditaa"
   "File name of the ditaa executable."
   :group 'org-babel
   :package-version '(Org . "9.8")
   :type 'string
-  :safe nil)
+  :risky t)
 
 (define-obsolete-variable-alias 'org-babel-ditaa-java-cmd 'org-ditaa-java-exec 
"9.8")
 (defcustom org-ditaa-java-exec "java"
   "Java executable to use when evaluating ditaa blocks using a JAR."
   :group 'org-babel
   :type 'string
-  :safe nil)
+  :risky t)
 
 (defcustom org-ditaa-jar-path (expand-file-name
                               "ditaa.jar"
diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index fc325f2594..930e218e6b 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -84,7 +84,7 @@ It takes 1 argument which is the parameters of the source 
block."
   :group 'org-babel
   :package-version '(Org . "9.8")
   :type 'function
-  :safe nil)
+  :risky t)
 
 (defcustom org-babel-latex-begin-env
   (lambda (_)
@@ -150,7 +150,7 @@ The following process symbols are recognized:
   :package-version '(Org . "9.8")
   :type '(alist :tag "LaTeX to image backends"
                :value-type (plist))
-  :safe nil)
+  :risky t)
 
 (defun org-babel-expand-body:latex (body params)
   "Expand BODY according to PARAMS, return the expanded body."
diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el
index 90aedd4e72..2d005ee5e4 100644
--- a/lisp/ob-lisp.el
+++ b/lisp/ob-lisp.el
@@ -68,7 +68,7 @@ current directory string."
   :group 'org-babel
   :package-version '(Org . "9.8")
   :type 'string
-  :safe nil)
+  :risky t)
 
 (defun org-babel-expand-body:lisp (body params)
   "Expand BODY according to PARAMS, return the expanded body."
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 6fe553469c..9d4c914c27 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -69,7 +69,7 @@ then the name of the language is used."
          (cons
           (string "Language name")
           (string "File Extension")))
-  :safe t)
+  :safe #'listp)
 
 (defcustom org-babel-tangle-use-relative-file-links t
   "Use relative path names in links from tangled source back the Org file."
diff --git a/lisp/oc-bibtex.el b/lisp/oc-bibtex.el
index 0e54967319..3adab69179 100644
--- a/lisp/oc-bibtex.el
+++ b/lisp/oc-bibtex.el
@@ -71,7 +71,7 @@ BibTeX provides the following default styles:
     (const :tag "IEEE" "ieeetr")
     (const :tag "SIAM" "siam")
     (string :tag "Other"))
-  :safe t)
+  :safe #'stringp)
 
 
 ;;; Export capability
diff --git a/lisp/ol.el b/lisp/ol.el
index 5fdff1de88..24ac9deb18 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -214,7 +214,7 @@ link.
   :package-version '(Org . "9.8")
   :type '(alist :tag "Link display parameters"
                :value-type plist)
-  :safe nil)
+  :risky t)
 
 (defun org-link--set-link-display (symbol value)
   "Set `org-link-descriptive' (SYMBOL) to VALUE.
@@ -388,7 +388,7 @@ another window."
                (choice
                 (const wl)
                 (const wl-other-frame))))
-  :safe nil)
+  :risky t)
 
 (defcustom org-link-search-must-match-exact-headline 'query-to-create
   "Control fuzzy link behavior when specific matches not found.
@@ -552,7 +552,7 @@ expense of higher lag."
   :group 'org-link
   :package-version '(Org . "9.8")
   :type 'number
-  :safe t)
+  :safe #'numberp)
 
 (defcustom org-link-preview-batch-size 6
   "Number of links that are previewed at once with `org-link-preview'.
@@ -563,7 +563,7 @@ expense of higher lag."
   :group 'org-link
   :package-version '(Org . "9.8")
   :type 'natnum
-  :safe t)
+  :safe #'natnump)
 
 (defcustom org-display-remote-inline-images 'skip
   "How to display remote inline images.
@@ -602,7 +602,7 @@ Possible values:
           (const :tag "Limit to window width" window)
           (integer :tag "Limit to a number of pixels")
           (float :tag "Limit to a fraction of window width"))
-  :safe t)
+  :safe (lambda (x) (or (numberp x) (member x '(nil 'fill-column 'window)))))
 
 (defcustom org-image-align 'left
   "How to align images previewed using `org-link-preview-region'.
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 783a9d878e..e128a276ef 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -146,7 +146,7 @@ information."
              (const :tag "Outline path" olpath)
              (const :tag "Outline parent id" olid)
              (const :tag "Local tags" ltags))
-  :safe t)
+  :safe #'listp)
 
 (defcustom org-archive-hook nil
   "Hook run after successfully archiving a subtree.
@@ -155,7 +155,7 @@ original file.  At this stage, the subtree has been added 
to the
 archive location, but not yet deleted from the original file."
   :group 'org-archive
   :type 'hook
-  :safe nil)
+  :risky t)
 
 (defcustom org-archive-finalize-hook nil
   "Hook run after successfully archiving a subtree in final location.
@@ -167,7 +167,7 @@ original file."
   :group 'org-archive
   :package-version '(Org . "9.8")
   :type 'hook
-  :safe nil)
+  :risky t)
 
 ;;;###autoload
 (defun org-add-archive-files (files)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 705fdc902f..6f1d3bc39b 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -535,7 +535,7 @@ you can escape ambiguous cases with a backward slash, e.g., 
\\%i."
                                     ((const :format "%v " :unnarrowed) (const 
t))
                                     ((const :format "%v " :table-line-pos) 
(string))
                                     ((const :format "%v " :kill-buffer) (const 
t))))))))
-  :safe nil)
+  :risky t)
 
 (defcustom org-capture-before-finalize-hook nil
   "Hook that is run right before a capture process is finalized.
diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el
index 9f9f44ee99..dbda887382 100644
--- a/lisp/org-cycle.el
+++ b/lisp/org-cycle.el
@@ -246,7 +246,7 @@ normal outline commands like `show-all', but not with the 
cycling commands."
   :group 'org-cycle
   :package-version '(Org . "9.8")
   :type 'boolean
-  :safe t)
+  :safe #'booleanp)
 
 (defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook)
 (defvar org-cycle-tab-first-hook nil
diff --git a/lisp/org-id.el b/lisp/org-id.el
index 6935a5115c..c33ea7fbbe 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -301,7 +301,7 @@ This variable has the same form as `org-refile-targets', 
which see."
   :group 'org-id
   :type (get 'org-refile-targets 'custom-type)
   :package-version '(Org . "9.8")
-  :safe t)
+  :risky t)
 
 ;;; The API functions
 
diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index 56f276e13e..739a719b9b 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -798,7 +798,7 @@ command."
                               (choice
                                (function)
                                (sexp)))))
-  :safe nil)
+  :risky t)
 
 (defun org--print-speed-command (speed-command)
   "Print information about SPEED-COMMAND in help buffer.
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 2a436a1009..5b53699a5c 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -407,7 +407,7 @@ be set.
   :group 'org-plot
   :package-version '(Org . "9.8")
   :type 'alist
-  :safe nil)
+  :risky t)
 
 (defvar org--plot/radar-template
   "### spider plot/chart with gnuplot
diff --git a/lisp/org-src.el b/lisp/org-src.el
index d19687d976..ed265d2d6a 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -246,7 +246,7 @@ but the mode to use is `tuareg-mode'."
          (cons
           (string :tag "Language name")
           (symbol :tag "Major mode")))
-  :safe t)
+  :safe #'listp)
 
 (defcustom org-src-block-faces nil
   "Alist of faces to be used for source-block.
diff --git a/lisp/org.el b/lisp/org.el
index db122f9208..b8d22309ea 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1075,7 +1075,7 @@ This variable can be nil, t, or an a list of entries like
                    (const :tag "Deactivate region" nil))))
   :package-version '(Org . "9.8")
   :group 'org-edit-structure
-  :safe t)
+  :safe #'always)
 
 (defun org--deactivate-mark ()
   "Return non-nil when `this-command' should deactivate mark upon completion.
@@ -2498,7 +2498,7 @@ highest priority, it is smaller than the lowest \"C\" 
priority:
   :package-version '(Org . "9.8")
   :type '( restricted-sexp :tag "Number 0-64 or uppercase character A-Z"
            :match-alternatives ((lambda (val) (org-priority-valid-value-p val 
t))))
-  :safe t)
+  :safe #'integerp)
 
 (defvaralias 'org-lowest-priority 'org-priority-lowest)
 (defcustom org-priority-lowest ?C
@@ -2521,7 +2521,7 @@ priority, it is greater than the highest \"A\" priority: 
67 >
   :package-version '(Org . "9.8")
   :type '( restricted-sexp :tag "Number 0-64 or uppercase character A-Z"
            :match-alternatives ((lambda (val) (org-priority-valid-value-p val 
t))))
-  :safe t)
+  :safe #'integerp)
 
 (defvaralias 'org-default-priority 'org-priority-default)
 (defcustom org-priority-default ?B
@@ -2538,7 +2538,7 @@ first step refuses to set the default and the second will 
fall back on
   :package-version '(Org . "9.8")
   :type '( restricted-sexp :tag "Number 0-64 or uppercase character A-Z"
            :match-alternatives ((lambda (val) (org-priority-valid-value-p val 
t))))
-  :safe t)
+  :safe #'integerp)
 
 (defcustom org-priority-start-cycle-with-default t
   "Non-nil means start with default priority when starting to cycle.
@@ -2631,7 +2631,7 @@ will be preserved on export."
   :group 'org-time
   :package-version '(Org . "9.8")
   :type '(cons string string)
-  :safe t)
+  :safe #'consp)
 
 (defun org-time-stamp-format (&optional with-time inactive custom)
   "Get timestamp format for a time string.
@@ -3082,7 +3082,7 @@ For an example of a function that uses this advanced 
sorting system, see
           (const :tag "Sort by hierarchy" org-tags-sort-hierarchy)
           (function :tag "Custom function" nil)
           (repeat function))
-  :safe nil)
+  :risky t)
 
 (defvar org-tags-history nil
   "History of minibuffer reads for tags.")
@@ -3554,7 +3554,7 @@ Place-holders only used by `:image-converter':
   :package-version '(Org . "9.8")
   :type '(alist :tag "LaTeX to image backends"
                :value-type (plist))
-  :safe nil)
+  :risky t)
 
 (defcustom org-preview-latex-image-directory "ltximg/"
   "Path to store latex preview images.
@@ -3574,7 +3574,7 @@ in the same place."
   :group 'org-latex
   :package-version '(Org . "9.8")
   :type 'string
-  :safe nil)
+  :risky t)
 
 (defun org-format-latex-mathml-available-p ()
   "Return t if `org-latex-to-mathml-convert-command' is usable."
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 73d981fa07..6916cc2160 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -457,7 +457,7 @@ customize `org-html-head-include-default-style'."
   :group 'org-export-html
   :package-version '(Org . "9.8")
   :type 'string
-  :safe t)
+  :safe #'stringp)
 
 
 ;;; User Configuration Variables
@@ -1177,7 +1177,7 @@ components."
   :type '(cons string string)
   :group 'org-export-html
   :package-version '(Org . "9.8")
-  :safe t)
+  :safe #'consp)
 
 ;;;; Template :: Mathjax
 
@@ -1569,7 +1569,7 @@ or for publication projects using the :html-head 
property."
   :package-version '(Org . "9.8")
   :type '(choice (string :tag "Literal text to insert")
                  (function :tag "Function evaluating to a string"))
-  :safe t)
+  :safe #'stringp)
 ;;;###autoload
 (put 'org-html-head 'safe-local-variable 'stringp)
 
@@ -1584,7 +1584,7 @@ a string."
   :package-version '(Org . "9.8")
   :type '(choice (string :tag "Literal text to insert")
                  (function :tag "Function evaluating to a string"))
-  :safe t)
+  :safe #'stringp)
 ;;;###autoload
 (put 'org-html-head-extra 'safe-local-variable 'stringp)
 
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index ae4224b3f2..f15f3f5686 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -107,7 +107,7 @@ When nil, the links still point to the plain \".org\" file."
   :group 'org-export-md
   :package-version '(Org . "9.8")
   :type 'boolean
-  :safe t)
+  :safe #'booleanp)
 
 
 
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 36c8342ef3..232a643738 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -384,7 +384,7 @@ replacements.  See info node `(org)Advanced Export 
Configuration'."
   :type '(choice (const :tag "Leave forbidden characters as-is" t)
                  (const :tag "Err when forbidden characters encountered" nil)
                  (string :tag "Replacement string"))
-  :safe t)
+  :safe #'always)
 
 ;;;; Debugging
 
@@ -744,7 +744,7 @@ provided, process as `verbatim'."
                            (,(lambda (v)
                                (assq v org-preview-latex-process-alist))))
           (const :tag "Leave math verbatim" verbatim))
-  :safe t)
+  :safe #'always)
 
 
 ;;;; Links

Reply via email to