mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 04:10:54 -08:00
* 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.
This commit is contained in:
parent
4a083b0d36
commit
f131e396f8
14 changed files with 97 additions and 82 deletions
3
etc/NEWS
3
etc/NEWS
|
|
@ -2170,7 +2170,8 @@ if you set 'time-stamp-format' or 'time-stamp-pattern' with a
|
|||
file-local variable, you may need to update the value.
|
||||
|
||||
** mode-local
|
||||
*** 'define-overload' is declared obsolete.
|
||||
*** Declare 'define-overload' and 'define-child-mode' as obsolete
|
||||
*** Rename several internal functions to use a ''mode-local-' prefix
|
||||
|
||||
|
||||
* New Modes and Packages in Emacs 27.1
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ after changing the major mode."
|
|||
(mode-local-map-file-buffers
|
||||
(lambda ()
|
||||
;; Make sure variables are set up for this mode.
|
||||
(activate-mode-local-bindings)
|
||||
(mode-local--activate-bindings)
|
||||
(run-hooks 'mode-local-init-hook))
|
||||
(lambda ()
|
||||
(not (mode-local-initialized-p)))
|
||||
|
|
@ -139,7 +139,9 @@ after changing the major mode."
|
|||
|
||||
;;; Mode lineage
|
||||
;;
|
||||
(defsubst set-mode-local-parent (mode parent)
|
||||
(define-obsolete-function-alias 'set-mode-local-parent
|
||||
#'mode-local--set-parent "27.1")
|
||||
(defsubst mode-local--set-parent (mode parent)
|
||||
"Set parent of major mode MODE to PARENT mode.
|
||||
To work properly, this function should be called after PARENT mode
|
||||
local variables have been defined."
|
||||
|
|
@ -147,14 +149,15 @@ local variables have been defined."
|
|||
;; Refresh mode bindings to get mode local variables inherited from
|
||||
;; PARENT. To work properly, the following should be called after
|
||||
;; PARENT mode local variables have been defined.
|
||||
(mode-local-map-mode-buffers #'activate-mode-local-bindings mode))
|
||||
(mode-local-map-mode-buffers #'mode-local--activate-bindings mode))
|
||||
|
||||
(defmacro define-child-mode (mode parent &optional _docstring)
|
||||
"Make major mode MODE inherit behavior from PARENT mode.
|
||||
DOCSTRING is optional and not used.
|
||||
To work properly, this should be put after PARENT mode local variables
|
||||
definition."
|
||||
`(set-mode-local-parent ',mode ',parent))
|
||||
(declare (obsolete define-derived-mode "27.1"))
|
||||
`(mode-local--set-parent ',mode ',parent))
|
||||
|
||||
(defun mode-local-use-bindings-p (this-mode desired-mode)
|
||||
"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.")
|
|||
(defvar mode-local-active-mode nil
|
||||
"Major mode in which bindings are active.")
|
||||
|
||||
(defsubst new-mode-local-bindings ()
|
||||
(define-obsolete-function-alias 'new-mode-local-bindings
|
||||
#'mode-local--new-bindings "27.1")
|
||||
(defsubst mode-local--new-bindings ()
|
||||
"Return a new empty mode bindings symbol table."
|
||||
(make-vector 13 0))
|
||||
(obarray-make 13))
|
||||
|
||||
(defun mode-local-bind (bindings &optional plist mode)
|
||||
"Define BINDINGS in the specified environment.
|
||||
|
|
@ -208,7 +213,7 @@ hook."
|
|||
;; Install in given MODE symbol table. Create a new one if
|
||||
;; needed.
|
||||
(setq table (or (get mode 'mode-local-symbol-table)
|
||||
(new-mode-local-bindings)))
|
||||
(mode-local--new-bindings)))
|
||||
(put mode 'mode-local-symbol-table table))
|
||||
;; Fail if trying to bind mode variables in local context!
|
||||
(if (plist-get plist 'mode-variable-flag)
|
||||
|
|
@ -217,7 +222,7 @@ hook."
|
|||
;; needed.
|
||||
(setq table (or mode-local-symbol-table
|
||||
(setq mode-local-symbol-table
|
||||
(new-mode-local-bindings)))))
|
||||
(mode-local--new-bindings)))))
|
||||
(while bindings
|
||||
(setq binding (car bindings)
|
||||
bindings (cdr bindings)
|
||||
|
|
@ -286,7 +291,9 @@ doesn't have PROPERTY set."
|
|||
|
||||
;;; Mode local variables
|
||||
;;
|
||||
(defun activate-mode-local-bindings (&optional mode)
|
||||
(define-obsolete-function-alias 'activate-mode-local-bindings
|
||||
#'mode-local--activate-bindings "27.1")
|
||||
(defun mode-local--activate-bindings (&optional mode)
|
||||
"Activate variables defined locally in MODE and its parents.
|
||||
That is, copy mode local bindings into corresponding buffer local
|
||||
variables.
|
||||
|
|
@ -328,7 +335,9 @@ Elements are (SYMBOL . PREVIOUS-VALUE), describing one variable."
|
|||
table)))
|
||||
old-locals)))
|
||||
|
||||
(defun deactivate-mode-local-bindings (&optional mode)
|
||||
(define-obsolete-function-alias 'deactivate-mode-local-bindings
|
||||
#'mode-local--deactivate-bindings "27.1")
|
||||
(defun mode-local--deactivate-bindings (&optional mode)
|
||||
"Deactivate variables defined locally in MODE and its parents.
|
||||
That is, kill buffer local variables set from the corresponding mode
|
||||
local bindings.
|
||||
|
|
@ -364,19 +373,19 @@ To use the symbol MODE (quoted), use `with-mode-local'."
|
|||
)
|
||||
(unwind-protect
|
||||
(progn
|
||||
(deactivate-mode-local-bindings ,old-mode)
|
||||
(mode-local--deactivate-bindings ,old-mode)
|
||||
(setq mode-local-active-mode ,new-mode)
|
||||
;; Save the previous value of buffer-local variables
|
||||
;; changed by `activate-mode-local-bindings'.
|
||||
(setq ,old-locals (activate-mode-local-bindings ,new-mode))
|
||||
;; changed by `mode-local--activate-bindings'.
|
||||
(setq ,old-locals (mode-local--activate-bindings ,new-mode))
|
||||
,@body)
|
||||
(deactivate-mode-local-bindings ,new-mode)
|
||||
(mode-local--deactivate-bindings ,new-mode)
|
||||
;; Restore the previous value of buffer-local variables.
|
||||
(dolist (,local ,old-locals)
|
||||
(set (car ,local) (cdr ,local)))
|
||||
;; Restore the mode local variables.
|
||||
(setq mode-local-active-mode ,old-mode)
|
||||
(activate-mode-local-bindings ,old-mode)))))
|
||||
(mode-local--activate-bindings ,old-mode)))))
|
||||
|
||||
(defmacro with-mode-local (mode &rest body)
|
||||
"With the local bindings of MODE, evaluate BODY.
|
||||
|
|
@ -453,20 +462,24 @@ DOCSTRING is optional."
|
|||
(defun make-obsolete-overload (old new when)
|
||||
"Mark OLD overload as obsoleted by NEW overload.
|
||||
WHEN is a string describing the first release where it was made obsolete."
|
||||
(put old 'overload-obsoleted-by new)
|
||||
(put old 'overload-obsoleted-since when)
|
||||
(put old 'mode-local--overload-obsoleted-by new)
|
||||
(put old 'mode-local--overload-obsoleted-since when)
|
||||
(put old 'mode-local-overload t)
|
||||
(put new 'overload-obsolete old))
|
||||
(put new 'mode-local--overload-obsolete old))
|
||||
|
||||
(defsubst overload-obsoleted-by (overload)
|
||||
(define-obsolete-function-alias 'overload-obsoleted-by
|
||||
#'mode-local--overload-obsoleted-by "27.1")
|
||||
(defsubst mode-local--overload-obsoleted-by (overload)
|
||||
"Get the overload symbol obsoleted by OVERLOAD.
|
||||
Return the obsolete symbol or nil if not found."
|
||||
(get overload 'overload-obsolete))
|
||||
(get overload 'mode-local--overload-obsolete))
|
||||
|
||||
(defsubst overload-that-obsolete (overload)
|
||||
(define-obsolete-function-alias 'overload-that-obsolete
|
||||
#'mode-local--overload-that-obsolete "27.1")
|
||||
(defsubst mode-local--overload-that-obsolete (overload)
|
||||
"Return the overload symbol that obsoletes OVERLOAD.
|
||||
Return the symbol found or nil if OVERLOAD is not obsolete."
|
||||
(get overload 'overload-obsoleted-by))
|
||||
(get overload 'mode-local--overload-obsoleted-by))
|
||||
|
||||
(defsubst fetch-overload (overload)
|
||||
"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
|
|||
in those bound in current `major-mode' and its parents."
|
||||
(or (mode-local-symbol-value overload nil 'override-flag)
|
||||
;; If an obsolete overload symbol exists, try it.
|
||||
(and (overload-obsoleted-by overload)
|
||||
(and (mode-local--overload-obsoleted-by overload)
|
||||
(mode-local-symbol-value
|
||||
(overload-obsoleted-by overload) nil 'override-flag))))
|
||||
(mode-local--overload-obsoleted-by overload) nil 'override-flag))))
|
||||
|
||||
(defun mode-local--override (name args body)
|
||||
"Return the form that handles overloading of function NAME.
|
||||
|
|
@ -566,7 +579,9 @@ OVERARGS is a list of arguments passed to the override and
|
|||
(define-obsolete-function-alias 'define-overload
|
||||
'define-overloadable-function "27.1")
|
||||
|
||||
(defsubst function-overload-p (symbol)
|
||||
(define-obsolete-function-alias 'function-overload-p
|
||||
#'mode-local--function-overload-p "27.1")
|
||||
(defsubst mode-local--function-overload-p (symbol)
|
||||
"Return non-nil if SYMBOL is a function which can be overloaded."
|
||||
(and symbol (symbolp symbol) (get symbol 'mode-local-overload)))
|
||||
|
||||
|
|
@ -601,22 +616,27 @@ BODY is the implementation of this function."
|
|||
(defun mode-local-read-function (prompt &optional initial hist default)
|
||||
"Interactively read in the name of a mode-local function.
|
||||
PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'."
|
||||
(completing-read prompt obarray 'function-overload-p t initial hist default))
|
||||
(declare (obsolete nil "27.1"))
|
||||
(completing-read prompt obarray #'mode-local--function-overload-p t initial hist default))
|
||||
|
||||
;;; Help support
|
||||
;;
|
||||
(defun overload-docstring-extension (overload)
|
||||
(define-obsolete-function-alias 'overload-docstring-extension
|
||||
#'mode-local--overload-docstring-extension "27.1")
|
||||
(defun mode-local--overload-docstring-extension (overload)
|
||||
"Return the doc string that augments the description of OVERLOAD."
|
||||
(let ((doc "\nThis function can be overloaded\
|
||||
with `define-mode-local-override'.")
|
||||
(sym (overload-obsoleted-by overload)))
|
||||
(sym (mode-local--overload-obsoleted-by overload)))
|
||||
(when sym
|
||||
(setq doc (format "%s\nIt has made the overload `%s' obsolete since %s."
|
||||
doc sym (get sym 'overload-obsoleted-since))))
|
||||
(setq sym (overload-that-obsolete overload))
|
||||
doc sym
|
||||
(get sym 'mode-local--overload-obsoleted-since))))
|
||||
(setq sym (mode-local--overload-that-obsolete overload))
|
||||
(when sym
|
||||
(setq doc (format "%s\nThis overload is obsolete since %s;\nUse `%s' instead."
|
||||
doc (get overload 'overload-obsoleted-since) sym)))
|
||||
(setq doc (format
|
||||
"%s\nThis overload is obsolete since %s;\nUse `%s' instead."
|
||||
doc (get overload 'mode-local--overload-obsoleted-since) sym)))
|
||||
doc))
|
||||
|
||||
(defun mode-local-augment-function-help (symbol)
|
||||
|
|
@ -630,7 +650,7 @@ SYMBOL is a function that can be overridden."
|
|||
(beginning-of-line)
|
||||
(forward-line -1))
|
||||
(let ((inhibit-read-only t))
|
||||
(insert (substitute-command-keys (overload-docstring-extension symbol))
|
||||
(insert (substitute-command-keys (mode-local--overload-docstring-extension symbol))
|
||||
"\n")
|
||||
;; NOTE TO SELF:
|
||||
;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
|
||||
|
|
@ -639,16 +659,16 @@ SYMBOL is a function that can be overridden."
|
|||
;; We are called from describe-function in help-fns.el, where this is defined.
|
||||
(defvar describe-function-orig-buffer)
|
||||
|
||||
(defun describe-mode-local-overload (symbol)
|
||||
(defun mode-local--describe-overload (symbol)
|
||||
"For `help-fns-describe-function-functions'; add overloads for SYMBOL."
|
||||
(when (function-overload-p symbol)
|
||||
(when (mode-local--function-overload-p symbol)
|
||||
(let ((default (or (intern-soft (format "%s-default" (symbol-name symbol)))
|
||||
symbol))
|
||||
(override (with-current-buffer describe-function-orig-buffer
|
||||
(fetch-overload symbol)))
|
||||
modes)
|
||||
|
||||
(insert (substitute-command-keys (overload-docstring-extension symbol))
|
||||
(insert (substitute-command-keys (mode-local--overload-docstring-extension symbol))
|
||||
"\n\n")
|
||||
(insert (format-message "default function: `%s'\n" default))
|
||||
(if override
|
||||
|
|
@ -671,7 +691,7 @@ SYMBOL is a function that can be overridden."
|
|||
)))
|
||||
)))
|
||||
|
||||
(add-hook 'help-fns-describe-function-functions #'describe-mode-local-overload)
|
||||
(add-hook 'help-fns-describe-function-functions #'mode-local--describe-overload)
|
||||
|
||||
(declare-function xref-item-location "xref" (xref) t)
|
||||
|
||||
|
|
@ -687,7 +707,7 @@ SYMBOL is a function that can be overridden."
|
|||
(defun xref-mode-local-overload (symbol)
|
||||
"For `elisp-xref-find-def-functions'; add overloads for SYMBOL."
|
||||
;; Current buffer is the buffer where xref-find-definitions was invoked.
|
||||
(when (function-overload-p symbol)
|
||||
(when (mode-local--function-overload-p symbol)
|
||||
(let* ((symbol-file (find-lisp-object-file-name
|
||||
symbol (symbol-function symbol)))
|
||||
(default (intern-soft (format "%s-default" (symbol-name symbol))))
|
||||
|
|
|
|||
|
|
@ -69,8 +69,10 @@ This function does not do any hidden buffer changes."
|
|||
)
|
||||
|
||||
;;; Code:
|
||||
(define-child-mode c++-mode c-mode
|
||||
"`c++-mode' uses the same parser as `c-mode'.")
|
||||
(with-suppressed-warnings ((obsolete define-child-mode))
|
||||
;; FIXME: We should handle this some other way!
|
||||
(define-child-mode c++-mode c-mode
|
||||
"`c++-mode' uses the same parser as `c-mode'."))
|
||||
|
||||
|
||||
;;; Include Paths
|
||||
|
|
@ -930,7 +932,7 @@ the regular parser."
|
|||
) ; save match data
|
||||
|
||||
;; Hack in mode-local
|
||||
(activate-mode-local-bindings)
|
||||
(mode-local--activate-bindings)
|
||||
;; Setup C parser
|
||||
(semantic-default-c-setup)
|
||||
;; CHEATER! The following 3 lines are from
|
||||
|
|
|
|||
|
|
@ -496,7 +496,8 @@ used to perform the override."
|
|||
(if (and (eq (semantic-tag-class tag) 'function)
|
||||
(semantic-tag-get-attribute tag :overloadable))
|
||||
;; Calc the doc to use for the overloadable symbols.
|
||||
(overload-docstring-extension (intern (semantic-tag-name tag)))
|
||||
(mode-local--overload-docstring-extension
|
||||
(intern (semantic-tag-name tag)))
|
||||
""))
|
||||
|
||||
(defun semantic-emacs-lisp-obsoleted-doc (tag)
|
||||
|
|
@ -944,8 +945,10 @@ See `semantic-format-tag-prototype' for Emacs Lisp for more details."
|
|||
"Add variables.
|
||||
ELisp variables can be pretty long, so track this one too.")
|
||||
|
||||
(define-child-mode lisp-mode emacs-lisp-mode
|
||||
"Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.")
|
||||
(with-suppressed-warnings ((obsolete define-child-mode))
|
||||
;; FIXME: We should handle this some other way!
|
||||
(define-child-mode lisp-mode emacs-lisp-mode
|
||||
"Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'."))
|
||||
|
||||
;;;###autoload
|
||||
(defun semantic-default-elisp-setup ()
|
||||
|
|
|
|||
|
|
@ -438,8 +438,8 @@ Menu items are appended to the common grammar menu.")
|
|||
"Major mode for editing Bovine grammars."
|
||||
(semantic-grammar-setup-menu bovine-grammar-menu)
|
||||
(semantic-install-function-overrides
|
||||
'((grammar-parsetable-builder . bovine-grammar-parsetable-builder)
|
||||
(grammar-setupcode-builder . bovine-grammar-setupcode-builder))))
|
||||
'((semantic-grammar-parsetable-builder . bovine-grammar-parsetable-builder)
|
||||
(semantic-grammar-setupcode-builder . bovine-grammar-setupcode-builder))))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.by\\'" . bovine-grammar-mode))
|
||||
|
||||
|
|
|
|||
|
|
@ -186,8 +186,8 @@ Mark OLDFNALIAS as obsolete, such that the byte compiler
|
|||
will throw a warning when it encounters this symbol."
|
||||
(defalias oldfnalias newfn)
|
||||
(make-obsolete oldfnalias newfn when)
|
||||
(when (and (function-overload-p newfn)
|
||||
(not (overload-obsoleted-by newfn))
|
||||
(when (and (mode-local--function-overload-p newfn)
|
||||
(not (mode-local--overload-obsoleted-by newfn))
|
||||
;; Only throw this warning when byte compiling things.
|
||||
(boundp 'byte-compile-current-file)
|
||||
byte-compile-current-file
|
||||
|
|
@ -261,7 +261,7 @@ FUNCTION does not have arguments. When FUNCTION is entered
|
|||
(semantic-alias-obsolete 'define-mode-overload-implementation
|
||||
'define-mode-local-override "23.2")
|
||||
|
||||
(defun semantic-install-function-overrides (overrides &optional transient mode)
|
||||
(defun semantic-install-function-overrides (overrides &optional transient)
|
||||
"Install the function OVERRIDES in the specified environment.
|
||||
OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD
|
||||
is a symbol identifying an overloadable entry, and FUNCTION is the
|
||||
|
|
@ -282,8 +282,7 @@ later installation should be done in MODE hook."
|
|||
(cons (intern (format "semantic-%s" name)) (cdr e)))))
|
||||
overrides)
|
||||
(list 'constant-flag (not transient)
|
||||
'override-flag t)
|
||||
mode))
|
||||
'override-flag t)))
|
||||
|
||||
;;; User Interrupt handling
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@
|
|||
(defun semantic-grammar-wy--install-parser ()
|
||||
"Setup the Semantic Parser."
|
||||
(semantic-install-function-overrides
|
||||
'((parse-stream . wisent-parse-stream)))
|
||||
'((semantic-parse-stream . wisent-parse-stream)))
|
||||
(setq semantic-parser-name "LALR"
|
||||
semantic--parse-table semantic-grammar-wy--parse-table
|
||||
semantic-debug-parser-source "grammar.wy"
|
||||
|
|
|
|||
|
|
@ -247,13 +247,15 @@ tag with greater section value than LEVEL is found."
|
|||
semantic-stickyfunc-sticky-classes '(section)
|
||||
)
|
||||
(semantic-install-function-overrides
|
||||
'((tag-components . semantic-html-components)
|
||||
'((semantic-tag-components . semantic-html-components)
|
||||
)
|
||||
t)
|
||||
)
|
||||
|
||||
(define-child-mode html-helper-mode html-mode
|
||||
"`html-helper-mode' needs the same semantic support as `html-mode'.")
|
||||
;; `html-helper-mode' hasn't been updated since 2004, so it's not very
|
||||
;; relevant nowadays.
|
||||
;;(define-child-mode html-helper-mode html-mode
|
||||
;; "`html-helper-mode' needs the same semantic support as `html-mode'.")
|
||||
|
||||
(provide 'semantic/html)
|
||||
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ and variable state from the current buffer."
|
|||
(error nil))
|
||||
|
||||
;; Hack in mode-local
|
||||
(activate-mode-local-bindings)
|
||||
(mode-local--activate-bindings)
|
||||
|
||||
;; Call the major mode's setup function
|
||||
(let ((entry (assq major-mode semantic-new-buffer-setup-functions)))
|
||||
|
|
|
|||
|
|
@ -63,9 +63,9 @@ Each tag returned is of the form:
|
|||
or
|
||||
(\"NAME\" def)
|
||||
|
||||
It is an override of 'parse-region and must be installed by the
|
||||
It is an override of `semantic-parse-region' and must be installed by the
|
||||
function `semantic-install-function-overrides'."
|
||||
(mapcar 'semantic-texi-expand-tag
|
||||
(mapcar #'semantic-texi-expand-tag
|
||||
(semantic-texi-parse-headings)))
|
||||
|
||||
(defun semantic-texi-parse-changes ()
|
||||
|
|
@ -451,8 +451,8 @@ that start with that symbol."
|
|||
"Set up a buffer for parsing of Texinfo files."
|
||||
;; This will use our parser.
|
||||
(semantic-install-function-overrides
|
||||
'((parse-region . semantic-texi-parse-region)
|
||||
(parse-changes . semantic-texi-parse-changes)))
|
||||
'((semantic-parse-region . semantic-texi-parse-region)
|
||||
(semantic-parse-changes . semantic-texi-parse-changes)))
|
||||
(setq semantic-parser-name "TEXI"
|
||||
;; Setup a dummy parser table to enable parsing!
|
||||
semantic--parse-table t
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ Return the expanded expression."
|
|||
"Return the parser setup code."
|
||||
(format
|
||||
"(semantic-install-function-overrides\n\
|
||||
'((parse-stream . wisent-parse-stream)))\n\
|
||||
'((semantic-parse-stream . wisent-parse-stream)))\n\
|
||||
(setq semantic-parser-name \"LALR\"\n\
|
||||
semantic--parse-table %s\n\
|
||||
semantic-debug-parser-source %S\n\
|
||||
|
|
@ -326,8 +326,8 @@ Menu items are appended to the common grammar menu.")
|
|||
"Major mode for editing Wisent grammars."
|
||||
(semantic-grammar-setup-menu wisent-grammar-menu)
|
||||
(semantic-install-function-overrides
|
||||
'((grammar-parsetable-builder . wisent-grammar-parsetable-builder)
|
||||
(grammar-setupcode-builder . wisent-grammar-setupcode-builder))))
|
||||
'((semantic-grammar-parsetable-builder . wisent-grammar-parsetable-builder)
|
||||
(semantic-grammar-setupcode-builder . wisent-grammar-setupcode-builder))))
|
||||
|
||||
(defvar-mode-local wisent-grammar-mode semantic-grammar-macros
|
||||
'(
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ to this variable NAME."
|
|||
;; the tags created by the javascript parser.
|
||||
;; Local context
|
||||
(define-mode-local-override semantic-get-local-variables
|
||||
javascript-mode ()
|
||||
js-mode ()
|
||||
"Get local values from a specific context.
|
||||
This function overrides `get-local-variables'."
|
||||
;; Does javascript have identifiable local variables?
|
||||
nil)
|
||||
|
||||
(define-mode-local-override semantic-tag-protection javascript-mode (tag &optional parent)
|
||||
(define-mode-local-override semantic-tag-protection js-mode (tag &optional parent)
|
||||
"Return protection information about TAG with optional PARENT.
|
||||
This function returns on of the following symbols:
|
||||
nil - No special protection. Language dependent.
|
||||
|
|
@ -85,14 +85,14 @@ The default behavior (if not overridden with `tag-protection'
|
|||
is to return a symbol based on type modifiers."
|
||||
nil)
|
||||
|
||||
(define-mode-local-override semantic-analyze-scope-calculate-access javascript-mode (type scope)
|
||||
(define-mode-local-override semantic-analyze-scope-calculate-access js-mode (type scope)
|
||||
"Calculate the access class for TYPE as defined by the current SCOPE.
|
||||
Access is related to the :parents in SCOPE. If type is a member of SCOPE
|
||||
then access would be 'private. If TYPE is inherited by a member of SCOPE,
|
||||
the access would be 'protected. Otherwise, access is 'public."
|
||||
nil)
|
||||
|
||||
(define-mode-local-override semantic-ctxt-current-symbol javascript-mode (&optional point)
|
||||
(define-mode-local-override semantic-ctxt-current-symbol js-mode (&optional point)
|
||||
"Return the current symbol the cursor is on at POINT in a list.
|
||||
This is a very simple implementation for Javascript symbols. It
|
||||
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."
|
|||
|
||||
;;; Setup Function
|
||||
;;
|
||||
;; Since javascript-mode is an alias for js-mode, let it inherit all
|
||||
;; the overrides.
|
||||
(define-child-mode js-mode javascript-mode)
|
||||
|
||||
;; Since javascript-mode is an alias for js-mode, let it inherit all
|
||||
;; the overrides.
|
||||
(define-child-mode js-mode javascript-mode)
|
||||
|
||||
;; In semantic-imenu.el, not part of Emacs.
|
||||
(defvar semantic-imenu-summary-function)
|
||||
|
|
|
|||
|
|
@ -530,11 +530,6 @@ Shortens `code' tags, but passes through for others."
|
|||
(code . "Code")))
|
||||
)
|
||||
|
||||
;; Make sure the newer python modes pull in the same python
|
||||
;; mode overrides.
|
||||
(define-child-mode python-2-mode python-mode "Python 2 mode")
|
||||
(define-child-mode python-3-mode python-mode "Python 3 mode")
|
||||
|
||||
|
||||
;;; Utility functions
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -346,8 +346,8 @@ if that file is NEW, otherwise assume the mode has not changed."
|
|||
Argument FAST implies that the file should not be reparsed if there
|
||||
is already an entry for it.
|
||||
Return non-nil if the map changed."
|
||||
(when (or (not fast)
|
||||
(not (srecode-map-entry-for-file-anywhere srecode-current-map file)))
|
||||
(unless (and fast
|
||||
(srecode-map-entry-for-file-anywhere srecode-current-map file))
|
||||
(let ((buff-orig (get-file-buffer file))
|
||||
(dirty nil))
|
||||
(save-excursion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue