2013-10-08 01:10:10 -04:00
|
|
|
|
;;; perl-mode.el --- Perl code editing commands for GNU Emacs -*- lexical-binding:t -*-
|
1992-07-15 23:29:10 +00:00
|
|
|
|
|
2017-01-01 03:14:01 +00:00
|
|
|
|
;; Copyright (C) 1990, 1994, 2001-2017 Free Software Foundation, Inc.
|
1992-07-22 04:22:42 +00:00
|
|
|
|
|
1992-07-15 23:29:10 +00:00
|
|
|
|
;; Author: William F. Mann
|
2014-02-09 17:34:22 -08:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1992-07-15 23:29:10 +00:00
|
|
|
|
;; Adapted-By: ESR
|
1992-07-17 20:24:00 +00:00
|
|
|
|
;; Keywords: languages
|
1992-07-15 23:29:10 +00:00
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; Adapted from C code editing commands 'c-mode.el', Copyright 1987 by the
|
|
|
|
|
;; Free Software Foundation, under terms of its General Public License.
|
|
|
|
|
|
1992-07-27 08:52:26 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1992-07-27 08:52:26 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1992-07-27 08:52:26 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1992-07-15 23:29:10 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; To enter perl-mode automatically, add (autoload 'perl-mode "perl-mode")
|
2012-09-17 13:41:04 +08:00
|
|
|
|
;; to your init file and change the first line of your perl script to:
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; #!/usr/bin/perl -- # -*-Perl-*-
|
1996-01-05 22:21:28 +00:00
|
|
|
|
;; With arguments to perl:
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; #!/usr/bin/perl -P- # -*-Perl-*-
|
|
|
|
|
;; To handle files included with do 'filename.pl';, add something like
|
1994-09-24 04:14:20 +00:00
|
|
|
|
;; (setq auto-mode-alist (append (list (cons "\\.pl\\'" 'perl-mode))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; auto-mode-alist))
|
2012-09-17 13:41:04 +08:00
|
|
|
|
;; to your init file; otherwise the .pl suffix defaults to prolog-mode.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
;; This code is based on the 18.53 version c-mode.el, with extensive
|
|
|
|
|
;; rewriting. Most of the features of c-mode survived intact.
|
|
|
|
|
|
|
|
|
|
;; I added a new feature which adds functionality to TAB; it is controlled
|
|
|
|
|
;; by the variable perl-tab-to-comment. With it enabled, TAB does the
|
|
|
|
|
;; first thing it can from the following list: change the indentation;
|
|
|
|
|
;; move past leading white space; delete an empty comment; reindent a
|
|
|
|
|
;; comment; move to end of line; create an empty comment; tell you that
|
|
|
|
|
;; the line ends in a quoted string, or has a # which should be a \#.
|
|
|
|
|
|
|
|
|
|
;; If your machine is slow, you may want to remove some of the bindings
|
2001-05-25 21:16:05 +00:00
|
|
|
|
;; to perl-electric-terminator. I changed the indenting defaults to be
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; what Larry Wall uses in perl/lib, but left in all the options.
|
|
|
|
|
|
|
|
|
|
;; I also tuned a few things: comments and labels starting in column
|
2001-05-25 21:16:05 +00:00
|
|
|
|
;; zero are left there by perl-indent-exp; perl-beginning-of-function
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; goes back to the first open brace/paren in column zero, the open brace
|
2001-05-25 21:16:05 +00:00
|
|
|
|
;; in 'sub ... {', or the equal sign in 'format ... ='; perl-indent-exp
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; (meta-^q) indents from the current line through the close of the next
|
|
|
|
|
;; brace/paren, so you don't need to start exactly at a brace or paren.
|
|
|
|
|
|
|
|
|
|
;; It may be good style to put a set of redundant braces around your
|
|
|
|
|
;; main program. This will let you reindent it with meta-^q.
|
|
|
|
|
|
1992-07-16 06:28:10 +00:00
|
|
|
|
;; Known problems (these are all caused by limitations in the Emacs Lisp
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; parsing routine (parse-partial-sexp), which was not designed for such
|
|
|
|
|
;; a rich language; writing a more suitable parser would be a big job):
|
|
|
|
|
;; 2) The globbing syntax <pattern> is not recognized, so special
|
|
|
|
|
;; characters in the pattern string must be backslashed.
|
2001-06-10 18:02:43 +00:00
|
|
|
|
;;
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; Here are some ugly tricks to bypass some of these problems: the perl
|
|
|
|
|
;; expression /`/ (that's a back-tick) usually evaluates harmlessly,
|
|
|
|
|
;; but will trick perl-mode into starting a quoted string, which
|
|
|
|
|
;; can be ended with another /`/. Assuming you have no embedded
|
|
|
|
|
;; back-ticks, this can used to help solve problem 3:
|
|
|
|
|
;;
|
|
|
|
|
;; /`/; $ugly = q?"'$?; /`/;
|
|
|
|
|
;;
|
2002-09-13 18:44:29 +00:00
|
|
|
|
;; The same trick can be used for problem 6 as in:
|
|
|
|
|
;; /{/; while (<${glob_me}>)
|
|
|
|
|
;; but a simpler solution is to add a space between the $ and the {:
|
|
|
|
|
;; while (<$ {glob_me}>)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;;
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; Problem 7 is even worse, but this 'fix' does work :-(
|
|
|
|
|
;; $DB'stop#'
|
|
|
|
|
;; [$DB'line#'
|
|
|
|
|
;; ] =~ s/;9$//;
|
|
|
|
|
|
1992-07-15 23:29:10 +00:00
|
|
|
|
;;; Code:
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defgroup perl nil
|
|
|
|
|
"Major mode for editing Perl code."
|
2005-11-17 07:40:11 +00:00
|
|
|
|
:link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
:prefix "perl-"
|
|
|
|
|
:group 'languages)
|
|
|
|
|
|
2002-01-22 07:18:14 +00:00
|
|
|
|
(defvar perl-mode-abbrev-table nil
|
|
|
|
|
"Abbrev table in use in perl-mode buffers.")
|
|
|
|
|
(define-abbrev-table 'perl-mode-abbrev-table ())
|
|
|
|
|
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(defvar perl-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map "\e\C-a" 'perl-beginning-of-function)
|
|
|
|
|
(define-key map "\e\C-e" 'perl-end-of-function)
|
|
|
|
|
(define-key map "\e\C-h" 'perl-mark-function)
|
|
|
|
|
(define-key map "\e\C-q" 'perl-indent-exp)
|
|
|
|
|
(define-key map "\177" 'backward-delete-char-untabify)
|
|
|
|
|
map)
|
2001-06-10 18:02:43 +00:00
|
|
|
|
"Keymap used in Perl mode.")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(defvar perl-mode-syntax-table
|
|
|
|
|
(let ((st (make-syntax-table (standard-syntax-table))))
|
|
|
|
|
(modify-syntax-entry ?\n ">" st)
|
|
|
|
|
(modify-syntax-entry ?# "<" st)
|
2002-10-18 21:35:05 +00:00
|
|
|
|
;; `$' is also a prefix char so I was tempted to say "/ p",
|
2013-10-08 01:10:10 -04:00
|
|
|
|
;; but the `p' thingy basically overrides the `/' :-( -- Stef
|
2002-10-18 21:35:05 +00:00
|
|
|
|
(modify-syntax-entry ?$ "/" st)
|
2002-09-13 18:44:29 +00:00
|
|
|
|
(modify-syntax-entry ?% ". p" st)
|
|
|
|
|
(modify-syntax-entry ?@ ". p" st)
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(modify-syntax-entry ?& "." st)
|
|
|
|
|
(modify-syntax-entry ?\' "\"" st)
|
|
|
|
|
(modify-syntax-entry ?* "." st)
|
|
|
|
|
(modify-syntax-entry ?+ "." st)
|
|
|
|
|
(modify-syntax-entry ?- "." st)
|
|
|
|
|
(modify-syntax-entry ?/ "." st)
|
|
|
|
|
(modify-syntax-entry ?< "." st)
|
|
|
|
|
(modify-syntax-entry ?= "." st)
|
|
|
|
|
(modify-syntax-entry ?> "." st)
|
|
|
|
|
(modify-syntax-entry ?\\ "\\" st)
|
|
|
|
|
(modify-syntax-entry ?` "\"" st)
|
|
|
|
|
(modify-syntax-entry ?| "." st)
|
|
|
|
|
st)
|
|
|
|
|
"Syntax table in use in `perl-mode' buffers.")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1995-07-26 18:01:10 +00:00
|
|
|
|
(defvar perl-imenu-generic-expression
|
2001-05-25 21:16:05 +00:00
|
|
|
|
'(;; Functions
|
2013-05-06 15:33:56 -04:00
|
|
|
|
(nil "^[ \t]*sub\\s-+\\([-[:alnum:]+_:]+\\)" 1)
|
1995-07-26 18:01:10 +00:00
|
|
|
|
;;Variables
|
2017-07-07 17:08:52 -05:00
|
|
|
|
("Variables" "^[ \t]*\\(?:anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1)
|
2013-05-06 15:33:56 -04:00
|
|
|
|
("Packages" "^[ \t]*package\\s-+\\([-[:alnum:]+_:]+\\);" 1)
|
2005-02-27 23:13:19 +00:00
|
|
|
|
("Doc sections" "^=head[0-9][ \t]+\\(.*\\)" 1))
|
1995-07-26 18:01:10 +00:00
|
|
|
|
"Imenu generic expression for Perl mode. See `imenu-generic-expression'.")
|
|
|
|
|
|
1996-01-25 10:27:31 +00:00
|
|
|
|
;; Regexps updated with help from Tom Tromey <tromey@cambric.colorado.edu> and
|
|
|
|
|
;; Jim Campbell <jec@murzim.ca.boeing.com>.
|
|
|
|
|
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(defconst perl--prettify-symbols-alist
|
2013-06-05 10:26:50 -04:00
|
|
|
|
'(("->" . ?→)
|
2012-11-08 10:35:32 -05:00
|
|
|
|
("=>" . ?⇒)
|
2013-06-05 10:26:50 -04:00
|
|
|
|
("::" . ?∷)))
|
2012-11-08 10:35:32 -05:00
|
|
|
|
|
1996-01-25 10:27:31 +00:00
|
|
|
|
(defconst perl-font-lock-keywords-1
|
|
|
|
|
'(;; What is this for?
|
|
|
|
|
;;("\\(--- .* ---\\|=== .* ===\\)" . font-lock-string-face)
|
|
|
|
|
;;
|
|
|
|
|
;; Fontify preprocessor statements as we do in `c-font-lock-keywords'.
|
|
|
|
|
;; Ilya Zakharevich <ilya@math.ohio-state.edu> thinks this is a bad idea.
|
2001-05-25 21:16:05 +00:00
|
|
|
|
;; ("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
|
|
|
|
|
;; ("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
|
|
|
|
|
;; ("^#[ \t]*if\\>"
|
|
|
|
|
;; ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
|
|
|
|
|
;; (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
|
|
|
|
|
;; ("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
|
|
|
|
|
;; (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t))
|
1996-01-25 10:27:31 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Fontify function and package names in declarations.
|
|
|
|
|
("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)?"
|
|
|
|
|
(1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
|
|
|
|
|
("\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
|
1998-02-20 14:58:27 +00:00
|
|
|
|
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t)))
|
1996-01-25 10:27:31 +00:00
|
|
|
|
"Subdued level highlighting for Perl mode.")
|
|
|
|
|
|
|
|
|
|
(defconst perl-font-lock-keywords-2
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(append
|
|
|
|
|
perl-font-lock-keywords-1
|
|
|
|
|
`( ;; Fontify keywords, except those fontified otherwise.
|
|
|
|
|
,(concat "\\<"
|
2012-11-08 10:37:29 -05:00
|
|
|
|
(regexp-opt '("if" "until" "while" "elsif" "else" "unless"
|
|
|
|
|
"do" "dump" "for" "foreach" "exit" "die"
|
|
|
|
|
"BEGIN" "END" "return" "exec" "eval") t)
|
|
|
|
|
"\\>")
|
|
|
|
|
;;
|
2017-07-07 17:08:52 -05:00
|
|
|
|
;; Fontify declarators and prefixes as types.
|
|
|
|
|
("\\<\\(anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\>" . font-lock-type-face) ; declarators
|
|
|
|
|
("\\<\\(let\\|temp\\)\\>" . font-lock-type-face) ; prefixes
|
2012-11-08 10:37:29 -05:00
|
|
|
|
;;
|
|
|
|
|
;; Fontify function, variable and file name references.
|
2012-11-08 10:35:32 -05:00
|
|
|
|
("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
|
2012-11-08 10:37:29 -05:00
|
|
|
|
;; Additionally underline non-scalar variables. Maybe this is a bad idea.
|
|
|
|
|
;;'("[$@%*][#{]?\\(\\sw+\\)" 1 font-lock-variable-name-face)
|
2012-11-08 10:35:32 -05:00
|
|
|
|
("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face)
|
|
|
|
|
("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)"
|
1996-01-25 10:27:31 +00:00
|
|
|
|
(2 (cons font-lock-variable-name-face '(underline))))
|
2012-11-08 10:35:32 -05:00
|
|
|
|
("<\\(\\sw+\\)>" 1 font-lock-constant-face)
|
2012-11-08 10:37:29 -05:00
|
|
|
|
;;
|
|
|
|
|
;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'.
|
2012-11-08 10:35:32 -05:00
|
|
|
|
("\\<\\(continue\\|goto\\|last\\|next\\|redo\\)\\>[ \t]*\\(\\sw+\\)?"
|
1998-02-20 14:58:27 +00:00
|
|
|
|
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
|
2013-06-05 10:26:50 -04:00
|
|
|
|
("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face)))
|
1996-01-25 10:27:31 +00:00
|
|
|
|
"Gaudy level highlighting for Perl mode.")
|
|
|
|
|
|
|
|
|
|
(defvar perl-font-lock-keywords perl-font-lock-keywords-1
|
|
|
|
|
"Default expressions to highlight in Perl mode.")
|
|
|
|
|
|
2002-09-13 18:44:29 +00:00
|
|
|
|
(defvar perl-quote-like-pairs
|
|
|
|
|
'((?\( . ?\)) (?\[ . ?\]) (?\{ . ?\}) (?\< . ?\>)))
|
|
|
|
|
|
2014-04-25 15:22:26 -04:00
|
|
|
|
(eval-and-compile
|
2015-06-15 17:10:06 -04:00
|
|
|
|
(defconst perl--syntax-exp-intro-keywords
|
|
|
|
|
'("split" "if" "unless" "until" "while" "print"
|
|
|
|
|
"grep" "map" "not" "or" "and" "for" "foreach"))
|
|
|
|
|
|
2014-04-25 15:22:26 -04:00
|
|
|
|
(defconst perl--syntax-exp-intro-regexp
|
|
|
|
|
(concat "\\(?:\\(?:^\\|[^$@&%[:word:]]\\)"
|
2015-06-15 17:10:06 -04:00
|
|
|
|
(regexp-opt perl--syntax-exp-intro-keywords)
|
2014-04-25 15:22:26 -04:00
|
|
|
|
"\\|[-?:.,;|&+*=!~({[]\\|\\(^\\)\\)[ \t\n]*")))
|
|
|
|
|
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(defun perl-syntax-propertize-function (start end)
|
|
|
|
|
(let ((case-fold-search nil))
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(perl-syntax-propertize-special-constructs end)
|
|
|
|
|
(funcall
|
|
|
|
|
(syntax-propertize-rules
|
|
|
|
|
;; Turn POD into b-style comments. Place the cut rule first since it's
|
|
|
|
|
;; more specific.
|
|
|
|
|
("^=cut\\>.*\\(\n\\)" (1 "> b"))
|
|
|
|
|
("^\\(=\\)\\sw" (1 "< b"))
|
|
|
|
|
;; Catch ${ so that ${var} doesn't screw up indentation.
|
|
|
|
|
;; This also catches $' to handle 'foo$', although it should really
|
|
|
|
|
;; check that it occurs inside a '..' string.
|
2014-04-02 20:41:09 -04:00
|
|
|
|
("\\(\\$\\)[{']" (1 (unless (and (eq ?\' (char-after (match-end 1)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(not (nth 3 (syntax-ppss
|
|
|
|
|
(match-beginning 0))))))
|
|
|
|
|
(string-to-syntax ". p"))))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; Handle funny names like $DB'stop.
|
2013-05-06 15:33:56 -04:00
|
|
|
|
("\\$ ?{?^?[_[:alpha:]][_[:alnum:]]*\\('\\)[_[:alpha:]]" (1 "_"))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; format statements
|
|
|
|
|
("^[ \t]*format.*=[ \t]*\\(\n\\)"
|
|
|
|
|
(1 (prog1 "\"" (perl-syntax-propertize-special-constructs end))))
|
2017-03-27 09:30:10 +03:00
|
|
|
|
;; Propertize perl prototype chars `$%&*;+@\[]' as punctuation
|
|
|
|
|
;; in `sub' arg-specs like `sub myfun ($)' and `sub ($)'. But
|
|
|
|
|
;; don't match subroutine signatures like `sub add ($a, $b)', or
|
|
|
|
|
;; anonymous subs like "sub { (...) ... }".
|
|
|
|
|
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;+@\\]+\\))"
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(1 "."))
|
2010-11-02 22:30:12 -04:00
|
|
|
|
;; Turn __DATA__ trailer into a comment.
|
|
|
|
|
("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"
|
|
|
|
|
(1 "< c") (2 "> c")
|
|
|
|
|
(0 (ignore (put-text-property (match-beginning 0) (match-end 0)
|
|
|
|
|
'syntax-multiline t))))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; Regexp and funny quotes. Distinguishing a / that starts a regexp
|
|
|
|
|
;; match from the division operator is ...interesting.
|
|
|
|
|
;; Basically, / is a regexp match if it's preceded by an infix operator
|
|
|
|
|
;; (or some similar separator), or by one of the special keywords
|
|
|
|
|
;; corresponding to builtin functions that can take their first arg
|
|
|
|
|
;; without parentheses. Of course, that presume we're looking at the
|
|
|
|
|
;; *opening* slash. We can afford to mis-match the closing ones
|
|
|
|
|
;; here, because they will be re-treated separately later in
|
|
|
|
|
;; perl-font-lock-special-syntactic-constructs.
|
2014-04-25 15:22:26 -04:00
|
|
|
|
((concat perl--syntax-exp-intro-regexp "\\(/\\)")
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(2 (ignore
|
|
|
|
|
(if (and (match-end 1) ; / at BOL.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (match-end 1))
|
|
|
|
|
(forward-comment (- (point-max)))
|
|
|
|
|
(put-text-property (point) (match-end 2)
|
|
|
|
|
'syntax-multiline t)
|
2015-06-15 17:10:06 -04:00
|
|
|
|
(not (or (and (eq ?w (char-syntax (preceding-char)))
|
|
|
|
|
(let ((end (point)))
|
|
|
|
|
(backward-sexp 1)
|
|
|
|
|
(member (buffer-substring (point) end)
|
|
|
|
|
perl--syntax-exp-intro-keywords)))
|
|
|
|
|
(memq (char-before)
|
|
|
|
|
'(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
nil ;; A division sign instead of a regexp-match.
|
|
|
|
|
(put-text-property (match-beginning 2) (match-end 2)
|
|
|
|
|
'syntax-table (string-to-syntax "\""))
|
|
|
|
|
(perl-syntax-propertize-special-constructs end)))))
|
2011-09-27 22:19:56 -04:00
|
|
|
|
("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\(?:\\([^])}>= \n\t]\\)\\|\\(?3:=\\)[^>]\\)"
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; Nasty cases:
|
|
|
|
|
;; /foo/m $a->m $#m $m @m %m
|
|
|
|
|
;; \s (appears often in regexps).
|
|
|
|
|
;; -s file
|
2011-09-27 22:19:56 -04:00
|
|
|
|
;; y => 3
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; sub tr {...}
|
|
|
|
|
(3 (ignore
|
|
|
|
|
(if (save-excursion (goto-char (match-beginning 0))
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
2016-02-05 23:54:21 +02:00
|
|
|
|
(forward-word-strictly -1)
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(looking-at-p "sub[ \t\n]"))
|
|
|
|
|
;; This is defining a function.
|
|
|
|
|
nil
|
2015-06-15 17:10:06 -04:00
|
|
|
|
(unless (nth 8 (save-excursion (syntax-ppss (match-beginning 1))))
|
|
|
|
|
;; Don't add this syntax-table property if
|
|
|
|
|
;; within a string, which would misbehave in cases such as
|
|
|
|
|
;; $a = "foo y \"toto\" bar" where we'd end up changing the
|
|
|
|
|
;; syntax of the backslash and hence de-escaping the embedded
|
|
|
|
|
;; double quote.
|
|
|
|
|
(put-text-property (match-beginning 3) (match-end 3)
|
|
|
|
|
'syntax-table
|
|
|
|
|
(if (assoc (char-after (match-beginning 3))
|
|
|
|
|
perl-quote-like-pairs)
|
|
|
|
|
(string-to-syntax "|")
|
|
|
|
|
(string-to-syntax "\"")))
|
|
|
|
|
(perl-syntax-propertize-special-constructs end))))))
|
2013-05-06 15:33:56 -04:00
|
|
|
|
;; Here documents.
|
2014-04-25 15:22:26 -04:00
|
|
|
|
((concat
|
|
|
|
|
"\\(?:"
|
|
|
|
|
;; << "EOF", << 'EOF', or << \EOF
|
2017-07-24 18:10:02 -04:00
|
|
|
|
"<<\\(~\\)?[ \t]*\\('[^'\n]*'\\|\"[^\"\n]*\"\\|\\\\[[:alpha:]][[:alnum:]]*\\)"
|
2014-04-25 15:22:26 -04:00
|
|
|
|
;; The <<EOF case which needs perl--syntax-exp-intro-regexp, to
|
|
|
|
|
;; disambiguate with the left-bitshift operator.
|
2017-07-24 18:10:02 -04:00
|
|
|
|
"\\|" perl--syntax-exp-intro-regexp "<<\\(?2:\\sw+\\)\\)"
|
2014-04-25 15:22:26 -04:00
|
|
|
|
".*\\(\n\\)")
|
2017-07-24 18:10:02 -04:00
|
|
|
|
(4 (let* ((st (get-text-property (match-beginning 4) 'syntax-table))
|
|
|
|
|
(name (match-string 2))
|
|
|
|
|
(indented (match-beginning 1)))
|
|
|
|
|
(goto-char (match-end 2))
|
2013-05-06 15:33:56 -04:00
|
|
|
|
(if (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
|
|
|
|
|
;; Leave the property of the newline unchanged.
|
|
|
|
|
st
|
|
|
|
|
(cons (car (string-to-syntax "< c"))
|
|
|
|
|
;; Remember the names of heredocs found on this line.
|
2017-07-24 18:10:02 -04:00
|
|
|
|
(cons (cons (pcase (aref name 0)
|
|
|
|
|
(`?\\ (substring name 1))
|
|
|
|
|
((or `?\" `?\' `?\`) (substring name 1 -1))
|
|
|
|
|
(_ name))
|
|
|
|
|
indented)
|
2013-05-06 15:33:56 -04:00
|
|
|
|
(cdr st)))))))
|
|
|
|
|
;; We don't call perl-syntax-propertize-special-constructs directly
|
|
|
|
|
;; from the << rule, because there might be other elements (between
|
|
|
|
|
;; the << and the \n) that need to be propertized.
|
|
|
|
|
("\\(?:$\\)\\s<"
|
|
|
|
|
(0 (ignore (perl-syntax-propertize-special-constructs end))))
|
|
|
|
|
)
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(point) end)))
|
2002-09-13 18:44:29 +00:00
|
|
|
|
|
|
|
|
|
(defvar perl-empty-syntax-table
|
|
|
|
|
(let ((st (copy-syntax-table)))
|
|
|
|
|
;; Make all chars be of punctuation syntax.
|
|
|
|
|
(dotimes (i 256) (aset st i '(1)))
|
|
|
|
|
(modify-syntax-entry ?\\ "\\" st)
|
|
|
|
|
st)
|
|
|
|
|
"Syntax table used internally for processing quote-like operators.")
|
|
|
|
|
|
|
|
|
|
(defun perl-quote-syntax-table (char)
|
|
|
|
|
(let ((close (cdr (assq char perl-quote-like-pairs)))
|
|
|
|
|
(st (copy-syntax-table perl-empty-syntax-table)))
|
|
|
|
|
(if (not close)
|
|
|
|
|
(modify-syntax-entry char "\"" st)
|
|
|
|
|
(modify-syntax-entry char "(" st)
|
|
|
|
|
(modify-syntax-entry close ")" st))
|
|
|
|
|
st))
|
2001-06-10 18:02:43 +00:00
|
|
|
|
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(defun perl-syntax-propertize-special-constructs (limit)
|
|
|
|
|
"Propertize special constructs like regexps and formats."
|
2005-11-02 17:33:28 +00:00
|
|
|
|
(let ((state (syntax-ppss))
|
|
|
|
|
char)
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(cond
|
2013-05-06 15:33:56 -04:00
|
|
|
|
((eq 2 (nth 7 state))
|
|
|
|
|
;; A Here document.
|
|
|
|
|
(let ((names (cdr (get-text-property (nth 8 state) 'syntax-table))))
|
|
|
|
|
(when (cdr names)
|
|
|
|
|
(setq names (reverse names))
|
|
|
|
|
;; Multiple heredocs on a single line, we have to search from the
|
|
|
|
|
;; beginning, since we don't know which names might be
|
|
|
|
|
;; before point.
|
|
|
|
|
(goto-char (nth 8 state)))
|
|
|
|
|
(while (and names
|
|
|
|
|
(re-search-forward
|
2017-07-24 18:10:02 -04:00
|
|
|
|
(pcase-let ((`(,name . ,indented) (pop names)))
|
|
|
|
|
(concat "^" (if indented "[ \t]*")
|
|
|
|
|
(regexp-quote name) "\n"))
|
2013-05-06 15:33:56 -04:00
|
|
|
|
limit 'move))
|
|
|
|
|
(unless names
|
|
|
|
|
(put-text-property (1- (point)) (point) 'syntax-table
|
|
|
|
|
(string-to-syntax "> c"))))))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
((or (null (setq char (nth 3 state)))
|
|
|
|
|
(and (characterp char) (eq (char-syntax (nth 3 state)) ?\")))
|
|
|
|
|
;; Normal text, or comment, or docstring, or normal string.
|
|
|
|
|
nil)
|
|
|
|
|
((eq (nth 3 state) ?\n)
|
|
|
|
|
;; A `format' command.
|
|
|
|
|
(when (re-search-forward "^\\s *\\.\\s *\n" limit 'move)
|
|
|
|
|
(put-text-property (1- (point)) (point)
|
|
|
|
|
'syntax-table (string-to-syntax "\""))))
|
|
|
|
|
(t
|
|
|
|
|
;; This is regexp like quote thingy.
|
|
|
|
|
(setq char (char-after (nth 8 state)))
|
2011-01-24 15:10:04 -05:00
|
|
|
|
(let ((startpos (point))
|
|
|
|
|
(twoargs (save-excursion
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(goto-char (nth 8 state))
|
|
|
|
|
(skip-syntax-backward " ")
|
|
|
|
|
(skip-syntax-backward "w")
|
|
|
|
|
(member (buffer-substring
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
2016-02-05 23:54:21 +02:00
|
|
|
|
(point) (progn (forward-word-strictly 1)
|
|
|
|
|
(point)))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
'("tr" "s" "y"))))
|
|
|
|
|
(close (cdr (assq char perl-quote-like-pairs)))
|
|
|
|
|
(st (perl-quote-syntax-table char)))
|
|
|
|
|
(when (with-syntax-table st
|
|
|
|
|
(if close
|
|
|
|
|
;; For paired delimiters, Perl allows nesting them, but
|
|
|
|
|
;; since we treat them as strings, Emacs does not count
|
|
|
|
|
;; those delimiters in `state', so we don't know how deep
|
|
|
|
|
;; we are: we have to go back to the beginning of this
|
|
|
|
|
;; "string" and count from there.
|
|
|
|
|
(condition-case nil
|
2012-03-29 23:13:04 -04:00
|
|
|
|
(progn
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; Start after the first char since it doesn't have
|
|
|
|
|
;; paren-syntax (an alternative would be to let-bind
|
|
|
|
|
;; parse-sexp-lookup-properties).
|
|
|
|
|
(goto-char (1+ (nth 8 state)))
|
|
|
|
|
(up-list 1)
|
|
|
|
|
t)
|
2011-01-24 15:10:04 -05:00
|
|
|
|
;; In case of error, make sure we don't move backward.
|
|
|
|
|
(scan-error (goto-char startpos) nil))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(not (or (nth 8 (parse-partial-sexp
|
2012-03-14 23:09:26 -04:00
|
|
|
|
;; Since we don't know if point is within
|
|
|
|
|
;; the first or the scond arg, we have to
|
|
|
|
|
;; start from the beginning.
|
|
|
|
|
(if twoargs (1+ (nth 8 state)) (point))
|
|
|
|
|
limit nil nil state 'syntax-table))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; If we have a self-paired opener and a twoargs
|
|
|
|
|
;; command, the form is s/../../ so we have to skip
|
|
|
|
|
;; a second time.
|
|
|
|
|
;; In the case of s{...}{...}, we only handle the
|
|
|
|
|
;; first part here and the next below.
|
|
|
|
|
(when (and twoargs (not close))
|
|
|
|
|
(nth 8 (parse-partial-sexp
|
|
|
|
|
(point) limit
|
|
|
|
|
nil nil state 'syntax-table)))))))
|
|
|
|
|
;; Point is now right after the arg(s).
|
|
|
|
|
(when (eq (char-before (1- (point))) ?$)
|
|
|
|
|
(put-text-property (- (point) 2) (1- (point))
|
|
|
|
|
'syntax-table '(1)))
|
|
|
|
|
(put-text-property (1- (point)) (point)
|
|
|
|
|
'syntax-table
|
|
|
|
|
(if close
|
|
|
|
|
(string-to-syntax "|")
|
|
|
|
|
(string-to-syntax "\"")))
|
|
|
|
|
;; If we have two args with a non-self-paired starter (e.g.
|
|
|
|
|
;; s{...}{...}) we're right after the first arg, so we still have to
|
|
|
|
|
;; handle the second part.
|
|
|
|
|
(when (and twoargs close)
|
2012-03-29 23:13:04 -04:00
|
|
|
|
;; Skip whitespace and make sure that font-lock will
|
|
|
|
|
;; refontify the second part in the proper context.
|
|
|
|
|
(put-text-property
|
|
|
|
|
(point) (progn (forward-comment (point-max)) (point))
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
'syntax-multiline t)
|
2012-03-29 23:13:04 -04:00
|
|
|
|
;;
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(when (< (point) limit)
|
2012-03-29 23:13:04 -04:00
|
|
|
|
(put-text-property (point) (1+ (point))
|
|
|
|
|
'syntax-table
|
|
|
|
|
(if (assoc (char-after)
|
|
|
|
|
perl-quote-like-pairs)
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
;; Put an `e' in the cdr to mark this
|
|
|
|
|
;; char as "second arg starter".
|
|
|
|
|
(string-to-syntax "|e")
|
|
|
|
|
(string-to-syntax "\"e")))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
;; Re-use perl-syntax-propertize-special-constructs to handle the
|
|
|
|
|
;; second part (the first delimiter of second part can't be
|
|
|
|
|
;; preceded by "s" or "tr" or "y", so it will not be considered
|
|
|
|
|
;; as twoarg).
|
|
|
|
|
(perl-syntax-propertize-special-constructs limit)))))))))
|
|
|
|
|
|
|
|
|
|
(defun perl-font-lock-syntactic-face-function (state)
|
|
|
|
|
(cond
|
|
|
|
|
((and (nth 3 state)
|
|
|
|
|
(eq ?e (cdr-safe (get-text-property (nth 8 state) 'syntax-table)))
|
|
|
|
|
;; This is a second-arg of s{..}{...} form; let's check if this second
|
|
|
|
|
;; arg is executable code rather than a string. For that, we need to
|
|
|
|
|
;; look for an "e" after this second arg, so we have to hunt for the
|
|
|
|
|
;; end of the arg. Depending on whether the whole arg has already
|
|
|
|
|
;; been syntax-propertized or not, the end-char will have different
|
|
|
|
|
;; syntaxes, so let's ignore syntax-properties temporarily so we can
|
|
|
|
|
;; pretend it has not been syntax-propertized yet.
|
|
|
|
|
(let* ((parse-sexp-lookup-properties nil)
|
|
|
|
|
(char (char-after (nth 8 state)))
|
|
|
|
|
(paired (assq char perl-quote-like-pairs)))
|
|
|
|
|
(with-syntax-table (perl-quote-syntax-table char)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if (not paired)
|
|
|
|
|
(parse-partial-sexp (point) (point-max)
|
|
|
|
|
nil nil state 'syntax-table)
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (1+ (nth 8 state)))
|
|
|
|
|
(up-list 1))
|
|
|
|
|
(scan-error (goto-char (point-max)))))
|
|
|
|
|
(put-text-property (nth 8 state) (point)
|
|
|
|
|
'jit-lock-defer-multiline t)
|
|
|
|
|
(looking-at "[ \t]*\\sw*e")))))
|
|
|
|
|
nil)
|
|
|
|
|
(t (funcall (default-value 'font-lock-syntactic-face-function) state))))
|
1994-10-07 10:08:48 +00:00
|
|
|
|
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-indent-level 4
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Indentation of Perl statements with respect to containing block."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
2007-08-25 20:14:54 +00:00
|
|
|
|
|
2007-12-09 19:19:46 +00:00
|
|
|
|
;; Is is not unusual to put both things like perl-indent-level and
|
2007-08-25 20:14:54 +00:00
|
|
|
|
;; cperl-indent-level in the local variable section of a file. If only
|
|
|
|
|
;; one of perl-mode and cperl-mode is in use, a warning will be issued
|
2007-12-09 19:19:46 +00:00
|
|
|
|
;; about the variable. Autoload these here, so that no warning is
|
2007-08-25 20:14:54 +00:00
|
|
|
|
;; issued when using either perl-mode or cperl-mode.
|
|
|
|
|
;;;###autoload(put 'perl-indent-level 'safe-local-variable 'integerp)
|
2007-12-09 19:19:46 +00:00
|
|
|
|
;;;###autoload(put 'perl-continued-statement-offset 'safe-local-variable 'integerp)
|
|
|
|
|
;;;###autoload(put 'perl-continued-brace-offset 'safe-local-variable 'integerp)
|
|
|
|
|
;;;###autoload(put 'perl-brace-offset 'safe-local-variable 'integerp)
|
|
|
|
|
;;;###autoload(put 'perl-brace-imaginary-offset 'safe-local-variable 'integerp)
|
|
|
|
|
;;;###autoload(put 'perl-label-offset 'safe-local-variable 'integerp)
|
2007-08-25 20:14:54 +00:00
|
|
|
|
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-continued-statement-offset 4
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Extra indent for lines not starting new statements."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-continued-brace-offset -4
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Extra indent for substatements that start with open-braces.
|
1998-02-22 19:51:45 +00:00
|
|
|
|
This is in addition to `perl-continued-statement-offset'."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-brace-offset 0
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Extra indentation for braces, compared with other text in same context."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-brace-imaginary-offset 0
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Imagined indentation of an open brace that actually follows a statement."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-label-offset -2
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Offset of Perl label lines relative to usual indentation."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'integer)
|
2001-10-05 09:36:31 +00:00
|
|
|
|
(defcustom perl-indent-continued-arguments nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"If non-nil offset of argument lines relative to usual indentation.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
If nil, continued arguments are aligned with the first argument."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type '(choice integer (const nil)))
|
1998-02-22 19:51:45 +00:00
|
|
|
|
|
2012-04-16 19:46:22 -07:00
|
|
|
|
(defcustom perl-indent-parens-as-block nil
|
|
|
|
|
"Non-nil means that non-block ()-, {}- and []-groups are indented as blocks.
|
|
|
|
|
The closing bracket is aligned with the line of the opening bracket,
|
|
|
|
|
not the contents of the brackets."
|
2012-08-15 09:29:11 -07:00
|
|
|
|
:version "24.3"
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'boolean)
|
2012-04-16 19:46:22 -07:00
|
|
|
|
|
2003-05-17 22:38:13 +00:00
|
|
|
|
(defcustom perl-tab-always-indent tab-always-indent
|
|
|
|
|
"Non-nil means TAB in Perl mode always indents the current line.
|
1994-01-14 20:54:08 +00:00
|
|
|
|
Otherwise it inserts a tab character if you type it past the first
|
1998-02-22 19:51:45 +00:00
|
|
|
|
nonwhite character on the line."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'boolean)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
1995-02-23 06:26:55 +00:00
|
|
|
|
;; I changed the default to nil for consistency with general Emacs
|
|
|
|
|
;; conventions -- rms.
|
1998-02-22 19:51:45 +00:00
|
|
|
|
(defcustom perl-tab-to-comment nil
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Non-nil means TAB moves to eol or makes a comment in some cases.
|
1994-01-14 20:54:08 +00:00
|
|
|
|
For lines which don't need indenting, TAB either indents an
|
|
|
|
|
existing comment, moves to end-of-line, or if at end-of-line already,
|
1998-02-22 19:51:45 +00:00
|
|
|
|
create a new comment."
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:type 'boolean)
|
1998-02-22 19:51:45 +00:00
|
|
|
|
|
2013-10-08 01:10:10 -04:00
|
|
|
|
(defcustom perl-nochange "\f"
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Lines starting with this regular expression are not auto-indented."
|
2005-05-19 19:06:19 +00:00
|
|
|
|
:type 'regexp
|
2013-10-08 01:10:10 -04:00
|
|
|
|
:options '(";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:[^:]"))
|
2005-02-27 23:13:19 +00:00
|
|
|
|
|
|
|
|
|
;; Outline support
|
|
|
|
|
|
|
|
|
|
(defvar perl-outline-regexp
|
|
|
|
|
(concat (mapconcat 'cadr perl-imenu-generic-expression "\\|")
|
|
|
|
|
"\\|^=cut\\>"))
|
|
|
|
|
|
|
|
|
|
(defun perl-outline-level ()
|
|
|
|
|
(cond
|
2012-11-08 10:35:32 -05:00
|
|
|
|
((looking-at "[ \t]*\\(package\\)\\s-")
|
|
|
|
|
(- (match-beginning 1) (match-beginning 0)))
|
|
|
|
|
((looking-at "[ \t]*s\\(ub\\)\\s-")
|
|
|
|
|
(- (match-beginning 1) (match-beginning 0)))
|
2005-02-27 23:13:19 +00:00
|
|
|
|
((looking-at "=head[0-9]") (- (char-before (match-end 0)) ?0))
|
|
|
|
|
((looking-at "=cut") 1)
|
|
|
|
|
(t 3)))
|
2012-12-01 12:57:07 +08:00
|
|
|
|
|
|
|
|
|
(defun perl-current-defun-name ()
|
|
|
|
|
"The `add-log-current-defun' function in Perl mode."
|
2012-12-01 13:09:12 +08:00
|
|
|
|
(save-excursion
|
|
|
|
|
(if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
|
|
|
|
|
(match-string-no-properties 1))))
|
|
|
|
|
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2005-03-18 00:13:40 +00:00
|
|
|
|
(defvar perl-mode-hook nil
|
|
|
|
|
"Normal hook to run when entering Perl mode.")
|
|
|
|
|
|
1998-04-30 03:22:20 +00:00
|
|
|
|
;;;###autoload
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
(define-derived-mode perl-mode prog-mode "Perl"
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Major mode for editing Perl code.
|
|
|
|
|
Expression and list commands understand all Perl brackets.
|
|
|
|
|
Tab indents for Perl code.
|
|
|
|
|
Comments are delimited with # ... \\n.
|
|
|
|
|
Paragraphs are separated by blank lines only.
|
|
|
|
|
Delete converts tabs to spaces as it moves back.
|
|
|
|
|
\\{perl-mode-map}
|
|
|
|
|
Variables controlling indentation style:
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-tab-always-indent'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Non-nil means TAB in Perl mode should always indent the current line,
|
|
|
|
|
regardless of where in the line point is when the TAB command is used.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-tab-to-comment'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Non-nil means that for lines which don't need indenting, TAB will
|
2003-02-04 13:24:35 +00:00
|
|
|
|
either delete an empty comment, indent an existing comment, move
|
1991-12-21 09:29:41 +00:00
|
|
|
|
to end-of-line, or if at end-of-line already, create a new comment.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-nochange'
|
1994-01-14 20:54:08 +00:00
|
|
|
|
Lines starting with this regular expression are not auto-indented.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-indent-level'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Indentation of Perl statements within surrounding block.
|
|
|
|
|
The surrounding block's indentation is the indentation
|
|
|
|
|
of the line on which the open-brace appears.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-continued-statement-offset'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Extra indentation given to a substatement, such as the
|
|
|
|
|
then-clause of an if or body of a while.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-continued-brace-offset'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Extra indentation given to a brace that starts a substatement.
|
1994-01-14 20:54:08 +00:00
|
|
|
|
This is in addition to `perl-continued-statement-offset'.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-brace-offset'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Extra indentation for line if it starts with an open brace.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-brace-imaginary-offset'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
An open brace following other text is treated as if it were
|
|
|
|
|
this far to the right of the start of its line.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-label-offset'
|
1991-12-21 09:29:41 +00:00
|
|
|
|
Extra indentation for line that is a label.
|
2001-10-05 09:36:31 +00:00
|
|
|
|
`perl-indent-continued-arguments'
|
|
|
|
|
Offset of argument lines relative to usual indentation.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
Various indentation styles: K&R BSD BLK GNU LW
|
|
|
|
|
perl-indent-level 5 8 0 2 4
|
|
|
|
|
perl-continued-statement-offset 5 8 4 2 4
|
|
|
|
|
perl-continued-brace-offset 0 0 0 0 -4
|
|
|
|
|
perl-brace-offset -5 -8 0 0 0
|
|
|
|
|
perl-brace-imaginary-offset 0 0 4 0 0
|
|
|
|
|
perl-label-offset -5 -8 -2 -2 -2
|
|
|
|
|
|
1994-01-14 20:54:08 +00:00
|
|
|
|
Turning on Perl mode runs the normal hook `perl-mode-hook'."
|
Derive from prog-mode, use derived-mode-p, and fix up various
minor style issues in lisp/progmodes.
* lisp/progmodes/vhdl-mode.el (vhdl-write-file-hooks-init)
(vhdl-hs-minor-mode, vhdl-ps-print-init): Fix make-local-variable ->
make-local-hook.
* lisp/progmodes/sh-script.el (sh-require-final-newline): Remove.
(sh-set-shell): Don't set require-final-newline since it's already done
by prog-mode.
* lisp/progmodes/modula2.el (m2-mode): Don't make m2-end-comment-column
since we never set it.
* lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation):
Use read-string and standard prompt.
* lisp/progmodes/dcl-mode.el (dcl-mode-map): Move init into declaration.
* lisp/progmodes/meta-mode.el (meta-mode-abbrev-table): Merge init and decl.
(meta-common-mode-syntax-table): Rename from meta-mode-syntax-table.
(meta-common-mode-map): Rename from meta-mode-map.
Remove C-m binding, which is a user preference, not mode specific.
(meta-common-mode): New major mode; replace meta-common-initialization.
* lisp/progmodes/js.el (js-mode): Call syntax-propertize rather than messing
around with font-lock.
* lisp/progmodes/etags.el (select-tags-table-mode):
Derive from special-mode.
* lisp/progmodes/octave-mod.el (octave-mode):
* lisp/progmodes/gdb-mi.el (gdb-inferior-io-mode, gdb-threads-mode)
(gdb-memory-mode, gdb-disassembly-mode, gdb-breakpoints-mode)
(gdb-frames-mode, gdb-locals-mode, gdb-registers-mode):
Let define-derived-mode do its job.
* lisp/progmodes/cpp.el (cpp-edit-mode-map):
Move initialization into declaration.
(cpp-edit-mode): Use define-derived-mode.
(cpp-edit-load): Use derived-mode-p.
* lisp/progmodes/mixal-mode.el (mixal-mode):
* lisp/progmodes/f90.el (f90-mode):
* lisp/progmodes/cfengine.el (cfengine-mode): Don't bother setting
require-final-newline since prog-mode does it already.
* lisp/progmodes/cc-cmds.el (c-update-modeline): Use match-string.
* lisp/progmodes/asm-mode.el (asm-mode-map): Fix menu setup.
* lisp/progmodes/antlr-mode.el: Require cc-mode upfront.
(antlr-mode-syntax-table, antlr-action-syntax-table): Initialize in
the declaration.
(antlr-directory-dependencies, antlr-show-makefile-rules):
Use derived-mode-p.
(antlr-language-option): Don't assume point-min==1.
(antlr-mode): Use define-derived-mode.
* lisp/progmodes/ada-mode.el: Use derived-mode-p.
(ada-mode): Use define-derived-mode.
Use hack-local-variables-hook.
* lisp/progmodes/vhdl-mode.el (vhdl-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vera-mode.el (vera-mode):
* lisp/progmodes/sql.el (sql-mode):
* lisp/progmodes/scheme.el (scheme-mode):
* lisp/progmodes/perl-mode.el (perl-mode):
* lisp/progmodes/octave-inf.el (inferior-octave-mode):
* lisp/progmodes/autoconf.el (autoconf-mode):
* lisp/progmodes/m4-mode.el (m4-mode):
* lisp/progmodes/inf-lisp.el (inferior-lisp-mode):
* lisp/progmodes/idlwave.el (idlwave-mode):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/idlw-help.el (idlwave-help-mode):
* lisp/progmodes/dcl-mode.el (dcl-mode):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode):
* lisp/progmodes/ebrowse.el (ebrowse-tree-mode, ebrowse-electric-list-mode)
(ebrowse-member-mode, ebrowse-electric-position-mode):
Use define-derived-mode.
* lisp/progmodes/xscheme.el (xscheme-start)
(local-set-scheme-interaction-buffer, scheme-interaction-mode):
* lisp/progmodes/which-func.el (which-function):
* lisp/progmodes/vhdl-mode.el (vhdl-set-style):
* lisp/progmodes/verilog-mode.el (verilog-set-compile-command)
(verilog-modify-compile-command, verilog-error-regexp-add-xemacs)
(verilog-set-define, verilog-auto-reeval-locals):
* lisp/progmodes/sql.el (sql-product-font-lock, sql-interactive-mode):
* lisp/progmodes/simula.el (simula-mode):
* lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode):
* lisp/progmodes/python.el (python-check, python-mode):
* lisp/progmodes/prolog.el (prolog-mode-variables):
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions):
* lisp/progmodes/ebrowse.el (ebrowse-view-file-other-frame):
* lisp/progmodes/delphi.el (delphi-mode):
* lisp/progmodes/cc-styles.el (c-setup-paragraph-variables):
* lisp/progmodes/cc-mode.el (c-basic-common-init, c-common-init)
(c-font-lock-init): Move make-local-variable to their setq.
* lisp/progmodes/xscheme.el (exit-scheme-interaction-mode)
(xscheme-enter-interaction-mode, xscheme-enter-debugger-mode)
(xscheme-debugger-mode-p, xscheme-send-string-1):
* lisp/progmodes/tcl.el (inferior-tcl-proc, tcl-current-word)
(tcl-load-file, tcl-restart-with-file):
* lisp/progmodes/ps-mode.el (ps-run-running):
* lisp/progmodes/gdb-mi.el (gud-watch, gdb-mouse-set-clear-breakpoint):
* lisp/progmodes/js.el (js--get-all-known-symbols):
* lisp/progmodes/inf-lisp.el (inferior-lisp-proc):
* lisp/progmodes/idlwave.el (idlwave-beginning-of-statement)
(idlwave-template, idlwave-update-buffer-routine-info)
(idlwave-update-current-buffer-info)
(idlwave-get-routine-info-from-buffers, idlwave-choose)
(idlwave-scan-class-info, idlwave-fix-keywords)
(idlwave-list-buffer-load-path-shadows):
* lisp/progmodes/idlw-toolbar.el (idlwave-toolbar, idlwave-toolbar-add)
(idlwave-toolbar-remove):
* lisp/progmodes/idlw-shell.el (idlwave-shell-save-and-action)
(idlwave-shell-file-name, idlwave-shell-electric-debug-all-off)
(idlwave-shell-menu-def):
* lisp/progmodes/idlw-complete-structtag.el
(idlwave-prepare-structure-tag-completion):
* lisp/progmodes/gud.el (gud-set-buffer):
* lisp/progmodes/f90.el (f90-backslash-not-special):
* lisp/progmodes/delphi.el (delphi-find-unit): Use derived-mode-p.
2010-12-10 15:00:25 -05:00
|
|
|
|
:abbrev-table perl-mode-abbrev-table
|
Convert several major modes to setq-local.
* emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/js.el (js-mode):
* progmodes/make-mode.el (makefile-mode, makefile-makepp-mode)
(makefile-bsdmake-mode, makefile-imake-mode, makefile-browse):
* progmodes/perl-mode.el (perl-mode):
* progmodes/sh-script.el (sh-mode, sh-set-shell):
* textmodes/css-mode.el (css-mode):
* textmodes/sgml-mode.el (html-mode, sgml-mode)
(sgml-tags-invisible, sgml-guess-indent):
* textmodes/tex-mode.el (tex-common-initialization)
(latex-complete-bibtex-keys, tex-shell, tex-main-file)
(doctex-mode, plain-tex-mode, latex-mode):
* textmodes/texinfo.el (texinfo-mode): Use setq-local.
2012-12-01 12:09:55 +08:00
|
|
|
|
(setq-local paragraph-start (concat "$\\|" page-delimiter))
|
|
|
|
|
(setq-local paragraph-separate paragraph-start)
|
|
|
|
|
(setq-local paragraph-ignore-fill-prefix t)
|
|
|
|
|
(setq-local indent-line-function #'perl-indent-line)
|
|
|
|
|
(setq-local comment-start "# ")
|
|
|
|
|
(setq-local comment-end "")
|
|
|
|
|
(setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *")
|
|
|
|
|
(setq-local comment-indent-function #'perl-comment-indent)
|
|
|
|
|
(setq-local parse-sexp-ignore-comments t)
|
2013-06-05 10:26:50 -04:00
|
|
|
|
|
1996-01-25 10:27:31 +00:00
|
|
|
|
;; Tell font-lock.el how to handle Perl.
|
2013-06-05 13:48:50 -04:00
|
|
|
|
(setq font-lock-defaults '((perl-font-lock-keywords
|
|
|
|
|
perl-font-lock-keywords-1
|
|
|
|
|
perl-font-lock-keywords-2)
|
2013-06-05 10:26:50 -04:00
|
|
|
|
nil nil ((?\_ . "w")) nil
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(font-lock-syntactic-face-function
|
|
|
|
|
. perl-font-lock-syntactic-face-function)))
|
2013-06-19 00:13:25 +02:00
|
|
|
|
(setq-local prettify-symbols-alist perl--prettify-symbols-alist)
|
Convert several major modes to setq-local.
* emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/js.el (js-mode):
* progmodes/make-mode.el (makefile-mode, makefile-makepp-mode)
(makefile-bsdmake-mode, makefile-imake-mode, makefile-browse):
* progmodes/perl-mode.el (perl-mode):
* progmodes/sh-script.el (sh-mode, sh-set-shell):
* textmodes/css-mode.el (css-mode):
* textmodes/sgml-mode.el (html-mode, sgml-mode)
(sgml-tags-invisible, sgml-guess-indent):
* textmodes/tex-mode.el (tex-common-initialization)
(latex-complete-bibtex-keys, tex-shell, tex-main-file)
(doctex-mode, plain-tex-mode, latex-mode):
* textmodes/texinfo.el (texinfo-mode): Use setq-local.
2012-12-01 12:09:55 +08:00
|
|
|
|
(setq-local syntax-propertize-function #'perl-syntax-propertize-function)
|
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
2010-09-11 01:13:42 +02:00
|
|
|
|
(add-hook 'syntax-propertize-extend-region-functions
|
|
|
|
|
#'syntax-propertize-multiline 'append 'local)
|
2012-11-08 10:35:32 -05:00
|
|
|
|
;; Electricity.
|
|
|
|
|
;; FIXME: setup electric-layout-rules.
|
Convert several major modes to setq-local.
* emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/js.el (js-mode):
* progmodes/make-mode.el (makefile-mode, makefile-makepp-mode)
(makefile-bsdmake-mode, makefile-imake-mode, makefile-browse):
* progmodes/perl-mode.el (perl-mode):
* progmodes/sh-script.el (sh-mode, sh-set-shell):
* textmodes/css-mode.el (css-mode):
* textmodes/sgml-mode.el (html-mode, sgml-mode)
(sgml-tags-invisible, sgml-guess-indent):
* textmodes/tex-mode.el (tex-common-initialization)
(latex-complete-bibtex-keys, tex-shell, tex-main-file)
(doctex-mode, plain-tex-mode, latex-mode):
* textmodes/texinfo.el (texinfo-mode): Use setq-local.
2012-12-01 12:09:55 +08:00
|
|
|
|
(setq-local electric-indent-chars
|
|
|
|
|
(append '(?\{ ?\} ?\; ?\:) electric-indent-chars))
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(add-hook 'electric-indent-functions #'perl-electric-noindent-p nil t)
|
1995-07-26 18:01:10 +00:00
|
|
|
|
;; Tell imenu how to handle Perl.
|
Convert several major modes to setq-local.
* emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/js.el (js-mode):
* progmodes/make-mode.el (makefile-mode, makefile-makepp-mode)
(makefile-bsdmake-mode, makefile-imake-mode, makefile-browse):
* progmodes/perl-mode.el (perl-mode):
* progmodes/sh-script.el (sh-mode, sh-set-shell):
* textmodes/css-mode.el (css-mode):
* textmodes/sgml-mode.el (html-mode, sgml-mode)
(sgml-tags-invisible, sgml-guess-indent):
* textmodes/tex-mode.el (tex-common-initialization)
(latex-complete-bibtex-keys, tex-shell, tex-main-file)
(doctex-mode, plain-tex-mode, latex-mode):
* textmodes/texinfo.el (texinfo-mode): Use setq-local.
2012-12-01 12:09:55 +08:00
|
|
|
|
(setq-local imenu-generic-expression perl-imenu-generic-expression)
|
2001-11-21 11:01:55 +00:00
|
|
|
|
(setq imenu-case-fold-search nil)
|
2005-02-27 23:13:19 +00:00
|
|
|
|
;; Setup outline-minor-mode.
|
Convert several major modes to setq-local.
* emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode):
* progmodes/autoconf.el (autoconf-mode):
* progmodes/js.el (js-mode):
* progmodes/make-mode.el (makefile-mode, makefile-makepp-mode)
(makefile-bsdmake-mode, makefile-imake-mode, makefile-browse):
* progmodes/perl-mode.el (perl-mode):
* progmodes/sh-script.el (sh-mode, sh-set-shell):
* textmodes/css-mode.el (css-mode):
* textmodes/sgml-mode.el (html-mode, sgml-mode)
(sgml-tags-invisible, sgml-guess-indent):
* textmodes/tex-mode.el (tex-common-initialization)
(latex-complete-bibtex-keys, tex-shell, tex-main-file)
(doctex-mode, plain-tex-mode, latex-mode):
* textmodes/texinfo.el (texinfo-mode): Use setq-local.
2012-12-01 12:09:55 +08:00
|
|
|
|
(setq-local outline-regexp perl-outline-regexp)
|
2012-12-01 12:57:07 +08:00
|
|
|
|
(setq-local outline-level 'perl-outline-level)
|
|
|
|
|
(setq-local add-log-current-defun-function #'perl-current-defun-name))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
;; This is used by indent-for-comment
|
|
|
|
|
;; to decide how much to indent a comment in Perl code
|
|
|
|
|
;; based on its context.
|
|
|
|
|
(defun perl-comment-indent ()
|
|
|
|
|
(if (and (bolp) (not (eolp)))
|
|
|
|
|
0 ;Existing comment at bol stays there.
|
2001-05-25 21:16:05 +00:00
|
|
|
|
comment-column))
|
|
|
|
|
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(define-obsolete-function-alias 'electric-perl-terminator
|
|
|
|
|
'perl-electric-terminator "22.1")
|
2013-10-08 01:10:10 -04:00
|
|
|
|
(defun perl-electric-noindent-p (_char)
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(unless (eolp) 'no-indent))
|
|
|
|
|
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(defun perl-electric-terminator (arg)
|
2011-10-04 22:28:55 -07:00
|
|
|
|
"Insert character and maybe adjust indentation.
|
|
|
|
|
If at end-of-line, and not in a comment or a quote, correct the indentation."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((insertpos (point)))
|
|
|
|
|
(and (not arg) ; decide whether to indent
|
|
|
|
|
(eolp)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(and (not ; eliminate comments quickly
|
1996-10-26 18:14:31 +00:00
|
|
|
|
(and comment-start-skip
|
|
|
|
|
(re-search-forward comment-start-skip insertpos t)) )
|
2009-01-09 04:23:38 +00:00
|
|
|
|
(or (/= last-command-event ?:)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
;; Colon is special only after a label ....
|
|
|
|
|
(looking-at "\\s-*\\(\\w\\|\\s_\\)+$"))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(let ((pps (parse-partial-sexp
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(perl-beginning-of-function) insertpos)))
|
|
|
|
|
(not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))
|
|
|
|
|
(progn ; must insert, indent, delete
|
2009-01-09 04:23:38 +00:00
|
|
|
|
(insert-char last-command-event 1)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(perl-indent-line)
|
|
|
|
|
(delete-char -1))))
|
|
|
|
|
(self-insert-command (prefix-numeric-value arg)))
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(make-obsolete 'perl-electric-terminator 'electric-indent-mode "24.4")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
;; not used anymore, but may be useful someday:
|
|
|
|
|
;;(defun perl-inside-parens-p ()
|
|
|
|
|
;; (condition-case ()
|
|
|
|
|
;; (save-excursion
|
|
|
|
|
;; (save-restriction
|
|
|
|
|
;; (narrow-to-region (point)
|
|
|
|
|
;; (perl-beginning-of-function))
|
|
|
|
|
;; (goto-char (point-max))
|
|
|
|
|
;; (= (char-after (or (scan-lists (point) -1 1) (point-min))) ?\()))
|
|
|
|
|
;; (error nil)))
|
|
|
|
|
|
|
|
|
|
(defun perl-indent-command (&optional arg)
|
2009-01-28 02:17:29 +00:00
|
|
|
|
"Indent Perl code in the active region or current line.
|
|
|
|
|
In Transient Mark mode, when the region is active, reindent the region.
|
|
|
|
|
Otherwise, with a prefix argument, reindent the current line
|
|
|
|
|
unconditionally.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2009-01-28 02:17:29 +00:00
|
|
|
|
Otherwise, if `perl-tab-always-indent' is nil and point is not in
|
|
|
|
|
the indentation area at the beginning of the line, insert a tab.
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2009-01-28 02:17:29 +00:00
|
|
|
|
Otherwise, indent the current line. If point was within the
|
|
|
|
|
indentation area, it is moved to the end of the indentation area.
|
|
|
|
|
If the line was already indented properly and point was not
|
|
|
|
|
within the indentation area, and if `perl-tab-to-comment' is
|
|
|
|
|
non-nil (the default), then do the first possible action from the
|
|
|
|
|
following list:
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
1) delete an empty comment
|
|
|
|
|
2) move forward to start of comment, indenting if necessary
|
|
|
|
|
3) move forward to end of line
|
|
|
|
|
4) create an empty comment
|
|
|
|
|
5) move backward to start of comment, indenting if necessary."
|
|
|
|
|
(interactive "P")
|
2009-01-28 02:17:29 +00:00
|
|
|
|
(cond ((use-region-p) ; indent the active region
|
|
|
|
|
(indent-region (region-beginning) (region-end)))
|
|
|
|
|
(arg
|
|
|
|
|
(perl-indent-line "\f")) ; just indent this line
|
|
|
|
|
((and (not perl-tab-always-indent)
|
|
|
|
|
(> (current-column) (current-indentation)))
|
|
|
|
|
(insert-tab))
|
|
|
|
|
(t
|
|
|
|
|
(let* ((oldpnt (point))
|
|
|
|
|
(lsexp (progn (beginning-of-line) (point)))
|
|
|
|
|
(bof (perl-beginning-of-function))
|
|
|
|
|
(delta (progn
|
|
|
|
|
(goto-char oldpnt)
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(perl-indent-line "\f\\|;?#"))))
|
2009-01-28 02:17:29 +00:00
|
|
|
|
(and perl-tab-to-comment
|
|
|
|
|
(= oldpnt (point)) ; done if point moved
|
|
|
|
|
(if (listp delta) ; if line starts in a quoted string
|
|
|
|
|
(setq lsexp (or (nth 2 delta) bof))
|
|
|
|
|
(= delta 0)) ; done if indenting occurred
|
|
|
|
|
(let ((eol (progn (end-of-line) (point)))
|
|
|
|
|
state)
|
|
|
|
|
(cond ((= (char-after bof) ?=)
|
|
|
|
|
(if (= oldpnt eol)
|
|
|
|
|
(message "In a format statement")))
|
|
|
|
|
((progn (setq state (parse-partial-sexp lsexp eol))
|
|
|
|
|
(nth 3 state))
|
|
|
|
|
(if (= oldpnt eol) ; already at eol in a string
|
|
|
|
|
(message "In a string which starts with a %c."
|
|
|
|
|
(nth 3 state))))
|
|
|
|
|
((not (nth 4 state))
|
|
|
|
|
(if (= oldpnt eol) ; no comment, create one?
|
|
|
|
|
(indent-for-comment)))
|
|
|
|
|
((progn (beginning-of-line)
|
|
|
|
|
(and comment-start-skip
|
|
|
|
|
(re-search-forward
|
|
|
|
|
comment-start-skip eol 'move)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (eolp)
|
2009-01-28 02:17:29 +00:00
|
|
|
|
(progn ; delete existing comment
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
|
(skip-chars-backward " \t")
|
2007-04-21 20:06:49 +00:00
|
|
|
|
(delete-region (point) eol))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (or (< oldpnt (point)) (= oldpnt eol))
|
|
|
|
|
(indent-for-comment) ; indent existing comment
|
2009-01-28 02:17:29 +00:00
|
|
|
|
(end-of-line))))
|
|
|
|
|
((/= oldpnt eol)
|
|
|
|
|
(end-of-line))
|
|
|
|
|
(t
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(message "Use backslash to quote # characters.")
|
2009-01-28 02:17:29 +00:00
|
|
|
|
(ding t)))))))))
|
2012-11-08 10:35:32 -05:00
|
|
|
|
(make-obsolete 'perl-indent-command 'indent-according-to-mode "24.4")
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(defun perl-indent-line (&optional nochange)
|
1994-01-14 20:54:08 +00:00
|
|
|
|
"Indent current line as Perl code.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
Return the amount the indentation
|
1991-12-21 09:29:41 +00:00
|
|
|
|
changed by, or (parse-state) if line starts in a quoted string."
|
|
|
|
|
(let ((case-fold-search nil)
|
|
|
|
|
(pos (- (point-max) (point)))
|
|
|
|
|
beg indent shift-amt)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(setq shift-amt
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(cond ((eq 1 (nth 7 (syntax-ppss))) 0) ;For doc sections!
|
|
|
|
|
((listp (setq indent (perl-calculate-indent))) indent)
|
2012-03-29 23:13:04 -04:00
|
|
|
|
((eq 'noindent indent) indent)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
((looking-at (or nochange perl-nochange)) 0)
|
|
|
|
|
(t
|
|
|
|
|
(skip-chars-forward " \t\f")
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(setq indent (perl-indent-new-calculate nil indent))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(- indent (current-column)))))
|
|
|
|
|
(skip-chars-forward " \t\f")
|
|
|
|
|
(if (and (numberp shift-amt) (/= 0 shift-amt))
|
|
|
|
|
(progn (delete-region beg (point))
|
|
|
|
|
(indent-to indent)))
|
|
|
|
|
;; If initial point was within line's indentation,
|
|
|
|
|
;; position after the indentation. Else stay at same point in text.
|
|
|
|
|
(if (> (- (point-max) pos) (point))
|
|
|
|
|
(goto-char (- (point-max) pos)))
|
|
|
|
|
shift-amt))
|
|
|
|
|
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(defun perl-continuation-line-p ()
|
2001-06-10 18:02:43 +00:00
|
|
|
|
"Move to end of previous line and return non-nil if continued."
|
|
|
|
|
;; Statement level. Is it a continuation or a new statement?
|
|
|
|
|
;; Find previous non-comment character.
|
|
|
|
|
(perl-backward-to-noncomment)
|
|
|
|
|
;; Back up over label lines, since they don't
|
|
|
|
|
;; affect whether our line is a continuation.
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(while (and (eq (preceding-char) ?:)
|
|
|
|
|
(memq (char-syntax (char-after (- (point) 2)))
|
|
|
|
|
'(?w ?_)))
|
|
|
|
|
(beginning-of-line)
|
2001-06-10 18:02:43 +00:00
|
|
|
|
(perl-backward-to-noncomment))
|
|
|
|
|
;; Now we get the answer.
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(unless (memq (preceding-char) '(?\; ?\} ?\{))
|
|
|
|
|
(preceding-char)))
|
2001-06-10 18:02:43 +00:00
|
|
|
|
|
2002-11-12 21:03:37 +00:00
|
|
|
|
(defun perl-hanging-paren-p ()
|
|
|
|
|
"Non-nil if we are right after a hanging parenthesis-like char."
|
|
|
|
|
(and (looking-at "[ \t]*$")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(skip-syntax-backward " (") (not (bolp)))))
|
|
|
|
|
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(defun perl-indent-new-calculate (&optional virtual default)
|
2005-03-20 18:04:41 +00:00
|
|
|
|
(or
|
|
|
|
|
(and virtual (save-excursion (skip-chars-backward " \t") (bolp))
|
|
|
|
|
(current-column))
|
|
|
|
|
(and (looking-at "\\(\\w\\|\\s_\\)+:[^:]")
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(max 1 (+ (or default (perl-calculate-indent))
|
2005-03-20 18:04:41 +00:00
|
|
|
|
perl-label-offset)))
|
|
|
|
|
(and (= (char-syntax (following-char)) ?\))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char 1)
|
2014-04-02 15:47:50 -04:00
|
|
|
|
(when (condition-case nil (progn (forward-sexp -1) t)
|
|
|
|
|
(scan-error nil))
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(perl-indent-new-calculate 'virtual))))
|
2005-03-20 18:04:41 +00:00
|
|
|
|
(and (and (= (following-char) ?{)
|
|
|
|
|
(save-excursion (forward-char) (perl-hanging-paren-p)))
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(+ (or default (perl-calculate-indent))
|
2005-03-20 18:04:41 +00:00
|
|
|
|
perl-brace-offset))
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(or default (perl-calculate-indent))))
|
2005-03-20 18:04:41 +00:00
|
|
|
|
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(defun perl-calculate-indent ()
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Return appropriate indentation for current line as Perl code.
|
|
|
|
|
In usual case returns an integer: the column to indent to.
|
2014-07-08 12:51:35 -04:00
|
|
|
|
Returns (parse-state) if line starts inside a string."
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((indent-point (point))
|
|
|
|
|
(case-fold-search nil)
|
|
|
|
|
(colon-line-end 0)
|
2014-07-08 12:51:35 -04:00
|
|
|
|
prev-char
|
1991-12-21 09:29:41 +00:00
|
|
|
|
state containing-sexp)
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(setq containing-sexp (nth 1 (syntax-ppss indent-point)))
|
2014-04-16 10:13:06 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; Don't auto-indent in a quoted string or a here-document.
|
|
|
|
|
((or (nth 3 state) (eq 2 (nth 7 state))) 'noindent)
|
2014-07-08 12:51:35 -04:00
|
|
|
|
((null containing-sexp) ; Line is at top level.
|
|
|
|
|
(skip-chars-forward " \t\f")
|
|
|
|
|
(if (memq (following-char)
|
|
|
|
|
(if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{)))
|
|
|
|
|
0 ; move to beginning of line if it starts a function body
|
|
|
|
|
;; indent a little if this is a continuation line
|
|
|
|
|
(perl-backward-to-noncomment)
|
|
|
|
|
(if (or (bobp)
|
|
|
|
|
(memq (preceding-char) '(?\; ?\})))
|
|
|
|
|
0 perl-continued-statement-offset)))
|
|
|
|
|
((/= (char-after containing-sexp) ?{)
|
|
|
|
|
;; line is expression, not statement:
|
|
|
|
|
;; indent to just after the surrounding open.
|
|
|
|
|
(goto-char (1+ containing-sexp))
|
|
|
|
|
(if (perl-hanging-paren-p)
|
|
|
|
|
;; We're indenting an arg of a call like:
|
|
|
|
|
;; $a = foobarlongnamefun (
|
|
|
|
|
;; arg1
|
|
|
|
|
;; arg2
|
|
|
|
|
;; );
|
|
|
|
|
(progn
|
|
|
|
|
(skip-syntax-backward "(")
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(while (save-excursion
|
|
|
|
|
(skip-syntax-backward " ") (not (bolp)))
|
|
|
|
|
(forward-sexp -1))
|
|
|
|
|
(scan-error nil))
|
|
|
|
|
(+ (current-column) perl-indent-level))
|
|
|
|
|
(if perl-indent-continued-arguments
|
|
|
|
|
(+ perl-indent-continued-arguments (current-indentation))
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(current-column))))
|
|
|
|
|
;; Statement level. Is it a continuation or a new statement?
|
|
|
|
|
((setq prev-char (perl-continuation-line-p))
|
|
|
|
|
;; This line is continuation of preceding line's statement;
|
|
|
|
|
;; indent perl-continued-statement-offset more than the
|
|
|
|
|
;; previous line of the statement.
|
|
|
|
|
(perl-backward-to-start-of-continued-exp)
|
|
|
|
|
(+ (if (or (save-excursion
|
|
|
|
|
(perl-continuation-line-p))
|
|
|
|
|
(and (eq prev-char ?\,)
|
|
|
|
|
(looking-at "[[:alnum:]_]+[ \t\n]*=>")))
|
|
|
|
|
;; If the continued line is itself a continuation
|
|
|
|
|
;; line, then align, otherwise add an offset.
|
|
|
|
|
0 perl-continued-statement-offset)
|
|
|
|
|
(current-column)
|
|
|
|
|
(if (save-excursion (goto-char indent-point)
|
|
|
|
|
(looking-at
|
|
|
|
|
(if perl-indent-parens-as-block
|
2015-09-17 16:08:20 -07:00
|
|
|
|
"[ \t]*[{([]" "[ \t]*{")))
|
2014-07-08 12:51:35 -04:00
|
|
|
|
perl-continued-brace-offset 0)))
|
|
|
|
|
(t
|
|
|
|
|
;; This line starts a new statement.
|
|
|
|
|
;; Position at last unclosed open.
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(or
|
|
|
|
|
;; Is line first statement after an open-brace?
|
|
|
|
|
;; If no, find that first statement and indent like it.
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
;; Skip over comments and labels following openbrace.
|
|
|
|
|
(while (progn
|
|
|
|
|
(skip-chars-forward " \t\f\n")
|
|
|
|
|
(cond ((looking-at ";?#")
|
|
|
|
|
(forward-line 1) t)
|
|
|
|
|
((looking-at "\\(\\w\\|\\s_\\)+:[^:]")
|
|
|
|
|
(setq colon-line-end (line-end-position))
|
|
|
|
|
(search-forward ":")))))
|
|
|
|
|
;; The first following code counts
|
|
|
|
|
;; if it is before the line we want to indent.
|
|
|
|
|
(and (< (point) indent-point)
|
|
|
|
|
(if (> colon-line-end (point))
|
|
|
|
|
(- (current-indentation) perl-label-offset)
|
|
|
|
|
(current-column))))
|
|
|
|
|
;; If no previous statement,
|
|
|
|
|
;; indent it relative to line brace is on.
|
|
|
|
|
;; For open paren in column zero, don't let statement
|
|
|
|
|
;; start there too. If perl-indent-level is zero,
|
|
|
|
|
;; use perl-brace-offset + perl-continued-statement-offset
|
|
|
|
|
;; For open-braces not the first thing in a line,
|
|
|
|
|
;; add in perl-brace-imaginary-offset.
|
|
|
|
|
(+ (if (and (bolp) (zerop perl-indent-level))
|
|
|
|
|
(+ perl-brace-offset perl-continued-statement-offset)
|
|
|
|
|
perl-indent-level)
|
|
|
|
|
;; Move back over whitespace before the openbrace.
|
|
|
|
|
;; If openbrace is not first nonwhite thing on the line,
|
|
|
|
|
;; add the perl-brace-imaginary-offset.
|
|
|
|
|
(progn (skip-chars-backward " \t")
|
|
|
|
|
(if (bolp) 0 perl-brace-imaginary-offset))
|
|
|
|
|
;; If the openbrace is preceded by a parenthesized exp,
|
|
|
|
|
;; move to the beginning of that;
|
|
|
|
|
;; possibly a different line
|
|
|
|
|
(progn
|
|
|
|
|
(if (eq (preceding-char) ?\))
|
|
|
|
|
(forward-sexp -1))
|
|
|
|
|
;; Get initial indentation of the line we are on.
|
|
|
|
|
(current-indentation)))))))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
(defun perl-backward-to-noncomment ()
|
|
|
|
|
"Move point backward to after the first non-white-space, skipping comments."
|
2001-10-05 09:36:31 +00:00
|
|
|
|
(forward-comment (- (point-max))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(defun perl-backward-to-start-of-continued-exp ()
|
|
|
|
|
(while
|
|
|
|
|
(let ((c (preceding-char)))
|
|
|
|
|
(cond
|
|
|
|
|
((memq c '(?\; ?\{ ?\[ ?\()) (forward-comment (point-max)) nil)
|
|
|
|
|
((memq c '(?\) ?\] ?\} ?\"))
|
|
|
|
|
(forward-sexp -1) (forward-comment (- (point))) t)
|
|
|
|
|
((eq ?w (char-syntax c))
|
Fix problems caused by new implementation of sub-word mode
* lisp/subr.el (forward-word-strictly, backward-word-strictly):
New functions.
(word-move-empty-char-table): New variable.
* etc/NEWS: Mention 'forward-word-strictly' and
'backward-word-strictly'.
* doc/lispref/positions.texi (Word Motion): Document
'find-word-boundary-function-table', 'forward-word-strictly', and
'backward-word-strictly'. (Bug#22560)
* src/syntax.c (syms_of_syntax)
<find-word-boundary-function-table>: Doc fix.
* lisp/wdired.el (wdired-xcase-word):
* lisp/textmodes/texnfo-upd.el (texinfo-copy-node-name)
(texinfo-copy-section-title, texinfo-start-menu-description)
(texinfo-copy-menu-title, texinfo-specific-section-type)
(texinfo-insert-node-lines, texinfo-copy-next-section-title):
* lisp/textmodes/texinfo.el (texinfo-clone-environment)
(texinfo-insert-@end):
* lisp/textmodes/texinfmt.el (texinfo-format-scan)
(texinfo-anchor, texinfo-multitable-widths)
(texinfo-multitable-item):
* lisp/textmodes/tex-mode.el (latex-env-before-change):
* lisp/textmodes/flyspell.el (texinfo-mode-flyspell-verify):
* lisp/skeleton.el (skeleton-insert):
* lisp/simple.el (count-words):
* lisp/progmodes/vhdl-mode.el (vhdl-beginning-of-libunit)
(vhdl-beginning-of-defun, vhdl-beginning-of-statement-1)
(vhdl-update-sensitivity-list, vhdl-template-block)
(vhdl-template-break, vhdl-template-case, vhdl-template-default)
(vhdl-template-default-indent, vhdl-template-for-loop)
(vhdl-template-if-then-use, vhdl-template-bare-loop)
(vhdl-template-nature, vhdl-template-procedural)
(vhdl-template-process, vhdl-template-selected-signal-asst)
(vhdl-template-type, vhdl-template-variable)
(vhdl-template-while-loop, vhdl-beginning-of-block)
(vhdl-hooked-abbrev, vhdl-port-copy, vhdl-hs-forward-sexp-func):
* lisp/progmodes/verilog-mode.el (verilog-backward-sexp)
(verilog-forward-sexp, verilog-beg-of-statement)
(verilog-set-auto-endcomments, verilog-backward-token)
(verilog-do-indent):
* lisp/progmodes/vera-mode.el (vera-guess-basic-syntax)
(vera-indent-block-closing):
* lisp/progmodes/simula.el (simula-context)
(simula-backward-up-level, simula-forward-down-level)
(simula-previous-statement, simula-next-statement)
(simula-skip-comment-backward, simula-calculate-indent)
(simula-find-if, simula-electric-keyword):
* lisp/progmodes/sh-script.el (sh-smie--rc-newline-semi-p):
* lisp/progmodes/ruby-mode.el (ruby-smie--redundant-do-p)
(ruby-smie--forward-token, ruby-smie--backward-token)
(ruby-singleton-class-p, ruby-calculate-indent)
(ruby-forward-sexp, ruby-backward-sexp):
* lisp/progmodes/ps-mode.el (ps-run-goto-error):
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function)
(perl-syntax-propertize-special-constructs)
(perl-backward-to-start-of-continued-exp):
* lisp/progmodes/pascal.el (pascal-indent-declaration):
* lisp/progmodes/octave.el (octave-function-file-p):
* lisp/progmodes/mantemp.el (mantemp-insert-cxx-syntax):
* lisp/progmodes/js.el (js--forward-function-decl):
* lisp/progmodes/idlwave.el (idlwave-show-begin-check)
(idlwave-beginning-of-block, idlwave-end-of-block)
(idlwave-block-jump-out, idlwave-determine-class):
* lisp/progmodes/icon.el (icon-is-continuation-line)
(icon-backward-to-start-of-continued-exp, end-of-icon-defun):
* lisp/progmodes/hideif.el (hide-ifdef-define):
* lisp/progmodes/f90.el (f90-change-keywords):
* lisp/progmodes/cperl-mode.el (cperl-electric-pod)
(cperl-linefeed, cperl-electric-terminator)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-invert-if-unless):
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist-recur):
* lisp/progmodes/cc-align.el (c-lineup-java-inher):
* lisp/progmodes/ada-mode.el (ada-compile-goto-error)
(ada-adjust-case-skeleton, ada-create-case-exception)
(ada-create-case-exception-substring)
(ada-case-read-exceptions-from-file, ada-after-keyword-p)
(ada-scan-paramlist, ada-get-current-indent, ada-get-indent-end)
(ada-get-indent-if, ada-get-indent-block-start)
(ada-get-indent-loop, ada-get-indent-type)
(ada-search-prev-end-stmt, ada-check-defun-name)
(ada-goto-decl-start, ada-goto-matching-start)
(ada-goto-matching-end, ada-looking-at-semi-or)
(ada-looking-at-semi-private, ada-in-paramlist-p)
(ada-search-ignore-complex-boolean, ada-move-to-start)
(ada-move-to-end, ada-which-function, ada-gen-treat-proc):
* lisp/net/quickurl.el (quickurl-grab-url):
* lisp/mail/sendmail.el (mail-do-fcc):
* lisp/mail/rmail.el (rmail-resend):
* lisp/mail/mailabbrev.el (mail-abbrev-complete-alias):
* lisp/mail/mail-extr.el (mail-extract-address-components):
* lisp/json.el (json-read-keyword):
* lisp/files.el (insert-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/completion.el (symbol-under-point, symbol-before-point)
(symbol-before-point-for-complete, next-cdabbrev)
(add-completions-from-c-buffer):
* lisp/cedet/semantic/texi.el (semantic-up-context)
(semantic-beginning-of-context):
* lisp/cedet/semantic/bovine/el.el (semantic-get-local-variables):
use 'forward-word-strictly' and 'backward-word-strictly' instead
of 'forward-word' and 'backward-word'.
2016-02-05 23:54:21 +02:00
|
|
|
|
(forward-word-strictly -1) (forward-comment (- (point))) t)
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(t (forward-char -1) (forward-comment (- (point))) t)))))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
|
|
|
|
|
;; note: this may be slower than the c-mode version, but I can understand it.
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(defalias 'indent-perl-exp 'perl-indent-exp)
|
|
|
|
|
(defun perl-indent-exp ()
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Indent each line of the Perl grouping following point."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((case-fold-search nil)
|
|
|
|
|
(oldpnt (point-marker))
|
|
|
|
|
(bof-mark (save-excursion
|
|
|
|
|
(end-of-line 2)
|
|
|
|
|
(perl-beginning-of-function)
|
|
|
|
|
(point-marker)))
|
|
|
|
|
eol last-mark lsexp-mark delta)
|
|
|
|
|
(if (= (char-after (marker-position bof-mark)) ?=)
|
|
|
|
|
(message "Can't indent a format statement")
|
|
|
|
|
(message "Indenting Perl expression...")
|
Use line-end-position rather than end-of-line, etc.
* textmodes/texnfo-upd.el (texinfo-start-menu-description)
(texinfo-update-menu-region-beginning, texinfo-menu-first-node)
(texinfo-delete-existing-pointers, texinfo-find-pointer)
(texinfo-clean-up-node-line, texinfo-insert-node-lines)
(texinfo-multiple-files-update):
* textmodes/table.el (table--probe-cell-left-up)
(table--probe-cell-right-bottom):
* textmodes/picture.el (picture-tab-search):
* textmodes/page-ext.el (pages-copy-header-and-position)
(pages-directory-for-addresses):
* progmodes/vera-mode.el (vera-get-offset):
* progmodes/simula.el (simula-calculate-indent):
* progmodes/python.el (python-pdbtrack-overlay-arrow):
* progmodes/prolog.el (end-of-prolog-clause):
* progmodes/perl-mode.el (perl-calculate-indent, perl-indent-exp):
* progmodes/icon.el (indent-icon-exp):
* progmodes/etags.el (tag-re-match-p):
* progmodes/ebrowse.el (ebrowse-show-file-name-at-point):
* progmodes/ebnf2ps.el (ebnf-begin-file):
* progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-save-local-variable):
* play/life.el (life-setup):
* play/gametree.el (gametree-looking-at-ply):
* nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* mail/sendmail.el (mail-mode-auto-fill):
* emacs-lisp/lisp-mode.el (calculate-lisp-indent):
* emacs-lisp/edebug.el (edebug-overlay-arrow):
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid):
* woman.el (woman-parse-numeric-value, woman2-TH, woman2-SH)
(woman-tab-to-tab-stop, WoMan-warn-ignored):
* type-break.el (type-break-file-keystroke-count):
* term.el (term-replace-by-expanded-history-before-point)
(term-skip-prompt, term-extract-string):
* speedbar.el (speedbar-edit-line, speedbar-expand-line)
(speedbar-contract-line, speedbar-toggle-line-expansion)
(speedbar-parse-c-or-c++tag, speedbar-parse-tex-string)
(speedbar-buffer-revert-buffer, speedbar-highlight-one-tag-line):
* sort.el (sort-skip-fields):
* skeleton.el (skeleton-internal-list):
* simple.el (line-move-finish, line-move-to-column):
* shell.el (shell-forward-command):
* misc.el (copy-from-above-command):
* makesum.el (double-column):
* ebuff-menu.el (electric-buffer-update-highlight):
* dired.el (dired-move-to-end-of-filename):
* dframe.el (dframe-popup-kludge):
* bookmark.el (bookmark-kill-line, bookmark-bmenu-show-filenames):
* arc-mode.el (archive-get-lineno):
Use line-end-position and line-beginning-position.
* net/ange-ftp.el, progmodes/hideif.el, reposition.el:
Same, but only in comments.
2010-11-06 13:23:42 -07:00
|
|
|
|
(setq eol (line-end-position))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(save-excursion ; locate matching close paren
|
|
|
|
|
(while (and (not (eobp)) (<= (point) eol))
|
|
|
|
|
(parse-partial-sexp (point) (point-max) 0))
|
|
|
|
|
(setq last-mark (point-marker)))
|
|
|
|
|
(setq lsexp-mark bof-mark)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(while (< (point) (marker-position last-mark))
|
2014-07-08 12:51:35 -04:00
|
|
|
|
(setq delta (perl-indent-line nil))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (numberp delta) ; unquoted start-of-line?
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(progn
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(if (eolp)
|
|
|
|
|
(delete-horizontal-space))
|
|
|
|
|
(setq lsexp-mark (point-marker))))
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq eol (point))
|
|
|
|
|
(if (nth 4 (parse-partial-sexp (marker-position lsexp-mark) eol))
|
|
|
|
|
(progn ; line ends in a comment
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if (or (not (looking-at "\\s-*;?#"))
|
|
|
|
|
(listp delta)
|
|
|
|
|
(and (/= 0 delta)
|
|
|
|
|
(= (- (current-indentation) delta) comment-column)))
|
1996-10-26 18:14:31 +00:00
|
|
|
|
(if (and comment-start-skip
|
|
|
|
|
(re-search-forward comment-start-skip eol t))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(indent-for-comment))))) ; indent existing comment
|
|
|
|
|
(forward-line 1))
|
|
|
|
|
(goto-char (marker-position oldpnt))
|
|
|
|
|
(message "Indenting Perl expression...done"))))
|
|
|
|
|
|
|
|
|
|
(defun perl-beginning-of-function (&optional arg)
|
|
|
|
|
"Move backward to next beginning-of-function, or as far as possible.
|
|
|
|
|
With argument, repeat that many times; negative args move forward.
|
|
|
|
|
Returns new value of point in all cases."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(or arg (setq arg 1))
|
|
|
|
|
(if (< arg 0) (forward-char 1))
|
|
|
|
|
(and (/= arg 0)
|
2006-05-04 21:58:34 +00:00
|
|
|
|
(re-search-backward
|
|
|
|
|
"^\\s(\\|^\\s-*sub\\b[ \t\n]*\\_<[^{]+{\\|^\\s-*format\\b[^=]*=\\|^\\."
|
|
|
|
|
nil 'move arg)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(goto-char (1- (match-end 0))))
|
|
|
|
|
(point))
|
|
|
|
|
|
|
|
|
|
;; note: this routine is adapted directly from emacs lisp.el, end-of-defun;
|
|
|
|
|
;; no bugs have been removed :-)
|
|
|
|
|
(defun perl-end-of-function (&optional arg)
|
|
|
|
|
"Move forward to next end-of-function.
|
|
|
|
|
The end of a function is found by moving forward from the beginning of one.
|
|
|
|
|
With argument, repeat that many times; negative args move backward."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
(or arg (setq arg 1))
|
|
|
|
|
(let ((first t))
|
|
|
|
|
(while (and (> arg 0) (< (point) (point-max)))
|
2003-05-17 22:38:13 +00:00
|
|
|
|
(let ((pos (point)))
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(while (progn
|
|
|
|
|
(if (and first
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(perl-beginning-of-function 1)
|
|
|
|
|
(not (bobp))))
|
|
|
|
|
nil
|
|
|
|
|
(or (bobp) (forward-char -1))
|
|
|
|
|
(perl-beginning-of-function -1))
|
|
|
|
|
(setq first nil)
|
|
|
|
|
(forward-list 1)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(if (looking-at "[#\n]")
|
|
|
|
|
(forward-line 1))
|
|
|
|
|
(<= (point) pos))))
|
|
|
|
|
(setq arg (1- arg)))
|
|
|
|
|
(while (< arg 0)
|
|
|
|
|
(let ((pos (point)))
|
|
|
|
|
(perl-beginning-of-function 1)
|
|
|
|
|
(forward-sexp 1)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(if (>= (point) pos)
|
|
|
|
|
(if (progn (perl-beginning-of-function 2) (not (bobp)))
|
|
|
|
|
(progn
|
|
|
|
|
(forward-list 1)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(if (looking-at "[#\n]")
|
|
|
|
|
(forward-line 1)))
|
|
|
|
|
(goto-char (point-min)))))
|
|
|
|
|
(setq arg (1+ arg)))))
|
|
|
|
|
|
2001-05-25 21:16:05 +00:00
|
|
|
|
(defalias 'mark-perl-function 'perl-mark-function)
|
|
|
|
|
(defun perl-mark-function ()
|
1991-12-21 09:29:41 +00:00
|
|
|
|
"Put mark at end of Perl function, point at beginning."
|
|
|
|
|
(interactive)
|
2017-04-28 11:25:26 +03:00
|
|
|
|
(push-mark)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(perl-end-of-function)
|
2017-04-28 11:25:26 +03:00
|
|
|
|
(push-mark)
|
1991-12-21 09:29:41 +00:00
|
|
|
|
(perl-beginning-of-function)
|
|
|
|
|
(backward-paragraph))
|
|
|
|
|
|
1996-09-28 03:17:21 +00:00
|
|
|
|
(provide 'perl-mode)
|
|
|
|
|
|
|
|
|
|
;;; perl-mode.el ends here
|