aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cedet
diff options
context:
space:
mode:
authorStefan Monnier2015-05-05 22:18:19 -0400
committerStefan Monnier2015-05-05 22:18:19 -0400
commita7d630eb4895a392bcc0d9986d1ca5382a4f7b96 (patch)
treea7dba5dd168029652d5640cac86e5c97444c0563 /lisp/cedet
parent0ed044dc1b524370f02f531b3b6fcc1ef45c395d (diff)
downloademacs-a7d630eb4895a392bcc0d9986d1ca5382a4f7b96.tar.gz
emacs-a7d630eb4895a392bcc0d9986d1ca5382a4f7b96.zip
* lisp/cedet/semantic/grammar.el: Fix compiler warnings (bug#20505)
(semantic-grammar--template-expand): New function. (semantic-grammar-header, semantic-grammar-footer): Use it. (semantic-grammar--lex-block-specs): Remove unused var `block-spec'. (semantic-grammar-file-regexp): Refine regexp. (semantic-grammar-eldoc-get-macro-docstring): Use elisp-get-fnsym-args-string when available. (semantic-idle-summary-current-symbol-info): Use new elisp-* names instead of the old eldoc-* names. * lisp/emacs-lisp/eldoc.el (eldoc-docstring-format-sym-doc): Move back from elisp-mode.el. Tweak calling convention. * lisp/progmodes/elisp-mode.el (package-user-dir): Declare. (elisp-get-fnsym-args-string): Add `prefix' argument. Rename from elisp--get-fnsym-args-string. (elisp--highlight-function-argument): Add `prefix' arg. (elisp-get-var-docstring): Rename from elisp--get-var-docstring. (elisp--docstring-format-sym-doc): Move back to eldoc.el.
Diffstat (limited to 'lisp/cedet')
-rw-r--r--lisp/cedet/semantic/grammar.el84
1 files changed, 49 insertions, 35 deletions
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index 15ad9872446..fc7e9e61a16 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -628,39 +628,38 @@ The symbols in the list are local variables in
628 t) 628 t)
629 (match-string 0)))) 629 (match-string 0))))
630 630
631(defun semantic-grammar--template-expand (template env)
632 (mapconcat (lambda (S)
633 (if (stringp S) S
634 (let ((x (assq S env)))
635 (cond
636 (x (cdr x))
637 ((symbolp S) (symbol-value S))))))
638 template ""))
639
631(defun semantic-grammar-header () 640(defun semantic-grammar-header ()
632 "Return text of a generated standard header." 641 "Return text of a generated standard header."
633 (let ((file (semantic-grammar-buffer-file 642 (semantic-grammar--template-expand
643 semantic-grammar-header-template
644 `((file . ,(semantic-grammar-buffer-file
634 semantic--grammar-output-buffer)) 645 semantic--grammar-output-buffer))
635 (gram (semantic-grammar-buffer-file)) 646 (gram . ,(semantic-grammar-buffer-file))
636 (date (format-time-string "%Y-%m-%d %T%z")) 647 (date . ,(format-time-string "%Y-%m-%d %T%z"))
637 (vcid (concat "$" "Id" "$")) ;; Avoid expansion 648 (vcid . ,(concat "$" "Id" "$")) ;; Avoid expansion
638 ;; Try to get the copyright from the input grammar, or 649 ;; Try to get the copyright from the input grammar, or
639 ;; generate a new one if not found. 650 ;; generate a new one if not found.
640 (copy (or (semantic-grammar-copyright-line) 651 (copy . ,(or (semantic-grammar-copyright-line)
641 (concat (format-time-string ";; Copyright (C) %Y ") 652 (concat (format-time-string ";; Copyright (C) %Y ")
642 user-full-name))) 653 user-full-name))))))
643 (out ""))
644 (dolist (S semantic-grammar-header-template)
645 (cond ((stringp S)
646 (setq out (concat out S)))
647 ((symbolp S)
648 (setq out (concat out (symbol-value S))))))
649 out))
650 654
651(defun semantic-grammar-footer () 655(defun semantic-grammar-footer ()
652 "Return text of a generated standard footer." 656 "Return text of a generated standard footer."
653 (let* ((file (semantic-grammar-buffer-file 657 (semantic-grammar--template-expand
654 semantic--grammar-output-buffer)) 658 semantic-grammar-footer-template
655 (libr (or semantic--grammar-provide 659 `((file . ,(semantic-grammar-buffer-file
656 semantic--grammar-package)) 660 semantic--grammar-output-buffer))
657 (out "")) 661 (libr . ,(or semantic--grammar-provide
658 (dolist (S semantic-grammar-footer-template) 662 semantic--grammar-package)))))
659 (cond ((stringp S)
660 (setq out (concat out S)))
661 ((symbolp S)
662 (setq out (concat out (symbol-value S))))))
663 out))
664 663
665(defun semantic-grammar-token-data () 664(defun semantic-grammar-token-data ()
666 "Return the string value of the table of lexical tokens." 665 "Return the string value of the table of lexical tokens."
@@ -714,7 +713,7 @@ Block definitions are read from the current table of lexical types."
714 (let* ((blocks (cdr (semantic-lex-type-value "block" t))) 713 (let* ((blocks (cdr (semantic-lex-type-value "block" t)))
715 (open-delims (cdr (semantic-lex-type-value "open-paren" t))) 714 (open-delims (cdr (semantic-lex-type-value "open-paren" t)))
716 (close-delims (cdr (semantic-lex-type-value "close-paren" t))) 715 (close-delims (cdr (semantic-lex-type-value "close-paren" t)))
717 olist clist block-spec delim-spec open-spec close-spec) 716 olist clist delim-spec open-spec close-spec)
718 (dolist (block-spec blocks) 717 (dolist (block-spec blocks)
719 (setq delim-spec (semantic-grammar--lex-delim-spec block-spec) 718 (setq delim-spec (semantic-grammar--lex-delim-spec block-spec)
720 open-spec (assq (car delim-spec) open-delims) 719 open-spec (assq (car delim-spec) open-delims)
@@ -818,7 +817,7 @@ Block definitions are read from the current table of lexical types."
818 817
819;;; Generation of the grammar support file. 818;;; Generation of the grammar support file.
820;; 819;;
821(defcustom semantic-grammar-file-regexp "\\.[wb]y$" 820(defcustom semantic-grammar-file-regexp "\\.[wb]y\\'"
822 "Regexp which matches grammar source files." 821 "Regexp which matches grammar source files."
823 :group 'semantic 822 :group 'semantic
824 :type 'regexp) 823 :type 'regexp)
@@ -1073,7 +1072,7 @@ See also the variable `semantic-grammar-file-regexp'."
1073(defvar semantic--grammar-macros-regexp-2 nil) 1072(defvar semantic--grammar-macros-regexp-2 nil)
1074(make-variable-buffer-local 'semantic--grammar-macros-regexp-2) 1073(make-variable-buffer-local 'semantic--grammar-macros-regexp-2)
1075 1074
1076(defun semantic--grammar-clear-macros-regexp-2 (&rest ignore) 1075(defun semantic--grammar-clear-macros-regexp-2 (&rest _)
1077 "Clear the cached regexp that match macros local in this grammar. 1076 "Clear the cached regexp that match macros local in this grammar.
1078IGNORE arguments. 1077IGNORE arguments.
1079Added to `before-change-functions' hooks to be run before each text 1078Added to `before-change-functions' hooks to be run before each text
@@ -1665,9 +1664,11 @@ Select the buffer containing the tag's definition, and move point there."
1665 "Return a one-line docstring for the given grammar MACRO. 1664 "Return a one-line docstring for the given grammar MACRO.
1666EXPANDER is the name of the function that expands MACRO." 1665EXPANDER is the name of the function that expands MACRO."
1667 (require 'eldoc) 1666 (require 'eldoc)
1668 (if (eq expander (car semantic-grammar-eldoc-last-data)) 1667 (cond
1669 (cdr semantic-grammar-eldoc-last-data) 1668 ((eq expander (car semantic-grammar-eldoc-last-data))
1670 (let ((doc (help-split-fundoc (documentation expander t) expander))) 1669 (cdr semantic-grammar-eldoc-last-data))
1670 ((fboundp 'eldoc-function-argstring) ;; Emacs<25
1671 (let* ((doc (help-split-fundoc (documentation expander t) expander)))
1671 (cond 1672 (cond
1672 (doc 1673 (doc
1673 (setq doc (car doc)) 1674 (setq doc (car doc))
@@ -1680,7 +1681,16 @@ EXPANDER is the name of the function that expands MACRO."
1680 (eldoc-docstring-format-sym-doc 1681 (eldoc-docstring-format-sym-doc
1681 macro (format "==> %s %s" expander doc) 'default)) 1682 macro (format "==> %s %s" expander doc) 'default))
1682 (setq semantic-grammar-eldoc-last-data (cons expander doc))) 1683 (setq semantic-grammar-eldoc-last-data (cons expander doc)))
1683 doc))) 1684 doc))
1685 ((fboundp 'elisp-get-fnsym-args-string) ;; Emacs≄25
1686 (elisp-get-fnsym-args-string
1687 expander nil
1688 (concat (propertize (symbol-name macro)
1689 'face 'font-lock-keyword-face)
1690 " ==> "
1691 (propertize (symbol-name macro)
1692 'face 'font-lock-function-name-face)
1693 ": ")))))
1684 1694
1685(define-mode-local-override semantic-idle-summary-current-symbol-info 1695(define-mode-local-override semantic-idle-summary-current-symbol-info
1686 semantic-grammar-mode () 1696 semantic-grammar-mode ()
@@ -1711,10 +1721,14 @@ Otherwise return nil."
1711 (setq val (semantic-grammar-eldoc-get-macro-docstring elt val))) 1721 (setq val (semantic-grammar-eldoc-get-macro-docstring elt val)))
1712 ;; Function 1722 ;; Function
1713 ((and elt (fboundp elt)) 1723 ((and elt (fboundp elt))
1714 (setq val (eldoc-get-fnsym-args-string elt))) 1724 (setq val (if (fboundp 'eldoc-get-fnsym-args-string)
1725 (eldoc-get-fnsym-args-string elt)
1726 (elisp-get-fnsym-args-string elt))))
1715 ;; Variable 1727 ;; Variable
1716 ((and elt (boundp elt)) 1728 ((and elt (boundp elt))
1717 (setq val (eldoc-get-var-docstring elt))) 1729 (setq val (if (fboundp 'eldoc-get-var-docstring)
1730 (eldoc-get-var-docstring elt)
1731 (elisp-get-var-docstring elt))))
1718 (t nil))) 1732 (t nil)))
1719 (or val (semantic-idle-summary-current-symbol-info-default)))) 1733 (or val (semantic-idle-summary-current-symbol-info-default))))
1720 1734