diff options
| author | Stefan Monnier | 2019-10-24 23:06:23 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-10-24 23:06:23 -0400 |
| commit | f131e396f8a32003b795456130ea37efa6ff41eb (patch) | |
| tree | cceba834987ecea14bbbe8db5aa2877f2e6de13d | |
| parent | 4a083b0d36a8b2afe23447dbc357de3641140d4d (diff) | |
| download | emacs-f131e396f8a32003b795456130ea37efa6ff41eb.tar.gz emacs-f131e396f8a32003b795456130ea37efa6ff41eb.zip | |
* lisp/cedet/mode-local.el: Clean up name space
Mostly renaming functions by adding `mode-local--` to their name
and leaving an obsolete alias behind, just in case.
(define-child-mode): Make obsolete.
(mode-local--set-parent): Rename from set-mode-local-parent.
(mode-local--new-bindings): Rename from new-mode-local-bindings.
Use `obarray-make`.
(mode-local--activate-bindings): Rename from activate-mode-local-bindings.
(mode-local--deactivate-bindings): Rename from
deactivate-mode-local-bindings.
(make-obsolete-overload): Rename properties with a `mode-local--` prefix.
Adjust all users.
(mode-local--overload-obsoleted-by): Rename from overload-obsoleted-by.
(mode-local--overload-that-obsolete): Rename from overload-that-obsolete.
(mode-local--function-overload-p): Rename from function-overload-p.
(mode-local-read-function): Mark obsolete.
(mode-local--overload-docstring-extension): Rename from
overload-docstring-extension.
(mode-local--describe-overload): Rename from describe-mode-local-overload.
* lisp/cedet/semantic/fw.el (semantic-install-function-overrides):
Remove unused `mode` argument.
* lisp/cedet/semantic/grammar-wy.el (semantic-grammar-wy--install-parser):
* lisp/cedet/semantic/bovine/grammar.el (bovine-grammar-mode):
* lisp/cedet/semantic/texi.el (semantic-default-texi-setup):
* lisp/cedet/semantic/wisent/grammar.el (wisent-grammar-setupcode-builder)
(wisent-grammar-mode):
* lisp/cedet/semantic/html.el (semantic-default-html-setup):
Make the `semantic-` prefix explicit to ease grep search.
(html-helper-mode): Remove obsolete setting.
* lisp/cedet/semantic/wisent/javascript.el: Fix js-mode/javascript-mode
mixup so we don't need define-child-mode any more.
(semantic-get-local-variables, semantic-ctxt-current-symbol)
(semantic-tag-protection, semantic-analyze-scope-calculate-access):
Use `js-mode` rather than `javascript-mode` as the mode name since
that's the real mode's name.
* lisp/cedet/semantic/wisent/python.el (python-2-mode, python-3-mode):
Remove child declaration for non-existing modes.
* lisp/cedet/srecode/map.el (srecode-map-validate-file-for-mode): Simplify.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/cedet/mode-local.el | 96 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/c.el | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/el.el | 9 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/grammar.el | 4 | ||||
| -rw-r--r-- | lisp/cedet/semantic/fw.el | 9 | ||||
| -rw-r--r-- | lisp/cedet/semantic/grammar-wy.el | 2 | ||||
| -rw-r--r-- | lisp/cedet/semantic/html.el | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/lex-spp.el | 2 | ||||
| -rw-r--r-- | lisp/cedet/semantic/texi.el | 8 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/grammar.el | 6 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/javascript.el | 15 | ||||
| -rw-r--r-- | lisp/cedet/semantic/wisent/python.el | 5 | ||||
| -rw-r--r-- | lisp/cedet/srecode/map.el | 4 |
14 files changed, 97 insertions, 82 deletions
| @@ -2170,7 +2170,8 @@ if you set 'time-stamp-format' or 'time-stamp-pattern' with a | |||
| 2170 | file-local variable, you may need to update the value. | 2170 | file-local variable, you may need to update the value. |
| 2171 | 2171 | ||
| 2172 | ** mode-local | 2172 | ** mode-local |
| 2173 | *** 'define-overload' is declared obsolete. | 2173 | *** Declare 'define-overload' and 'define-child-mode' as obsolete |
| 2174 | *** Rename several internal functions to use a ''mode-local-' prefix | ||
| 2174 | 2175 | ||
| 2175 | 2176 | ||
| 2176 | * New Modes and Packages in Emacs 27.1 | 2177 | * New Modes and Packages in Emacs 27.1 |
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 602961c199e..c4e5280df30 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el | |||
| @@ -126,7 +126,7 @@ after changing the major mode." | |||
| 126 | (mode-local-map-file-buffers | 126 | (mode-local-map-file-buffers |
| 127 | (lambda () | 127 | (lambda () |
| 128 | ;; Make sure variables are set up for this mode. | 128 | ;; Make sure variables are set up for this mode. |
| 129 | (activate-mode-local-bindings) | 129 | (mode-local--activate-bindings) |
| 130 | (run-hooks 'mode-local-init-hook)) | 130 | (run-hooks 'mode-local-init-hook)) |
| 131 | (lambda () | 131 | (lambda () |
| 132 | (not (mode-local-initialized-p))) | 132 | (not (mode-local-initialized-p))) |
| @@ -139,7 +139,9 @@ after changing the major mode." | |||
| 139 | 139 | ||
| 140 | ;;; Mode lineage | 140 | ;;; Mode lineage |
| 141 | ;; | 141 | ;; |
| 142 | (defsubst set-mode-local-parent (mode parent) | 142 | (define-obsolete-function-alias 'set-mode-local-parent |
| 143 | #'mode-local--set-parent "27.1") | ||
| 144 | (defsubst mode-local--set-parent (mode parent) | ||
| 143 | "Set parent of major mode MODE to PARENT mode. | 145 | "Set parent of major mode MODE to PARENT mode. |
| 144 | To work properly, this function should be called after PARENT mode | 146 | To work properly, this function should be called after PARENT mode |
| 145 | local variables have been defined." | 147 | local variables have been defined." |
| @@ -147,14 +149,15 @@ local variables have been defined." | |||
| 147 | ;; Refresh mode bindings to get mode local variables inherited from | 149 | ;; Refresh mode bindings to get mode local variables inherited from |
| 148 | ;; PARENT. To work properly, the following should be called after | 150 | ;; PARENT. To work properly, the following should be called after |
| 149 | ;; PARENT mode local variables have been defined. | 151 | ;; PARENT mode local variables have been defined. |
| 150 | (mode-local-map-mode-buffers #'activate-mode-local-bindings mode)) | 152 | (mode-local-map-mode-buffers #'mode-local--activate-bindings mode)) |
| 151 | 153 | ||
| 152 | (defmacro define-child-mode (mode parent &optional _docstring) | 154 | (defmacro define-child-mode (mode parent &optional _docstring) |
| 153 | "Make major mode MODE inherit behavior from PARENT mode. | 155 | "Make major mode MODE inherit behavior from PARENT mode. |
| 154 | DOCSTRING is optional and not used. | 156 | DOCSTRING is optional and not used. |
| 155 | To work properly, this should be put after PARENT mode local variables | 157 | To work properly, this should be put after PARENT mode local variables |
| 156 | definition." | 158 | definition." |
| 157 | `(set-mode-local-parent ',mode ',parent)) | 159 | (declare (obsolete define-derived-mode "27.1")) |
| 160 | `(mode-local--set-parent ',mode ',parent)) | ||
| 158 | 161 | ||
| 159 | (defun mode-local-use-bindings-p (this-mode desired-mode) | 162 | (defun mode-local-use-bindings-p (this-mode desired-mode) |
| 160 | "Return non-nil if THIS-MODE can use bindings of DESIRED-MODE." | 163 | "Return non-nil if THIS-MODE can use bindings of DESIRED-MODE." |
| @@ -176,9 +179,11 @@ behaviors. Use the function `mode-local-bind' to define new bindings.") | |||
| 176 | (defvar mode-local-active-mode nil | 179 | (defvar mode-local-active-mode nil |
| 177 | "Major mode in which bindings are active.") | 180 | "Major mode in which bindings are active.") |
| 178 | 181 | ||
| 179 | (defsubst new-mode-local-bindings () | 182 | (define-obsolete-function-alias 'new-mode-local-bindings |
| 183 | #'mode-local--new-bindings "27.1") | ||
| 184 | (defsubst mode-local--new-bindings () | ||
| 180 | "Return a new empty mode bindings symbol table." | 185 | "Return a new empty mode bindings symbol table." |
| 181 | (make-vector 13 0)) | 186 | (obarray-make 13)) |
| 182 | 187 | ||
| 183 | (defun mode-local-bind (bindings &optional plist mode) | 188 | (defun mode-local-bind (bindings &optional plist mode) |
| 184 | "Define BINDINGS in the specified environment. | 189 | "Define BINDINGS in the specified environment. |
| @@ -208,7 +213,7 @@ hook." | |||
| 208 | ;; Install in given MODE symbol table. Create a new one if | 213 | ;; Install in given MODE symbol table. Create a new one if |
| 209 | ;; needed. | 214 | ;; needed. |
| 210 | (setq table (or (get mode 'mode-local-symbol-table) | 215 | (setq table (or (get mode 'mode-local-symbol-table) |
| 211 | (new-mode-local-bindings))) | 216 | (mode-local--new-bindings))) |
| 212 | (put mode 'mode-local-symbol-table table)) | 217 | (put mode 'mode-local-symbol-table table)) |
| 213 | ;; Fail if trying to bind mode variables in local context! | 218 | ;; Fail if trying to bind mode variables in local context! |
| 214 | (if (plist-get plist 'mode-variable-flag) | 219 | (if (plist-get plist 'mode-variable-flag) |
| @@ -217,7 +222,7 @@ hook." | |||
| 217 | ;; needed. | 222 | ;; needed. |
| 218 | (setq table (or mode-local-symbol-table | 223 | (setq table (or mode-local-symbol-table |
| 219 | (setq mode-local-symbol-table | 224 | (setq mode-local-symbol-table |
| 220 | (new-mode-local-bindings))))) | 225 | (mode-local--new-bindings))))) |
| 221 | (while bindings | 226 | (while bindings |
| 222 | (setq binding (car bindings) | 227 | (setq binding (car bindings) |
| 223 | bindings (cdr bindings) | 228 | bindings (cdr bindings) |
| @@ -286,7 +291,9 @@ doesn't have PROPERTY set." | |||
| 286 | 291 | ||
| 287 | ;;; Mode local variables | 292 | ;;; Mode local variables |
| 288 | ;; | 293 | ;; |
| 289 | (defun activate-mode-local-bindings (&optional mode) | 294 | (define-obsolete-function-alias 'activate-mode-local-bindings |
| 295 | #'mode-local--activate-bindings "27.1") | ||
| 296 | (defun mode-local--activate-bindings (&optional mode) | ||
| 290 | "Activate variables defined locally in MODE and its parents. | 297 | "Activate variables defined locally in MODE and its parents. |
| 291 | That is, copy mode local bindings into corresponding buffer local | 298 | That is, copy mode local bindings into corresponding buffer local |
| 292 | variables. | 299 | variables. |
| @@ -328,7 +335,9 @@ Elements are (SYMBOL . PREVIOUS-VALUE), describing one variable." | |||
| 328 | table))) | 335 | table))) |
| 329 | old-locals))) | 336 | old-locals))) |
| 330 | 337 | ||
| 331 | (defun deactivate-mode-local-bindings (&optional mode) | 338 | (define-obsolete-function-alias 'deactivate-mode-local-bindings |
| 339 | #'mode-local--deactivate-bindings "27.1") | ||
| 340 | (defun mode-local--deactivate-bindings (&optional mode) | ||
| 332 | "Deactivate variables defined locally in MODE and its parents. | 341 | "Deactivate variables defined locally in MODE and its parents. |
| 333 | That is, kill buffer local variables set from the corresponding mode | 342 | That is, kill buffer local variables set from the corresponding mode |
| 334 | local bindings. | 343 | local bindings. |
| @@ -364,19 +373,19 @@ To use the symbol MODE (quoted), use `with-mode-local'." | |||
| 364 | ) | 373 | ) |
| 365 | (unwind-protect | 374 | (unwind-protect |
| 366 | (progn | 375 | (progn |
| 367 | (deactivate-mode-local-bindings ,old-mode) | 376 | (mode-local--deactivate-bindings ,old-mode) |
| 368 | (setq mode-local-active-mode ,new-mode) | 377 | (setq mode-local-active-mode ,new-mode) |
| 369 | ;; Save the previous value of buffer-local variables | 378 | ;; Save the previous value of buffer-local variables |
| 370 | ;; changed by `activate-mode-local-bindings'. | 379 | ;; changed by `mode-local--activate-bindings'. |
| 371 | (setq ,old-locals (activate-mode-local-bindings ,new-mode)) | 380 | (setq ,old-locals (mode-local--activate-bindings ,new-mode)) |
| 372 | ,@body) | 381 | ,@body) |
| 373 | (deactivate-mode-local-bindings ,new-mode) | 382 | (mode-local--deactivate-bindings ,new-mode) |
| 374 | ;; Restore the previous value of buffer-local variables. | 383 | ;; Restore the previous value of buffer-local variables. |
| 375 | (dolist (,local ,old-locals) | 384 | (dolist (,local ,old-locals) |
| 376 | (set (car ,local) (cdr ,local))) | 385 | (set (car ,local) (cdr ,local))) |
| 377 | ;; Restore the mode local variables. | 386 | ;; Restore the mode local variables. |
| 378 | (setq mode-local-active-mode ,old-mode) | 387 | (setq mode-local-active-mode ,old-mode) |
| 379 | (activate-mode-local-bindings ,old-mode))))) | 388 | (mode-local--activate-bindings ,old-mode))))) |
| 380 | 389 | ||
| 381 | (defmacro with-mode-local (mode &rest body) | 390 | (defmacro with-mode-local (mode &rest body) |
| 382 | "With the local bindings of MODE, evaluate BODY. | 391 | "With the local bindings of MODE, evaluate BODY. |
| @@ -453,20 +462,24 @@ DOCSTRING is optional." | |||
| 453 | (defun make-obsolete-overload (old new when) | 462 | (defun make-obsolete-overload (old new when) |
| 454 | "Mark OLD overload as obsoleted by NEW overload. | 463 | "Mark OLD overload as obsoleted by NEW overload. |
| 455 | WHEN is a string describing the first release where it was made obsolete." | 464 | WHEN is a string describing the first release where it was made obsolete." |
| 456 | (put old 'overload-obsoleted-by new) | 465 | (put old 'mode-local--overload-obsoleted-by new) |
| 457 | (put old 'overload-obsoleted-since when) | 466 | (put old 'mode-local--overload-obsoleted-since when) |
| 458 | (put old 'mode-local-overload t) | 467 | (put old 'mode-local-overload t) |
| 459 | (put new 'overload-obsolete old)) | 468 | (put new 'mode-local--overload-obsolete old)) |
| 460 | 469 | ||
| 461 | (defsubst overload-obsoleted-by (overload) | 470 | (define-obsolete-function-alias 'overload-obsoleted-by |
| 471 | #'mode-local--overload-obsoleted-by "27.1") | ||
| 472 | (defsubst mode-local--overload-obsoleted-by (overload) | ||
| 462 | "Get the overload symbol obsoleted by OVERLOAD. | 473 | "Get the overload symbol obsoleted by OVERLOAD. |
| 463 | Return the obsolete symbol or nil if not found." | 474 | Return the obsolete symbol or nil if not found." |
| 464 | (get overload 'overload-obsolete)) | 475 | (get overload 'mode-local--overload-obsolete)) |
| 465 | 476 | ||
| 466 | (defsubst overload-that-obsolete (overload) | 477 | (define-obsolete-function-alias 'overload-that-obsolete |
| 478 | #'mode-local--overload-that-obsolete "27.1") | ||
| 479 | (defsubst mode-local--overload-that-obsolete (overload) | ||
| 467 | "Return the overload symbol that obsoletes OVERLOAD. | 480 | "Return the overload symbol that obsoletes OVERLOAD. |
| 468 | Return the symbol found or nil if OVERLOAD is not obsolete." | 481 | Return the symbol found or nil if OVERLOAD is not obsolete." |
| 469 | (get overload 'overload-obsoleted-by)) | 482 | (get overload 'mode-local--overload-obsoleted-by)) |
| 470 | 483 | ||
| 471 | (defsubst fetch-overload (overload) | 484 | (defsubst fetch-overload (overload) |
| 472 | "Return the current OVERLOAD function, or nil if not found. | 485 | "Return the current OVERLOAD function, or nil if not found. |
| @@ -474,9 +487,9 @@ First, lookup for OVERLOAD into locally bound mode local symbols, then | |||
| 474 | in those bound in current `major-mode' and its parents." | 487 | in those bound in current `major-mode' and its parents." |
| 475 | (or (mode-local-symbol-value overload nil 'override-flag) | 488 | (or (mode-local-symbol-value overload nil 'override-flag) |
| 476 | ;; If an obsolete overload symbol exists, try it. | 489 | ;; If an obsolete overload symbol exists, try it. |
| 477 | (and (overload-obsoleted-by overload) | 490 | (and (mode-local--overload-obsoleted-by overload) |
| 478 | (mode-local-symbol-value | 491 | (mode-local-symbol-value |
| 479 | (overload-obsoleted-by overload) nil 'override-flag)))) | 492 | (mode-local--overload-obsoleted-by overload) nil 'override-flag)))) |
| 480 | 493 | ||
| 481 | (defun mode-local--override (name args body) | 494 | (defun mode-local--override (name args body) |
| 482 | "Return the form that handles overloading of function NAME. | 495 | "Return the form that handles overloading of function NAME. |
| @@ -566,7 +579,9 @@ OVERARGS is a list of arguments passed to the override and | |||
| 566 | (define-obsolete-function-alias 'define-overload | 579 | (define-obsolete-function-alias 'define-overload |
| 567 | 'define-overloadable-function "27.1") | 580 | 'define-overloadable-function "27.1") |
| 568 | 581 | ||
| 569 | (defsubst function-overload-p (symbol) | 582 | (define-obsolete-function-alias 'function-overload-p |
| 583 | #'mode-local--function-overload-p "27.1") | ||
| 584 | (defsubst mode-local--function-overload-p (symbol) | ||
| 570 | "Return non-nil if SYMBOL is a function which can be overloaded." | 585 | "Return non-nil if SYMBOL is a function which can be overloaded." |
| 571 | (and symbol (symbolp symbol) (get symbol 'mode-local-overload))) | 586 | (and symbol (symbolp symbol) (get symbol 'mode-local-overload))) |
| 572 | 587 | ||
| @@ -601,22 +616,27 @@ BODY is the implementation of this function." | |||
| 601 | (defun mode-local-read-function (prompt &optional initial hist default) | 616 | (defun mode-local-read-function (prompt &optional initial hist default) |
| 602 | "Interactively read in the name of a mode-local function. | 617 | "Interactively read in the name of a mode-local function. |
| 603 | PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'." | 618 | PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'." |
| 604 | (completing-read prompt obarray 'function-overload-p t initial hist default)) | 619 | (declare (obsolete nil "27.1")) |
| 620 | (completing-read prompt obarray #'mode-local--function-overload-p t initial hist default)) | ||
| 605 | 621 | ||
| 606 | ;;; Help support | 622 | ;;; Help support |
| 607 | ;; | 623 | ;; |
| 608 | (defun overload-docstring-extension (overload) | 624 | (define-obsolete-function-alias 'overload-docstring-extension |
| 625 | #'mode-local--overload-docstring-extension "27.1") | ||
| 626 | (defun mode-local--overload-docstring-extension (overload) | ||
| 609 | "Return the doc string that augments the description of OVERLOAD." | 627 | "Return the doc string that augments the description of OVERLOAD." |
| 610 | (let ((doc "\nThis function can be overloaded\ | 628 | (let ((doc "\nThis function can be overloaded\ |
| 611 | with `define-mode-local-override'.") | 629 | with `define-mode-local-override'.") |
| 612 | (sym (overload-obsoleted-by overload))) | 630 | (sym (mode-local--overload-obsoleted-by overload))) |
| 613 | (when sym | 631 | (when sym |
| 614 | (setq doc (format "%s\nIt has made the overload `%s' obsolete since %s." | 632 | (setq doc (format "%s\nIt has made the overload `%s' obsolete since %s." |
| 615 | doc sym (get sym 'overload-obsoleted-since)))) | 633 | doc sym |
| 616 | (setq sym (overload-that-obsolete overload)) | 634 | (get sym 'mode-local--overload-obsoleted-since)))) |
| 635 | (setq sym (mode-local--overload-that-obsolete overload)) | ||
| 617 | (when sym | 636 | (when sym |
| 618 | (setq doc (format "%s\nThis overload is obsolete since %s;\nUse `%s' instead." | 637 | (setq doc (format |
| 619 | doc (get overload 'overload-obsoleted-since) sym))) | 638 | "%s\nThis overload is obsolete since %s;\nUse `%s' instead." |
| 639 | doc (get overload 'mode-local--overload-obsoleted-since) sym))) | ||
| 620 | doc)) | 640 | doc)) |
| 621 | 641 | ||
| 622 | (defun mode-local-augment-function-help (symbol) | 642 | (defun mode-local-augment-function-help (symbol) |
| @@ -630,7 +650,7 @@ SYMBOL is a function that can be overridden." | |||
| 630 | (beginning-of-line) | 650 | (beginning-of-line) |
| 631 | (forward-line -1)) | 651 | (forward-line -1)) |
| 632 | (let ((inhibit-read-only t)) | 652 | (let ((inhibit-read-only t)) |
| 633 | (insert (substitute-command-keys (overload-docstring-extension symbol)) | 653 | (insert (substitute-command-keys (mode-local--overload-docstring-extension symbol)) |
| 634 | "\n") | 654 | "\n") |
| 635 | ;; NOTE TO SELF: | 655 | ;; NOTE TO SELF: |
| 636 | ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE | 656 | ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE |
| @@ -639,16 +659,16 @@ SYMBOL is a function that can be overridden." | |||
| 639 | ;; We are called from describe-function in help-fns.el, where this is defined. | 659 | ;; We are called from describe-function in help-fns.el, where this is defined. |
| 640 | (defvar describe-function-orig-buffer) | 660 | (defvar describe-function-orig-buffer) |
| 641 | 661 | ||
| 642 | (defun describe-mode-local-overload (symbol) | 662 | (defun mode-local--describe-overload (symbol) |
| 643 | "For `help-fns-describe-function-functions'; add overloads for SYMBOL." | 663 | "For `help-fns-describe-function-functions'; add overloads for SYMBOL." |
| 644 | (when (function-overload-p symbol) | 664 | (when (mode-local--function-overload-p symbol) |
| 645 | (let ((default (or (intern-soft (format "%s-default" (symbol-name symbol))) | 665 | (let ((default (or (intern-soft (format "%s-default" (symbol-name symbol))) |
| 646 | symbol)) | 666 | symbol)) |
| 647 | (override (with-current-buffer describe-function-orig-buffer | 667 | (override (with-current-buffer describe-function-orig-buffer |
| 648 | (fetch-overload symbol))) | 668 | (fetch-overload symbol))) |
| 649 | modes) | 669 | modes) |
| 650 | 670 | ||
| 651 | (insert (substitute-command-keys (overload-docstring-extension symbol)) | 671 | (insert (substitute-command-keys (mode-local--overload-docstring-extension symbol)) |
| 652 | "\n\n") | 672 | "\n\n") |
| 653 | (insert (format-message "default function: `%s'\n" default)) | 673 | (insert (format-message "default function: `%s'\n" default)) |
| 654 | (if override | 674 | (if override |
| @@ -671,7 +691,7 @@ SYMBOL is a function that can be overridden." | |||
| 671 | ))) | 691 | ))) |
| 672 | ))) | 692 | ))) |
| 673 | 693 | ||
| 674 | (add-hook 'help-fns-describe-function-functions #'describe-mode-local-overload) | 694 | (add-hook 'help-fns-describe-function-functions #'mode-local--describe-overload) |
| 675 | 695 | ||
| 676 | (declare-function xref-item-location "xref" (xref) t) | 696 | (declare-function xref-item-location "xref" (xref) t) |
| 677 | 697 | ||
| @@ -687,7 +707,7 @@ SYMBOL is a function that can be overridden." | |||
| 687 | (defun xref-mode-local-overload (symbol) | 707 | (defun xref-mode-local-overload (symbol) |
| 688 | "For `elisp-xref-find-def-functions'; add overloads for SYMBOL." | 708 | "For `elisp-xref-find-def-functions'; add overloads for SYMBOL." |
| 689 | ;; Current buffer is the buffer where xref-find-definitions was invoked. | 709 | ;; Current buffer is the buffer where xref-find-definitions was invoked. |
| 690 | (when (function-overload-p symbol) | 710 | (when (mode-local--function-overload-p symbol) |
| 691 | (let* ((symbol-file (find-lisp-object-file-name | 711 | (let* ((symbol-file (find-lisp-object-file-name |
| 692 | symbol (symbol-function symbol))) | 712 | symbol (symbol-function symbol))) |
| 693 | (default (intern-soft (format "%s-default" (symbol-name symbol)))) | 713 | (default (intern-soft (format "%s-default" (symbol-name symbol)))) |
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index b05082c60ef..862969dbc87 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el | |||
| @@ -69,8 +69,10 @@ This function does not do any hidden buffer changes." | |||
| 69 | ) | 69 | ) |
| 70 | 70 | ||
| 71 | ;;; Code: | 71 | ;;; Code: |
| 72 | (define-child-mode c++-mode c-mode | 72 | (with-suppressed-warnings ((obsolete define-child-mode)) |
| 73 | "`c++-mode' uses the same parser as `c-mode'.") | 73 | ;; FIXME: We should handle this some other way! |
| 74 | (define-child-mode c++-mode c-mode | ||
| 75 | "`c++-mode' uses the same parser as `c-mode'.")) | ||
| 74 | 76 | ||
| 75 | 77 | ||
| 76 | ;;; Include Paths | 78 | ;;; Include Paths |
| @@ -930,7 +932,7 @@ the regular parser." | |||
| 930 | ) ; save match data | 932 | ) ; save match data |
| 931 | 933 | ||
| 932 | ;; Hack in mode-local | 934 | ;; Hack in mode-local |
| 933 | (activate-mode-local-bindings) | 935 | (mode-local--activate-bindings) |
| 934 | ;; Setup C parser | 936 | ;; Setup C parser |
| 935 | (semantic-default-c-setup) | 937 | (semantic-default-c-setup) |
| 936 | ;; CHEATER! The following 3 lines are from | 938 | ;; CHEATER! The following 3 lines are from |
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index dd21f50325e..590256cc709 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el | |||
| @@ -496,7 +496,8 @@ used to perform the override." | |||
| 496 | (if (and (eq (semantic-tag-class tag) 'function) | 496 | (if (and (eq (semantic-tag-class tag) 'function) |
| 497 | (semantic-tag-get-attribute tag :overloadable)) | 497 | (semantic-tag-get-attribute tag :overloadable)) |
| 498 | ;; Calc the doc to use for the overloadable symbols. | 498 | ;; Calc the doc to use for the overloadable symbols. |
| 499 | (overload-docstring-extension (intern (semantic-tag-name tag))) | 499 | (mode-local--overload-docstring-extension |
| 500 | (intern (semantic-tag-name tag))) | ||
| 500 | "")) | 501 | "")) |
| 501 | 502 | ||
| 502 | (defun semantic-emacs-lisp-obsoleted-doc (tag) | 503 | (defun semantic-emacs-lisp-obsoleted-doc (tag) |
| @@ -944,8 +945,10 @@ See `semantic-format-tag-prototype' for Emacs Lisp for more details." | |||
| 944 | "Add variables. | 945 | "Add variables. |
| 945 | ELisp variables can be pretty long, so track this one too.") | 946 | ELisp variables can be pretty long, so track this one too.") |
| 946 | 947 | ||
| 947 | (define-child-mode lisp-mode emacs-lisp-mode | 948 | (with-suppressed-warnings ((obsolete define-child-mode)) |
| 948 | "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.") | 949 | ;; FIXME: We should handle this some other way! |
| 950 | (define-child-mode lisp-mode emacs-lisp-mode | ||
| 951 | "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.")) | ||
| 949 | 952 | ||
| 950 | ;;;###autoload | 953 | ;;;###autoload |
| 951 | (defun semantic-default-elisp-setup () | 954 | (defun semantic-default-elisp-setup () |
diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el index 7c25b79db86..4d7b008dbd3 100644 --- a/lisp/cedet/semantic/bovine/grammar.el +++ b/lisp/cedet/semantic/bovine/grammar.el | |||
| @@ -438,8 +438,8 @@ Menu items are appended to the common grammar menu.") | |||
| 438 | "Major mode for editing Bovine grammars." | 438 | "Major mode for editing Bovine grammars." |
| 439 | (semantic-grammar-setup-menu bovine-grammar-menu) | 439 | (semantic-grammar-setup-menu bovine-grammar-menu) |
| 440 | (semantic-install-function-overrides | 440 | (semantic-install-function-overrides |
| 441 | '((grammar-parsetable-builder . bovine-grammar-parsetable-builder) | 441 | '((semantic-grammar-parsetable-builder . bovine-grammar-parsetable-builder) |
| 442 | (grammar-setupcode-builder . bovine-grammar-setupcode-builder)))) | 442 | (semantic-grammar-setupcode-builder . bovine-grammar-setupcode-builder)))) |
| 443 | 443 | ||
| 444 | (add-to-list 'auto-mode-alist '("\\.by\\'" . bovine-grammar-mode)) | 444 | (add-to-list 'auto-mode-alist '("\\.by\\'" . bovine-grammar-mode)) |
| 445 | 445 | ||
diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index e07f0901849..202dec3df3b 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el | |||
| @@ -186,8 +186,8 @@ Mark OLDFNALIAS as obsolete, such that the byte compiler | |||
| 186 | will throw a warning when it encounters this symbol." | 186 | will throw a warning when it encounters this symbol." |
| 187 | (defalias oldfnalias newfn) | 187 | (defalias oldfnalias newfn) |
| 188 | (make-obsolete oldfnalias newfn when) | 188 | (make-obsolete oldfnalias newfn when) |
| 189 | (when (and (function-overload-p newfn) | 189 | (when (and (mode-local--function-overload-p newfn) |
| 190 | (not (overload-obsoleted-by newfn)) | 190 | (not (mode-local--overload-obsoleted-by newfn)) |
| 191 | ;; Only throw this warning when byte compiling things. | 191 | ;; Only throw this warning when byte compiling things. |
| 192 | (boundp 'byte-compile-current-file) | 192 | (boundp 'byte-compile-current-file) |
| 193 | byte-compile-current-file | 193 | byte-compile-current-file |
| @@ -261,7 +261,7 @@ FUNCTION does not have arguments. When FUNCTION is entered | |||
| 261 | (semantic-alias-obsolete 'define-mode-overload-implementation | 261 | (semantic-alias-obsolete 'define-mode-overload-implementation |
| 262 | 'define-mode-local-override "23.2") | 262 | 'define-mode-local-override "23.2") |
| 263 | 263 | ||
| 264 | (defun semantic-install-function-overrides (overrides &optional transient mode) | 264 | (defun semantic-install-function-overrides (overrides &optional transient) |
| 265 | "Install the function OVERRIDES in the specified environment. | 265 | "Install the function OVERRIDES in the specified environment. |
| 266 | OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD | 266 | OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD |
| 267 | is a symbol identifying an overloadable entry, and FUNCTION is the | 267 | is a symbol identifying an overloadable entry, and FUNCTION is the |
| @@ -282,8 +282,7 @@ later installation should be done in MODE hook." | |||
| 282 | (cons (intern (format "semantic-%s" name)) (cdr e))))) | 282 | (cons (intern (format "semantic-%s" name)) (cdr e))))) |
| 283 | overrides) | 283 | overrides) |
| 284 | (list 'constant-flag (not transient) | 284 | (list 'constant-flag (not transient) |
| 285 | 'override-flag t) | 285 | 'override-flag t))) |
| 286 | mode)) | ||
| 287 | 286 | ||
| 288 | ;;; User Interrupt handling | 287 | ;;; User Interrupt handling |
| 289 | ;; | 288 | ;; |
diff --git a/lisp/cedet/semantic/grammar-wy.el b/lisp/cedet/semantic/grammar-wy.el index 3b99469f558..1da57862d57 100644 --- a/lisp/cedet/semantic/grammar-wy.el +++ b/lisp/cedet/semantic/grammar-wy.el | |||
| @@ -421,7 +421,7 @@ | |||
| 421 | (defun semantic-grammar-wy--install-parser () | 421 | (defun semantic-grammar-wy--install-parser () |
| 422 | "Setup the Semantic Parser." | 422 | "Setup the Semantic Parser." |
| 423 | (semantic-install-function-overrides | 423 | (semantic-install-function-overrides |
| 424 | '((parse-stream . wisent-parse-stream))) | 424 | '((semantic-parse-stream . wisent-parse-stream))) |
| 425 | (setq semantic-parser-name "LALR" | 425 | (setq semantic-parser-name "LALR" |
| 426 | semantic--parse-table semantic-grammar-wy--parse-table | 426 | semantic--parse-table semantic-grammar-wy--parse-table |
| 427 | semantic-debug-parser-source "grammar.wy" | 427 | semantic-debug-parser-source "grammar.wy" |
diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el index 3a8165c423a..f70fec2db74 100644 --- a/lisp/cedet/semantic/html.el +++ b/lisp/cedet/semantic/html.el | |||
| @@ -247,13 +247,15 @@ tag with greater section value than LEVEL is found." | |||
| 247 | semantic-stickyfunc-sticky-classes '(section) | 247 | semantic-stickyfunc-sticky-classes '(section) |
| 248 | ) | 248 | ) |
| 249 | (semantic-install-function-overrides | 249 | (semantic-install-function-overrides |
| 250 | '((tag-components . semantic-html-components) | 250 | '((semantic-tag-components . semantic-html-components) |
| 251 | ) | 251 | ) |
| 252 | t) | 252 | t) |
| 253 | ) | 253 | ) |
| 254 | 254 | ||
| 255 | (define-child-mode html-helper-mode html-mode | 255 | ;; `html-helper-mode' hasn't been updated since 2004, so it's not very |
| 256 | "`html-helper-mode' needs the same semantic support as `html-mode'.") | 256 | ;; relevant nowadays. |
| 257 | ;;(define-child-mode html-helper-mode html-mode | ||
| 258 | ;; "`html-helper-mode' needs the same semantic support as `html-mode'.") | ||
| 257 | 259 | ||
| 258 | (provide 'semantic/html) | 260 | (provide 'semantic/html) |
| 259 | 261 | ||
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index d07dc806a48..a81b23ca750 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el | |||
| @@ -1071,7 +1071,7 @@ and variable state from the current buffer." | |||
| 1071 | (error nil)) | 1071 | (error nil)) |
| 1072 | 1072 | ||
| 1073 | ;; Hack in mode-local | 1073 | ;; Hack in mode-local |
| 1074 | (activate-mode-local-bindings) | 1074 | (mode-local--activate-bindings) |
| 1075 | 1075 | ||
| 1076 | ;; Call the major mode's setup function | 1076 | ;; Call the major mode's setup function |
| 1077 | (let ((entry (assq major-mode semantic-new-buffer-setup-functions))) | 1077 | (let ((entry (assq major-mode semantic-new-buffer-setup-functions))) |
diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 3a0050b920c..73f0e734f32 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el | |||
| @@ -63,9 +63,9 @@ Each tag returned is of the form: | |||
| 63 | or | 63 | or |
| 64 | (\"NAME\" def) | 64 | (\"NAME\" def) |
| 65 | 65 | ||
| 66 | It is an override of 'parse-region and must be installed by the | 66 | It is an override of `semantic-parse-region' and must be installed by the |
| 67 | function `semantic-install-function-overrides'." | 67 | function `semantic-install-function-overrides'." |
| 68 | (mapcar 'semantic-texi-expand-tag | 68 | (mapcar #'semantic-texi-expand-tag |
| 69 | (semantic-texi-parse-headings))) | 69 | (semantic-texi-parse-headings))) |
| 70 | 70 | ||
| 71 | (defun semantic-texi-parse-changes () | 71 | (defun semantic-texi-parse-changes () |
| @@ -451,8 +451,8 @@ that start with that symbol." | |||
| 451 | "Set up a buffer for parsing of Texinfo files." | 451 | "Set up a buffer for parsing of Texinfo files." |
| 452 | ;; This will use our parser. | 452 | ;; This will use our parser. |
| 453 | (semantic-install-function-overrides | 453 | (semantic-install-function-overrides |
| 454 | '((parse-region . semantic-texi-parse-region) | 454 | '((semantic-parse-region . semantic-texi-parse-region) |
| 455 | (parse-changes . semantic-texi-parse-changes))) | 455 | (semantic-parse-changes . semantic-texi-parse-changes))) |
| 456 | (setq semantic-parser-name "TEXI" | 456 | (setq semantic-parser-name "TEXI" |
| 457 | ;; Setup a dummy parser table to enable parsing! | 457 | ;; Setup a dummy parser table to enable parsing! |
| 458 | semantic--parse-table t | 458 | semantic--parse-table t |
diff --git a/lisp/cedet/semantic/wisent/grammar.el b/lisp/cedet/semantic/wisent/grammar.el index e6b389b60ba..1254f996809 100644 --- a/lisp/cedet/semantic/wisent/grammar.el +++ b/lisp/cedet/semantic/wisent/grammar.el | |||
| @@ -297,7 +297,7 @@ Return the expanded expression." | |||
| 297 | "Return the parser setup code." | 297 | "Return the parser setup code." |
| 298 | (format | 298 | (format |
| 299 | "(semantic-install-function-overrides\n\ | 299 | "(semantic-install-function-overrides\n\ |
| 300 | '((parse-stream . wisent-parse-stream)))\n\ | 300 | '((semantic-parse-stream . wisent-parse-stream)))\n\ |
| 301 | (setq semantic-parser-name \"LALR\"\n\ | 301 | (setq semantic-parser-name \"LALR\"\n\ |
| 302 | semantic--parse-table %s\n\ | 302 | semantic--parse-table %s\n\ |
| 303 | semantic-debug-parser-source %S\n\ | 303 | semantic-debug-parser-source %S\n\ |
| @@ -326,8 +326,8 @@ Menu items are appended to the common grammar menu.") | |||
| 326 | "Major mode for editing Wisent grammars." | 326 | "Major mode for editing Wisent grammars." |
| 327 | (semantic-grammar-setup-menu wisent-grammar-menu) | 327 | (semantic-grammar-setup-menu wisent-grammar-menu) |
| 328 | (semantic-install-function-overrides | 328 | (semantic-install-function-overrides |
| 329 | '((grammar-parsetable-builder . wisent-grammar-parsetable-builder) | 329 | '((semantic-grammar-parsetable-builder . wisent-grammar-parsetable-builder) |
| 330 | (grammar-setupcode-builder . wisent-grammar-setupcode-builder)))) | 330 | (semantic-grammar-setupcode-builder . wisent-grammar-setupcode-builder)))) |
| 331 | 331 | ||
| 332 | (defvar-mode-local wisent-grammar-mode semantic-grammar-macros | 332 | (defvar-mode-local wisent-grammar-mode semantic-grammar-macros |
| 333 | '( | 333 | '( |
diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 7722c953609..4c93c0dc4fa 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el | |||
| @@ -64,13 +64,13 @@ to this variable NAME." | |||
| 64 | ;; the tags created by the javascript parser. | 64 | ;; the tags created by the javascript parser. |
| 65 | ;; Local context | 65 | ;; Local context |
| 66 | (define-mode-local-override semantic-get-local-variables | 66 | (define-mode-local-override semantic-get-local-variables |
| 67 | javascript-mode () | 67 | js-mode () |
| 68 | "Get local values from a specific context. | 68 | "Get local values from a specific context. |
| 69 | This function overrides `get-local-variables'." | 69 | This function overrides `get-local-variables'." |
| 70 | ;; Does javascript have identifiable local variables? | 70 | ;; Does javascript have identifiable local variables? |
| 71 | nil) | 71 | nil) |
| 72 | 72 | ||
| 73 | (define-mode-local-override semantic-tag-protection javascript-mode (tag &optional parent) | 73 | (define-mode-local-override semantic-tag-protection js-mode (tag &optional parent) |
| 74 | "Return protection information about TAG with optional PARENT. | 74 | "Return protection information about TAG with optional PARENT. |
| 75 | This function returns on of the following symbols: | 75 | This function returns on of the following symbols: |
| 76 | nil - No special protection. Language dependent. | 76 | nil - No special protection. Language dependent. |
| @@ -85,14 +85,14 @@ The default behavior (if not overridden with `tag-protection' | |||
| 85 | is to return a symbol based on type modifiers." | 85 | is to return a symbol based on type modifiers." |
| 86 | nil) | 86 | nil) |
| 87 | 87 | ||
| 88 | (define-mode-local-override semantic-analyze-scope-calculate-access javascript-mode (type scope) | 88 | (define-mode-local-override semantic-analyze-scope-calculate-access js-mode (type scope) |
| 89 | "Calculate the access class for TYPE as defined by the current SCOPE. | 89 | "Calculate the access class for TYPE as defined by the current SCOPE. |
| 90 | Access is related to the :parents in SCOPE. If type is a member of SCOPE | 90 | Access is related to the :parents in SCOPE. If type is a member of SCOPE |
| 91 | then access would be 'private. If TYPE is inherited by a member of SCOPE, | 91 | then access would be 'private. If TYPE is inherited by a member of SCOPE, |
| 92 | the access would be 'protected. Otherwise, access is 'public." | 92 | the access would be 'protected. Otherwise, access is 'public." |
| 93 | nil) | 93 | nil) |
| 94 | 94 | ||
| 95 | (define-mode-local-override semantic-ctxt-current-symbol javascript-mode (&optional point) | 95 | (define-mode-local-override semantic-ctxt-current-symbol js-mode (&optional point) |
| 96 | "Return the current symbol the cursor is on at POINT in a list. | 96 | "Return the current symbol the cursor is on at POINT in a list. |
| 97 | This is a very simple implementation for Javascript symbols. It | 97 | This is a very simple implementation for Javascript symbols. It |
| 98 | will at maximum do one split, so that the first part is seen as | 98 | will at maximum do one split, so that the first part is seen as |
| @@ -117,13 +117,6 @@ This is currently needed for the mozrepl omniscient database." | |||
| 117 | 117 | ||
| 118 | ;;; Setup Function | 118 | ;;; Setup Function |
| 119 | ;; | 119 | ;; |
| 120 | ;; Since javascript-mode is an alias for js-mode, let it inherit all | ||
| 121 | ;; the overrides. | ||
| 122 | (define-child-mode js-mode javascript-mode) | ||
| 123 | |||
| 124 | ;; Since javascript-mode is an alias for js-mode, let it inherit all | ||
| 125 | ;; the overrides. | ||
| 126 | (define-child-mode js-mode javascript-mode) | ||
| 127 | 120 | ||
| 128 | ;; In semantic-imenu.el, not part of Emacs. | 121 | ;; In semantic-imenu.el, not part of Emacs. |
| 129 | (defvar semantic-imenu-summary-function) | 122 | (defvar semantic-imenu-summary-function) |
diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index f0e294efa62..540c59b9a7a 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el | |||
| @@ -530,11 +530,6 @@ Shortens `code' tags, but passes through for others." | |||
| 530 | (code . "Code"))) | 530 | (code . "Code"))) |
| 531 | ) | 531 | ) |
| 532 | 532 | ||
| 533 | ;; Make sure the newer python modes pull in the same python | ||
| 534 | ;; mode overrides. | ||
| 535 | (define-child-mode python-2-mode python-mode "Python 2 mode") | ||
| 536 | (define-child-mode python-3-mode python-mode "Python 3 mode") | ||
| 537 | |||
| 538 | 533 | ||
| 539 | ;;; Utility functions | 534 | ;;; Utility functions |
| 540 | ;; | 535 | ;; |
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el index 08ff0e6305e..343cc9155d3 100644 --- a/lisp/cedet/srecode/map.el +++ b/lisp/cedet/srecode/map.el | |||
| @@ -346,8 +346,8 @@ if that file is NEW, otherwise assume the mode has not changed." | |||
| 346 | Argument FAST implies that the file should not be reparsed if there | 346 | Argument FAST implies that the file should not be reparsed if there |
| 347 | is already an entry for it. | 347 | is already an entry for it. |
| 348 | Return non-nil if the map changed." | 348 | Return non-nil if the map changed." |
| 349 | (when (or (not fast) | 349 | (unless (and fast |
| 350 | (not (srecode-map-entry-for-file-anywhere srecode-current-map file))) | 350 | (srecode-map-entry-for-file-anywhere srecode-current-map file)) |
| 351 | (let ((buff-orig (get-file-buffer file)) | 351 | (let ((buff-orig (get-file-buffer file)) |
| 352 | (dirty nil)) | 352 | (dirty nil)) |
| 353 | (save-excursion | 353 | (save-excursion |