From: Stefan Monnier Date: Tue, 11 Jun 2013 21:38:35 +0000 (-0400) Subject: * lisp/progmodes/prolog.el (prolog-make-keywords-regexp): Remove. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2016^2~145^2~17 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e3eb1bb7d954183f107c406b69c9e5597203d70e;p=emacs.git * lisp/progmodes/prolog.el (prolog-make-keywords-regexp): Remove. (prolog-font-lock-keywords): Use regexp-opt instead. Don't manually highlight strings. (prolog-mode-variables): Simplify comment-start-skip. (prolog-consult-compile): Use display-buffer. Remove unused old-filter. --- diff --git a/etc/NEWS b/etc/NEWS index 81509469638..1e6088fe671 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -445,6 +445,7 @@ file using `set-file-extended-attributes'. *** `minibuffer-completion-contents' *** `isearch-nonincremental-exit-minibuffer' *** `isearch-filter-visible' +*** `generic-make-keywords-list' ** `with-wrapper-hook' is obsoleted by `add-function'. The few hooks that used with-wrapper-hook are replaced as follows: diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fbc885cefbc..3bfd46028c7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2013-06-11 Stefan Monnier + * progmodes/prolog.el (prolog-make-keywords-regexp): Remove. + (prolog-font-lock-keywords): Use regexp-opt instead. + Don't manually highlight strings. + (prolog-mode-variables): Simplify comment-start-skip. + (prolog-consult-compile): Use display-buffer. Remove unused old-filter. + * emacs-lisp/generic.el (generic--normalise-comments) (generic-set-comment-syntax, generic-set-comment-vars): New functions. (generic-mode-set-comments): Use them. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 63bd9258d69..0f3c1504ee9 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -1149,11 +1149,7 @@ VERSION is of the format (Major . Minor)" (set (make-local-variable 'comment-start) "%") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'comment-add) 1) - (set (make-local-variable 'comment-start-skip) - ;; This complex regexp makes sure that comments cannot start - ;; inside quoted atoms or strings - (format "^\\(\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\)\\(/\\*+ *\\|%%+ *\\)" - prolog-quoted-atom-regexp prolog-string-regexp)) + (set (make-local-variable 'comment-start-skip) "\\(?:/\\*+ *\\|%%+ *\\)") (set (make-local-variable 'parens-require-spaces) nil) ;; Initialize Prolog system specific variables (dolist (var '(prolog-keywords prolog-types prolog-mode-specificators @@ -1739,8 +1735,7 @@ This function must be called from the source code buffer." (real-file buffer-file-name) (command-string (prolog-build-prolog-command compilep file real-file first-line)) - (process (get-process "prolog")) - (old-filter (process-filter process))) + (process (get-process "prolog"))) (with-current-buffer buffer (delete-region (point-min) (point-max)) ;; FIXME: Wasn't this supposed to use prolog-inferior-mode? @@ -1759,8 +1754,7 @@ This function must be called from the source code buffer." 'prolog-parse-sicstus-compilation-errors)) (setq buffer-read-only nil) (insert command-string "\n")) - (save-selected-window - (pop-to-buffer buffer)) + (display-buffer buffer) (setq prolog-process-flag t prolog-consult-compile-output "" prolog-consult-compile-first-line (if first-line (1- first-line) 0) @@ -1954,20 +1948,6 @@ If COMPILEP is non-nil, compile, otherwise consult." ;;------------------------------------------------------------------- ;; Auxiliary functions -(defun prolog-make-keywords-regexp (keywords &optional protect) - "Create regexp from the list of strings KEYWORDS. -If PROTECT is non-nil, surround the result regexp by word breaks." - (let ((regexp - (if (fboundp 'regexp-opt) - ;; Emacs 20 - ;; Avoid compile warnings under earlier versions by using eval - (eval '(regexp-opt keywords)) - ;; Older Emacsen - (concat (mapconcat 'regexp-quote keywords "\\|"))) - )) - (if protect - (concat "\\<\\(" regexp "\\)\\>") - regexp))) (defun prolog-font-lock-object-matcher (bound) "Find SICStus objects method name for font lock. @@ -2084,20 +2064,16 @@ Argument BOUND is a buffer position limiting searching." (if (eq prolog-system 'mercury) (concat "\\<\\(" - (prolog-make-keywords-regexp prolog-keywords-i) + (regexp-opt prolog-keywords-i) "\\|" - (prolog-make-keywords-regexp + (regexp-opt prolog-determinism-specificators-i) "\\)\\>") (concat "^[?:]- *\\(" - (prolog-make-keywords-regexp prolog-keywords-i) + (regexp-opt prolog-keywords-i) "\\)\\>")) 1 prolog-builtin-face)) - (quoted_atom (list prolog-quoted-atom-regexp - 2 'font-lock-string-face 'append)) - (string (list prolog-string-regexp - 1 'font-lock-string-face 'append)) ;; SICStus specific patterns (sicstus-object-methods (if (eq prolog-system 'sicstus) @@ -2107,17 +2083,17 @@ Argument BOUND is a buffer position limiting searching." (types (if (eq prolog-system 'mercury) (list - (prolog-make-keywords-regexp prolog-types-i t) + (regexp-opt prolog-types-i 'words) 0 'font-lock-type-face))) (modes (if (eq prolog-system 'mercury) (list - (prolog-make-keywords-regexp prolog-mode-specificators-i t) + (regexp-opt prolog-mode-specificators-i 'words) 0 'font-lock-constant-face))) (directives (if (eq prolog-system 'mercury) (list - (prolog-make-keywords-regexp prolog-directives-i t) + (regexp-opt prolog-directives-i 'words) 0 'prolog-warning-face))) ;; Inferior mode specific patterns (prompt @@ -2211,8 +2187,6 @@ Argument BOUND is a buffer position limiting searching." (list head-predicates head-predicates-1 - quoted_atom - string variables important-elements important-elements-1