aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorStefan Monnier2019-06-26 10:24:59 -0400
committerStefan Monnier2019-06-26 10:24:59 -0400
commit0b4e003766f15225dede9bdba4ead33e493856e2 (patch)
tree99de57fe8feeca540f398acb232b75e9c802418c /lisp/progmodes
parent699fce296b13d7db386b1cb5cecf2710e5196691 (diff)
downloademacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.gz
emacs-0b4e003766f15225dede9bdba4ead33e493856e2.zip
Revert "* lisp/calc/calc-ext.el (math-scalarp): Fix typo"
This reverts commit 698ff554ac2699ec48fefc85a1307cbc4a183b0d.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-mode.el59
-rw-r--r--lisp/progmodes/cperl-mode.el53
-rw-r--r--lisp/progmodes/gud.el6
-rw-r--r--lisp/progmodes/modula2.el21
-rw-r--r--lisp/progmodes/python.el4
5 files changed, 86 insertions, 57 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8d6cce690d1..5c18879712c 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -525,8 +525,6 @@ preferably use the `c-mode-menu' language constant directly."
525;; and `after-change-functions'. Note that this variable is not set when 525;; and `after-change-functions'. Note that this variable is not set when
526;; `c-before-change' is invoked by a change to text properties. 526;; `c-before-change' is invoked by a change to text properties.
527 527
528(defvar c--use-syntax-propertize t)
529
530(defun c-basic-common-init (mode default-style) 528(defun c-basic-common-init (mode default-style)
531 "Do the necessary initialization for the syntax handling routines 529 "Do the necessary initialization for the syntax handling routines
532and the line breaking/filling code. Intended to be used by other 530and the line breaking/filling code. Intended to be used by other
@@ -671,20 +669,15 @@ that requires a literal mode spec at compile time."
671 669
672 ;; Install the functions that ensure that various internal caches 670 ;; Install the functions that ensure that various internal caches
673 ;; don't become invalid due to buffer changes. 671 ;; don't become invalid due to buffer changes.
674 (if c--use-syntax-propertize 672 (when (featurep 'xemacs)
675 (setq-local syntax-propertize-function 673 (make-local-hook 'before-change-functions)
676 (lambda (start end) 674 (make-local-hook 'after-change-functions))
677 (c-before-change start (point-max)) 675 (add-hook 'before-change-functions 'c-before-change nil t)
678 (c-after-change start end (- end start)))) 676 (setq c-just-done-before-change nil)
679 (when (featurep 'xemacs) 677 ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
680 (make-local-hook 'before-change-functions) 678 ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
681 (make-local-hook 'after-change-functions)) 679 ;; c-after-font-lock-init.
682 (add-hook 'before-change-functions 'c-before-change nil t) 680 (add-hook 'after-change-functions 'c-after-change nil t)
683 (setq c-just-done-before-change nil)
684 ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
685 ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
686 ;; c-after-font-lock-init.
687 (add-hook 'after-change-functions 'c-after-change nil t))
688 (when (boundp 'font-lock-extend-after-change-region-function) 681 (when (boundp 'font-lock-extend-after-change-region-function)
689 (set (make-local-variable 'font-lock-extend-after-change-region-function) 682 (set (make-local-variable 'font-lock-extend-after-change-region-function)
690 'c-extend-after-change-region))) ; Currently (2009-05) used by all 683 'c-extend-after-change-region))) ; Currently (2009-05) used by all
@@ -742,17 +735,15 @@ compatible with old code; callers should always specify it."
742 (widen) 735 (widen)
743 (setq c-new-BEG (point-min)) 736 (setq c-new-BEG (point-min))
744 (setq c-new-END (point-max)) 737 (setq c-new-END (point-max))
745 (unless c--use-syntax-propertize 738 (save-excursion
746 (save-excursion 739 (let (before-change-functions after-change-functions)
747 (let (before-change-functions after-change-functions) 740 (mapc (lambda (fn)
748 (mapc (lambda (fn) 741 (funcall fn (point-min) (point-max)))
749 (funcall fn (point-min) (point-max))) 742 c-get-state-before-change-functions)
750 c-get-state-before-change-functions) 743 (mapc (lambda (fn)
751 (mapc (lambda (fn) 744 (funcall fn (point-min) (point-max)
752 (funcall fn (point-min) (point-max) 745 (- (point-max) (point-min))))
753 (- (point-max) (point-min)))) 746 c-before-font-lock-functions))))
754 c-before-font-lock-functions)
755 ))))
756 747
757 (set (make-local-variable 'outline-regexp) "[^#\n\^M]") 748 (set (make-local-variable 'outline-regexp) "[^#\n\^M]")
758 (set (make-local-variable 'outline-level) 'c-outline-level) 749 (set (make-local-variable 'outline-level) 'c-outline-level)
@@ -2059,12 +2050,6 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
2059 ;; 2050 ;;
2060 ;; Type a space in the first blank line, and the fontification of the next 2051 ;; Type a space in the first blank line, and the fontification of the next
2061 ;; line was fouled up by context fontification. 2052 ;; line was fouled up by context fontification.
2062 (when c--use-syntax-propertize
2063 ;; This should also update c-new-END and c-new-BEG.
2064 (syntax-propertize end)
2065 ;; FIXME: Apparently `c-new-END' may be left unchanged to a stale value,
2066 ;; presumably when the buffer gets truncated.
2067 (if (> c-new-END (point-max)) (setq c-new-END (point-max))))
2068 (let (new-beg new-end new-region case-fold-search) 2053 (let (new-beg new-end new-region case-fold-search)
2069 (if (and c-in-after-change-fontification 2054 (if (and c-in-after-change-fontification
2070 (< beg c-new-END) (> end c-new-BEG)) 2055 (< beg c-new-END) (> end c-new-BEG))
@@ -2103,8 +2088,7 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
2103(defun c-after-font-lock-init () 2088(defun c-after-font-lock-init ()
2104 ;; Put on `font-lock-mode-hook'. This function ensures our after-change 2089 ;; Put on `font-lock-mode-hook'. This function ensures our after-change
2105 ;; function will get executed before the font-lock one. 2090 ;; function will get executed before the font-lock one.
2106 (when (and c--use-syntax-propertize 2091 (when (memq #'c-after-change after-change-functions)
2107 (memq #'c-after-change after-change-functions))
2108 (remove-hook 'after-change-functions #'c-after-change t) 2092 (remove-hook 'after-change-functions #'c-after-change t)
2109 (add-hook 'after-change-functions #'c-after-change nil t))) 2093 (add-hook 'after-change-functions #'c-after-change nil t)))
2110 2094
@@ -2158,14 +2142,11 @@ This function is called from `c-common-init', once per mode initialization."
2158 (when (eq font-lock-support-mode 'jit-lock-mode) 2142 (when (eq font-lock-support-mode 'jit-lock-mode)
2159 (save-restriction 2143 (save-restriction
2160 (widen) 2144 (widen)
2161 ;; FIXME: This presumes that c-new-BEG and c-new-END have been set
2162 ;; I guess from the before-change-function.
2163 (c-save-buffer-state () ; Protect the undo-list from put-text-property. 2145 (c-save-buffer-state () ; Protect the undo-list from put-text-property.
2164 (if (< c-new-BEG beg) 2146 (if (< c-new-BEG beg)
2165 (put-text-property c-new-BEG beg 'fontified nil)) 2147 (put-text-property c-new-BEG beg 'fontified nil))
2166 (if (> c-new-END end) 2148 (if (> c-new-END end)
2167 (put-text-property end (min c-new-END (point-max)) 2149 (put-text-property end c-new-END 'fontified nil)))))
2168 'fontified nil)))))
2169 (cons c-new-BEG c-new-END)) 2150 (cons c-new-BEG c-new-END))
2170 2151
2171;; Emacs < 22 and XEmacs 2152;; Emacs < 22 and XEmacs
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index d5ef37a4c02..254269ddf1a 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -480,7 +480,8 @@ Older version of this page was called `perl5', newer `perl'."
480 :type 'string 480 :type 'string
481 :group 'cperl-help-system) 481 :group 'cperl-help-system)
482 482
483(defcustom cperl-use-syntax-table-text-property t 483(defcustom cperl-use-syntax-table-text-property
484 (boundp 'parse-sexp-lookup-properties)
484 "Non-nil means CPerl sets up and uses `syntax-table' text property." 485 "Non-nil means CPerl sets up and uses `syntax-table' text property."
485 :type 'boolean 486 :type 'boolean
486 :group 'cperl-speed) 487 :group 'cperl-speed)
@@ -699,7 +700,55 @@ install choose-color.el, available from
699 700
700`fill-paragraph' on a comment may leave the point behind the 701`fill-paragraph' on a comment may leave the point behind the
701paragraph. It also triggers a bug in some versions of Emacs (CPerl tries 702paragraph. It also triggers a bug in some versions of Emacs (CPerl tries
702to detect it and bulk out).") 703to detect it and bulk out).
704
705See documentation of a variable `cperl-problems-old-emaxen' for the
706problems which disappear if you upgrade Emacs to a reasonably new
707version (20.3 for Emacs, and those of 2004 for XEmacs).")
708
709(defvar cperl-problems-old-emaxen 'please-ignore-this-line
710 "Description of problems in CPerl mode specific for older Emacs versions.
711
712Emacs had a _very_ restricted syntax parsing engine until version
71320.1. Most problems below are corrected starting from this version of
714Emacs, and all of them should be fixed in version 20.3. (Or apply
715patches to Emacs 19.33/34 - see tips.) XEmacs was very backward in
716this respect (until 2003).
717
718Note that even with newer Emacsen in some very rare cases the details
719of interaction of `font-lock' and syntaxification may be not cleaned
720up yet. You may get slightly different colors basing on the order of
721fontification and syntaxification. Say, the initial faces is correct,
722but editing the buffer breaks this.
723
724Even with older Emacsen CPerl mode tries to corrects some Emacs
725misunderstandings, however, for efficiency reasons the degree of
726correction is different for different operations. The partially
727corrected problems are: POD sections, here-documents, regexps. The
728operations are: highlighting, indentation, electric keywords, electric
729braces.
730
731This may be confusing, since the regexp s#//#/#; may be highlighted
732as a comment, but it will be recognized as a regexp by the indentation
733code. Or the opposite case, when a POD section is highlighted, but
734may break the indentation of the following code (though indentation
735should work if the balance of delimiters is not broken by POD).
736
737The main trick (to make $ a \"backslash\") makes constructions like
738${aaa} look like unbalanced braces. The only trick I can think of is
739to insert it as $ {aaa} (valid in perl5, not in perl4).
740
741Similar problems arise in regexps, when /(\\s|$)/ should be rewritten
742as /($|\\s)/. Note that such a transposition is not always possible.
743
744The solution is to upgrade your Emacs or patch an older one. Note
745that Emacs 20.2 has some bugs related to `syntax-table' text
746properties. Patches are available on the main CPerl download site,
747and on CPAN.
748
749If these bugs cannot be fixed on your machine (say, you have an inferior
750environment and cannot recompile), you may still disable all the fancy stuff
751via `cperl-use-syntax-table-text-property'.")
703 752
704(defvar cperl-praise 'please-ignore-this-line 753(defvar cperl-praise 'please-ignore-this-line
705 "Advantages of CPerl mode. 754 "Advantages of CPerl mode.
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 30c9b813407..4306f5daa02 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -152,8 +152,7 @@ Used to gray out relevant toolbar icons.")
152 (bound-and-true-p 152 (bound-and-true-p
153 gdb-active-process))))) 153 gdb-active-process)))))
154 ([go] menu-item (if (bound-and-true-p gdb-active-process) 154 ([go] menu-item (if (bound-and-true-p gdb-active-process)
155 "Continue" "Run") 155 "Continue" "Run") gud-go
156 gud-go
157 :visible (and (eq gud-minor-mode 'gdbmi) 156 :visible (and (eq gud-minor-mode 'gdbmi)
158 (gdb-show-run-p))) 157 (gdb-show-run-p)))
159 ([stop] menu-item "Stop" gud-stop-subjob 158 ([stop] menu-item "Stop" gud-stop-subjob
@@ -191,8 +190,7 @@ Used to gray out relevant toolbar icons.")
191 (eq gud-minor-mode 'gdbmi))) 190 (eq gud-minor-mode 'gdbmi)))
192 ([print*] menu-item (if (eq gud-minor-mode 'jdb) 191 ([print*] menu-item (if (eq gud-minor-mode 'jdb)
193 "Dump object" 192 "Dump object"
194 "Print Dereference") 193 "Print Dereference") gud-pstar
195 gud-pstar
196 :enable (not gud-running) 194 :enable (not gud-running)
197 :visible (memq gud-minor-mode '(gdbmi gdb jdb))) 195 :visible (memq gud-minor-mode '(gdbmi gdb jdb)))
198 ([print] menu-item "Print Expression" gud-print 196 ([print] menu-item "Print Expression" gud-print
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index 33c69e168f4..aa412304c59 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -33,11 +33,12 @@
33;;; Added by Tom Perrine (TEP) 33;;; Added by Tom Perrine (TEP)
34(defvar m2-mode-syntax-table 34(defvar m2-mode-syntax-table
35 (let ((table (make-syntax-table))) 35 (let ((table (make-syntax-table)))
36 ;; FIXME: nesting!
37 ;; FIXME: `comment-indent' just inserts "(**)" whereas the old code
38 ;; resulted in a nicer "(* *)"!
39 (comment-set-syntax table '(("(*" . "*)") ("//" . "\n")))
40 (modify-syntax-entry ?\\ "\\" table) 36 (modify-syntax-entry ?\\ "\\" table)
37 (modify-syntax-entry ?/ ". 12" table)
38 (modify-syntax-entry ?\n ">" table)
39 (modify-syntax-entry ?\( "()1" table)
40 (modify-syntax-entry ?\) ")(4" table)
41 (modify-syntax-entry ?* ". 23nb" table)
41 (modify-syntax-entry ?+ "." table) 42 (modify-syntax-entry ?+ "." table)
42 (modify-syntax-entry ?- "." table) 43 (modify-syntax-entry ?- "." table)
43 (modify-syntax-entry ?= "." table) 44 (modify-syntax-entry ?= "." table)
@@ -203,11 +204,10 @@
203 (let ((tok (smie-default-backward-token))) 204 (let ((tok (smie-default-backward-token)))
204 (cond 205 (cond
205 ((zerop (length tok)) 206 ((zerop (length tok))
206 (if (bobp) (setq res ":") 207 (let ((forward-sexp-function nil))
207 (let ((forward-sexp-function nil)) 208 (condition-case nil
208 (condition-case nil 209 (forward-sexp -1)
209 (forward-sexp -1) 210 (scan-error (setq res ":")))))
210 (scan-error (setq res ":"))))))
211 ((member tok '("|" "OF" "..")) (setq res ":-case")) 211 ((member tok '("|" "OF" "..")) (setq res ":-case"))
212 ((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE")) 212 ((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE"))
213 (setq res ":"))))) 213 (setq res ":")))))
@@ -311,6 +311,9 @@ followed by the first character of the construct.
311 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter)) 311 (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
312 (set (make-local-variable 'paragraph-separate) paragraph-start) 312 (set (make-local-variable 'paragraph-separate) paragraph-start)
313 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) 313 (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
314 (set (make-local-variable 'comment-start) "(* ")
315 (set (make-local-variable 'comment-end) " *)")
316 (set (make-local-variable 'comment-start-skip) "\\(?:(\\*+\\|//+\\) *")
314 (set (make-local-variable 'parse-sexp-ignore-comments) t) 317 (set (make-local-variable 'parse-sexp-ignore-comments) t)
315 (set (make-local-variable 'font-lock-defaults) 318 (set (make-local-variable 'font-lock-defaults)
316 '((m3-font-lock-keywords 319 '((m3-font-lock-keywords
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 28d8746ffaf..e1f9a33a691 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -628,8 +628,7 @@ builtins.")
628 ;; OS specific 628 ;; OS specific
629 "VMSError" "WindowsError" 629 "VMSError" "WindowsError"
630 ) 630 )
631 symbol-end) 631 symbol-end) . font-lock-type-face)
632 . font-lock-type-face)
633 ;; assignments 632 ;; assignments
634 ;; support for a = b = c = 5 633 ;; support for a = b = c = 5
635 (,(lambda (limit) 634 (,(lambda (limit)
@@ -679,7 +678,6 @@ Which one will be chosen depends on the value of
679 ((rx (or "\"\"\"" "'''")) 678 ((rx (or "\"\"\"" "'''"))
680 (0 (ignore (python-syntax-stringify)))))) 679 (0 (ignore (python-syntax-stringify))))))
681 680
682;; Always define the alias(es) *before* the variable.
683(define-obsolete-variable-alias 'python--prettify-symbols-alist 681(define-obsolete-variable-alias 'python--prettify-symbols-alist
684 'python-prettify-symbols-alist "26.1") 682 'python-prettify-symbols-alist "26.1")
685 683