summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-defs.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/cc-defs.el')
-rw-r--r--lisp/progmodes/cc-defs.el107
1 files changed, 77 insertions, 30 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 613e2b303d9..83b27ef16c1 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -81,7 +81,7 @@
(progn
(require 'font-lock)
(let (font-lock-keywords)
- (font-lock-compile-keywords '("\\<\\>"))
+ (font-lock-compile-keywords '("a\\`")) ; doesn't match anything.
font-lock-keywords))))
@@ -219,6 +219,7 @@ one of the following symbols:
`bol' -- beginning of line
`eol' -- end of line
+`eoll' -- end of logical line (i.e. without escaped NL)
`bod' -- beginning of defun
`eod' -- end of defun
`boi' -- beginning of indentation
@@ -240,7 +241,7 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'bol)
(if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
- `(line-beginning-position)
+ '(line-beginning-position)
`(save-excursion
,@(if point `((goto-char ,point)))
(beginning-of-line)
@@ -248,12 +249,22 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'eol)
(if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
- `(line-end-position)
+ '(line-end-position)
`(save-excursion
,@(if point `((goto-char ,point)))
(end-of-line)
(point))))
+ ((eq position 'eoll)
+ `(save-excursion
+ ,@(if point `((goto-char ,point)))
+ (while (progn
+ (end-of-line)
+ (prog1 (eq (logand 1 (skip-chars-backward "\\\\")) 1)))
+ (beginning-of-line 2))
+ (end-of-line)
+ (point)))
+
((eq position 'boi)
`(save-excursion
,@(if point `((goto-char ,point)))
@@ -274,7 +285,7 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'bopl)
(if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
- `(line-beginning-position 0)
+ '(line-beginning-position 0)
`(save-excursion
,@(if point `((goto-char ,point)))
(forward-line -1)
@@ -282,7 +293,7 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'bonl)
(if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
- `(line-beginning-position 2)
+ '(line-beginning-position 2)
`(save-excursion
,@(if point `((goto-char ,point)))
(forward-line 1)
@@ -290,7 +301,7 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'eopl)
(if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
- `(line-end-position 0)
+ '(line-end-position 0)
`(save-excursion
,@(if point `((goto-char ,point)))
(beginning-of-line)
@@ -299,7 +310,7 @@ to it is returned. This function does not modify the point or the mark."
((eq position 'eonl)
(if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
- `(line-end-position 2)
+ '(line-end-position 2)
`(save-excursion
,@(if point `((goto-char ,point)))
(forward-line 1)
@@ -453,6 +464,13 @@ to it is returned. This function does not modify the point or the mark."
`(int-to-char ,integer)
integer))
+(defmacro c-characterp (arg)
+ ;; Return t when ARG is a character (XEmacs) or integer (Emacs), otherwise
+ ;; return nil.
+ (if (integerp ?c)
+ `(integerp ,arg)
+ `(characterp ,arg)))
+
(defmacro c-last-command-char ()
;; The last character just typed. Note that `last-command-event' exists in
;; both Emacs and XEmacs, but with confusingly different meanings.
@@ -464,17 +482,17 @@ to it is returned. This function does not modify the point or the mark."
;; Get the regular expression `sentence-end'.
(if (cc-bytecomp-fboundp 'sentence-end)
;; Emacs 22:
- `(sentence-end)
+ '(sentence-end)
;; Emacs <22 + XEmacs
- `sentence-end))
+ 'sentence-end))
(defmacro c-default-value-sentence-end ()
;; Get the default value of the variable sentence end.
(if (cc-bytecomp-fboundp 'sentence-end)
;; Emacs 22:
- `(let (sentence-end) (sentence-end))
+ '(let (sentence-end) (sentence-end))
;; Emacs <22 + XEmacs
- `(default-value 'sentence-end)))
+ '(default-value 'sentence-end)))
;; The following is essentially `save-buffer-state' from lazy-lock.el.
;; It ought to be a standard macro.
@@ -673,7 +691,7 @@ leave point unmoved.
A LIMIT for the search may be given. The start position is assumed to be
before it."
- `(let ((dest (c-safe-scan-lists ,(or pos `(point)) 1 0 ,limit)))
+ `(let ((dest (c-safe-scan-lists ,(or pos '(point)) 1 0 ,limit)))
(when dest (goto-char dest) dest)))
(defmacro c-go-list-backward (&optional pos limit)
@@ -683,7 +701,7 @@ leave point unmoved.
A LIMIT for the search may be given. The start position is assumed to be
after it."
- `(let ((dest (c-safe-scan-lists ,(or pos `(point)) -1 0 ,limit)))
+ `(let ((dest (c-safe-scan-lists ,(or pos '(point)) -1 0 ,limit)))
(when dest (goto-char dest) dest)))
(defmacro c-up-list-forward (&optional pos limit)
@@ -692,7 +710,7 @@ or nil if no such position exists. The point is used if POS is left out.
A limit for the search may be given. The start position is assumed to
be before it."
- `(c-safe-scan-lists ,(or pos `(point)) 1 1 ,limit))
+ `(c-safe-scan-lists ,(or pos '(point)) 1 1 ,limit))
(defmacro c-up-list-backward (&optional pos limit)
"Return the position of the start of the list sexp containing POS,
@@ -700,7 +718,7 @@ or nil if no such position exists. The point is used if POS is left out.
A limit for the search may be given. The start position is assumed to
be after it."
- `(c-safe-scan-lists ,(or pos `(point)) -1 1 ,limit))
+ `(c-safe-scan-lists ,(or pos '(point)) -1 1 ,limit))
(defmacro c-down-list-forward (&optional pos limit)
"Return the first position inside the first list sexp after POS,
@@ -708,7 +726,7 @@ or nil if no such position exists. The point is used if POS is left out.
A limit for the search may be given. The start position is assumed to
be before it."
- `(c-safe-scan-lists ,(or pos `(point)) 1 -1 ,limit))
+ `(c-safe-scan-lists ,(or pos '(point)) 1 -1 ,limit))
(defmacro c-down-list-backward (&optional pos limit)
"Return the last position inside the last list sexp before POS,
@@ -716,7 +734,7 @@ or nil if no such position exists. The point is used if POS is left out.
A limit for the search may be given. The start position is assumed to
be after it."
- `(c-safe-scan-lists ,(or pos `(point)) -1 -1 ,limit))
+ `(c-safe-scan-lists ,(or pos '(point)) -1 -1 ,limit))
(defmacro c-go-up-list-forward (&optional pos limit)
"Move the point to the first position after the list sexp containing POS,
@@ -877,7 +895,7 @@ be after it."
;; c-beginning-of-statement-1.
;; Languages which don't have EOL terminated statements always return NIL
;; (they _know_ there's no vsemi ;-).
- `(if c-vsemi-status-unknown-p-fn (funcall c-vsemi-status-unknown-p-fn)))
+ '(if c-vsemi-status-unknown-p-fn (funcall c-vsemi-status-unknown-p-fn)))
(defmacro c-benign-error (format &rest args)
@@ -1298,20 +1316,36 @@ with value CHAR in the region [FROM to)."
;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
; '(progn
(def-edebug-spec cc-eval-when-compile (&rest def-form))
+(def-edebug-spec c--mapcan t)
+(def-edebug-spec c--set-difference (form form &rest [symbolp form]))
+(def-edebug-spec c--intersection (form form &rest [symbolp form]))
+(def-edebug-spec c--delete-duplicates (form &rest [symbolp form]))
(def-edebug-spec c-point t)
+(def-edebug-spec c-next-single-property-change t)
+(def-edebug-spec c-delete-and-extract-region t)
(def-edebug-spec c-set-region-active t)
(def-edebug-spec c-set-keymap-parent t)
(def-edebug-spec c-safe t)
+(def-edebug-spec c-int-to-char t)
+(def-edebug-spec c-characterp t)
(def-edebug-spec c-save-buffer-state let*)
(def-edebug-spec c-tentative-buffer-changes t)
(def-edebug-spec c-forward-syntactic-ws t)
(def-edebug-spec c-backward-syntactic-ws t)
(def-edebug-spec c-forward-sexp t)
(def-edebug-spec c-backward-sexp t)
+(def-edebug-spec c-safe-scan-lists t)
+(def-edebug-spec c-go-list-forward t)
+(def-edebug-spec c-go-list-backward t)
(def-edebug-spec c-up-list-forward t)
(def-edebug-spec c-up-list-backward t)
(def-edebug-spec c-down-list-forward t)
(def-edebug-spec c-down-list-backward t)
+(def-edebug-spec c-go-up-list-forward t)
+(def-edebug-spec c-go-up-list-backward t)
+(def-edebug-spec c-go-down-list-forward t)
+(def-edebug-spec c-go-down-list-backward t)
+(def-edebug-spec c-at-vsemi-p t)
(def-edebug-spec c-add-syntax t)
(def-edebug-spec c-add-class-syntax t)
(def-edebug-spec c-benign-error t)
@@ -1319,15 +1353,28 @@ with value CHAR in the region [FROM to)."
(def-edebug-spec c-skip-ws-forward t)
(def-edebug-spec c-skip-ws-backward t)
(def-edebug-spec c-major-mode-is t)
+(def-edebug-spec c-search-forward-char-property t)
+(def-edebug-spec c-search-backward-char-property t)
(def-edebug-spec c-put-char-property t)
(def-edebug-spec c-get-char-property t)
(def-edebug-spec c-clear-char-property t)
+(def-edebug-spec c-clear-char-property-with-value t)
(def-edebug-spec c-clear-char-property-with-value-on-char t)
(def-edebug-spec c-put-char-properties-on-char t)
(def-edebug-spec c-clear-char-properties t)
(def-edebug-spec c-put-overlay t)
(def-edebug-spec c-delete-overlay t)
-(def-edebug-spec c-self-bind-state-cache t);))
+(def-edebug-spec c-mark-<-as-paren t)
+(def-edebug-spec c-mark->-as-paren t)
+(def-edebug-spec c-unmark-<->-as-paren t)
+(def-edebug-spec c-with-<->-as-parens-suppressed (body))
+(def-edebug-spec c-self-bind-state-cache (body))
+(def-edebug-spec c-sc-scan-lists-no-category+1+1 t)
+(def-edebug-spec c-sc-scan-lists-no-category+1-1 t)
+(def-edebug-spec c-sc-scan-lists-no-category-1+1 t)
+(def-edebug-spec c-sc-scan-lists-no-category-1-1 t)
+(def-edebug-spec c-sc-scan-lists t)
+(def-edebug-spec c-sc-parse-partial-sexp t);))
;;; Functions.
@@ -1560,12 +1607,12 @@ with value CHAR in the region [FROM to)."
(defmacro c-looking-at-non-alphnumspace ()
"Are we looking at a character which isn't alphanumeric or space?"
(if (memq 'gen-comment-delim c-emacs-features)
- `(looking-at
-"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")
- `(or (looking-at
-"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
- (let ((prop (c-get-char-property (point) 'syntax-table)))
- (eq prop '(14))))))) ; '(14) is generic comment delimiter.
+ '(looking-at
+ "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")
+ '(or (looking-at
+ "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
+ (let ((prop (c-get-char-property (point) 'syntax-table)))
+ (eq prop '(14))))))) ; '(14) is generic comment delimiter.
(defsubst c-intersect-lists (list alist)
@@ -1775,10 +1822,10 @@ when it's needed. The default is the current language taken from
(t
re)))
- ;; Produce a regexp that matches nothing.
+ ;; Produce a regexp that doesn't match anything.
(if adorn
- "\\(\\<\\>\\)"
- "\\<\\>")))
+ "\\(a\\`\\)"
+ "a\\`")))
(put 'c-make-keywords-re 'lisp-indent-function 1)
@@ -1789,7 +1836,7 @@ The returned string is of the type that can be used with
non-nil, a caret is prepended to invert the set."
;; This function ought to be in the elisp core somewhere.
(let ((str (if inverted "^" "")) char char2)
- (setq chars (sort (append chars nil) `<))
+ (setq chars (sort (append chars nil) #'<))
(while chars
(setq char (pop chars))
(if (memq char '(?\\ ?^ ?-))
@@ -1840,7 +1887,7 @@ non-nil, a caret is prepended to invert the set."
(setq entry (get-char-table ?a table)))
;; incompatible
(t (error "CC Mode is incompatible with this version of Emacs")))
- (setq list (cons (if (= (logand (lsh entry -16) 255) 255)
+ (setq list (cons (if (= (logand (ash entry -16) 255) 255)
'8-bit
'1-bit)
list)))