summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-06-26 10:24:59 -0400
commit0b4e003766f15225dede9bdba4ead33e493856e2 (patch)
tree99de57fe8feeca540f398acb232b75e9c802418c /lisp/progmodes
parent699fce296b13d7db386b1cb5cecf2710e5196691 (diff)
downloademacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.gz
emacs-0b4e003766f15225dede9bdba4ead33e493856e2.tar.bz2
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."
;; and `after-change-functions'. Note that this variable is not set when
;; `c-before-change' is invoked by a change to text properties.
-(defvar c--use-syntax-propertize t)
-
(defun c-basic-common-init (mode default-style)
"Do the necessary initialization for the syntax handling routines
and the line breaking/filling code. Intended to be used by other
@@ -671,20 +669,15 @@ that requires a literal mode spec at compile time."
;; Install the functions that ensure that various internal caches
;; don't become invalid due to buffer changes.
- (if c--use-syntax-propertize
- (setq-local syntax-propertize-function
- (lambda (start end)
- (c-before-change start (point-max))
- (c-after-change start end (- end start))))
- (when (featurep 'xemacs)
- (make-local-hook 'before-change-functions)
- (make-local-hook 'after-change-functions))
- (add-hook 'before-change-functions 'c-before-change nil t)
- (setq c-just-done-before-change nil)
- ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
- ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
- ;; c-after-font-lock-init.
- (add-hook 'after-change-functions 'c-after-change nil t))
+ (when (featurep 'xemacs)
+ (make-local-hook 'before-change-functions)
+ (make-local-hook 'after-change-functions))
+ (add-hook 'before-change-functions 'c-before-change nil t)
+ (setq c-just-done-before-change nil)
+ ;; FIXME: We should use the new `depth' arg in Emacs-27 (e.g. a depth of -10
+ ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
+ ;; c-after-font-lock-init.
+ (add-hook 'after-change-functions 'c-after-change nil t)
(when (boundp 'font-lock-extend-after-change-region-function)
(set (make-local-variable 'font-lock-extend-after-change-region-function)
'c-extend-after-change-region))) ; Currently (2009-05) used by all
@@ -742,17 +735,15 @@ compatible with old code; callers should always specify it."
(widen)
(setq c-new-BEG (point-min))
(setq c-new-END (point-max))
- (unless c--use-syntax-propertize
- (save-excursion
- (let (before-change-functions after-change-functions)
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)))
- c-get-state-before-change-functions)
- (mapc (lambda (fn)
- (funcall fn (point-min) (point-max)
- (- (point-max) (point-min))))
- c-before-font-lock-functions)
- ))))
+ (save-excursion
+ (let (before-change-functions after-change-functions)
+ (mapc (lambda (fn)
+ (funcall fn (point-min) (point-max)))
+ c-get-state-before-change-functions)
+ (mapc (lambda (fn)
+ (funcall fn (point-min) (point-max)
+ (- (point-max) (point-min))))
+ c-before-font-lock-functions))))
(set (make-local-variable 'outline-regexp) "[^#\n\^M]")
(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....\".")
;;
;; Type a space in the first blank line, and the fontification of the next
;; line was fouled up by context fontification.
- (when c--use-syntax-propertize
- ;; This should also update c-new-END and c-new-BEG.
- (syntax-propertize end)
- ;; FIXME: Apparently `c-new-END' may be left unchanged to a stale value,
- ;; presumably when the buffer gets truncated.
- (if (> c-new-END (point-max)) (setq c-new-END (point-max))))
(let (new-beg new-end new-region case-fold-search)
(if (and c-in-after-change-fontification
(< 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....\".")
(defun c-after-font-lock-init ()
;; Put on `font-lock-mode-hook'. This function ensures our after-change
;; function will get executed before the font-lock one.
- (when (and c--use-syntax-propertize
- (memq #'c-after-change after-change-functions))
+ (when (memq #'c-after-change after-change-functions)
(remove-hook 'after-change-functions #'c-after-change t)
(add-hook 'after-change-functions #'c-after-change nil t)))
@@ -2158,14 +2142,11 @@ This function is called from `c-common-init', once per mode initialization."
(when (eq font-lock-support-mode 'jit-lock-mode)
(save-restriction
(widen)
- ;; FIXME: This presumes that c-new-BEG and c-new-END have been set
- ;; I guess from the before-change-function.
(c-save-buffer-state () ; Protect the undo-list from put-text-property.
(if (< c-new-BEG beg)
(put-text-property c-new-BEG beg 'fontified nil))
(if (> c-new-END end)
- (put-text-property end (min c-new-END (point-max))
- 'fontified nil)))))
+ (put-text-property end c-new-END 'fontified nil)))))
(cons c-new-BEG c-new-END))
;; 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'."
:type 'string
:group 'cperl-help-system)
-(defcustom cperl-use-syntax-table-text-property t
+(defcustom cperl-use-syntax-table-text-property
+ (boundp 'parse-sexp-lookup-properties)
"Non-nil means CPerl sets up and uses `syntax-table' text property."
:type 'boolean
:group 'cperl-speed)
@@ -699,7 +700,55 @@ install choose-color.el, available from
`fill-paragraph' on a comment may leave the point behind the
paragraph. It also triggers a bug in some versions of Emacs (CPerl tries
-to detect it and bulk out).")
+to detect it and bulk out).
+
+See documentation of a variable `cperl-problems-old-emaxen' for the
+problems which disappear if you upgrade Emacs to a reasonably new
+version (20.3 for Emacs, and those of 2004 for XEmacs).")
+
+(defvar cperl-problems-old-emaxen 'please-ignore-this-line
+ "Description of problems in CPerl mode specific for older Emacs versions.
+
+Emacs had a _very_ restricted syntax parsing engine until version
+20.1. Most problems below are corrected starting from this version of
+Emacs, and all of them should be fixed in version 20.3. (Or apply
+patches to Emacs 19.33/34 - see tips.) XEmacs was very backward in
+this respect (until 2003).
+
+Note that even with newer Emacsen in some very rare cases the details
+of interaction of `font-lock' and syntaxification may be not cleaned
+up yet. You may get slightly different colors basing on the order of
+fontification and syntaxification. Say, the initial faces is correct,
+but editing the buffer breaks this.
+
+Even with older Emacsen CPerl mode tries to corrects some Emacs
+misunderstandings, however, for efficiency reasons the degree of
+correction is different for different operations. The partially
+corrected problems are: POD sections, here-documents, regexps. The
+operations are: highlighting, indentation, electric keywords, electric
+braces.
+
+This may be confusing, since the regexp s#//#/#; may be highlighted
+as a comment, but it will be recognized as a regexp by the indentation
+code. Or the opposite case, when a POD section is highlighted, but
+may break the indentation of the following code (though indentation
+should work if the balance of delimiters is not broken by POD).
+
+The main trick (to make $ a \"backslash\") makes constructions like
+${aaa} look like unbalanced braces. The only trick I can think of is
+to insert it as $ {aaa} (valid in perl5, not in perl4).
+
+Similar problems arise in regexps, when /(\\s|$)/ should be rewritten
+as /($|\\s)/. Note that such a transposition is not always possible.
+
+The solution is to upgrade your Emacs or patch an older one. Note
+that Emacs 20.2 has some bugs related to `syntax-table' text
+properties. Patches are available on the main CPerl download site,
+and on CPAN.
+
+If these bugs cannot be fixed on your machine (say, you have an inferior
+environment and cannot recompile), you may still disable all the fancy stuff
+via `cperl-use-syntax-table-text-property'.")
(defvar cperl-praise 'please-ignore-this-line
"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.")
(bound-and-true-p
gdb-active-process)))))
([go] menu-item (if (bound-and-true-p gdb-active-process)
- "Continue" "Run")
- gud-go
+ "Continue" "Run") gud-go
:visible (and (eq gud-minor-mode 'gdbmi)
(gdb-show-run-p)))
([stop] menu-item "Stop" gud-stop-subjob
@@ -191,8 +190,7 @@ Used to gray out relevant toolbar icons.")
(eq gud-minor-mode 'gdbmi)))
([print*] menu-item (if (eq gud-minor-mode 'jdb)
"Dump object"
- "Print Dereference")
- gud-pstar
+ "Print Dereference") gud-pstar
:enable (not gud-running)
:visible (memq gud-minor-mode '(gdbmi gdb jdb)))
([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 @@
;;; Added by Tom Perrine (TEP)
(defvar m2-mode-syntax-table
(let ((table (make-syntax-table)))
- ;; FIXME: nesting!
- ;; FIXME: `comment-indent' just inserts "(**)" whereas the old code
- ;; resulted in a nicer "(* *)"!
- (comment-set-syntax table '(("(*" . "*)") ("//" . "\n")))
(modify-syntax-entry ?\\ "\\" table)
+ (modify-syntax-entry ?/ ". 12" table)
+ (modify-syntax-entry ?\n ">" table)
+ (modify-syntax-entry ?\( "()1" table)
+ (modify-syntax-entry ?\) ")(4" table)
+ (modify-syntax-entry ?* ". 23nb" table)
(modify-syntax-entry ?+ "." table)
(modify-syntax-entry ?- "." table)
(modify-syntax-entry ?= "." table)
@@ -203,11 +204,10 @@
(let ((tok (smie-default-backward-token)))
(cond
((zerop (length tok))
- (if (bobp) (setq res ":")
- (let ((forward-sexp-function nil))
- (condition-case nil
- (forward-sexp -1)
- (scan-error (setq res ":"))))))
+ (let ((forward-sexp-function nil))
+ (condition-case nil
+ (forward-sexp -1)
+ (scan-error (setq res ":")))))
((member tok '("|" "OF" "..")) (setq res ":-case"))
((member tok '(":" "END" ";" "BEGIN" "VAR" "RECORD" "PROCEDURE"))
(setq res ":")))))
@@ -311,6 +311,9 @@ followed by the first character of the construct.
(set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
(set (make-local-variable 'paragraph-separate) paragraph-start)
(set (make-local-variable 'paragraph-ignore-fill-prefix) t)
+ (set (make-local-variable 'comment-start) "(* ")
+ (set (make-local-variable 'comment-end) " *)")
+ (set (make-local-variable 'comment-start-skip) "\\(?:(\\*+\\|//+\\) *")
(set (make-local-variable 'parse-sexp-ignore-comments) t)
(set (make-local-variable 'font-lock-defaults)
'((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.")
;; OS specific
"VMSError" "WindowsError"
)
- symbol-end)
- . font-lock-type-face)
+ symbol-end) . font-lock-type-face)
;; assignments
;; support for a = b = c = 5
(,(lambda (limit)
@@ -679,7 +678,6 @@ Which one will be chosen depends on the value of
((rx (or "\"\"\"" "'''"))
(0 (ignore (python-syntax-stringify))))))
-;; Always define the alias(es) *before* the variable.
(define-obsolete-variable-alias 'python--prettify-symbols-alist
'python-prettify-symbols-alist "26.1")