summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2014-08-11 16:15:59 -0400
committerSam Steingold <sds@gnu.org>2014-08-11 16:15:59 -0400
commit70276d32c755dc94328463e102e7b3cbf8fefd55 (patch)
treee3a1aaebe5dddbfb268fadc9a3adc104a64b891d /lisp/textmodes
parent26b49dfa0c3ef69bf1266e391aef55362f3bf618 (diff)
downloademacs-70276d32c755dc94328463e102e7b3cbf8fefd55.tar.gz
Set sgml-validate-command based on validator existence
* lisp/textmodes/sgml-mode.el (sgml-validate-command): Set depending on the presence of known validators (tidy, (o)nsgmls).
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/sgml-mode.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index d2f1307b6c9..39ac0621733 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -240,12 +240,21 @@ This takes effect when first loading the `sgml-mode' library.")
"A table for mapping non-ASCII characters into SGML entity names.
Currently, only Latin-1 characters are supported.")
-;; nsgmls is a free SGML parser in the SP suite available from
-;; ftp.jclark.com and otherwise packaged for GNU systems.
-;; Its error messages can be parsed by next-error.
-;; The -s option suppresses output.
-
-(defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls'
+(defcustom sgml-validate-command
+ ;; prefer tidy because (o)nsgmls is often built without --enable-http
+ ;; which makes it next to useless
+ (cond ((executable-find "tidy")
+ ;; tidy is available from http://tidy.sourceforge.net/
+ "tidy --gnu-emacs yes -e -q")
+ ((executable-find "nsgmls")
+ ;; nsgmls is a free SGML parser in the SP suite available from
+ ;; ftp.jclark.com, replaced old `sgmls'.
+ "nsgmls -s")
+ ((executable-find "onsgmls")
+ ;; onsgmls is the community version of `nsgmls'
+ ;; hosted on http://openjade.sourceforge.net/
+ "onsgmls -s")
+ (t "Install (o)nsgmls, tidy, or some other SGML validator, and set `sgml-validate-command'"))
"The command to validate an SGML document.
The file name of current buffer file name will be appended to this,
separated by a space."