Commit 89c19c1e authored by Michaël Cadilhac's avatar Michaël Cadilhac
Browse files

(meta-font-lock-keywords)

(font-lock-match-meta-declaration-item-and-skip-to-next)
(meta-comment-indent, meta-indent-previous-line)
(meta-indent-unfinished-line, meta-beginning-of-defun)
(meta-end-of-defun, meta-common-initialization): Handle \f.
parent 481249ca
2007-09-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name> 2007-09-10 Micha,Ak(Bl Cadilhac <michael@cadilhac.name>
* progmodes/meta-mode.el (meta-font-lock-keywords)
(font-lock-match-meta-declaration-item-and-skip-to-next)
(meta-comment-indent, meta-indent-previous-line)
(meta-indent-unfinished-line, meta-beginning-of-defun)
(meta-end-of-defun, meta-common-initialization): Handle \f.
* files.el (file-modes-char-to-who, file-modes-char-to-right) * files.el (file-modes-char-to-who, file-modes-char-to-right)
(file-modes-rights-to-number): Auxiliary functions for symbolic to (file-modes-rights-to-number): Auxiliary functions for symbolic to
numeric notation of file modes. numeric notation of file modes.
......
...@@ -194,42 +194,42 @@ ...@@ -194,42 +194,42 @@
(list (list
;; embedded TeX code in btex ... etex ;; embedded TeX code in btex ... etex
(cons (concat "\\(btex\\|verbatimtex\\)" (cons (concat "\\(btex\\|verbatimtex\\)"
"[ \t]+\\(.*\\)[ \t]+" "[ \t\f]+\\(.*\\)[ \t\f]+"
"\\(etex\\)") "\\(etex\\)")
'((1 font-lock-keyword-face) '((1 font-lock-keyword-face)
(2 font-lock-string-face) (2 font-lock-string-face)
(3 font-lock-keyword-face))) (3 font-lock-keyword-face)))
;; unary macro definitions: def, vardef, let ;; unary macro definitions: def, vardef, let
(cons (concat "\\<" macro-keywords-1 "\\>" (cons (concat "\\<" macro-keywords-1 "\\>"
"[ \t]+\\(\\sw+\\|\\s_+\\|\\s.+\\)") "[ \t\f]+\\(\\sw+\\|\\s_+\\|\\s.+\\)")
'((1 font-lock-keyword-face) '((1 font-lock-keyword-face)
(2 font-lock-function-name-face))) (2 font-lock-function-name-face)))
;; binary macro defintions: <leveldef> x operator y ;; binary macro defintions: <leveldef> x operator y
(cons (concat "\\<" macro-keywords-2 "\\>" (cons (concat "\\<" macro-keywords-2 "\\>"
"[ \t]+\\(\\sw+\\)" "[ \t\f]+\\(\\sw+\\)"
"[ \t]*\\(\\sw+\\|\\s.+\\)" "[ \t\f]*\\(\\sw+\\|\\s.+\\)"
"[ \t]*\\(\\sw+\\)") "[ \t\f]*\\(\\sw+\\)")
'((1 font-lock-keyword-face) '((1 font-lock-keyword-face)
(2 font-lock-variable-name-face nil t) (2 font-lock-variable-name-face nil t)
(3 font-lock-function-name-face nil t) (3 font-lock-function-name-face nil t)
(4 font-lock-variable-name-face nil t))) (4 font-lock-variable-name-face nil t)))
;; variable declarations: numeric, pair, color, ... ;; variable declarations: numeric, pair, color, ...
(cons (concat "\\<" type-keywords "\\>" (cons (concat "\\<" type-keywords "\\>"
"\\([ \t]+\\(\\sw+\\)\\)*") "\\([ \t\f]+\\(\\sw+\\)\\)*")
'((1 font-lock-type-face) '((1 font-lock-type-face)
(font-lock-match-meta-declaration-item-and-skip-to-next (font-lock-match-meta-declaration-item-and-skip-to-next
(goto-char (match-end 1)) nil (goto-char (match-end 1)) nil
(1 font-lock-variable-name-face nil t)))) (1 font-lock-variable-name-face nil t))))
;; argument declarations: expr, suffix, text, ... ;; argument declarations: expr, suffix, text, ...
(cons (concat "\\<" args-keywords "\\>" (cons (concat "\\<" args-keywords "\\>"
"\\([ \t]+\\(\\sw+\\|\\s_+\\)\\)*") "\\([ \t\f]+\\(\\sw+\\|\\s_+\\)\\)*")
'((1 font-lock-type-face) '((1 font-lock-type-face)
(font-lock-match-meta-declaration-item-and-skip-to-next (font-lock-match-meta-declaration-item-and-skip-to-next
(goto-char (match-end 1)) nil (goto-char (match-end 1)) nil
(1 font-lock-variable-name-face nil t)))) (1 font-lock-variable-name-face nil t))))
;; special case of arguments: expr x of y ;; special case of arguments: expr x of y
(cons (concat "\\(expr\\)[ \t]+\\(\\sw+\\)" (cons (concat "\\(expr\\)[ \t\f]+\\(\\sw+\\)"
"[ \t]+\\(of\\)[ \t]+\\(\\sw+\\)") "[ \t\f]+\\(of\\)[ \t\f]+\\(\\sw+\\)")
'((1 font-lock-type-face) '((1 font-lock-type-face)
(2 font-lock-variable-name-face) (2 font-lock-variable-name-face)
(3 font-lock-keyword-face nil t) (3 font-lock-keyword-face nil t)
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
'font-lock-keyword-face) 'font-lock-keyword-face)
;; input, generate ;; input, generate
(cons (concat "\\<" input-keywords "\\>" (cons (concat "\\<" input-keywords "\\>"
"[ \t]+\\(\\sw+\\)") "[ \t\f]+\\(\\sw+\\)")
'((1 font-lock-keyword-face) '((1 font-lock-keyword-face)
(2 font-lock-constant-face))) (2 font-lock-constant-face)))
;; embedded Metafont/MetaPost code in comments ;; embedded Metafont/MetaPost code in comments
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
;; `forward-sexp'. The list of items is expected to be separated ;; `forward-sexp'. The list of items is expected to be separated
;; by commas and terminated by semicolons or equals signs. ;; by commas and terminated by semicolons or equals signs.
;; ;;
(if (looking-at "[ \t]*\\(\\sw+\\|\\s_+\\)") (if (looking-at "[ \t\f]*\\(\\sw+\\|\\s_+\\)")
(save-match-data (save-match-data
(condition-case nil (condition-case nil
(save-restriction (save-restriction
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
(narrow-to-region (point-min) limit) (narrow-to-region (point-min) limit)
(goto-char (match-end 1)) (goto-char (match-end 1))
;; Move over any item value, etc., to the next item. ;; Move over any item value, etc., to the next item.
(while (not (looking-at "[ \t]*\\(\\(,\\)\\|;\\|=\\|$\\)")) (while (not (looking-at "[ \t\f]*\\(\\(,\\)\\|;\\|=\\|$\\)"))
(goto-char (or (scan-sexps (point) 1) (point-max)))) (goto-char (or (scan-sexps (point) 1) (point-max))))
(goto-char (match-end 2))) (goto-char (match-end 2)))
(error t))))) (error t)))))
...@@ -586,7 +586,7 @@ If the list was changed, sort the list and remove duplicates first." ...@@ -586,7 +586,7 @@ If the list was changed, sort the list and remove duplicates first."
(if (and meta-left-comment-regexp (if (and meta-left-comment-regexp
(looking-at meta-left-comment-regexp)) (looking-at meta-left-comment-regexp))
(current-column) (current-column)
(skip-chars-backward "\t ") (skip-chars-backward "\t\f ")
(max (if (bolp) 0 (1+ (current-column))) (max (if (bolp) 0 (1+ (current-column)))
comment-column))) comment-column)))
...@@ -647,11 +647,11 @@ If the list was changed, sort the list and remove duplicates first." ...@@ -647,11 +647,11 @@ If the list was changed, sort the list and remove duplicates first."
(defun meta-indent-previous-line () (defun meta-indent-previous-line ()
"Go to the previous line of code, skipping comments." "Go to the previous line of code, skipping comments."
(skip-chars-backward "\n\t ") (skip-chars-backward "\n\t\f ")
(move-to-column (current-indentation)) (move-to-column (current-indentation))
;; Ignore comments. ;; Ignore comments.
(while (and (looking-at comment-start) (not (bobp))) (while (and (looking-at comment-start) (not (bobp)))
(skip-chars-backward "\n\t ") (skip-chars-backward "\n\t\f ")
(if (not (bobp)) (if (not (bobp))
(move-to-column (current-indentation))))) (move-to-column (current-indentation)))))
...@@ -672,7 +672,7 @@ If the list was changed, sort the list and remove duplicates first." ...@@ -672,7 +672,7 @@ If the list was changed, sort the list and remove duplicates first."
;; See if the last statement of the line is environment-related, ;; See if the last statement of the line is environment-related,
;; or exists at all. ;; or exists at all.
(if (meta-indent-looking-at-code (if (meta-indent-looking-at-code
(concat "[ \t]*\\($\\|" (regexp-quote comment-start) (concat "[ \t\f]*\\($\\|" (regexp-quote comment-start)
"\\|\\<" meta-end-environment-regexp "\\>" "\\|\\<" meta-end-environment-regexp "\\>"
"\\|\\<" meta-begin-environment-regexp "\\>" "\\|\\<" meta-begin-environment-regexp "\\>"
"\\|\\<" meta-within-environment-regexp "\\>\\)")) "\\|\\<" meta-within-environment-regexp "\\>\\)"))
...@@ -782,7 +782,7 @@ Returns t unless search stops due to beginning or end of buffer." ...@@ -782,7 +782,7 @@ Returns t unless search stops due to beginning or end of buffer."
(concat "\\<" meta-begin-defun-regexp "\\>") nil t arg) (concat "\\<" meta-begin-defun-regexp "\\>") nil t arg)
(progn (goto-char (match-beginning 0)) (progn (goto-char (match-beginning 0))
(skip-chars-backward "%") (skip-chars-backward "%")
(skip-chars-backward " \t") t))) (skip-chars-backward " \t\f") t)))
(defun meta-end-of-defun (&optional arg) (defun meta-end-of-defun (&optional arg)
"Move forward to end of a defun in Metafont or MetaPost code. "Move forward to end of a defun in Metafont or MetaPost code.
...@@ -796,7 +796,7 @@ Returns t unless search stops due to beginning or end of buffer." ...@@ -796,7 +796,7 @@ Returns t unless search stops due to beginning or end of buffer."
(concat "\\<" meta-end-defun-regexp "\\>") nil t arg) (concat "\\<" meta-end-defun-regexp "\\>") nil t arg)
(progn (goto-char (match-end 0)) (progn (goto-char (match-end 0))
(skip-chars-forward ";") (skip-chars-forward ";")
(skip-chars-forward " \t") (skip-chars-forward " \t\f")
(if (looking-at "\n") (forward-line 1)) t))) (if (looking-at "\n") (forward-line 1)) t)))
...@@ -1014,11 +1014,14 @@ The environment marked is the one that contains point or follows point." ...@@ -1014,11 +1014,14 @@ The environment marked is the one that contains point or follows point."
(make-local-variable 'comment-start) (make-local-variable 'comment-start)
(make-local-variable 'comment-end) (make-local-variable 'comment-end)
(make-local-variable 'comment-multi-line) (make-local-variable 'comment-multi-line)
(setq comment-start-skip "%+[ \t]*") (setq comment-start-skip "%+[ \t\f]*")
(setq comment-start "%") (setq comment-start "%")
(setq comment-end "") (setq comment-end "")
(setq comment-multi-line nil) (setq comment-multi-line nil)
;; We use `back-to-indentation' but \f is no indentation sign.
(modify-syntax-entry ?\f "_ ")
(make-local-variable 'parse-sexp-ignore-comments) (make-local-variable 'parse-sexp-ignore-comments)
(setq parse-sexp-ignore-comments t) (setq parse-sexp-ignore-comments t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment