diff options
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/cc-align.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 99 | ||||
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/cc-vars.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/hideshow.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 24 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 20 | ||||
| -rw-r--r-- | lisp/progmodes/sql.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/vhdl-mode.el | 43 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 2 |
10 files changed, 143 insertions, 64 deletions
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 7cb36c4396b..0f7e4b598dc 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -1221,6 +1221,18 @@ Works with: arglist-cont, arglist-cont-nonempty." | |||
| 1221 | 1221 | ||
| 1222 | (vector (progn (goto-char alignto) (current-column))))))) | 1222 | (vector (progn (goto-char alignto) (current-column))))))) |
| 1223 | 1223 | ||
| 1224 | (defun c-lineup-under-anchor (langelem) | ||
| 1225 | "Line up the current line directly under the anchor position in LANGELEM. | ||
| 1226 | |||
| 1227 | This is like 0, except it supersedes any indentation already calculated for | ||
| 1228 | previous syntactic elements in the syntactic context. | ||
| 1229 | |||
| 1230 | Works with: Any syntactic symbol which has an anchor position." | ||
| 1231 | (save-excursion | ||
| 1232 | (goto-char (c-langelem-pos langelem)) | ||
| 1233 | (vector (current-column)))) | ||
| 1234 | |||
| 1235 | |||
| 1224 | (defun c-lineup-dont-change (langelem) | 1236 | (defun c-lineup-dont-change (langelem) |
| 1225 | "Do not change the indentation of the current line. | 1237 | "Do not change the indentation of the current line. |
| 1226 | 1238 | ||
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index f214242bdd9..7f49557c7a6 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -10260,13 +10260,22 @@ comment at the start of cc-engine.el for more info." | |||
| 10260 | (t nil))))) | 10260 | (t nil))))) |
| 10261 | 10261 | ||
| 10262 | (setq pos (point)) | 10262 | (setq pos (point)) |
| 10263 | (if (and after-type-id-pos | 10263 | (cond |
| 10264 | (goto-char after-type-id-pos) | 10264 | ((and after-type-id-pos |
| 10265 | (setq res (c-back-over-member-initializers)) | 10265 | (goto-char after-type-id-pos) |
| 10266 | (goto-char res) | 10266 | (setq res (c-back-over-member-initializers)) |
| 10267 | (eq (car (c-beginning-of-decl-1 lim)) 'same)) | 10267 | (goto-char res) |
| 10268 | (cons (point) nil) ; Return value. | 10268 | (eq (car (c-beginning-of-decl-1 lim)) 'same)) |
| 10269 | (cons (point) nil)) ; Return value. | ||
| 10270 | |||
| 10271 | ((and after-type-id-pos | ||
| 10272 | (progn | ||
| 10273 | (c-backward-syntactic-ws) | ||
| 10274 | (eq (char-before) ?\())) | ||
| 10275 | ;; Single identifier between '(' and '{'. We have a bracelist. | ||
| 10276 | (cons after-type-id-pos nil)) | ||
| 10269 | 10277 | ||
| 10278 | (t | ||
| 10270 | (goto-char pos) | 10279 | (goto-char pos) |
| 10271 | ;; Checks to do on all sexps before the brace, up to the | 10280 | ;; Checks to do on all sexps before the brace, up to the |
| 10272 | ;; beginning of the statement. | 10281 | ;; beginning of the statement. |
| @@ -10368,7 +10377,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10368 | ; languages where | 10377 | ; languages where |
| 10369 | ; `c-opt-inexpr-brace-list-key' is | 10378 | ; `c-opt-inexpr-brace-list-key' is |
| 10370 | ; non-nil and we have macros. | 10379 | ; non-nil and we have macros. |
| 10371 | (t t))) ;; The caller can go up one level. | 10380 | (t t)))) ;; The caller can go up one level. |
| 10372 | ))) | 10381 | ))) |
| 10373 | 10382 | ||
| 10374 | (defun c-inside-bracelist-p (containing-sexp paren-state) | 10383 | (defun c-inside-bracelist-p (containing-sexp paren-state) |
| @@ -10493,6 +10502,30 @@ comment at the start of cc-engine.el for more info." | |||
| 10493 | (c-at-statement-start-p)) | 10502 | (c-at-statement-start-p)) |
| 10494 | (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") | 10503 | (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") |
| 10495 | 10504 | ||
| 10505 | (defun c-looking-at-statement-block () | ||
| 10506 | ;; Point is at an opening brace. If this is a statement block (i.e. the | ||
| 10507 | ;; elements in it are terminated by semicolons) return t. Otherwise, return | ||
| 10508 | ;; nil. | ||
| 10509 | (let ((here (point))) | ||
| 10510 | (prog1 | ||
| 10511 | (if (c-go-list-forward) | ||
| 10512 | (let ((there (point))) | ||
| 10513 | (backward-char) | ||
| 10514 | (c-syntactic-skip-backward | ||
| 10515 | "^;," here t) | ||
| 10516 | (cond | ||
| 10517 | ((eq (char-before) ?\;) t) | ||
| 10518 | ((eq (char-before) ?,) nil) | ||
| 10519 | (t (goto-char here) | ||
| 10520 | (forward-char) | ||
| 10521 | (and (c-syntactic-re-search-forward "{" there t t) | ||
| 10522 | (progn (backward-char) | ||
| 10523 | (c-looking-at-statement-block)))))) | ||
| 10524 | (forward-char) | ||
| 10525 | (and (c-syntactic-re-search-forward "[;,]" nil t t) | ||
| 10526 | (eq (char-before) ?\;))) | ||
| 10527 | (goto-char here)))) | ||
| 10528 | |||
| 10496 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) | 10529 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) |
| 10497 | ;; Return non-nil if we're looking at the beginning of a block | 10530 | ;; Return non-nil if we're looking at the beginning of a block |
| 10498 | ;; inside an expression. The value returned is actually a cons of | 10531 | ;; inside an expression. The value returned is actually a cons of |
| @@ -10648,15 +10681,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10648 | (and (c-major-mode-is 'c++-mode) | 10681 | (and (c-major-mode-is 'c++-mode) |
| 10649 | (save-excursion | 10682 | (save-excursion |
| 10650 | (goto-char block-follows) | 10683 | (goto-char block-follows) |
| 10651 | (if (c-go-list-forward) | 10684 | (not (c-looking-at-statement-block))))) |
| 10652 | (progn | ||
| 10653 | (backward-char) | ||
| 10654 | (c-syntactic-skip-backward | ||
| 10655 | "^;," block-follows t) | ||
| 10656 | (not (eq (char-before) ?\;))) | ||
| 10657 | (or (not (c-syntactic-re-search-forward | ||
| 10658 | "[;,]" nil t t)) | ||
| 10659 | (not (eq (char-before) ?\;))))))) | ||
| 10660 | nil | 10685 | nil |
| 10661 | (cons 'inexpr-statement (point))))) | 10686 | (cons 'inexpr-statement (point))))) |
| 10662 | 10687 | ||
| @@ -10792,17 +10817,20 @@ comment at the start of cc-engine.el for more info." | |||
| 10792 | syntax-extra-args | 10817 | syntax-extra-args |
| 10793 | stop-at-boi-only | 10818 | stop-at-boi-only |
| 10794 | containing-sexp | 10819 | containing-sexp |
| 10795 | paren-state) | 10820 | paren-state |
| 10821 | &optional fixed-anchor) | ||
| 10796 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as | 10822 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as |
| 10797 | ;; needed with further syntax elements of the types `substatement', | 10823 | ;; needed with further syntax elements of the types `substatement', |
| 10798 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and | 10824 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', |
| 10799 | ;; `defun-block-intro'. | 10825 | ;; `defun-block-intro', and `brace-list-intro'. |
| 10800 | ;; | 10826 | ;; |
| 10801 | ;; Do the generic processing to anchor the given syntax symbol on | 10827 | ;; Do the generic processing to anchor the given syntax symbol on the |
| 10802 | ;; the preceding statement: Skip over any labels and containing | 10828 | ;; preceding statement: First skip over any labels and containing statements |
| 10803 | ;; statements on the same line, and then search backward until we | 10829 | ;; on the same line. If FIXED-ANCHOR is non-nil, use this as the |
| 10804 | ;; find a statement or block start that begins at boi without a | 10830 | ;; anchor-point for the given syntactic symbol, and don't make syntactic |
| 10805 | ;; label or comment. | 10831 | ;; entries for constructs beginning on lines before that containing |
| 10832 | ;; ANCHOR-POINT. Otherwise search backward until we find a statement or | ||
| 10833 | ;; block start that begins at boi without a label or comment. | ||
| 10806 | ;; | 10834 | ;; |
| 10807 | ;; Point is assumed to be at the prospective anchor point for the | 10835 | ;; Point is assumed to be at the prospective anchor point for the |
| 10808 | ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to | 10836 | ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to |
| @@ -10831,6 +10859,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10831 | 10859 | ||
| 10832 | (let ((syntax-last c-syntactic-context) | 10860 | (let ((syntax-last c-syntactic-context) |
| 10833 | (boi (c-point 'boi)) | 10861 | (boi (c-point 'boi)) |
| 10862 | (anchor-boi (c-point 'boi)) | ||
| 10834 | ;; Set when we're on a label, so that we don't stop there. | 10863 | ;; Set when we're on a label, so that we don't stop there. |
| 10835 | ;; FIXME: To be complete we should check if we're on a label | 10864 | ;; FIXME: To be complete we should check if we're on a label |
| 10836 | ;; now at the start. | 10865 | ;; now at the start. |
| @@ -10908,7 +10937,9 @@ comment at the start of cc-engine.el for more info." | |||
| 10908 | (c-add-syntax 'substatement nil)))) | 10937 | (c-add-syntax 'substatement nil)))) |
| 10909 | ))) | 10938 | ))) |
| 10910 | 10939 | ||
| 10911 | containing-sexp) | 10940 | containing-sexp |
| 10941 | (or (null fixed-anchor) | ||
| 10942 | (> containing-sexp anchor-boi))) | ||
| 10912 | 10943 | ||
| 10913 | ;; Now we have to go out of this block. | 10944 | ;; Now we have to go out of this block. |
| 10914 | (goto-char containing-sexp) | 10945 | (goto-char containing-sexp) |
| @@ -10982,6 +11013,14 @@ comment at the start of cc-engine.el for more info." | |||
| 10982 | (cdr (assoc (match-string 1) | 11013 | (cdr (assoc (match-string 1) |
| 10983 | c-other-decl-block-key-in-symbols-alist)) | 11014 | c-other-decl-block-key-in-symbols-alist)) |
| 10984 | (max (c-point 'boi paren-pos) (point)))) | 11015 | (max (c-point 'boi paren-pos) (point)))) |
| 11016 | ((save-excursion | ||
| 11017 | (goto-char paren-pos) | ||
| 11018 | (c-looking-at-or-maybe-in-bracelist containing-sexp)) | ||
| 11019 | (if (save-excursion | ||
| 11020 | (goto-char paren-pos) | ||
| 11021 | (c-looking-at-statement-block)) | ||
| 11022 | (c-add-syntax 'defun-block-intro nil) | ||
| 11023 | (c-add-syntax 'brace-list-intro nil))) | ||
| 10985 | (t (c-add-syntax 'defun-block-intro nil)))) | 11024 | (t (c-add-syntax 'defun-block-intro nil)))) |
| 10986 | 11025 | ||
| 10987 | (c-add-syntax 'statement-block-intro nil))) | 11026 | (c-add-syntax 'statement-block-intro nil))) |
| @@ -11001,7 +11040,10 @@ comment at the start of cc-engine.el for more info." | |||
| 11001 | (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] | 11040 | (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] |
| 11002 | (while q | 11041 | (while q |
| 11003 | (unless (car q) | 11042 | (unless (car q) |
| 11004 | (setcar q (point))) | 11043 | (setcar q (if (or (cdr p) |
| 11044 | (null fixed-anchor)) | ||
| 11045 | (point) | ||
| 11046 | fixed-anchor))) | ||
| 11005 | (setq q (cdr q))) | 11047 | (setq q (cdr q))) |
| 11006 | (setq p (cdr p)))) | 11048 | (setq p (cdr p)))) |
| 11007 | ))) | 11049 | ))) |
| @@ -12354,7 +12396,8 @@ comment at the start of cc-engine.el for more info." | |||
| 12354 | (c-forward-syntactic-ws (c-point 'eol)) | 12396 | (c-forward-syntactic-ws (c-point 'eol)) |
| 12355 | (c-looking-at-special-brace-list (point))))) | 12397 | (c-looking-at-special-brace-list (point))))) |
| 12356 | (c-add-syntax 'brace-entry-open (point)) | 12398 | (c-add-syntax 'brace-entry-open (point)) |
| 12357 | (c-add-syntax 'brace-list-entry (point)) | 12399 | (c-add-stmt-syntax 'brace-list-entry nil t containing-sexp |
| 12400 | paren-state (point)) | ||
| 12358 | )) | 12401 | )) |
| 12359 | )))) | 12402 | )))) |
| 12360 | 12403 | ||
| @@ -12848,7 +12891,7 @@ Cannot combine absolute offsets %S and %S in `add' method" | |||
| 12848 | ;; | 12891 | ;; |
| 12849 | ;; Note that topmost-intro always has an anchor position at bol, for | 12892 | ;; Note that topmost-intro always has an anchor position at bol, for |
| 12850 | ;; historical reasons. It's often used together with other symbols | 12893 | ;; historical reasons. It's often used together with other symbols |
| 12851 | ;; that has more sane positions. Since we always use the first | 12894 | ;; that have more sane positions. Since we always use the first |
| 12852 | ;; found anchor position, we rely on that these other symbols always | 12895 | ;; found anchor position, we rely on that these other symbols always |
| 12853 | ;; precede topmost-intro in the LANGELEMS list. | 12896 | ;; precede topmost-intro in the LANGELEMS list. |
| 12854 | ;; | 12897 | ;; |
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index d3505490505..b3848a74f97 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | (arglist-close . c-lineup-arglist) | 67 | (arglist-close . c-lineup-arglist) |
| 68 | (inline-open . 0) | 68 | (inline-open . 0) |
| 69 | (brace-list-open . +) | 69 | (brace-list-open . +) |
| 70 | (brace-list-intro . c-lineup-arglist-intro-after-paren) | ||
| 70 | (topmost-intro-cont | 71 | (topmost-intro-cont |
| 71 | . (first c-lineup-topmost-intro-cont | 72 | . (first c-lineup-topmost-intro-cont |
| 72 | c-lineup-gnu-DEFUN-intro-cont)))) | 73 | c-lineup-gnu-DEFUN-intro-cont)))) |
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index a6a96d15188..1114b21381d 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -1115,7 +1115,7 @@ can always override the use of `c-default-style' by making calls to | |||
| 1115 | ;; Anchor pos: At the brace list decl start(*). | 1115 | ;; Anchor pos: At the brace list decl start(*). |
| 1116 | (brace-list-intro . +) | 1116 | (brace-list-intro . +) |
| 1117 | ;; Anchor pos: At the brace list decl start(*). | 1117 | ;; Anchor pos: At the brace list decl start(*). |
| 1118 | (brace-list-entry . 0) | 1118 | (brace-list-entry . c-lineup-under-anchor) |
| 1119 | ;; Anchor pos: At the first non-ws char after the open paren if | 1119 | ;; Anchor pos: At the first non-ws char after the open paren if |
| 1120 | ;; the first token is on the same line, otherwise boi at that | 1120 | ;; the first token is on the same line, otherwise boi at that |
| 1121 | ;; token. | 1121 | ;; token. |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 0e4e67018ed..5328526abd9 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -582,7 +582,7 @@ and then further adjusted to be at the end of the line." | |||
| 582 | (setq p (line-end-position))) | 582 | (setq p (line-end-position))) |
| 583 | ;; `q' is the point at the end of the block | 583 | ;; `q' is the point at the end of the block |
| 584 | (hs-forward-sexp mdata 1) | 584 | (hs-forward-sexp mdata 1) |
| 585 | (setq q (if (looking-back hs-block-end-regexp) | 585 | (setq q (if (looking-back hs-block-end-regexp nil) |
| 586 | (match-beginning 0) | 586 | (match-beginning 0) |
| 587 | (point))) | 587 | (point))) |
| 588 | (when (and (< p q) (> (count-lines p q) 1)) | 588 | (when (and (< p q) (> (count-lines p q) 1)) |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 2e5c6ae119b..e42e01481b6 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -574,8 +574,8 @@ then the \".\"s will be lined up: | |||
| 574 | (define-key keymap [(control ?c) (control ?j)] #'js-set-js-context) | 574 | (define-key keymap [(control ?c) (control ?j)] #'js-set-js-context) |
| 575 | (define-key keymap [(control meta ?x)] #'js-eval-defun) | 575 | (define-key keymap [(control meta ?x)] #'js-eval-defun) |
| 576 | (define-key keymap [(meta ?.)] #'js-find-symbol) | 576 | (define-key keymap [(meta ?.)] #'js-find-symbol) |
| 577 | (easy-menu-define nil keymap "Javascript Menu" | 577 | (easy-menu-define nil keymap "JavaScript Menu" |
| 578 | '("Javascript" | 578 | '("JavaScript" |
| 579 | ["Select New Mozilla Context..." js-set-js-context | 579 | ["Select New Mozilla Context..." js-set-js-context |
| 580 | (fboundp #'inferior-moz-process)] | 580 | (fboundp #'inferior-moz-process)] |
| 581 | ["Evaluate Expression in Mozilla Context..." js-eval | 581 | ["Evaluate Expression in Mozilla Context..." js-eval |
| @@ -1712,7 +1712,7 @@ This performs fontification according to `js--class-styles'." | |||
| 1712 | nil)))))) | 1712 | nil)))))) |
| 1713 | 1713 | ||
| 1714 | (defun js-syntax-propertize (start end) | 1714 | (defun js-syntax-propertize (start end) |
| 1715 | ;; Javascript allows immediate regular expression objects, written /.../. | 1715 | ;; JavaScript allows immediate regular expression objects, written /.../. |
| 1716 | (goto-char start) | 1716 | (goto-char start) |
| 1717 | (js-syntax-propertize-regexp end) | 1717 | (js-syntax-propertize-regexp end) |
| 1718 | (funcall | 1718 | (funcall |
| @@ -2710,7 +2710,7 @@ current buffer. Pushes a mark onto the tag ring just like | |||
| 2710 | ;;; MozRepl integration | 2710 | ;;; MozRepl integration |
| 2711 | 2711 | ||
| 2712 | (define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) | 2712 | (define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) |
| 2713 | (define-error 'js-js-error "Javascript Error") ;; '(js-error error)) | 2713 | (define-error 'js-js-error "JavaScript Error") ;; '(js-error error)) |
| 2714 | 2714 | ||
| 2715 | (defun js--wait-for-matching-output | 2715 | (defun js--wait-for-matching-output |
| 2716 | (process regexp timeout &optional start) | 2716 | (process regexp timeout &optional start) |
| @@ -3214,7 +3214,7 @@ with `js--js-encode-value'." | |||
| 3214 | Inside the lexical scope of `with-js', `js?', `js!', | 3214 | Inside the lexical scope of `with-js', `js?', `js!', |
| 3215 | `js-new', `js-eval', `js-list', `js<', `js>', `js-get-service', | 3215 | `js-new', `js-eval', `js-list', `js<', `js>', `js-get-service', |
| 3216 | `js-create-instance', and `js-qi' are defined." | 3216 | `js-create-instance', and `js-qi' are defined." |
| 3217 | 3217 | (declare (indent 0) (debug t)) | |
| 3218 | `(progn | 3218 | `(progn |
| 3219 | (js--js-enter-repl) | 3219 | (js--js-enter-repl) |
| 3220 | (unwind-protect | 3220 | (unwind-protect |
| @@ -3391,7 +3391,7 @@ With argument, run even if no intervening GC has happened." | |||
| 3391 | 3391 | ||
| 3392 | (defun js-eval (js) | 3392 | (defun js-eval (js) |
| 3393 | "Evaluate the JavaScript in JS and return JSON-decoded result." | 3393 | "Evaluate the JavaScript in JS and return JSON-decoded result." |
| 3394 | (interactive "MJavascript to evaluate: ") | 3394 | (interactive "MJavaScript to evaluate: ") |
| 3395 | (with-js | 3395 | (with-js |
| 3396 | (let* ((content-window (js--js-content-window | 3396 | (let* ((content-window (js--js-content-window |
| 3397 | (js--get-js-context))) | 3397 | (js--get-js-context))) |
| @@ -3431,11 +3431,8 @@ left-to-right." | |||
| 3431 | (eq (cl-fifth window-info) 2)) | 3431 | (eq (cl-fifth window-info) 2)) |
| 3432 | do (push window-info windows)) | 3432 | do (push window-info windows)) |
| 3433 | 3433 | ||
| 3434 | (cl-loop for window-info in windows | 3434 | (cl-loop for (window title location) in windows |
| 3435 | for window = (cl-first window-info) | 3435 | collect (list title location window) |
| 3436 | collect (list (cl-second window-info) | ||
| 3437 | (cl-third window-info) | ||
| 3438 | window) | ||
| 3439 | 3436 | ||
| 3440 | for gbrowser = (js< window "gBrowser") | 3437 | for gbrowser = (js< window "gBrowser") |
| 3441 | if (js-handle? gbrowser) | 3438 | if (js-handle? gbrowser) |
| @@ -3668,7 +3665,7 @@ Change with `js-set-js-context'.") | |||
| 3668 | (defun js-set-js-context (context) | 3665 | (defun js-set-js-context (context) |
| 3669 | "Set the JavaScript context to CONTEXT. | 3666 | "Set the JavaScript context to CONTEXT. |
| 3670 | When called interactively, prompt for CONTEXT." | 3667 | When called interactively, prompt for CONTEXT." |
| 3671 | (interactive (list (js--read-tab "Javascript Context: "))) | 3668 | (interactive (list (js--read-tab "JavaScript Context: "))) |
| 3672 | (setq js--js-context context)) | 3669 | (setq js--js-context context)) |
| 3673 | 3670 | ||
| 3674 | (defun js--get-js-context () | 3671 | (defun js--get-js-context () |
| @@ -3682,7 +3679,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." | |||
| 3682 | (`browser (not (js? (js< (cdr js--js-context) | 3679 | (`browser (not (js? (js< (cdr js--js-context) |
| 3683 | "contentDocument")))) | 3680 | "contentDocument")))) |
| 3684 | (x (error "Unmatched case in js--get-js-context: %S" x)))) | 3681 | (x (error "Unmatched case in js--get-js-context: %S" x)))) |
| 3685 | (setq js--js-context (js--read-tab "Javascript Context: "))) | 3682 | (setq js--js-context (js--read-tab "JavaScript Context: "))) |
| 3686 | js--js-context)) | 3683 | js--js-context)) |
| 3687 | 3684 | ||
| 3688 | (defun js--js-content-window (context) | 3685 | (defun js--js-content-window (context) |
| @@ -3852,6 +3849,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." | |||
| 3852 | comment-start-skip "\\(//+\\|/\\*+\\)\\s *") | 3849 | comment-start-skip "\\(//+\\|/\\*+\\)\\s *") |
| 3853 | (setq-local comment-line-break-function #'c-indent-new-comment-line) | 3850 | (setq-local comment-line-break-function #'c-indent-new-comment-line) |
| 3854 | (setq-local c-block-comment-start-regexp "/\\*") | 3851 | (setq-local c-block-comment-start-regexp "/\\*") |
| 3852 | (setq-local comment-multi-line t) | ||
| 3855 | 3853 | ||
| 3856 | (setq-local electric-indent-chars | 3854 | (setq-local electric-indent-chars |
| 3857 | (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". | 3855 | (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d8262dd0a75..90b5e4e0dc6 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -4693,7 +4693,8 @@ likely an invalid python file." | |||
| 4693 | (let ((dedenter-pos (python-info-dedenter-statement-p))) | 4693 | (let ((dedenter-pos (python-info-dedenter-statement-p))) |
| 4694 | (when dedenter-pos | 4694 | (when dedenter-pos |
| 4695 | (goto-char dedenter-pos) | 4695 | (goto-char dedenter-pos) |
| 4696 | (let* ((pairs '(("elif" "elif" "if") | 4696 | (let* ((cur-line (line-beginning-position)) |
| 4697 | (pairs '(("elif" "elif" "if") | ||
| 4697 | ("else" "if" "elif" "except" "for" "while") | 4698 | ("else" "if" "elif" "except" "for" "while") |
| 4698 | ("except" "except" "try") | 4699 | ("except" "except" "try") |
| 4699 | ("finally" "else" "except" "try"))) | 4700 | ("finally" "else" "except" "try"))) |
| @@ -4709,7 +4710,22 @@ likely an invalid python file." | |||
| 4709 | (let ((indentation (current-indentation))) | 4710 | (let ((indentation (current-indentation))) |
| 4710 | (when (and (not (memq indentation collected-indentations)) | 4711 | (when (and (not (memq indentation collected-indentations)) |
| 4711 | (or (not collected-indentations) | 4712 | (or (not collected-indentations) |
| 4712 | (< indentation (apply #'min collected-indentations)))) | 4713 | (< indentation (apply #'min collected-indentations))) |
| 4714 | ;; There must be no line with indentation | ||
| 4715 | ;; smaller than `indentation' (except for | ||
| 4716 | ;; blank lines) between the found opening | ||
| 4717 | ;; block and the current line, otherwise it | ||
| 4718 | ;; is not an opening block. | ||
| 4719 | (save-excursion | ||
| 4720 | (forward-line) | ||
| 4721 | (let ((no-back-indent t)) | ||
| 4722 | (save-match-data | ||
| 4723 | (while (and (< (point) cur-line) | ||
| 4724 | (setq no-back-indent | ||
| 4725 | (or (> (current-indentation) indentation) | ||
| 4726 | (python-info-current-line-empty-p)))) | ||
| 4727 | (forward-line))) | ||
| 4728 | no-back-indent))) | ||
| 4713 | (setq collected-indentations | 4729 | (setq collected-indentations |
| 4714 | (cons indentation collected-indentations)) | 4730 | (cons indentation collected-indentations)) |
| 4715 | (when (member (match-string-no-properties 0) | 4731 | (when (member (match-string-no-properties 0) |
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 71563486ecd..88683431290 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -2790,7 +2790,7 @@ local variable." | |||
| 2790 | ;; Iterate until we've moved the desired number of stmt ends | 2790 | ;; Iterate until we've moved the desired number of stmt ends |
| 2791 | (while (not (= (cl-signum arg) 0)) | 2791 | (while (not (= (cl-signum arg) 0)) |
| 2792 | ;; if we're looking at the terminator, jump by 2 | 2792 | ;; if we're looking at the terminator, jump by 2 |
| 2793 | (if (or (and (> 0 arg) (looking-back term)) | 2793 | (if (or (and (> 0 arg) (looking-back term nil)) |
| 2794 | (and (< 0 arg) (looking-at term))) | 2794 | (and (< 0 arg) (looking-at term))) |
| 2795 | (setq n 2) | 2795 | (setq n 2) |
| 2796 | (setq n 1)) | 2796 | (setq n 1)) |
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 0e8ff525e62..6c76d7e4ad2 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el | |||
| @@ -126,6 +126,14 @@ | |||
| 126 | 126 | ||
| 127 | ;;; Code: | 127 | ;;; Code: |
| 128 | 128 | ||
| 129 | (eval-when-compile (require 'cl)) | ||
| 130 | (eval-and-compile | ||
| 131 | ;; Before Emacs-24.4, `pushnew' expands to runtime calls to `cl-adjoin' | ||
| 132 | ;; even for relatively simple cases such as used here. We only test <25 | ||
| 133 | ;; because it's easier and sufficient. | ||
| 134 | (when (or (featurep 'xemacs) (< emacs-major-version 25)) | ||
| 135 | (require 'cl))) | ||
| 136 | |||
| 129 | ;; Emacs 21+ handling | 137 | ;; Emacs 21+ handling |
| 130 | (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs))) | 138 | (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs))) |
| 131 | "Non-nil if GNU Emacs 21, 22, ... is used.") | 139 | "Non-nil if GNU Emacs 21, 22, ... is used.") |
| @@ -14314,7 +14322,7 @@ of PROJECT." | |||
| 14314 | (vhdl-scan-directory-contents dir-name project nil | 14322 | (vhdl-scan-directory-contents dir-name project nil |
| 14315 | (format "(%s/%s) " act-dir num-dir) | 14323 | (format "(%s/%s) " act-dir num-dir) |
| 14316 | (cdr dir-list)) | 14324 | (cdr dir-list)) |
| 14317 | (add-to-list 'dir-list-tmp (file-name-directory dir-name)) | 14325 | (pushnew (file-name-directory dir-name) dir-list-tmp :test #'equal) |
| 14318 | (setq dir-list (cdr dir-list) | 14326 | (setq dir-list (cdr dir-list) |
| 14319 | act-dir (1+ act-dir))) | 14327 | act-dir (1+ act-dir))) |
| 14320 | (vhdl-aput 'vhdl-directory-alist project (list (nreverse dir-list-tmp))) | 14328 | (vhdl-aput 'vhdl-directory-alist project (list (nreverse dir-list-tmp))) |
| @@ -16406,8 +16414,8 @@ component instantiation." | |||
| 16406 | (if (or (member constant-name single-list) | 16414 | (if (or (member constant-name single-list) |
| 16407 | (member constant-name multi-list)) | 16415 | (member constant-name multi-list)) |
| 16408 | (progn (setq single-list (delete constant-name single-list)) | 16416 | (progn (setq single-list (delete constant-name single-list)) |
| 16409 | (add-to-list 'multi-list constant-name)) | 16417 | (pushnew constant-name multi-list :test #'equal)) |
| 16410 | (add-to-list 'single-list constant-name)) | 16418 | (pushnew constant-name single-list :test #'equal)) |
| 16411 | (unless (match-string 1) | 16419 | (unless (match-string 1) |
| 16412 | (setq generic-alist (cdr generic-alist))) | 16420 | (setq generic-alist (cdr generic-alist))) |
| 16413 | (vhdl-forward-syntactic-ws)) | 16421 | (vhdl-forward-syntactic-ws)) |
| @@ -16433,12 +16441,12 @@ component instantiation." | |||
| 16433 | (member signal-name multi-out-list)) | 16441 | (member signal-name multi-out-list)) |
| 16434 | (setq single-out-list (delete signal-name single-out-list)) | 16442 | (setq single-out-list (delete signal-name single-out-list)) |
| 16435 | (setq multi-out-list (delete signal-name multi-out-list)) | 16443 | (setq multi-out-list (delete signal-name multi-out-list)) |
| 16436 | (add-to-list 'local-list signal-name)) | 16444 | (pushnew signal-name local-list :test #'equal)) |
| 16437 | ((member signal-name single-in-list) | 16445 | ((member signal-name single-in-list) |
| 16438 | (setq single-in-list (delete signal-name single-in-list)) | 16446 | (setq single-in-list (delete signal-name single-in-list)) |
| 16439 | (add-to-list 'multi-in-list signal-name)) | 16447 | (pushnew signal-name multi-in-list :test #'equal)) |
| 16440 | ((not (member signal-name multi-in-list)) | 16448 | ((not (member signal-name multi-in-list)) |
| 16441 | (add-to-list 'single-in-list signal-name))) | 16449 | (pushnew signal-name single-in-list :test #'equal))) |
| 16442 | ;; output signal | 16450 | ;; output signal |
| 16443 | (cond | 16451 | (cond |
| 16444 | ((member signal-name local-list) | 16452 | ((member signal-name local-list) |
| @@ -16447,17 +16455,18 @@ component instantiation." | |||
| 16447 | (member signal-name multi-in-list)) | 16455 | (member signal-name multi-in-list)) |
| 16448 | (setq single-in-list (delete signal-name single-in-list)) | 16456 | (setq single-in-list (delete signal-name single-in-list)) |
| 16449 | (setq multi-in-list (delete signal-name multi-in-list)) | 16457 | (setq multi-in-list (delete signal-name multi-in-list)) |
| 16450 | (add-to-list 'local-list signal-name)) | 16458 | (pushnew signal-name local-list :test #'equal)) |
| 16451 | ((member signal-name single-out-list) | 16459 | ((member signal-name single-out-list) |
| 16452 | (setq single-out-list (delete signal-name single-out-list)) | 16460 | (setq single-out-list (delete signal-name single-out-list)) |
| 16453 | (add-to-list 'multi-out-list signal-name)) | 16461 | (pushnew signal-name multi-out-list :test #'equal)) |
| 16454 | ((not (member signal-name multi-out-list)) | 16462 | ((not (member signal-name multi-out-list)) |
| 16455 | (add-to-list 'single-out-list signal-name)))) | 16463 | (pushnew signal-name single-out-list :test #'equal)))) |
| 16456 | (unless (match-string 1) | 16464 | (unless (match-string 1) |
| 16457 | (setq port-alist (cdr port-alist))) | 16465 | (setq port-alist (cdr port-alist))) |
| 16458 | (vhdl-forward-syntactic-ws)) | 16466 | (vhdl-forward-syntactic-ws)) |
| 16459 | (push (list inst-name (nreverse constant-alist) | 16467 | (push (list inst-name (nreverse constant-alist) |
| 16460 | (nreverse signal-alist)) inst-alist)) | 16468 | (nreverse signal-alist)) |
| 16469 | inst-alist)) | ||
| 16461 | ;; prepare signal insertion | 16470 | ;; prepare signal insertion |
| 16462 | (vhdl-goto-marker arch-decl-pos) | 16471 | (vhdl-goto-marker arch-decl-pos) |
| 16463 | (forward-line 1) | 16472 | (forward-line 1) |
| @@ -16534,14 +16543,14 @@ component instantiation." | |||
| 16534 | generic-end-pos | 16543 | generic-end-pos |
| 16535 | (vhdl-compose-insert-generic constant-entry))) | 16544 | (vhdl-compose-insert-generic constant-entry))) |
| 16536 | (setq generic-pos (point-marker)) | 16545 | (setq generic-pos (point-marker)) |
| 16537 | (add-to-list 'written-list constant-name)) | 16546 | (pushnew constant-name written-list :test #'equal)) |
| 16538 | (t | 16547 | (t |
| 16539 | (vhdl-goto-marker | 16548 | (vhdl-goto-marker |
| 16540 | (vhdl-max-marker generic-inst-pos generic-pos)) | 16549 | (vhdl-max-marker generic-inst-pos generic-pos)) |
| 16541 | (setq generic-end-pos | 16550 | (setq generic-end-pos |
| 16542 | (vhdl-compose-insert-generic constant-entry)) | 16551 | (vhdl-compose-insert-generic constant-entry)) |
| 16543 | (setq generic-inst-pos (point-marker)) | 16552 | (setq generic-inst-pos (point-marker)) |
| 16544 | (add-to-list 'written-list constant-name)))) | 16553 | (pushnew constant-name written-list :test #'equal)))) |
| 16545 | (setq constant-alist (cdr constant-alist))) | 16554 | (setq constant-alist (cdr constant-alist))) |
| 16546 | (when (/= constant-temp-pos generic-inst-pos) | 16555 | (when (/= constant-temp-pos generic-inst-pos) |
| 16547 | (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) | 16556 | (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) |
| @@ -16560,14 +16569,14 @@ component instantiation." | |||
| 16560 | (vhdl-max-marker | 16569 | (vhdl-max-marker |
| 16561 | port-end-pos (vhdl-compose-insert-port signal-entry))) | 16570 | port-end-pos (vhdl-compose-insert-port signal-entry))) |
| 16562 | (setq port-in-pos (point-marker)) | 16571 | (setq port-in-pos (point-marker)) |
| 16563 | (add-to-list 'written-list signal-name)) | 16572 | (pushnew signal-name written-list :test #'equal)) |
| 16564 | ((member signal-name multi-out-list) | 16573 | ((member signal-name multi-out-list) |
| 16565 | (vhdl-goto-marker (vhdl-max-marker port-out-pos port-in-pos)) | 16574 | (vhdl-goto-marker (vhdl-max-marker port-out-pos port-in-pos)) |
| 16566 | (setq port-end-pos | 16575 | (setq port-end-pos |
| 16567 | (vhdl-max-marker | 16576 | (vhdl-max-marker |
| 16568 | port-end-pos (vhdl-compose-insert-port signal-entry))) | 16577 | port-end-pos (vhdl-compose-insert-port signal-entry))) |
| 16569 | (setq port-out-pos (point-marker)) | 16578 | (setq port-out-pos (point-marker)) |
| 16570 | (add-to-list 'written-list signal-name)) | 16579 | (pushnew signal-name written-list :test #'equal)) |
| 16571 | ((or (member signal-name single-in-list) | 16580 | ((or (member signal-name single-in-list) |
| 16572 | (member signal-name single-out-list)) | 16581 | (member signal-name single-out-list)) |
| 16573 | (vhdl-goto-marker | 16582 | (vhdl-goto-marker |
| @@ -16576,12 +16585,12 @@ component instantiation." | |||
| 16576 | (vhdl-max-marker port-out-pos port-in-pos))) | 16585 | (vhdl-max-marker port-out-pos port-in-pos))) |
| 16577 | (setq port-end-pos (vhdl-compose-insert-port signal-entry)) | 16586 | (setq port-end-pos (vhdl-compose-insert-port signal-entry)) |
| 16578 | (setq port-inst-pos (point-marker)) | 16587 | (setq port-inst-pos (point-marker)) |
| 16579 | (add-to-list 'written-list signal-name)) | 16588 | (pushnew signal-name written-list :test #'equal)) |
| 16580 | ((equal (upcase (nth 2 signal-entry)) "OUT") | 16589 | ((equal (upcase (nth 2 signal-entry)) "OUT") |
| 16581 | (vhdl-goto-marker signal-pos) | 16590 | (vhdl-goto-marker signal-pos) |
| 16582 | (vhdl-compose-insert-signal signal-entry) | 16591 | (vhdl-compose-insert-signal signal-entry) |
| 16583 | (setq signal-pos (point-marker)) | 16592 | (setq signal-pos (point-marker)) |
| 16584 | (add-to-list 'written-list signal-name))) | 16593 | (pushnew signal-name written-list :test #'equal))) |
| 16585 | (setq signal-alist (cdr signal-alist))) | 16594 | (setq signal-alist (cdr signal-alist))) |
| 16586 | (when (/= port-temp-pos port-inst-pos) | 16595 | (when (/= port-temp-pos port-inst-pos) |
| 16587 | (vhdl-goto-marker | 16596 | (vhdl-goto-marker |
| @@ -16932,7 +16941,7 @@ no project is defined." | |||
| 16932 | "Remove duplicate elements from IN-LIST." | 16941 | "Remove duplicate elements from IN-LIST." |
| 16933 | (let (out-list) | 16942 | (let (out-list) |
| 16934 | (while in-list | 16943 | (while in-list |
| 16935 | (add-to-list 'out-list (car in-list)) | 16944 | (pushnew (car in-list) out-list :test #'equal) |
| 16936 | (setq in-list (cdr in-list))) | 16945 | (setq in-list (cdr in-list))) |
| 16937 | out-list)) | 16946 | out-list)) |
| 16938 | 16947 | ||
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index d8098c5a54a..a8933b0103e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -918,7 +918,7 @@ IGNORES is a list of glob patterns." | |||
| 918 | (grep-compute-defaults) | 918 | (grep-compute-defaults) |
| 919 | (defvar grep-find-template) | 919 | (defvar grep-find-template) |
| 920 | (defvar grep-highlight-matches) | 920 | (defvar grep-highlight-matches) |
| 921 | (let* ((grep-find-template (replace-regexp-in-string "-e " "-E " | 921 | (let* ((grep-find-template (replace-regexp-in-string "<C>" "<C> -E" |
| 922 | grep-find-template t t)) | 922 | grep-find-template t t)) |
| 923 | (grep-highlight-matches nil) | 923 | (grep-highlight-matches nil) |
| 924 | (command (xref--rgrep-command (xref--regexp-to-extended regexp) | 924 | (command (xref--rgrep-command (xref--regexp-to-extended regexp) |