aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/prolog.el72
1 files changed, 26 insertions, 46 deletions
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index fa281ddf4eb..43c5b8575d6 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -776,12 +776,6 @@ This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24."
776 (modify-syntax-entry ?> "." table) 776 (modify-syntax-entry ?> "." table)
777 (modify-syntax-entry ?| "." table) 777 (modify-syntax-entry ?| "." table)
778 (modify-syntax-entry ?\' "\"" table) 778 (modify-syntax-entry ?\' "\"" table)
779
780 ;; Any better way to handle the 0'<char> construct?!?
781 (when (and prolog-char-quote-workaround
782 (not (fboundp 'syntax-propertize-rules)))
783 (modify-syntax-entry ?0 "\\" table))
784
785 (modify-syntax-entry ?% "<" table) 779 (modify-syntax-entry ?% "<" table)
786 (modify-syntax-entry ?\n ">" table) 780 (modify-syntax-entry ?\n ">" table)
787 (modify-syntax-entry ?* ". 23b" table) 781 (modify-syntax-entry ?* ". 23b" table)
@@ -1047,21 +1041,19 @@ VERSION is of the format (Major . Minor)"
1047 alist))) 1041 alist)))
1048 1042
1049(defconst prolog-syntax-propertize-function 1043(defconst prolog-syntax-propertize-function
1050 (when (fboundp 'syntax-propertize-rules) 1044 (syntax-propertize-rules
1051 (syntax-propertize-rules 1045 ;; GNU Prolog only accepts 0'\' rather than 0'', but the only
1052 ;; GNU Prolog only accepts 0'\' rather than 0'', but the only 1046 ;; possible meaning of 0'' is rather clear.
1053 ;; possible meaning of 0'' is rather clear. 1047 ("\\<0\\(''?\\)"
1054 ("\\<0\\(''?\\)" 1048 (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
1055 (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) 1049 (string-to-syntax "_"))))
1056 (string-to-syntax "_")))) 1050 ;; We could check that we're not inside an atom, but I don't think
1057 ;; We could check that we're not inside an atom, but I don't think 1051 ;; that 'foo 8'z could be a valid syntax anyway, so why bother?
1058 ;; that 'foo 8'z could be a valid syntax anyway, so why bother? 1052 ("\\<[1-9][0-9]*\\('\\)[0-9a-zA-Z]" (1 "_"))
1059 ("\\<[1-9][0-9]*\\('\\)[0-9a-zA-Z]" (1 "_")) 1053 ;; Supposedly, ISO-Prolog wants \NNN\ for octal and \xNNN\ for hexadecimal
1060 ;; Supposedly, ISO-Prolog wants \NNN\ for octal and \xNNN\ for hexadecimal 1054 ;; escape sequences in atoms, so be careful not to let the terminating \
1061 ;; escape sequences in atoms, so be careful not to let the terminating \ 1055 ;; escape a subsequent quote.
1062 ;; escape a subsequent quote. 1056 ("\\\\[x0-7][[:xdigit:]]*\\(\\\\\\)" (1 "_"))))
1063 ("\\\\[x0-7][[:xdigit:]]*\\(\\\\\\)" (1 "_"))
1064 )))
1065 1057
1066(defun prolog-mode-variables () 1058(defun prolog-mode-variables ()
1067 "Set some common variables to Prolog code specific values." 1059 "Set some common variables to Prolog code specific values."
@@ -1886,14 +1878,7 @@ Argument BOUND is a buffer position limiting searching."
1886 bound t))) 1878 bound t)))
1887 point)) 1879 point))
1888 1880
1889(defsubst prolog-face-name-p (facename) 1881(define-obsolete-function-alias 'prolog-face-name-p 'facep "28.1")
1890 ;; Return t if FACENAME is the name of a face. This method is
1891 ;; necessary since facep in XEmacs only returns t for the actual
1892 ;; face objects (while it's only their names that are used just
1893 ;; about anywhere else) without providing a predicate that tests
1894 ;; face names. This function (including the above commentary) is
1895 ;; borrowed from cc-mode.
1896 (memq facename (face-list)))
1897 1882
1898;; Set everything up 1883;; Set everything up
1899(defun prolog-font-lock-keywords () 1884(defun prolog-font-lock-keywords ()
@@ -1938,12 +1923,12 @@ Argument BOUND is a buffer position limiting searching."
1938 "Face name to use for compiler warnings." 1923 "Face name to use for compiler warnings."
1939 :group 'prolog-faces) 1924 :group 'prolog-faces)
1940 (defvar prolog-warning-face 1925 (defvar prolog-warning-face
1941 (if (prolog-face-name-p 'font-lock-warning-face) 1926 (if (facep 'font-lock-warning-face)
1942 'font-lock-warning-face 1927 'font-lock-warning-face
1943 'prolog-warning-face) 1928 'prolog-warning-face)
1944 "Face name to use for built in predicates.") 1929 "Face name to use for built in predicates.")
1945 (defvar prolog-builtin-face 1930 (defvar prolog-builtin-face
1946 (if (prolog-face-name-p 'font-lock-builtin-face) 1931 (if (facep 'font-lock-builtin-face)
1947 'font-lock-builtin-face 1932 'font-lock-builtin-face
1948 'prolog-builtin-face) 1933 'prolog-builtin-face)
1949 "Face name to use for built in predicates.") 1934 "Face name to use for built in predicates.")
@@ -2291,12 +2276,12 @@ between them)."
2291 (progn 2276 (progn
2292 (goto-char cbeg) 2277 (goto-char cbeg)
2293 (search-forward-regexp "%+[ \t]*" end t) 2278 (search-forward-regexp "%+[ \t]*" end t)
2294 (prolog-replace-in-string (buffer-substring beg (point)) 2279 (replace-regexp-in-string "[^ \t%]" " "
2295 "[^ \t%]" " ")) 2280 (buffer-substring beg (point))))
2296 ;(goto-char beg) 2281 ;(goto-char beg)
2297 (if (search-forward-regexp "^[ \t]*\\(%+\\|\\*+\\|/\\*+\\)[ \t]*" 2282 (if (search-forward-regexp "^[ \t]*\\(%+\\|\\*+\\|/\\*+\\)[ \t]*"
2298 end t) 2283 end t)
2299 (prolog-replace-in-string (buffer-substring beg (point)) "/" " ") 2284 (replace-regexp-in-string "/" " " (buffer-substring beg (point)))
2300 (beginning-of-line) 2285 (beginning-of-line)
2301 (when (search-forward-regexp "^[ \t]+" end t) 2286 (when (search-forward-regexp "^[ \t]+" end t)
2302 (buffer-substring beg (point))))))))) 2287 (buffer-substring beg (point)))))))))
@@ -2336,11 +2321,10 @@ In effect it sets the `fill-prefix' when inside comments and then calls
2336 (do-auto-fill) 2321 (do-auto-fill)
2337 )) 2322 ))
2338 2323
2339(defalias 'prolog-replace-in-string 2324(defun prolog-replace-in-string (str regexp newtext &optional literal)
2340 (if (fboundp 'replace-in-string) 2325 (declare (obsolete replace-regexp-in-string "28.1"))
2341 #'replace-in-string 2326 (replace-regexp-in-string regexp newtext str nil literal))
2342 (lambda (str regexp newtext &optional literal) 2327
2343 (replace-regexp-in-string regexp newtext str nil literal))))
2344 2328
2345;;------------------------------------------------------------------- 2329;;-------------------------------------------------------------------
2346;; Online help 2330;; Online help
@@ -3083,12 +3067,8 @@ The module name should be written manually just before the semi-colon."
3083 (insert "%%% -*- Module: ; -*-\n") 3067 (insert "%%% -*- Module: ; -*-\n")
3084 (backward-char 6)) 3068 (backward-char 6))
3085 3069
3086(defalias 'prolog-uncomment-region 3070(define-obsolete-function-alias 'prolog-uncomment-region
3087 (if (fboundp 'uncomment-region) #'uncomment-region 3071 'uncomment-region "28.1")
3088 (lambda (beg end)
3089 "Uncomment the region between BEG and END."
3090 (interactive "r")
3091 (comment-region beg end -1))))
3092 3072
3093(defun prolog-indent-predicate () 3073(defun prolog-indent-predicate ()
3094 "Indent the current predicate." 3074 "Indent the current predicate."
@@ -3374,7 +3354,7 @@ PREFIX is the prefix of the search regexp."
3374 "Commands for Prolog code manipulation." 3354 "Commands for Prolog code manipulation."
3375 '("Prolog" 3355 '("Prolog"
3376 ["Comment region" comment-region (use-region-p)] 3356 ["Comment region" comment-region (use-region-p)]
3377 ["Uncomment region" prolog-uncomment-region (use-region-p)] 3357 ["Uncomment region" uncomment-region (use-region-p)]
3378 ["Add comment/move to comment" indent-for-comment t] 3358 ["Add comment/move to comment" indent-for-comment t]
3379 ["Convert variables in region to '_'" prolog-variables-to-anonymous 3359 ["Convert variables in region to '_'" prolog-variables-to-anonymous
3380 :active (use-region-p) :included (not (eq prolog-system 'mercury))] 3360 :active (use-region-p) :included (not (eq prolog-system 'mercury))]