From d1a7d16f8e1a42d6e6edc0621e29b38f92e9fc2e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 12 Mar 2021 11:32:42 -0500 Subject: * lisp/cedet/{*.el,ede/*.el}: Use lexical-binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove a few redundant `:group` arguments as well. * lisp/cedet/ede.el: Use lexical-binding. Don't load `ede/files` at compile-time. (ede-speedbar): Declare function. (ede-load-project-file): Allow `rootreturn` to be a reference rather than a symbol. (ede-initialize-state-current-buffer): Pass `ROOT` as a reference rather than a symbol to `ede-directory-get-open-project` and `ede-load-project-file` so we don't need to make it dynamically scoped. (ede-flush-deleted-projects): Avoid `add-to-list` on a local var. * lisp/cedet/ede/files.el: Use lexical-binding. (ede-directory-get-open-project): Allow `rootreturn` to be a reference rather than a symbol. (ede-project-root-directory): Remove unused var `root`. (ede-expand-filename-impl): Remove unused vars `path` and `proj`. * lisp/cedet/cedet-idutils.el: Use lexical-binding. (cedet-idutils-search): Remove always-nil variable `scopeflags`. * lisp/cedet/data-debug.el: Use lexical-binding. (data-debug-insert-overlay-button, data-debug-insert-overlay-list-button) (data-debug-insert-buffer-button, data-debug-insert-buffer-list-button) (data-debug-insert-process-button): Remove always-nil variable `tip`. (data-debug-insert-ring-button): Remove unused var `ringthing`. (data-debug-insert-widget-properties): Remove unused var `type`. * lisp/cedet/semantic.el: Use lexical-binding. (semantic-mode): Strength-reduce `eval` to `symbol-value`. * lisp/cedet/ede/custom.el: Use lexical-binding. (ede-project-sort-targets): Remove unused vars `count`, `current`, and `order`. * lisp/cedet/ede/pconf.el: Use lexical-binding. (ede-proj-configure-synchronize): Remove unused var `add-missing`. * lisp/cedet/ede/pmake.el (ede-proj-makefile-garbage-patterns): Simplify via η-reduction. (ede-proj-makefile-dependencies): Use `seq-some` rather than `eval+or`. * lisp/cedet/ede/proj-elisp.el: Use lexical-binding. (project-compile-target): Remove unused var `elc`. (ede-update-version-in-source): Remove unused var `match`. (project-compile-target): Declare function `cedet-update-autoloads` from file we don't have. * lisp/cedet/cedet-cscope.el: Use lexical-binding. * lisp/cedet/cedet-files.el: Use lexical-binding. * lisp/cedet/cedet-global.el: Use lexical-binding. * lisp/cedet/cedet.el: Use lexical-binding. * lisp/cedet/ede/auto.el: Use lexical-binding. * lisp/cedet/ede/autoconf-edit.el: Use lexical-binding. * lisp/cedet/ede/config.el: Use lexical-binding. * lisp/cedet/ede/cpp-root.el: Use lexical-binding. * lisp/cedet/ede/detect.el: Use lexical-binding. * lisp/cedet/ede/generic.el: Use lexical-binding. * lisp/cedet/ede/linux.el: Use lexical-binding. * lisp/cedet/ede/locate.el: Use lexical-binding. * lisp/cedet/ede/makefile-edit.el: Use lexical-binding. * lisp/cedet/ede/proj-info.el: Use lexical-binding. * lisp/cedet/ede/proj-obj.el: Use lexical-binding. * lisp/cedet/ede/proj-prog.el: Use lexical-binding. * lisp/cedet/ede/proj-shared.el: Use lexical-binding. * lisp/cedet/ede/proj.el: Use lexical-binding. * lisp/cedet/ede/shell.el: Use lexical-binding. * lisp/cedet/ede/simple.el: Use lexical-binding. * lisp/cedet/ede/source.el: Use lexical-binding. * lisp/cedet/ede/speedbar.el: Use lexical-binding. * lisp/cedet/ede/util.el: Use lexical-binding. --- lisp/cedet/ede/proj-obj.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/cedet/ede/proj-obj.el') diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el index 3aa4497f932..72d09167ab8 100644 --- a/lisp/cedet/ede/proj-obj.el +++ b/lisp/cedet/ede/proj-obj.el @@ -1,4 +1,4 @@ -;;; ede/proj-obj.el --- EDE Generic Project Object code generation support +;;; ede/proj-obj.el --- EDE Generic Project Object code generation support -*- lexical-binding: t; -*- ;;; Copyright (C) 1998-2000, 2005, 2008-2021 Free Software Foundation, ;;; Inc. @@ -282,15 +282,15 @@ Argument THIS is the target to get sources from." (append (oref this source) (oref this auxsource))) (cl-defmethod ede-proj-makefile-insert-variables ((this ede-proj-target-makefile-objectcode) - &optional moresource) + &optional _moresource) "Insert variables needed by target THIS. Optional argument MORESOURCE is not used." (let ((ede-proj-objectcode-dodependencies (oref (ede-target-parent this) automatic-dependencies))) (cl-call-next-method))) -(cl-defmethod ede-buffer-header-file((this ede-proj-target-makefile-objectcode) - buffer) +(cl-defmethod ede-buffer-header-file ((this ede-proj-target-makefile-objectcode) + _buffer) "There are no default header files." (or (cl-call-next-method) ;; Ok, nothing obvious. Try looking in ourselves. -- cgit v1.2.3 From 371fdd4f1be51b6a2babe21e3655e99401246c4c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 15 Mar 2021 00:08:34 -0400 Subject: * lisp/cedet: Convert remaining files to lexical-binding Remove a few more redundant `:group` args. Make use of lexical scoping to replace `(lambda...) with proper closures. * lisp/cedet/ede/custom.el (ede-project-sort-targets-list): Use `dotimes` and replace `(lambda..) with closures. * lisp/cedet/ede/proj-comp.el (proj-comp-insert-variable-once): * lisp/cedet/ede/pmake.el (ede-pmake-insert-variable-once): Remove unused var `addcr`. * lisp/cedet/semantic/complete.el: Use lexical-binding. (semantic-displayer-show-request): Remove unused var `typing-count`. Use `equal` instead of `stringp+string=`. * lisp/cedet/semantic/db-ebrowse.el: Use lexical-binding. (semanticdb-create-ebrowse-database): Remove unused vars `mma` and `regexp`. (semanticdb-ebrowse-strip-trees): Remove unused var `class` and `filename`. (semanticdb-ebrowse-add-globals-to-table): Remove unused var `fname`. * lisp/cedet/semantic/db-find.el: Use lexical-binding. (semanticdb-find-adebug-insert-scanned-tag-cons): Remove always-nil var `tip`. * lisp/cedet/semantic/db-global.el: Use lexical-binding. (semanticdb-enable-gnu-global-databases): Access local var `semantic--ih` by sticking its value in the code passed to `eval` rather than by dynamic scoping. * lisp/cedet/semantic/db-typecache.el: Use lexical-binding. (semanticdb-db-typecache-dump): Remove unused var `junk`. * lisp/cedet/semantic/debug.el: Use lexical-binding. * lisp/cedet/semantic/dep.el: Use lexical-binding. (semantic-add-system-include): Avoid `add-to-list` on a local variable. Access local var `value` by sticking its value in the code passed to `eval` rather than by dynamic scoping. (semantic-remove-system-include): Don't use `delete` on a list received from elsewhere. Access local var `value` by sticking its value in the code passed to `eval` rather than by dynamic scoping. (semantic-reset-system-include): Simplify a bit. * lisp/cedet/semantic/ede-grammar.el: Use lexical-binding. (project-compile-target): Remove unused vars `csrc` and `cb`. Use `cl-incf`. Remove apparently unneeded `with-no-warnings`. * lisp/cedet/semantic/edit.el: Use lexical-binding. (semantic-edits-change-over-tags): Remove unused var `inner-start`. (semantic-edits-incremental-parser-1): Silence warnings about intentionally unused var `last-cond`. * lisp/cedet/semantic/fw.el: Use lexical-binding. (recentf-exclude, semantic-init-hook, ede-auto-add-method) (flymake-start-syntax-check-on-find-file, auto-insert): Declare vars. * lisp/cedet/semantic/ia-sb.el: Use lexical-binding. (semantic-ia-sb-key-map): Move initialization into declaration. (semantic-ia-sb-more-buttons): Remove unused var `idx`. (semantic-ia-sb-line-path): Simplify `if` -> `or`. * lisp/cedet/semantic/idle.el (semantic-idle-breadcrumbs--tag-function): Make it a function returning a closure. * lisp/cedet/semantic/senator.el: Use lexical-binding. (senator-search-set-tag-class-filter): Replace `(lambda..) with a closure. * lisp/cedet/semantic/sort.el: Use lexical-binding. (semanticdb-search-system-databases): Declare var. (semantic-tag-external-member-children-default): Replace `(lambda..) with a closure. * lisp/cedet/semantic/tag-ls.el: Use lexical-binding. (semantic-tag-protection-default, semantic-tag-abstract-p-default): Simplify with `member`. * lisp/cedet/semantic/util.el: Use lexical-binding. (semantic-something-to-tag-table): Declare function `semanticdb-abstract-table--eieio-childp` called via `cl-typep`. * lisp/cedet/semantic/bovine/scm.el (semantic-default-scheme-setup): Remove duplicate setting of `imenu-create-index-function`. * lisp/cedet/semantic/decorate/mode.el (semantic-decoration-build-style-menu): Replace `(lambda..) with a closure. * lisp/cedet/srecode/cpp.el (srecode-semantic-apply-tag-to-dict): Remove always-t variable `member`. * lisp/cedet/srecode/mode.el (srecode-minor-mode-templates-menu): Replace `(lambda..) with a closure. Use `push`. * lisp/cedet/semantic/chart.el: Use lexical-binding. * lisp/cedet/semantic/db-debug.el: Use lexical-binding. * lisp/cedet/semantic/db-el.el: Use lexical-binding. * lisp/cedet/semantic/db-file.el: Use lexical-binding. * lisp/cedet/semantic/db-javascript.el: Use lexical-binding. * lisp/cedet/semantic/db-mode.el: Use lexical-binding. * lisp/cedet/semantic/db-ref.el: Use lexical-binding. * lisp/cedet/semantic/decorate.el: Use lexical-binding. * lisp/cedet/semantic/doc.el: Use lexical-binding. * lisp/cedet/semantic/find.el: Use lexical-binding. * lisp/cedet/semantic/format.el: Use lexical-binding. * lisp/cedet/semantic/html.el: Use lexical-binding. * lisp/cedet/semantic/ia.el: Use lexical-binding. * lisp/cedet/semantic/imenu.el: Use lexical-binding. * lisp/cedet/semantic/java.el: Use lexical-binding. * lisp/cedet/semantic/mru-bookmark.el: Use lexical-binding. * lisp/cedet/semantic/symref.el: Use lexical-binding. * lisp/cedet/semantic/tag-file.el: Use lexical-binding. * lisp/cedet/semantic/tag-write.el: Use lexical-binding. * lisp/cedet/semantic/texi.el: Use lexical-binding. * lisp/cedet/semantic/util-modes.el: Use lexical-binding. --- lisp/cedet/cedet-cscope.el | 2 +- lisp/cedet/ede/custom.el | 46 ++++++------ lisp/cedet/ede/make.el | 2 +- lisp/cedet/ede/pconf.el | 3 +- lisp/cedet/ede/pmake.el | 16 ++-- lisp/cedet/ede/proj-comp.el | 7 +- lisp/cedet/ede/proj-info.el | 3 +- lisp/cedet/ede/proj-obj.el | 3 +- lisp/cedet/ede/proj-shared.el | 2 +- lisp/cedet/semantic/analyze/debug.el | 17 +++-- lisp/cedet/semantic/bovine/make.el | 4 +- lisp/cedet/semantic/bovine/scm.el | 5 +- lisp/cedet/semantic/chart.el | 12 +-- lisp/cedet/semantic/complete.el | 123 +++++++++++++++---------------- lisp/cedet/semantic/db-debug.el | 6 +- lisp/cedet/semantic/db-ebrowse.el | 44 +++++------ lisp/cedet/semantic/db-el.el | 6 +- lisp/cedet/semantic/db-file.el | 8 +- lisp/cedet/semantic/db-find.el | 17 +++-- lisp/cedet/semantic/db-global.el | 17 +++-- lisp/cedet/semantic/db-javascript.el | 18 ++--- lisp/cedet/semantic/db-mode.el | 2 +- lisp/cedet/semantic/db-ref.el | 8 +- lisp/cedet/semantic/db-typecache.el | 26 +++---- lisp/cedet/semantic/debug.el | 52 ++++++------- lisp/cedet/semantic/decorate.el | 11 ++- lisp/cedet/semantic/decorate/include.el | 8 +- lisp/cedet/semantic/decorate/mode.el | 20 +++-- lisp/cedet/semantic/dep.el | 26 +++---- lisp/cedet/semantic/doc.el | 4 +- lisp/cedet/semantic/ede-grammar.el | 16 ++-- lisp/cedet/semantic/edit.el | 14 ++-- lisp/cedet/semantic/find.el | 6 +- lisp/cedet/semantic/format.el | 10 +-- lisp/cedet/semantic/fw.el | 58 ++++++++------- lisp/cedet/semantic/html.el | 10 +-- lisp/cedet/semantic/ia-sb.el | 36 ++++----- lisp/cedet/semantic/ia.el | 8 +- lisp/cedet/semantic/idle.el | 48 +++++------- lisp/cedet/semantic/imenu.el | 26 ++----- lisp/cedet/semantic/java.el | 22 +++--- lisp/cedet/semantic/lex-spp.el | 4 +- lisp/cedet/semantic/lex.el | 2 +- lisp/cedet/semantic/mru-bookmark.el | 20 ++--- lisp/cedet/semantic/senator.el | 21 ++---- lisp/cedet/semantic/sort.el | 20 ++--- lisp/cedet/semantic/symref.el | 8 +- lisp/cedet/semantic/symref/list.el | 28 +++---- lisp/cedet/semantic/tag-file.el | 2 +- lisp/cedet/semantic/tag-ls.el | 23 +++--- lisp/cedet/semantic/tag-write.el | 4 +- lisp/cedet/semantic/tag.el | 22 +++--- lisp/cedet/semantic/texi.el | 18 ++--- lisp/cedet/semantic/util-modes.el | 66 ++++++++--------- lisp/cedet/semantic/util.el | 11 ++- lisp/cedet/semantic/wisent/comp.el | 2 +- lisp/cedet/semantic/wisent/java-tags.el | 8 +- lisp/cedet/semantic/wisent/javascript.el | 8 +- lisp/cedet/semantic/wisent/python.el | 4 +- lisp/cedet/semantic/wisent/wisent.el | 2 +- lisp/cedet/srecode.el | 2 +- lisp/cedet/srecode/cpp.el | 4 +- lisp/cedet/srecode/mode.el | 8 +- lisp/cedet/srecode/template.el | 6 +- 64 files changed, 516 insertions(+), 549 deletions(-) (limited to 'lisp/cedet/ede/proj-obj.el') diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el index 95f04541c84..6ffc2765d68 100644 --- a/lisp/cedet/cedet-cscope.el +++ b/lisp/cedet/cedet-cscope.el @@ -1,6 +1,6 @@ ;;; cedet-cscope.el --- CScope support for CEDET -*- lexical-binding: t; -*- -;;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Package: cedet diff --git a/lisp/cedet/ede/custom.el b/lisp/cedet/ede/custom.el index adb1a49cdf7..ac4f9f66846 100644 --- a/lisp/cedet/ede/custom.el +++ b/lisp/cedet/ede/custom.el @@ -133,47 +133,45 @@ OBJ is the target object to customize." (defun ede-project-sort-targets-list () "Sort the target list while using `ede-project-sort-targets'." (save-excursion - (let ((count 0) - (targets (oref ede-object-project targets)) + (let ((targets (oref ede-object-project targets)) (inhibit-read-only t) (inhibit-modification-hooks t)) (goto-char (point-min)) (forward-line 2) (delete-region (point) (point-max)) - (while (< count (length targets)) + (dotimes (count (length targets)) (if (> count 0) (widget-create 'push-button - :notify `(lambda (&rest ignore) - (let ((cur ede-project-sort-targets-order)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth ,count cur) - (1- ,count)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth (1- ,count) cur) ,count)) - (ede-project-sort-targets-list)) + :notify (lambda (&rest _ignore) + (let ((cur ede-project-sort-targets-order)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth count cur) + (1- count)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth (1- count) cur) count)) + (ede-project-sort-targets-list)) " Up ") (widget-insert " ")) (if (< count (1- (length targets))) (widget-create 'push-button - :notify `(lambda (&rest ignore) - (let ((cur ede-project-sort-targets-order)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth ,count cur) (1+ ,count)) - (add-to-ordered-list - 'ede-project-sort-targets-order - (nth (1+ ,count) cur) ,count)) - (ede-project-sort-targets-list)) + :notify (lambda (&rest _ignore) + (let ((cur ede-project-sort-targets-order)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth count cur) (1+ count)) + (add-to-ordered-list + 'ede-project-sort-targets-order + (nth (1+ count) cur) count)) + (ede-project-sort-targets-list)) " Down ") (widget-insert " ")) (widget-insert (concat " " (number-to-string (1+ count)) ".: " (oref (nth (nth count ede-project-sort-targets-order) targets) name) - "\n")) - (setq count (1+ count)))))) + "\n")))))) ;;; Customization hooks ;; diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el index d9811ce52f9..3402020fc4a 100644 --- a/lisp/cedet/ede/make.el +++ b/lisp/cedet/ede/make.el @@ -1,6 +1,6 @@ ;;; ede/make.el --- General information about "make" -*- lexical-binding: t -*- -;;; Copyright (C) 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2009-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el index 106ba2cf5b9..c5b2ea4cb60 100644 --- a/lisp/cedet/ede/pconf.el +++ b/lisp/cedet/ede/pconf.el @@ -1,7 +1,6 @@ ;;; ede/pconf.el --- configure.ac maintenance for EDE -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2005, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: project diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el index ceb44031f6a..fd6918c4e81 100644 --- a/lisp/cedet/ede/pmake.el +++ b/lisp/cedet/ede/pmake.el @@ -266,14 +266,14 @@ Execute BODY in a location where a value can be placed." "Add VARNAME into the current Makefile if it doesn't exist. Execute BODY in a location where a value can be placed." (declare (debug t) (indent 1)) - `(let ((addcr t) (v ,varname)) - (unless - (save-excursion - (re-search-backward (concat "^" v "\\s-*=") nil t)) - (insert v "=") - ,@body - (when addcr (insert "\n")) - (goto-char (point-max))))) + `(let ((v ,varname)) + (unless + (save-excursion + (re-search-backward (concat "^" v "\\s-*=") nil t)) + (insert v "=") + ,@body + (insert "\n") + (goto-char (point-max))))) ;;; SOURCE VARIABLE NAME CONSTRUCTION diff --git a/lisp/cedet/ede/proj-comp.el b/lisp/cedet/ede/proj-comp.el index 1d6a4eb47cd..0d797aa5fb9 100644 --- a/lisp/cedet/ede/proj-comp.el +++ b/lisp/cedet/ede/proj-comp.el @@ -249,13 +249,12 @@ This will prevent rules from creating duplicate variables or rules." "Add VARNAME into the current Makefile if it doesn't exist. Execute BODY in a location where a value can be placed." (declare (indent 1) (debug (sexp body))) - `(let ((addcr t) (v ,varname)) + `(let ((v ,varname)) (unless (re-search-backward (concat "^" v "\\s-*=") nil t) (insert v "=") ,@body - (if addcr (insert "\n")) - (goto-char (point-max))) - )) + (insert "\n") + (goto-char (point-max))))) (cl-defmethod ede-proj-makefile-insert-variables ((this ede-compilation-program)) "Insert variables needed by the compiler THIS." diff --git a/lisp/cedet/ede/proj-info.el b/lisp/cedet/ede/proj-info.el index 11e0f302e2b..dbb86edb217 100644 --- a/lisp/cedet/ede/proj-info.el +++ b/lisp/cedet/ede/proj-info.el @@ -1,7 +1,6 @@ ;;; ede-proj-info.el --- EDE Generic Project texinfo support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2001, 2004, 2007-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: project, make diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el index 72d09167ab8..2ae62f4b38e 100644 --- a/lisp/cedet/ede/proj-obj.el +++ b/lisp/cedet/ede/proj-obj.el @@ -1,7 +1,6 @@ ;;; ede/proj-obj.el --- EDE Generic Project Object code generation support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2005, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: project, make diff --git a/lisp/cedet/ede/proj-shared.el b/lisp/cedet/ede/proj-shared.el index 8688d15174f..01f19bc6572 100644 --- a/lisp/cedet/ede/proj-shared.el +++ b/lisp/cedet/ede/proj-shared.el @@ -1,6 +1,6 @@ ;;; ede-proj-shared.el --- EDE Generic Project shared library support -*- lexical-binding: t; -*- -;;; Copyright (C) 1998-2000, 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 1998-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: project, make diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index 58d6644f9a9..69b3b9c8328 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -1,6 +1,6 @@ ;;; semantic/analyze/debug.el --- Debug the analyzer -*- lexical-binding: t; -*- -;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam @@ -593,19 +593,20 @@ Look for key expressions, and add push-buttons near them." (setq-local semantic-analyzer-debug-orig orig-buffer) ;; First, add do-in buttons to recommendations. (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t) - (let ((fcn (match-string 1))) - (when (not (fboundp (intern-soft fcn))) + (let* ((fcn (match-string 1)) + (fsym (intern-soft fcn))) + (when (not (fboundp fsym)) (error "Help Err: Can't find %s" fcn)) (end-of-line) (insert " ") (insert-button "[ Do It ]" 'mouse-face 'custom-button-pressed-face 'do-fcn fcn - 'action `(lambda (arg) - (let ((M semantic-analyzer-debug-orig)) - (set-buffer (marker-buffer M)) - (goto-char M)) - (call-interactively (quote ,(intern-soft fcn)))))))) + 'action (lambda (_arg) + (let ((M semantic-analyzer-debug-orig)) + (set-buffer (marker-buffer M)) + (goto-char M)) + (call-interactively fsym)))))) ;; Do something else? ;; Clean up the mess (set-buffer-modified-p nil)))) diff --git a/lisp/cedet/semantic/bovine/make.el b/lisp/cedet/semantic/bovine/make.el index 2c9b78f9dd1..bb579cfde3f 100644 --- a/lisp/cedet/semantic/bovine/make.el +++ b/lisp/cedet/semantic/bovine/make.el @@ -218,7 +218,7 @@ Uses default implementation, and also gets a list of filenames." ;; but not actually parsed. (file . "File")) semantic-case-fold t - semantic-tag-expand-function 'semantic-make-expand-tag + semantic-tag-expand-function #'semantic-make-expand-tag semantic-lex-syntax-modifications '((?. "_") (?= ".") (?/ "_") @@ -226,7 +226,7 @@ Uses default implementation, and also gets a list of filenames." (?+ ".") (?\\ ".") ) - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-make-lexer) ) diff --git a/lisp/cedet/semantic/bovine/scm.el b/lisp/cedet/semantic/bovine/scm.el index 939348ef4a5..0395412069b 100644 --- a/lisp/cedet/semantic/bovine/scm.el +++ b/lisp/cedet/semantic/bovine/scm.el @@ -1,6 +1,6 @@ ;;; semantic/bovine/scm.el --- Semantic details for Scheme (guile) -*- lexical-binding: t; -*- -;;; Copyright (C) 2001-2004, 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2001-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam @@ -102,8 +102,7 @@ syntax as specified by the syntax table." (function . "Functions") (include . "Loads") (package . "DefineModule")) - imenu-create-index-function 'semantic-create-imenu-index - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ) (setq semantic-lex-analyzer #'semantic-scheme-lexer) ) diff --git a/lisp/cedet/semantic/chart.el b/lisp/cedet/semantic/chart.el index e7848faf741..0abbe458647 100644 --- a/lisp/cedet/semantic/chart.el +++ b/lisp/cedet/semantic/chart.el @@ -1,4 +1,4 @@ -;;; semantic/chart.el --- Utilities for use with semantic tag tables +;;; semantic/chart.el --- Utilities for use with semantic tag tables -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2001, 2003, 2005, 2008-2021 Free Software ;; Foundation, Inc. @@ -43,7 +43,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (interactive) (let* ((stream (semantic-something-to-tag-table (or tagtable (current-buffer)))) - (names (mapcar 'cdr semantic-symbol->name-assoc-list)) + (names (mapcar #'cdr semantic-symbol->name-assoc-list)) (nums (mapcar (lambda (symname) (length @@ -57,7 +57,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." nums "Volume") )) -(defun semantic-chart-database-size (&optional tagtable) +(defun semantic-chart-database-size (&optional _tagtable) "Create a bar chart representing the size of each file in semanticdb. Each bar represents how many toplevel tags in TAGTABLE exist in each database entry. @@ -68,7 +68,7 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (error "Semanticdb is not enabled")) (let* ((db semanticdb-current-database) (dbt (semanticdb-get-database-tables db)) - (names (mapcar 'car + (names (mapcar #'car (object-assoc-list 'file dbt))) @@ -84,8 +84,8 @@ TAGTABLE is passed to `semantic-something-to-tag-table'." (nums nil) (fh (/ (- (frame-height) 7) 4))) (setq numnuts (sort numnuts (lambda (a b) (> (car a) (car b))))) - (setq names (mapcar 'cdr numnuts) - nums (mapcar 'car numnuts)) + (setq names (mapcar #'cdr numnuts) + nums (mapcar #'car numnuts)) (if (> (length names) fh) (progn (setcdr (nthcdr fh names) nil) diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index c83505818f5..d6ef7960473 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -1,4 +1,4 @@ -;;; semantic/complete.el --- Routines for performing tag completion +;;; semantic/complete.el --- Routines for performing tag completion -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2005, 2007-2021 Free Software Foundation, Inc. @@ -154,8 +154,8 @@ Presumably if you call this you will insert something new there." (defun semantic-completion-message (fmt &rest args) "Display the string FMT formatted with ARGS at the end of the minibuffer." (if semantic-complete-inline-overlay - (apply 'message fmt args) - (apply 'message (concat "%s" fmt) (buffer-string) args))) + (apply #'message fmt args) + (apply #'message (concat "%s" fmt) (buffer-string) args))) ;;; ------------------------------------------------------------ ;;; MINIBUFFER: Option Selection harnesses @@ -171,14 +171,14 @@ Value should be a ... what?") (defvar semantic-complete-key-map (let ((km (make-sparse-keymap))) - (define-key km " " 'semantic-complete-complete-space) - (define-key km "\t" 'semantic-complete-complete-tab) - (define-key km "\C-m" 'semantic-complete-done) - (define-key km "\C-g" 'abort-recursive-edit) - (define-key km "\M-n" 'next-history-element) - (define-key km "\M-p" 'previous-history-element) - (define-key km "\C-n" 'next-history-element) - (define-key km "\C-p" 'previous-history-element) + (define-key km " " #'semantic-complete-complete-space) + (define-key km "\t" #'semantic-complete-complete-tab) + (define-key km "\C-m" #'semantic-complete-done) + (define-key km "\C-g" #'abort-recursive-edit) + (define-key km "\M-n" #'next-history-element) + (define-key km "\M-p" #'previous-history-element) + (define-key km "\C-n" #'next-history-element) + (define-key km "\C-p" #'previous-history-element) ;; Add history navigation km) "Keymap used while completing across a list of tags.") @@ -488,7 +488,7 @@ If PARTIAL, do partial completion stopping at spaces." ) (t nil)))) -(defun semantic-complete-do-completion (&optional partial inline) +(defun semantic-complete-do-completion (&optional partial _inline) "Do a completion for the current minibuffer. If PARTIAL, do partial completion stopping at spaces. if INLINE, then completion is happening inline in a buffer." @@ -550,12 +550,12 @@ if INLINE, then completion is happening inline in a buffer." ;; push ourselves out of this mode on alternate keypresses. (defvar semantic-complete-inline-map (let ((km (make-sparse-keymap))) - (define-key km "\C-i" 'semantic-complete-inline-TAB) - (define-key km "\M-p" 'semantic-complete-inline-up) - (define-key km "\M-n" 'semantic-complete-inline-down) - (define-key km "\C-m" 'semantic-complete-inline-done) - (define-key km "\C-\M-c" 'semantic-complete-inline-exit) - (define-key km "\C-g" 'semantic-complete-inline-quit) + (define-key km "\C-i" #'semantic-complete-inline-TAB) + (define-key km "\M-p" #'semantic-complete-inline-up) + (define-key km "\M-n" #'semantic-complete-inline-down) + (define-key km "\C-m" #'semantic-complete-inline-done) + (define-key km "\C-\M-c" #'semantic-complete-inline-exit) + (define-key km "\C-g" #'semantic-complete-inline-quit) (define-key km "?" (lambda () (interactive) (describe-variable 'semantic-complete-inline-map))) @@ -620,7 +620,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer." "Exit inline completion mode." (interactive) ;; Remove this hook FIRST! - (remove-hook 'pre-command-hook 'semantic-complete-pre-command-hook) + (remove-hook 'pre-command-hook #'semantic-complete-pre-command-hook) (condition-case nil (progn @@ -649,7 +649,7 @@ Similar to `minibuffer-contents' when completing in the minibuffer." ;; Remove this hook LAST!!! ;; This will force us back through this function if there was ;; some sort of error above. - (remove-hook 'post-command-hook 'semantic-complete-post-command-hook) + (remove-hook 'post-command-hook #'semantic-complete-post-command-hook) ;;(message "Exiting inline completion.") ) @@ -770,8 +770,8 @@ END is at the end of the current symbol being completed." (overlay-put semantic-complete-inline-overlay 'semantic-original-start start) ;; Install our command hooks - (add-hook 'pre-command-hook 'semantic-complete-pre-command-hook) - (add-hook 'post-command-hook 'semantic-complete-post-command-hook) + (add-hook 'pre-command-hook #'semantic-complete-pre-command-hook) + (add-hook 'post-command-hook #'semantic-complete-post-command-hook) ;; Go! (semantic-complete-inline-force-display) ) @@ -929,8 +929,8 @@ The only options available for completion are those which can be logically inserted into the current context.") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-analyze-completions) prefix completionlist) - "calculate the completions for prefix from completionlist." + ((obj semantic-collector-analyze-completions) prefix _completionlist) + "calculate the completions for prefix from COMPLETIONLIST." ;; if there are no completions yet, calculate them. (if (not (slot-boundp obj 'first-pass-completions)) (oset obj first-pass-completions @@ -943,7 +943,7 @@ inserted into the current context.") prefix (oref obj first-pass-completions))))) -(cl-defmethod semantic-collector-cleanup ((obj semantic-collector-abstract)) +(cl-defmethod semantic-collector-cleanup ((_obj semantic-collector-abstract)) "Clean up any mess this collector may have." nil) @@ -1004,7 +1004,7 @@ Output must be in semanticdb Find result format." (list (cons table result))))) (cl-defmethod semantic-collector-calculate-completions - ((obj semantic-collector-abstract) prefix partial) + ((obj semantic-collector-abstract) prefix _partial) "Calculate completions for prefix as setup for other queries." (let* ((case-fold-search semantic-case-fold) (same-prefix-p (semantic-collector-last-prefix= obj prefix)) @@ -1014,7 +1014,8 @@ Output must be in semanticdb Find result format." (cond ((or same-prefix-p (and last-prefix (eq (compare-strings last-prefix 0 nil - prefix 0 (length last-prefix)) t))) + prefix 0 (length last-prefix)) + t))) ;; We have the same prefix, or last-prefix is a ;; substring of the of new prefix, in which case we are ;; refining our symbol so just re-use cache. @@ -1023,7 +1024,8 @@ Output must be in semanticdb Find result format." (> (length prefix) 1) (eq (compare-strings prefix 0 nil - last-prefix 0 (length prefix)) t)) + last-prefix 0 (length prefix)) + t)) ;; The new prefix is a substring of the old ;; prefix, and it's longer than one character. ;; Perform a full search to pull in additional @@ -1134,7 +1136,7 @@ into a buffer." (semanticdb-find-result-nth-in-buffer (oref obj current-exact-match) 0))) (cl-defmethod semantic-collector-all-completions - ((obj semantic-collector-abstract) prefix) + ((obj semantic-collector-abstract) _prefix) "For OBJ, retrieve all completions matching PREFIX. The returned list consists of all the tags currently matching PREFIX." @@ -1142,7 +1144,7 @@ matching PREFIX." (oref obj last-all-completions))) (cl-defmethod semantic-collector-try-completion - ((obj semantic-collector-abstract) prefix) + ((obj semantic-collector-abstract) _prefix) "For OBJ, attempt to match PREFIX. See `try-completion' for details on how this works. Return nil for no match. @@ -1153,7 +1155,7 @@ with that name." (oref obj last-completion))) (cl-defmethod semantic-collector-calculate-cache - ((obj semantic-collector-abstract)) + ((_obj semantic-collector-abstract)) "Calculate the completion cache for OBJ." nil ) @@ -1176,7 +1178,7 @@ These collectors track themselves on a per-buffer basis." :abstract t) (cl-defmethod make-instance ((this (subclass semantic-collector-buffer-abstract)) - &rest args) + &rest _args) "Reuse previously created objects of this type in buffer." (let ((old nil) (bl semantic-collector-per-buffer-list)) @@ -1193,7 +1195,7 @@ These collectors track themselves on a per-buffer basis." old)) ;; Buffer specific collectors should flush themselves -(defun semantic-collector-buffer-flush (newcache) +(defun semantic-collector-buffer-flush (_newcache) "Flush all buffer collector objects. NEWCACHE is the new tag table, but we ignore it." (condition-case nil @@ -1204,7 +1206,7 @@ NEWCACHE is the new tag table, but we ignore it." (error nil))) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-collector-buffer-flush) + #'semantic-collector-buffer-flush) ;;; DEEP BUFFER SPECIFIC COMPLETION ;; @@ -1246,8 +1248,8 @@ Uses semanticdb for searching all tags in the current project." (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-project) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-project) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (semanticdb-find-tags-for-completion prefix (oref obj path))) ;;; Brutish Project search @@ -1259,8 +1261,8 @@ Uses semanticdb for searching all tags in the current project." "semantic/db-find") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-project-brutish) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-project-brutish) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (require 'semantic/db-find) (semanticdb-brute-deep-find-tags-for-completion prefix (oref obj path))) @@ -1273,8 +1275,8 @@ Uses semanticdb for searching all tags in the current project." "Completion engine for tags in a project.") (cl-defmethod semantic-collector-calculate-completions-raw - ((obj semantic-collector-local-members) prefix completionlist) - "Calculate the completions for prefix from completionlist." + ((obj semantic-collector-local-members) prefix _completionlist) + "Calculate the completions for prefix from COMPLETIONLIST." (let* ((scope (or (oref obj scope) (oset obj scope (semantic-calculate-scope)))) (localstuff (oref scope scope))) @@ -1323,7 +1325,7 @@ a collector, and tracking tables of completion to display." (define-obsolete-function-alias 'semantic-displayor-cleanup #'semantic-displayer-cleanup "27.1") -(cl-defmethod semantic-displayer-cleanup ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-cleanup ((_obj semantic-displayer-abstract)) "Clean up any mess this displayer may have." nil) @@ -1348,37 +1350,37 @@ a collector, and tracking tables of completion to display." (define-obsolete-function-alias 'semantic-displayor-show-request #'semantic-displayer-show-request "27.1") -(cl-defmethod semantic-displayer-show-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-show-request ((_obj semantic-displayer-abstract)) "A request to show the current tags table." (ding)) (define-obsolete-function-alias 'semantic-displayor-focus-request #'semantic-displayer-focus-request "27.1") -(cl-defmethod semantic-displayer-focus-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-request ((_obj semantic-displayer-abstract)) "A request to for the displayer to focus on some tag option." (ding)) (define-obsolete-function-alias 'semantic-displayor-scroll-request #'semantic-displayer-scroll-request "27.1") -(cl-defmethod semantic-displayer-scroll-request ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-scroll-request ((_obj semantic-displayer-abstract)) "A request to for the displayer to scroll the completion list (if needed)." (scroll-other-window)) (define-obsolete-function-alias 'semantic-displayor-focus-previous #'semantic-displayer-focus-previous "27.1") -(cl-defmethod semantic-displayer-focus-previous ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-previous ((_obj semantic-displayer-abstract)) "Set the current focus to the previous item." nil) (define-obsolete-function-alias 'semantic-displayor-focus-next #'semantic-displayer-focus-next "27.1") -(cl-defmethod semantic-displayer-focus-next ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-focus-next ((_obj semantic-displayer-abstract)) "Set the current focus to the next item." nil) (define-obsolete-function-alias 'semantic-displayor-current-focus #'semantic-displayer-current-focus "27.1") -(cl-defmethod semantic-displayer-current-focus ((obj semantic-displayer-abstract)) +(cl-defmethod semantic-displayer-current-focus ((_obj semantic-displayer-abstract)) "Return a single tag currently in focus. This object type doesn't do focus, so will never have a focus object." nil) @@ -1452,7 +1454,7 @@ which have the same name." (define-obsolete-function-alias 'semantic-displayor-set-completions #'semantic-displayer-set-completions "27.1") (cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-focus-abstract) - table prefix) + _table _prefix) "Set the list of tags to be completed over to TABLE." (cl-call-next-method) (slot-makeunbound obj 'focus)) @@ -1663,7 +1665,7 @@ This will not happen if you directly set this variable via `setq'." "Display completions options in a tooltip. Display mechanism using tooltip for a list of possible completions.") -(cl-defmethod initialize-instance :after ((obj semantic-displayer-tooltip) &rest args) +(cl-defmethod initialize-instance :after ((_obj semantic-displayer-tooltip) &rest _args) "Make sure we have tooltips required." (require 'tooltip)) @@ -1681,16 +1683,16 @@ Display mechanism using tooltip for a list of possible completions.") (table (semantic-unique-tag-table-by-name tablelong)) (completions (mapcar semantic-completion-displayer-format-tag-function table)) (numcompl (length completions)) - (typing-count (oref obj typing-count)) + ;; (typing-count (oref obj typing-count)) (mode (oref obj mode)) (max-tags (oref obj max-tags-initial)) (matchtxt (semantic-completion-text)) msg msg-tail) ;; Keep a count of the consecutive completion commands entered by the user. - (if (and (stringp (this-command-keys)) - (string= (this-command-keys) "\C-i")) - (oset obj typing-count (1+ (oref obj typing-count))) - (oset obj typing-count 0)) + (oset obj typing-count + (if (equal (this-command-keys) "\C-i") + (1+ (oref obj typing-count)) + 0)) (cond ((eq mode 'quiet) ;; Switch back to standard mode if user presses key more than 5 times. @@ -1730,7 +1732,7 @@ Display mechanism using tooltip for a list of possible completions.") (when semantic-idle-scheduler-verbose-flag (setq msg "[NO MATCH]")))) ;; Create the tooltip text. - (setq msg (concat msg (mapconcat 'identity completions "\n")))) + (setq msg (concat msg (mapconcat #'identity completions "\n")))) ;; Add any tail info. (setq msg (concat msg msg-tail)) ;; Display tooltip. @@ -1828,12 +1830,10 @@ text using overlay options.") (define-obsolete-function-alias 'semantic-displayor-set-completions #'semantic-displayer-set-completions "27.1") (cl-defmethod semantic-displayer-set-completions ((obj semantic-displayer-ghost) - table prefix) + _table _prefix) "Set the list of tags to be completed over to TABLE." (cl-call-next-method) - - (semantic-displayer-cleanup obj) - ) + (semantic-displayer-cleanup obj)) (define-obsolete-function-alias 'semantic-displayor-show-request @@ -2058,9 +2058,8 @@ prompts. these are calculated from the CONTEXT variable passed in." (semantic-displayer-traditional-with-focus-highlight) (with-current-buffer (oref context buffer) (goto-char (cdr (oref context bounds))) - (concat prompt (mapconcat 'identity syms ".") - (if syms "." "") - )) + (concat prompt (mapconcat #'identity syms ".") + (if syms "." ""))) nil inp history))) diff --git a/lisp/cedet/semantic/db-debug.el b/lisp/cedet/semantic/db-debug.el index c553ab499ae..d8f7034f03a 100644 --- a/lisp/cedet/semantic/db-debug.el +++ b/lisp/cedet/semantic/db-debug.el @@ -1,6 +1,6 @@ -;;; semantic/db-debug.el --- Extra level debugging routines for Semantic +;;; semantic/db-debug.el --- Extra level debugging routines for Semantic -*- lexical-binding: t; -*- -;;; Copyright (C) 2008-2021 Free Software Foundation, Inc. +;; Copyright (C) 2008-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam @@ -38,7 +38,7 @@ (data-debug-new-buffer "*SEMANTICDB*") (data-debug-insert-stuff-list db "*"))) -(defalias 'semanticdb-adebug-database-list 'semanticdb-dump-all-table-summary) +(defalias 'semanticdb-adebug-database-list #'semanticdb-dump-all-table-summary) (defun semanticdb-adebug-current-database () "Run ADEBUG on the current database." diff --git a/lisp/cedet/semantic/db-ebrowse.el b/lisp/cedet/semantic/db-ebrowse.el index 946f9ef6326..db37512de3c 100644 --- a/lisp/cedet/semantic/db-ebrowse.el +++ b/lisp/cedet/semantic/db-ebrowse.el @@ -1,4 +1,4 @@ -;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse. +;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse. -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2021 Free Software Foundation, Inc. @@ -135,8 +135,8 @@ is specified by `semanticdb-default-save-directory'." (let* ((savein (semanticdb-ebrowse-file-for-directory dir)) (filebuff (get-buffer-create "*SEMANTICDB EBROWSE TMP*")) (files (directory-files (expand-file-name dir) t)) - (mma auto-mode-alist) - (regexp nil) + ;; (mma auto-mode-alist) + ;; (regexp nil) ) ;; Create the input to the ebrowse command (with-current-buffer filebuff @@ -227,7 +227,7 @@ warn instead." () "Search Ebrowse for symbols.") -(cl-defmethod semanticdb-needs-refresh-p ((table semanticdb-table-ebrowse)) +(cl-defmethod semanticdb-needs-refresh-p ((_table semanticdb-table-ebrowse)) "EBROWSE database do not need to be refreshed. JAVE: stub for needs-refresh, because, how do we know if BROWSE files @@ -274,7 +274,7 @@ For instance: /home//.semanticdb/!usr!include!BROWSE" (insert-file-contents B) (let ((ans nil) (efcn (symbol-function 'ebrowse-show-progress))) - (fset 'ebrowse-show-progress #'(lambda (&rest junk) nil)) + (fset 'ebrowse-show-progress #'(lambda (&rest _junk) nil)) (unwind-protect ;; Protect against errors w/ ebrowse (setq ans (list B (ebrowse-read))) ;; These items must always happen @@ -341,10 +341,10 @@ If there is no database for DIRECTORY available, then (while T (let* ((tree (car T)) - (class (ebrowse-ts-class tree)); root class of tree + ;;(class (ebrowse-ts-class tree)); root class of tree ;; Something funny going on with this file thing... - (filename (or (ebrowse-cs-source-file class) - (ebrowse-cs-file class))) + ;; (filename (or (ebrowse-cs-source-file class) + ;; (ebrowse-cs-file class))) ) (cond ((ebrowse-globals-tree-p tree) @@ -363,18 +363,18 @@ If there is no database for DIRECTORY available, then ;;; Filename based methods ;; -(defun semanticdb-ebrowse-add-globals-to-table (dbe tree) +(defun semanticdb-ebrowse-add-globals-to-table (_dbe tree) "For database DBE, add the ebrowse TREE into the table." (if (or (not (ebrowse-ts-p tree)) (not (ebrowse-globals-tree-p tree))) (signal 'wrong-type-argument (list 'ebrowse-ts-p tree))) (let* ((class (ebrowse-ts-class tree)) - (fname (or (ebrowse-cs-source-file class) - (ebrowse-cs-file class) - ;; Not def'd here, assume our current - ;; file - (concat default-directory "/unknown-proxy.hh"))) + ;; (fname (or (ebrowse-cs-source-file class) + ;; (ebrowse-cs-file class) + ;; ;; Not def'd here, assume our current + ;; ;; file + ;; (concat default-directory "/unknown-proxy.hh"))) (vars (ebrowse-ts-member-functions tree)) (fns (ebrowse-ts-member-variables tree)) (toks nil) @@ -573,7 +573,7 @@ return that." ;; how your new search routines are implemented. ;; (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-ebrowse) name &optional tags) + ((_table semanticdb-table-ebrowse) _name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." ;;(message "semanticdb-find-tags-by-name-method name -- %s" name) @@ -588,7 +588,7 @@ Return a list of tags." ) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-ebrowse) regex &optional tags) + ((_table semanticdb-table-ebrowse) _regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -598,7 +598,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-ebrowse) prefix &optional tags) + ((_table semanticdb-table-ebrowse) _prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -608,7 +608,7 @@ Returns a table of all matching tags." )) (cl-defmethod semanticdb-find-tags-by-class-method - ((table semanticdb-table-ebrowse) class &optional tags) + ((_table semanticdb-table-ebrowse) _class &optional tags) "In TABLE, find all occurrences of tags of CLASS. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -625,7 +625,7 @@ Returns a table of all matching tags." ;; (cl-defmethod semanticdb-deep-find-tags-by-name-method - ((table semanticdb-table-ebrowse) name &optional tags) + ((_table semanticdb-table-ebrowse) _name &optional _tags) "Find all tags name NAME in TABLE. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-by-name-method' for ebrowse." @@ -633,7 +633,7 @@ Like `semanticdb-find-tags-by-name-method' for ebrowse." (cl-call-next-method)) (cl-defmethod semanticdb-deep-find-tags-by-name-regexp-method - ((table semanticdb-table-ebrowse) regex &optional tags) + ((_table semanticdb-table-ebrowse) _regex &optional _tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-by-name-method' for ebrowse." @@ -641,7 +641,7 @@ Like `semanticdb-find-tags-by-name-method' for ebrowse." (cl-call-next-method)) (cl-defmethod semanticdb-deep-find-tags-for-completion-method - ((table semanticdb-table-ebrowse) prefix &optional tags) + ((_table semanticdb-table-ebrowse) _prefix &optional _tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Like `semanticdb-find-tags-for-completion-method' for ebrowse." @@ -651,7 +651,7 @@ Like `semanticdb-find-tags-for-completion-method' for ebrowse." ;;; Advanced Searches ;; (cl-defmethod semanticdb-find-tags-external-children-of-type-method - ((table semanticdb-table-ebrowse) type &optional tags) + ((_table semanticdb-table-ebrowse) _type &optional tags) "Find all nonterminals which are child elements of TYPE Optional argument TAGS is a list of tags to search. Return a list of tags." diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el index de84b978026..78339c375fb 100644 --- a/lisp/cedet/semantic/db-el.el +++ b/lisp/cedet/semantic/db-el.el @@ -1,6 +1,6 @@ -;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp +;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: tags @@ -53,7 +53,7 @@ It does not need refreshing." "Return nil, we never need a refresh." nil) -(cl-defmethod semanticdb-debug-info ((obj semanticdb-table-emacs-lisp)) +(cl-defmethod semanticdb-debug-info ((_obj semanticdb-table-emacs-lisp)) (list "(proxy)")) (cl-defmethod cl-print-object ((obj semanticdb-table-emacs-lisp) stream) diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el index d99b94f49eb..c9007ac7a02 100644 --- a/lisp/cedet/semantic/db-file.el +++ b/lisp/cedet/semantic/db-file.el @@ -1,6 +1,6 @@ -;;; semantic/db-file.el --- Save a semanticdb to a cache file. +;;; semantic/db-file.el --- Save a semanticdb to a cache file. -*- lexical-binding: t; -*- -;;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: tags @@ -358,13 +358,13 @@ Uses `semanticdb-persistent-path' to determine the return value." (object-assoc (file-name-nondirectory filename) 'file (oref obj tables))) (cl-defmethod semanticdb-file-name-non-directory - ((dbclass (subclass semanticdb-project-database-file))) + ((_dbclass (subclass semanticdb-project-database-file))) "Return the file name DBCLASS will use. File name excludes any directory part." semanticdb-default-file-name) (cl-defmethod semanticdb-file-name-directory - ((dbclass (subclass semanticdb-project-database-file)) directory) + ((_dbclass (subclass semanticdb-project-database-file)) directory) "Return the relative directory to where DBCLASS will save its cache file. The returned path is related to DIRECTORY." (if semanticdb-default-save-directory diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index db88463bfd1..c96a426280e 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -1,4 +1,4 @@ -;;; semantic/db-find.el --- Searching through semantic databases. +;;; semantic/db-find.el --- Searching through semantic databases. -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -209,14 +209,14 @@ This class will cache data derived during various searches.") ) (cl-defmethod semanticdb-synchronize ((idx semanticdb-find-search-index) - new-tags) + _new-tags) "Synchronize the search index IDX with some NEW-TAGS." ;; Reset our parts. (semantic-reset idx) ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (semantic-reset (semanticdb-get-table-index tab)))) ) @@ -230,7 +230,7 @@ This class will cache data derived during various searches.") ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (semantic-reset (semanticdb-get-table-index tab)))) ) ;; Else, not an include, by just a type. @@ -240,7 +240,7 @@ This class will cache data derived during various searches.") ;; Notify dependants by clearing their indices. (semanticdb-notify-references (oref idx table) - (lambda (tab me) + (lambda (tab _me) (let ((tab-idx (semanticdb-get-table-index tab))) ;; Not a full reset? (when (oref tab-idx type-cache) @@ -791,7 +791,8 @@ PREBUTTONTEXT is some text between prefix and the overlay button." (file (semantic-tag-file-name tag)) (str1 (format "%S %s" mode name)) (str2 (format " : %s" file)) - (tip nil)) + ;; (tip nil) + ) (insert prefix prebuttontext str1) (setq end (point)) (insert str2) @@ -807,7 +808,7 @@ PREBUTTONTEXT is some text between prefix and the overlay button." (put-text-property start end 'ddebug (cdr consdata)) (put-text-property start end 'ddebug-indent(length prefix)) (put-text-property start end 'ddebug-prefix prefix) - (put-text-property start end 'help-echo tip) + ;; (put-text-property start end 'help-echo tip) (put-text-property start end 'ddebug-function 'data-debug-insert-tag-parts-from-point) (insert "\n") @@ -1009,7 +1010,7 @@ is still made current." (when norm ;; The normalized tags can now be found based on that ;; tags table. - (condition-case foo + (condition-case nil (progn (semanticdb-set-buffer (car norm)) ;; Now reset ans diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el index 2f40082d53c..6bdc7b3f750 100644 --- a/lisp/cedet/semantic/db-global.el +++ b/lisp/cedet/semantic/db-global.el @@ -1,4 +1,4 @@ -;;; semantic/db-global.el --- Semantic database extensions for GLOBAL +;;; semantic/db-global.el --- Semantic database extensions for GLOBAL -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2006, 2008-2021 Free Software Foundation, Inc. @@ -69,7 +69,8 @@ values." (let ((semanticdb--ih (mode-local-value mode 'semantic-init-mode-hook))) (eval `(setq-mode-local ,mode semantic-init-mode-hook - (cons 'semanticdb-enable-gnu-global-hook semanticdb--ih)))) + (cons 'semanticdb-enable-gnu-global-hook ',semanticdb--ih)) + t)) t ) ) @@ -114,7 +115,7 @@ if optional DONT-ERR-IF-NOT-AVAILABLE is non-nil; else throw an error." ) "A table for returning search results from GNU Global.") -(cl-defmethod semanticdb-debug-info ((obj semanticdb-table-global)) +(cl-defmethod semanticdb-debug-info ((_obj semanticdb-table-global)) (list "(proxy)")) (cl-defmethod cl-print-object ((obj semanticdb-table-global) stream) @@ -123,7 +124,7 @@ Adds the number of tags in this file to the object print name." (princ (eieio-object-name obj (semanticdb-debug-info obj)) stream)) -(cl-defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer) +(cl-defmethod semanticdb-equivalent-mode ((_table semanticdb-table-global) &optional _buffer) "Return t, pretend that this table's mode is equivalent to BUFFER. Equivalent modes are specified by the `semantic-equivalent-major-modes' local variable." @@ -146,7 +147,7 @@ For each file hit, get the traditional semantic table from that file." (cl-call-next-method)) -(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-global) filename) +(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-global) _filename) "From OBJ, return FILENAME's associated table object." ;; We pass in "don't load". I wonder if we need to avoid that or not? (car (semanticdb-get-database-tables obj)) @@ -157,7 +158,7 @@ For each file hit, get the traditional semantic table from that file." ;; Only NAME based searches work with GLOBAL as that is all it tracks. ;; (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-global) name &optional tags) + ((_table semanticdb-table-global) name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." (if tags @@ -174,7 +175,7 @@ Return a list of tags." ))) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-global) regex &optional tags) + ((_table semanticdb-table-global) regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -187,7 +188,7 @@ Return a list of tags." ))) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-global) prefix &optional tags) + ((_table semanticdb-table-global) prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." diff --git a/lisp/cedet/semantic/db-javascript.el b/lisp/cedet/semantic/db-javascript.el index 2b138866215..cad561e7967 100644 --- a/lisp/cedet/semantic/db-javascript.el +++ b/lisp/cedet/semantic/db-javascript.el @@ -1,4 +1,4 @@ -;;; semantic/db-javascript.el --- Semantic database extensions for javascript +;;; semantic/db-javascript.el --- Semantic database extensions for javascript -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -129,20 +129,20 @@ Create one of our special tables that can act as an intermediary." (cl-call-next-method) ) -(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-javascript) filename) +(cl-defmethod semanticdb-file-table ((obj semanticdb-project-database-javascript) _filename) "From OBJ, return FILENAME's associated table object." ;; NOTE: See not for `semanticdb-get-database-tables'. (car (semanticdb-get-database-tables obj)) ) -(cl-defmethod semanticdb-get-tags ((table semanticdb-table-javascript )) +(cl-defmethod semanticdb-get-tags ((_table semanticdb-table-javascript )) "Return the list of tags belonging to TABLE." ;; NOTE: Omniscient databases probably don't want to keep large tables ;; lolly-gagging about. Keep internal Emacs tables empty and ;; refer to alternate databases when you need something. semanticdb-javascript-tags) -(cl-defmethod semanticdb-equivalent-mode ((table semanticdb-table-javascript) &optional buffer) +(cl-defmethod semanticdb-equivalent-mode ((_table semanticdb-table-javascript) &optional buffer) "Return non-nil if TABLE's mode is equivalent to BUFFER. Equivalent modes are specified by the `semantic-equivalent-major-modes' local variable." @@ -193,7 +193,7 @@ database (if available.)" result)) (cl-defmethod semanticdb-find-tags-by-name-method - ((table semanticdb-table-javascript) name &optional tags) + ((_table semanticdb-table-javascript) name &optional tags) "Find all tags named NAME in TABLE. Return a list of tags." (if tags @@ -203,7 +203,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-by-name-regexp-method - ((table semanticdb-table-javascript) regex &optional tags) + ((_table semanticdb-table-javascript) regex &optional tags) "Find all tags with name matching REGEX in TABLE. Optional argument TAGS is a list of tags to search. Return a list of tags." @@ -214,7 +214,7 @@ Return a list of tags." )) (cl-defmethod semanticdb-find-tags-for-completion-method - ((table semanticdb-table-javascript) prefix &optional tags) + ((_table semanticdb-table-javascript) prefix &optional tags) "In TABLE, find all occurrences of tags matching PREFIX. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -224,7 +224,7 @@ Returns a table of all matching tags." )) (cl-defmethod semanticdb-find-tags-by-class-method - ((table semanticdb-table-javascript) class &optional tags) + ((_table semanticdb-table-javascript) _class &optional tags) "In TABLE, find all occurrences of tags of CLASS. Optional argument TAGS is a list of tags to search. Returns a table of all matching tags." @@ -268,7 +268,7 @@ Like `semanticdb-find-tags-for-completion-method' for javascript." ;;; Advanced Searches ;; (cl-defmethod semanticdb-find-tags-external-children-of-type-method - ((table semanticdb-table-javascript) type &optional tags) + ((_table semanticdb-table-javascript) _type &optional tags) "Find all nonterminals which are child elements of TYPE. Optional argument TAGS is a list of tags to search. Return a list of tags." diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el index aa4634faa98..839dcb8172d 100644 --- a/lisp/cedet/semantic/db-mode.el +++ b/lisp/cedet/semantic/db-mode.el @@ -1,4 +1,4 @@ -;;; semantic/db-mode.el --- Semanticdb Minor Mode +;;; semantic/db-mode.el --- Semanticdb Minor Mode -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/semantic/db-ref.el b/lisp/cedet/semantic/db-ref.el index da09f9830a7..10108d39772 100644 --- a/lisp/cedet/semantic/db-ref.el +++ b/lisp/cedet/semantic/db-ref.el @@ -1,6 +1,6 @@ -;;; semantic/db-ref.el --- Handle cross-db file references +;;; semantic/db-ref.el --- Handle cross-db file references -*- lexical-binding: t; -*- -;;; Copyright (C) 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2007-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam @@ -67,7 +67,7 @@ will be added to the database that INCLUDE-TAG refers to." (object-add-to-list refdbt 'db-refs dbt) t))) -(cl-defmethod semanticdb-check-references ((dbt semanticdb-abstract-table)) +(cl-defmethod semanticdb-check-references ((_dbt semanticdb-abstract-table)) "Check and cleanup references in the database DBT. Abstract tables would be difficult to reference." ;; Not sure how an abstract table can have references. @@ -109,7 +109,7 @@ refers to DBT will be removed." )) (setq refs (cdr refs))))) -(cl-defmethod semanticdb-refresh-references ((dbt semanticdb-abstract-table)) +(cl-defmethod semanticdb-refresh-references ((_dbt semanticdb-abstract-table)) "Refresh references to DBT in other files." ;; alternate tables can't be edited, so can't be changed. nil diff --git a/lisp/cedet/semantic/db-typecache.el b/lisp/cedet/semantic/db-typecache.el index 8c394cd7fa9..c0fee3b2bd9 100644 --- a/lisp/cedet/semantic/db-typecache.el +++ b/lisp/cedet/semantic/db-typecache.el @@ -1,4 +1,4 @@ -;;; semantic/db-typecache.el --- Manage Datatypes +;;; semantic/db-typecache.el --- Manage Datatypes -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -74,14 +74,14 @@ Said object must support `semantic-reset' methods.") (oset tc stream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) (cl-defmethod semanticdb-typecache-notify-reset ((tc semanticdb-typecache)) "Do a reset from a notify from a table we depend on." (oset tc includestream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) @@ -90,7 +90,7 @@ Said object must support `semantic-reset' methods.") "Reset the typecache based on a partial reparse." (when (semantic-find-tags-by-class 'include new-tags) (oset tc includestream nil) - (mapc 'semantic-reset (oref tc dependants)) + (mapc #'semantic-reset (oref tc dependants)) (oset tc dependants nil) ) @@ -167,15 +167,15 @@ If there is no table, create one, and fill it in." (oset tc stream nil) ) -(cl-defmethod semanticdb-synchronize ((cache semanticdb-database-typecache) - new-tags) +(cl-defmethod semanticdb-synchronize ((_cache semanticdb-database-typecache) + _new-tags) "Synchronize a CACHE with some NEW-TAGS." - ) + nil) -(cl-defmethod semanticdb-partial-synchronize ((cache semanticdb-database-typecache) - new-tags) +(cl-defmethod semanticdb-partial-synchronize ((_cache semanticdb-database-typecache) + _new-tags) "Synchronize a CACHE with some changed NEW-TAGS." - ) + nil) (cl-defmethod semanticdb-get-typecache ((db semanticdb-project-database)) "Retrieve the typecache from the semantic database DB. @@ -312,7 +312,7 @@ If TAG has fully qualified names, expand it to a series of nested namespaces instead." tag) -(cl-defmethod semanticdb-typecache-file-tags ((table semanticdb-abstract-table)) +(cl-defmethod semanticdb-typecache-file-tags ((_table semanticdb-abstract-table)) "No tags available from non-file based tables." nil) @@ -338,7 +338,7 @@ all included files." (oref cache filestream) )) -(cl-defmethod semanticdb-typecache-include-tags ((table semanticdb-abstract-table)) +(cl-defmethod semanticdb-typecache-include-tags ((_table semanticdb-abstract-table)) "No tags available from non-file based tables." nil) @@ -611,7 +611,7 @@ If there isn't one, create it. (require 'data-debug) (let* ((tab semanticdb-current-table) (idx (semanticdb-get-table-index tab)) - (junk (oset idx type-cache nil)) ;; flush! + (_ (oset idx type-cache nil)) ;; flush! (start (current-time)) (tc (semanticdb-typecache-for-database (oref tab parent-db))) (end (current-time)) diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el index ce4afbbf26d..4f96746166b 100644 --- a/lisp/cedet/semantic/debug.el +++ b/lisp/cedet/semantic/debug.el @@ -1,4 +1,4 @@ -;;; semantic/debug.el --- Language Debugger framework +;;; semantic/debug.el --- Language Debugger framework -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2005, 2008-2021 Free Software Foundation, Inc. @@ -265,12 +265,12 @@ on different types of return values." ) "One frame representation.") -(cl-defmethod semantic-debug-frame-highlight ((frame semantic-debug-frame)) +(cl-defmethod semantic-debug-frame-highlight ((_frame semantic-debug-frame)) "Highlight one parser frame." ) -(cl-defmethod semantic-debug-frame-info ((frame semantic-debug-frame)) +(cl-defmethod semantic-debug-frame-info ((_frame semantic-debug-frame)) "Display info about this one parser frame." ) @@ -279,21 +279,21 @@ on different types of return values." ;; (defvar semantic-debug-mode-map (let ((km (make-sparse-keymap))) - (define-key km "n" 'semantic-debug-next) - (define-key km " " 'semantic-debug-next) - (define-key km "s" 'semantic-debug-step) - (define-key km "u" 'semantic-debug-up) - (define-key km "d" 'semantic-debug-down) - (define-key km "f" 'semantic-debug-fail-match) - (define-key km "h" 'semantic-debug-print-state) - (define-key km "s" 'semantic-debug-jump-to-source) - (define-key km "p" 'semantic-debug-jump-to-parser) - (define-key km "q" 'semantic-debug-quit) - (define-key km "a" 'semantic-debug-abort) - (define-key km "g" 'semantic-debug-go) - (define-key km "b" 'semantic-debug-set-breakpoint) + (define-key km "n" #'semantic-debug-next) + (define-key km " " #'semantic-debug-next) + (define-key km "s" #'semantic-debug-step) + (define-key km "u" #'semantic-debug-up) + (define-key km "d" #'semantic-debug-down) + (define-key km "f" #'semantic-debug-fail-match) + (define-key km "h" #'semantic-debug-print-state) + (define-key km "s" #'semantic-debug-jump-to-source) + (define-key km "p" #'semantic-debug-jump-to-parser) + (define-key km "q" #'semantic-debug-quit) + (define-key km "a" #'semantic-debug-abort) + (define-key km "g" #'semantic-debug-go) + (define-key km "b" #'semantic-debug-set-breakpoint) ;; Some boring bindings. - (define-key km "e" 'eval-expression) + (define-key km "e" #'eval-expression) km) "Keymap used when in semantic-debug-node.") @@ -514,49 +514,49 @@ by overriding one of the command methods. Be sure to use down to your parser later." :abstract t) -(cl-defmethod semantic-debug-parser-next ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-next ((_parser semantic-debug-parser)) "Execute next for this PARSER." (setq semantic-debug-user-command 'next) ) -(cl-defmethod semantic-debug-parser-step ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-step ((_parser semantic-debug-parser)) "Execute a step for this PARSER." (setq semantic-debug-user-command 'step) ) -(cl-defmethod semantic-debug-parser-go ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-go ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'go) ) -(cl-defmethod semantic-debug-parser-fail ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-fail ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'fail) ) -(cl-defmethod semantic-debug-parser-quit ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-quit ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'quit) ) -(cl-defmethod semantic-debug-parser-abort ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-abort ((_parser semantic-debug-parser)) "Continue execution in this PARSER until the next breakpoint." (setq semantic-debug-user-command 'abort) ) -(cl-defmethod semantic-debug-parser-print-state ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-print-state ((_parser semantic-debug-parser)) "Print state for this PARSER at the current breakpoint." (with-slots (current-frame) semantic-debug-current-interface (when current-frame (semantic-debug-frame-info current-frame) ))) -(cl-defmethod semantic-debug-parser-break ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-break ((_parser semantic-debug-parser)) "Set a breakpoint for this PARSER." ) ;; Stack stuff -(cl-defmethod semantic-debug-parser-frames ((parser semantic-debug-parser)) +(cl-defmethod semantic-debug-parser-frames ((_parser semantic-debug-parser)) "Return a list of frames for the current parser. A frame is of the form: ( .. .what ? .. ) diff --git a/lisp/cedet/semantic/decorate.el b/lisp/cedet/semantic/decorate.el index 53c54ab4cc8..3e6651df152 100644 --- a/lisp/cedet/semantic/decorate.el +++ b/lisp/cedet/semantic/decorate.el @@ -1,7 +1,6 @@ -;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens. +;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens. -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2003, 2005-2007, 2009-2021 Free Software -;;; Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: syntax @@ -51,7 +50,7 @@ Optional FACE specifies the face to use." )) ;;; Momentary Highlighting - One line -(defun semantic-momentary-highlight-one-tag-line (tag &optional face) +(defun semantic-momentary-highlight-one-tag-line (tag &optional _face) "Highlight the first line of TAG, unhighlighting before next command. Optional argument FACE specifies the face to do the highlighting." (save-excursion @@ -88,7 +87,7 @@ If VISIBLE is non-nil, make the text visible." (overlay-get (semantic-tag-overlay tag) 'invisible)) (defun semantic-overlay-signal-read-only - (overlay after start end &optional len) + (overlay after start end &optional _len) "Hook used in modification hooks to prevent modification. Allows deletion of the entire text. Argument OVERLAY, AFTER, START, END, and LEN are passed in by the system." @@ -261,7 +260,7 @@ nil implies the tag should be fully shown." (declare-function semantic-current-tag "semantic/find") -(defun semantic-set-tag-folded-isearch (overlay) +(defun semantic-set-tag-folded-isearch (_overlay) "Called by isearch if it discovers text in the folded region. OVERLAY is passed in by isearch." (semantic-set-tag-folded (semantic-current-tag) nil) diff --git a/lisp/cedet/semantic/decorate/include.el b/lisp/cedet/semantic/decorate/include.el index 851a2c46a9e..a3bf4e252f7 100644 --- a/lisp/cedet/semantic/decorate/include.el +++ b/lisp/cedet/semantic/decorate/include.el @@ -55,7 +55,7 @@ Used by the decoration style: `semantic-decoration-on-includes'." (defvar semantic-decoration-on-include-map (let ((km (make-sparse-keymap))) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-include-menu) km) "Keymap used on includes.") @@ -114,7 +114,7 @@ Used by the decoration style: `semantic-decoration-on-unknown-includes'." (defvar semantic-decoration-on-unknown-include-map (let ((km (make-sparse-keymap))) ;(define-key km [ mouse-2 ] 'semantic-decoration-unknown-include-describe) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-unknown-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-unknown-include-menu) km) "Keymap used on unparsed includes.") @@ -169,7 +169,7 @@ Used by the decoration style: `semantic-decoration-on-fileless-includes'." (defvar semantic-decoration-on-fileless-include-map (let ((km (make-sparse-keymap))) ;(define-key km [ mouse-2 ] 'semantic-decoration-fileless-include-describe) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-fileless-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-fileless-include-menu) km) "Keymap used on unparsed includes.") @@ -223,7 +223,7 @@ Used by the decoration style: `semantic-decoration-on-unparsed-includes'." (defvar semantic-decoration-on-unparsed-include-map (let ((km (make-sparse-keymap))) - (define-key km semantic-decoration-mouse-3 'semantic-decoration-unparsed-include-menu) + (define-key km semantic-decoration-mouse-3 #'semantic-decoration-unparsed-include-menu) km) "Keymap used on unparsed includes.") diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index 89cc9304d47..78950159199 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -264,9 +264,9 @@ non-nil if the minor mode is enabled." (buffer-name))) ;; Add hooks (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-decorate-tags-after-partial-reparse nil t) + #'semantic-decorate-tags-after-partial-reparse nil t) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-decorate-tags-after-full-reparse nil t) + #'semantic-decorate-tags-after-full-reparse nil t) ;; Add decorations to available tags. The above hooks ensure ;; that new tags will be decorated when they become available. ;; However, don't do this immediately, because EDE will be @@ -282,9 +282,9 @@ non-nil if the minor mode is enabled." (semantic-decorate-flush-decorations) ;; Remove hooks (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-decorate-tags-after-partial-reparse t) + #'semantic-decorate-tags-after-partial-reparse t) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-decorate-tags-after-full-reparse t))) + #'semantic-decorate-tags-after-full-reparse t))) (semantic-add-minor-mode 'semantic-decoration-mode "") @@ -350,13 +350,11 @@ Return non-nil if the decoration style is enabled." (defun semantic-decoration-build-style-menu (style) "Build a menu item for controlling a specific decoration STYLE." - (vector (car style) - `(lambda () (interactive) - (semantic-toggle-decoration-style - ,(car style))) - :style 'toggle - :selected `(semantic-decoration-style-enabled-p ,(car style)) - )) + (let ((s (car style))) + (vector s + (lambda () (interactive) (semantic-toggle-decoration-style s)) + :style 'toggle + :selected `(semantic-decoration-style-enabled-p ',s)))) (defun semantic-build-decoration-mode-menu (&rest _ignore) "Create a menu listing all the known decorations for toggling. diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el index db8be5ecf47..efebe21a945 100644 --- a/lisp/cedet/semantic/dep.el +++ b/lisp/cedet/semantic/dep.el @@ -1,4 +1,4 @@ -;;; semantic/dep.el --- Methods for tracking dependencies (include files) +;;; semantic/dep.el --- Methods for tracking dependencies (include files) -*- lexical-binding: t; -*- ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. @@ -123,12 +123,12 @@ Changes made by this function are not persistent." (if (not mode) (setq mode major-mode)) (let ((dirtmp (file-name-as-directory dir)) (value - (mode-local-value mode 'semantic-dependency-system-include-path)) - ) - (add-to-list 'value dirtmp t) + (mode-local-value mode 'semantic-dependency-system-include-path))) (eval `(setq-mode-local ,mode - semantic-dependency-system-include-path value)) - )) + semantic-dependency-system-include-path + ',(if (member dirtmp value) value + (append value (list dirtmp)))) + t))) ;;;###autoload (defun semantic-remove-system-include (dir &optional mode) @@ -146,10 +146,10 @@ Changes made by this function are not persistent." (value (mode-local-value mode 'semantic-dependency-system-include-path)) ) - (setq value (delete dirtmp value)) + (setq value (remove dirtmp value)) (eval `(setq-mode-local ,mode semantic-dependency-system-include-path - value)) - )) + ',value) + t))) ;;;###autoload (defun semantic-reset-system-include (&optional mode) @@ -157,10 +157,10 @@ Changes made by this function are not persistent." Modifies a mode-local version of `semantic-dependency-system-include-path'." (interactive) - (if (not mode) (setq mode major-mode)) - (eval `(setq-mode-local ,mode semantic-dependency-system-include-path - nil)) - ) + (eval `(setq-mode-local ,(or mode major-mode) + semantic-dependency-system-include-path + nil) + t)) ;;;###autoload (defun semantic-customize-system-include-path (&optional mode) diff --git a/lisp/cedet/semantic/doc.el b/lisp/cedet/semantic/doc.el index d4dd9286421..413ed83a154 100644 --- a/lisp/cedet/semantic/doc.el +++ b/lisp/cedet/semantic/doc.el @@ -1,4 +1,4 @@ -;;; semantic/doc.el --- Routines for documentation strings +;;; semantic/doc.el --- Routines for documentation strings -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2003, 2005, 2008-2021 Free Software Foundation, ;; Inc. @@ -85,7 +85,7 @@ just the lexical token and not the string." )) (define-obsolete-function-alias 'semantic-documentation-comment-preceeding-tag - 'semantic-documentation-comment-preceding-tag + #'semantic-documentation-comment-preceding-tag "25.1") (defun semantic-doc-snarf-comment-for-tag (nosnarf) diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index 64fc07fe1bb..6bb83526f6c 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -1,4 +1,4 @@ -;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files +;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. @@ -30,6 +30,7 @@ (require 'ede/pconf) (require 'ede/proj-elisp) (require 'semantic/grammar) +(eval-when-compile (require 'cl-lib)) ;;; Code: (defclass semantic-ede-proj-target-grammar (ede-proj-target-elisp) @@ -118,7 +119,7 @@ For Emacs Lisp, return addsuffix command on source files." "Compile Emacs Lisp programs.") ;;; Target options. -(cl-defmethod ede-buffer-mine ((this semantic-ede-proj-target-grammar) buffer) +(cl-defmethod ede-buffer-mine ((_this semantic-ede-proj-target-grammar) buffer) "Return t if object THIS lays claim to the file in BUFFER. Lays claim to all -by.el, and -wy.el files." ;; We need to be a little more careful than this, but at the moment it @@ -130,7 +131,7 @@ Lays claim to all -by.el, and -wy.el files." (cl-defmethod project-compile-target ((obj semantic-ede-proj-target-grammar)) "Compile all sources in a Lisp target OBJ." - (let* ((cb (current-buffer)) + (let* (;; (cb (current-buffer)) (proj (ede-target-parent obj)) (default-directory (oref proj directory)) (comp 0) @@ -141,11 +142,10 @@ Lays claim to all -by.el, and -wy.el files." (fname (progn (string-match ".*/\\(.+\\.el\\)" package) (match-string 1 package))) (src (ede-expand-filename obj fname)) - (csrc (concat (file-name-sans-extension src) ".elc"))) - (with-no-warnings - (if (eq (byte-recompile-file src nil 0) t) - (setq comp (1+ comp)) - (setq utd (1+ utd))))))) + ;; (csrc (concat (file-name-sans-extension src) ".elc")) + ) + (cl-incf (if (eq (byte-recompile-file src nil 0) t) + comp utd))))) (oref obj source)) (message "All Semantic Grammar sources are up to date in %s" (eieio-object-name obj)) (cons comp utd))) diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index 4594d7f6969..0cca156454b 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -1,4 +1,4 @@ -;;; semantic/edit.el --- Edit Management for Semantic +;;; semantic/edit.el --- Edit Management for Semantic -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. @@ -157,7 +157,7 @@ Optional argument BUFFER is the buffer to search for changes in." (sort ret #'(lambda (a b) (< (overlay-start a) (overlay-start b))))))) -(defun semantic-edits-change-function-handle-changes (start end length) +(defun semantic-edits-change-function-handle-changes (start end _length) "Run whenever a buffer controlled by `semantic-mode' change. Tracks when and how the buffer is re-parsed. Argument START, END, and LENGTH specify the bounds of the change." @@ -356,7 +356,7 @@ See `semantic-edits-change-leaf-tag' for details on parents." start end))) (parent nil) (overlapped-tags nil) - inner-start inner-end + inner-end ;; inner-start (list-to-search nil)) ;; By the time this is already called, we know that it is ;; not a leaf change, nor a between tag change. That leaves @@ -370,7 +370,7 @@ See `semantic-edits-change-leaf-tag' for details on parents." (progn ;; We encompass one whole change. (setq overlapped-tags (list (car tags)) - inner-start (semantic-tag-start (car tags)) + ;; inner-start (semantic-tag-start (car tags)) inner-end (semantic-tag-end (car tags)) tags (cdr tags)) ;; Keep looping while tags are inside the change. @@ -386,13 +386,14 @@ See `semantic-edits-change-leaf-tag' for details on parents." ;; This is a parent. Drop the children found ;; so far. (setq overlapped-tags (list (car tags)) - inner-start (semantic-tag-start (car tags)) + ;; inner-start (semantic-tag-start (car tags)) inner-end (semantic-tag-end (car tags)) ) ;; It is not a parent encompassing tag (setq overlapped-tags (cons (car tags) overlapped-tags) - inner-start (semantic-tag-start (car tags)))) + ;; inner-start (semantic-tag-start (car tags)) + )) (setq tags (cdr tags))) (if (not tags) ;; There are no tags left, and all tags originally @@ -533,6 +534,7 @@ This function is for internal use by `semantic-edits-incremental-parser'." ;query this when debugging to find ;source of bugs. ) + (ignore last-cond) ;; Don't warn about the var not being used. (or changes ;; If we were called, and there are no changes, then we ;; don't know what to do. Force a full reparse. diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index 706892b4861..17fb20fa0a0 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el @@ -1,4 +1,4 @@ -;;; semantic/find.el --- Search routines for Semantic +;;; semantic/find.el --- Search routines for Semantic -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2008-2021 Free Software Foundation, Inc. @@ -583,7 +583,7 @@ Optional argument SEARCH-PARTS and SEARCH-INCLUDES are passed to ) (defun semantic-brute-find-tag-by-function - (function streamorbuffer &optional search-parts search-includes) + (function streamorbuffer &optional search-parts _search-includes) "Find all tags for which FUNCTION's value is non-nil within STREAMORBUFFER. FUNCTION must return non-nil if an element of STREAM will be included in the new list. @@ -620,7 +620,7 @@ This parameter hasn't be active for a while and is obsolete." nl)) (defun semantic-brute-find-first-tag-by-function - (function streamorbuffer &optional search-parts search-includes) + (function streamorbuffer &optional _search-parts _search-includes) "Find the first tag which FUNCTION match within STREAMORBUFFER. FUNCTION must return non-nil if an element of STREAM will be included in the new list. diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el index 8927ccde843..a68ef8064d1 100644 --- a/lisp/cedet/semantic/format.el +++ b/lisp/cedet/semantic/format.el @@ -1,4 +1,4 @@ -;;; semantic/format.el --- Routines for formatting tags +;;; semantic/format.el --- Routines for formatting tags -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. @@ -162,7 +162,7 @@ COLOR specifies if color should be used." (car args) nil color 'variable)) out) (setq args (cdr args))) - (mapconcat 'identity (nreverse out) semantic-function-argument-separator) + (mapconcat #'identity (nreverse out) semantic-function-argument-separator) )) ;;; Data Type @@ -200,7 +200,7 @@ Argument COLOR specifies to colorize the text." ;;; Abstract formatting functions ;; -(defun semantic-format-tag-prin1 (tag &optional parent color) +(defun semantic-format-tag-prin1 (tag &optional _parent _color) "Convert TAG to a string that is the print name for TAG. PARENT and COLOR are ignored." (format "%S" tag)) @@ -237,7 +237,7 @@ The name is the shortest possible representation. Optional argument PARENT is the parent type if TAG is a detail. Optional argument COLOR means highlight the prototype with font-lock colors.") -(defun semantic-format-tag-name-default (tag &optional parent color) +(defun semantic-format-tag-name-default (tag &optional _parent color) "Return an abbreviated string describing TAG. Optional argument PARENT is the parent type if TAG is a detail. Optional argument COLOR means highlight the prototype with font-lock colors." @@ -500,7 +500,7 @@ Optional argument COLOR means highlight the prototype with font-lock colors." args (if (eq class 'type) "}" ")")))) (when mods - (setq mods (concat (mapconcat 'identity mods " ") " "))) + (setq mods (concat (mapconcat #'identity mods " ") " "))) (concat (or mods "") (if type (concat type " ")) name diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index bdead99d68b..2a3b0f5fb7d 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el @@ -1,6 +1,6 @@ -;;; semantic/fw.el --- Framework for Semantic +;;; semantic/fw.el --- Framework for Semantic -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam @@ -34,29 +34,29 @@ ;;; Compatibility ;; -(define-obsolete-function-alias 'semantic-overlay-live-p 'overlay-buffer "27.1") -(define-obsolete-function-alias 'semantic-make-overlay 'make-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlay-put 'overlay-put "27.1") -(define-obsolete-function-alias 'semantic-overlay-get 'overlay-get "27.1") +(define-obsolete-function-alias 'semantic-overlay-live-p #'overlay-buffer "27.1") +(define-obsolete-function-alias 'semantic-make-overlay #'make-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlay-put #'overlay-put "27.1") +(define-obsolete-function-alias 'semantic-overlay-get #'overlay-get "27.1") (define-obsolete-function-alias 'semantic-overlay-properties - 'overlay-properties "27.1") -(define-obsolete-function-alias 'semantic-overlay-move 'move-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlay-delete 'delete-overlay "27.1") -(define-obsolete-function-alias 'semantic-overlays-at 'overlays-at "27.1") -(define-obsolete-function-alias 'semantic-overlays-in 'overlays-in "27.1") -(define-obsolete-function-alias 'semantic-overlay-buffer 'overlay-buffer "27.1") -(define-obsolete-function-alias 'semantic-overlay-start 'overlay-start "27.1") -(define-obsolete-function-alias 'semantic-overlay-end 'overlay-end "27.1") + #'overlay-properties "27.1") +(define-obsolete-function-alias 'semantic-overlay-move #'move-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlay-delete #'delete-overlay "27.1") +(define-obsolete-function-alias 'semantic-overlays-at #'overlays-at "27.1") +(define-obsolete-function-alias 'semantic-overlays-in #'overlays-in "27.1") +(define-obsolete-function-alias 'semantic-overlay-buffer #'overlay-buffer "27.1") +(define-obsolete-function-alias 'semantic-overlay-start #'overlay-start "27.1") +(define-obsolete-function-alias 'semantic-overlay-end #'overlay-end "27.1") (define-obsolete-function-alias 'semantic-overlay-next-change - 'next-overlay-change "27.1") + #'next-overlay-change "27.1") (define-obsolete-function-alias 'semantic-overlay-previous-change - 'previous-overlay-change "27.1") -(define-obsolete-function-alias 'semantic-overlay-lists 'overlay-lists "27.1") -(define-obsolete-function-alias 'semantic-overlay-p 'overlayp "27.1") -(define-obsolete-function-alias 'semantic-read-event 'read-event "27.1") -(define-obsolete-function-alias 'semantic-popup-menu 'popup-menu "27.1") + #'previous-overlay-change "27.1") +(define-obsolete-function-alias 'semantic-overlay-lists #'overlay-lists "27.1") +(define-obsolete-function-alias 'semantic-overlay-p #'overlayp "27.1") +(define-obsolete-function-alias 'semantic-read-event #'read-event "27.1") +(define-obsolete-function-alias 'semantic-popup-menu #'popup-menu "27.1") (define-obsolete-function-alias 'semantic-buffer-local-value - 'buffer-local-value "27.1") + #'buffer-local-value "27.1") (defun semantic-event-window (event) "Extract the window from EVENT." @@ -68,11 +68,11 @@ ;; Since Emacs 22 major mode functions should use `run-mode-hooks' to ;; run major mode hooks. -(define-obsolete-function-alias 'semantic-run-mode-hooks 'run-mode-hooks "28.1") +(define-obsolete-function-alias 'semantic-run-mode-hooks #'run-mode-hooks "28.1") ;; Fancy compat usage now handled in cedet-compat (define-obsolete-function-alias 'semantic-subst-char-in-string - 'subst-char-in-string "28.1") + #'subst-char-in-string "28.1") (defun semantic-delete-overlay-maybe (overlay) "Delete OVERLAY if it is a semantic token overlay." @@ -111,7 +111,7 @@ Possible Lifespans are: (setq semantic-cache-data-overlays (cons o semantic-cache-data-overlays)) ;;(message "Adding to cache: %s" o) - (add-hook 'post-command-hook 'semantic-cache-data-post-command-hook) + (add-hook 'post-command-hook #'semantic-cache-data-post-command-hook) )) (defun semantic-cache-data-post-command-hook () @@ -137,7 +137,7 @@ Remove self from `post-command-hook' if it is empty." ;; Remove ourselves if we have removed all overlays. (unless semantic-cache-data-overlays (remove-hook 'post-command-hook - 'semantic-cache-data-post-command-hook))) + #'semantic-cache-data-post-command-hook))) (defun semantic-get-cache-data (name &optional point) "Get cached data with NAME from optional POINT." @@ -254,7 +254,7 @@ FUNCTION does not have arguments. When FUNCTION is entered `current-buffer' is a selected Semantic enabled buffer." (mode-local-map-file-buffers function #'semantic-active-p)) -(defalias 'semantic-map-mode-buffers 'mode-local-map-mode-buffers) +(defalias 'semantic-map-mode-buffers #'mode-local-map-mode-buffers) (defun semantic-install-function-overrides (overrides &optional transient) "Install the function OVERRIDES in the specified environment. @@ -318,6 +318,12 @@ calling this one." ;;; Special versions of Find File ;; +(defvar recentf-exclude) +(defvar semantic-init-hook) +(defvar ede-auto-add-method) +(defvar flymake-start-syntax-check-on-find-file) +(defvar auto-insert) + (defun semantic-find-file-noselect (file &optional nowarn rawfile wildcards) "Call `find-file-noselect' with various features turned off. Use this when referencing a file that will be soon deleted. diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el index 658d218a4a3..ad5d2c798fb 100644 --- a/lisp/cedet/semantic/html.el +++ b/lisp/cedet/semantic/html.el @@ -1,4 +1,4 @@ -;;; semantic/html.el --- Semantic details for html files +;;; semantic/html.el --- Semantic details for html files -*- lexical-binding: t; -*- ;; Copyright (C) 2004-2005, 2007-2021 Free Software Foundation, Inc. @@ -59,14 +59,14 @@ "Alist of sectioning commands and their relative level.") (define-mode-local-override semantic-parse-region - html-mode (&rest ignore) + html-mode (&rest _ignore) "Parse the current html buffer for semantic tags. IGNORE any arguments. Always parse the whole buffer. Each tag returned is of the form: (\"NAME\" section (:members CHILDREN)) or (\"NAME\" anchor)" - (mapcar 'semantic-html-expand-tag + (mapcar #'semantic-html-expand-tag (semantic-html-parse-headings))) (define-mode-local-override semantic-parse-changes @@ -79,7 +79,7 @@ or (let ((chil (semantic-html-components tag))) (if chil (semantic-tag-put-attribute - tag :members (mapcar 'semantic-html-expand-tag chil))) + tag :members (mapcar #'semantic-html-expand-tag chil))) (car (semantic--tag-expand tag)))) (defun semantic-html-components (tag) @@ -233,7 +233,7 @@ tag with greater section value than LEVEL is found." ;; This will use our parser. (setq semantic-parser-name "HTML" semantic--parse-table t - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ">" semantic-type-relation-separator-character '(":") semantic-symbol->name-assoc-list '((section . "Section") diff --git a/lisp/cedet/semantic/ia-sb.el b/lisp/cedet/semantic/ia-sb.el index b132d41cd4a..12a2f1db92a 100644 --- a/lisp/cedet/semantic/ia-sb.el +++ b/lisp/cedet/semantic/ia-sb.el @@ -1,7 +1,6 @@ -;;; semantic/ia-sb.el --- Speedbar analysis display interactor +;;; semantic/ia-sb.el --- Speedbar analysis display interactor -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2004, 2006, 2008-2021 Free Software Foundation, -;;; Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: syntax @@ -30,18 +29,14 @@ (require 'speedbar) ;;; Code: -(defvar semantic-ia-sb-key-map nil +(defvar semantic-ia-sb-key-map + (let ((map (speedbar-make-specialized-keymap))) + ;; Basic features. + (define-key map "\C-m" #'speedbar-edit-line) + (define-key map "I" #'semantic-ia-sb-show-tag-info) + map) "Keymap used when in semantic analysis display mode.") -(if semantic-ia-sb-key-map - nil - (setq semantic-ia-sb-key-map (speedbar-make-specialized-keymap)) - - ;; Basic features. - (define-key semantic-ia-sb-key-map "\C-m" 'speedbar-edit-line) - (define-key semantic-ia-sb-key-map "I" 'semantic-ia-sb-show-tag-info) - ) - (defvar semantic-ia-sb-easymenu-definition '( "---" ; [ "Expand" speedbar-expand-line nil ] @@ -75,7 +70,7 @@ list of possible completions." (speedbar-change-initial-expansion-list "Analyze") ) -(defun semantic-ia-speedbar (directory zero) +(defun semantic-ia-speedbar (_directory _zero) "Create buttons in speedbar which define the current analysis at POINT. DIRECTORY is the current directory, which is ignored, and ZERO is 0." (let ((analysis nil) @@ -195,7 +190,7 @@ DIRECTORY is the current directory, which is ignored, and ZERO is 0." ;; An index for the argument the prefix is in: (let ((arg (oref context argument)) (args (semantic-tag-function-arguments (car func))) - (idx 0) + ;; (idx 0) ) (speedbar-insert-separator (format "Argument #%d" (oref context index))) @@ -275,7 +270,7 @@ See `semantic-ia-sb-tag-info' for more." (setq tok (get-text-property (point) 'speedbar-token))) (semantic-ia-sb-tag-info nil tok 0))) -(defun semantic-ia-sb-tag-info (text tag indent) +(defun semantic-ia-sb-tag-info (_text tag _indent) "Display as much information as we can about tag. Show the information in a shrunk split-buffer and expand out as many details as possible. @@ -322,16 +317,15 @@ TEXT, TAG, and INDENT are speedbar function arguments." (get-buffer-window "*Tag Information*"))) (select-frame speedbar-frame)))) -(defun semantic-ia-sb-line-path (&optional depth) +(defun semantic-ia-sb-line-path (&optional _depth) "Return the file name associated with DEPTH." (save-match-data (let* ((tok (speedbar-line-token)) - (buff (if (semantic-tag-buffer tok) - (semantic-tag-buffer tok) - (current-buffer)))) + (buff (or (semantic-tag-buffer tok) + (current-buffer)))) (buffer-file-name buff)))) -(defun semantic-ia-sb-complete (text tag indent) +(defun semantic-ia-sb-complete (_text tag _indent) "At point in the attached buffer, complete the symbol clicked on. TEXT TAG and INDENT are the details." ;; Find the specified bounds from the current analysis. diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el index 6d3ec7570b5..e75bc918e0b 100644 --- a/lisp/cedet/semantic/ia.el +++ b/lisp/cedet/semantic/ia.el @@ -1,6 +1,6 @@ -;;; semantic/ia.el --- Interactive Analysis functions +;;; semantic/ia.el --- Interactive Analysis functions -*- lexical-binding: t; -*- -;;; Copyright (C) 2000-2021 Free Software Foundation, Inc. +;; Copyright (C) 2000-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: syntax @@ -79,11 +79,11 @@ (insert "(")) (t nil)))) -(defalias 'semantic-ia-get-completions 'semantic-ia-get-completions-deprecated) +(defalias 'semantic-ia-get-completions #'semantic-ia-get-completions-deprecated) (make-obsolete 'semantic-ia-get-completions #'semantic-analyze-possible-completions "28.1") -(defun semantic-ia-get-completions-deprecated (context point) +(defun semantic-ia-get-completions-deprecated (context _point) "A function to help transition away from `semantic-ia-get-completions'. Return completions based on CONTEXT at POINT." (declare (obsolete semantic-analyze-possible-completions "28.1")) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 9df97780433..b6633d7ee5c 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -1038,21 +1038,20 @@ be called." (popup-menu semantic-idle-breadcrumbs-popup-menu) (select-window old-window))) -(defmacro semantic-idle-breadcrumbs--tag-function (function) +(defun semantic-idle-breadcrumbs--tag-function (function) "Return lambda expression calling FUNCTION when called from a popup." - `(lambda (event) - (interactive "e") - (let* ((old-window (selected-window)) - (window (semantic-event-window event)) - (column (car (nth 6 (nth 1 event)))) ;; TODO semantic-event-column? - (tag (progn - (select-window window t) - (plist-get - (text-properties-at column header-line-format) - 'tag)))) - (,function tag) - (select-window old-window))) - ) + (lambda (event) + (interactive "e") + (let* ((old-window (selected-window)) + (window (semantic-event-window event)) + (column (car (nth 6 (nth 1 event)))) ;; TODO semantic-event-column? + (tag (progn + (select-window window t) + (plist-get + (text-properties-at column header-line-format) + 'tag)))) + (funcall function tag) + (select-window old-window)))) ;; TODO does this work for mode-line case? (defvar semantic-idle-breadcrumbs-popup-map @@ -1060,8 +1059,7 @@ be called." ;; mouse-1 goes to clicked tag (define-key map [ header-line mouse-1 ] - (semantic-idle-breadcrumbs--tag-function - semantic-go-to-tag)) + (semantic-idle-breadcrumbs--tag-function #'semantic-go-to-tag)) ;; mouse-3 pops up a context menu (define-key map [ header-line mouse-3 ] @@ -1077,8 +1075,7 @@ be called." "Breadcrumb Tag" (vector "Go to Tag" - (semantic-idle-breadcrumbs--tag-function - semantic-go-to-tag) + (semantic-idle-breadcrumbs--tag-function #'semantic-go-to-tag) :active t :help "Jump to this tag") ;; TODO these entries need minor changes (optional tag argument) in @@ -1086,37 +1083,32 @@ be called." ;; (semantic-menu-item ;; (vector ;; "Copy Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-copy-tag) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-copy-tag) ;; :active t ;; :help "Copy this tag")) ;; (semantic-menu-item ;; (vector ;; "Kill Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-kill-tag) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-kill-tag) ;; :active t ;; :help "Kill tag text to the kill ring, and copy the tag to ;; the tag ring")) ;; (semantic-menu-item ;; (vector ;; "Copy Tag to Register" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-copy-tag-to-register) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-copy-tag-to-register) ;; :active t ;; :help "Copy this tag")) ;; (semantic-menu-item ;; (vector ;; "Narrow to Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-narrow-to-defun) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-narrow-to-defun) ;; :active t ;; :help "Narrow to the bounds of the current tag")) ;; (semantic-menu-item ;; (vector ;; "Fold Tag" - ;; (semantic-idle-breadcrumbs--tag-function - ;; senator-fold-tag-toggle) + ;; (semantic-idle-breadcrumbs--tag-function #'senator-fold-tag-toggle) ;; :active t ;; :style 'toggle ;; :selected '(let ((tag (semantic-current-tag))) diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el index 4c13959ba1d..2c5f10a2c35 100644 --- a/lisp/cedet/semantic/imenu.el +++ b/lisp/cedet/semantic/imenu.el @@ -1,4 +1,4 @@ -;;; semantic/imenu.el --- Use Semantic as an imenu tag generator +;;; semantic/imenu.el --- Use Semantic as an imenu tag generator -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2008, 2010-2021 Free Software ;; Foundation, Inc. @@ -57,14 +57,12 @@ (defcustom semantic-imenu-summary-function 'semantic-format-tag-abbreviate "Function to use when creating items in Imenu. Some useful functions are found in `semantic-format-tag-functions'." - :group 'semantic-imenu :type semantic-format-tag-custom-list) (make-variable-buffer-local 'semantic-imenu-summary-function) ;;;###autoload (defcustom semantic-imenu-bucketize-file t "Non-nil if tags in a file are to be grouped into buckets." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-bucketize-file) @@ -72,20 +70,17 @@ Some useful functions are found in `semantic-format-tag-functions'." "Non-nil if types in a file should adopt externally defined members. C++ and CLOS can define methods that are not in the body of a class definition." - :group 'semantic-imenu :type 'boolean) (defcustom semantic-imenu-buckets-to-submenu t "Non-nil if buckets of tags are to be turned into submenus. This option is ignored if `semantic-imenu-bucketize-file' is nil." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-buckets-to-submenu) ;;;###autoload (defcustom semantic-imenu-expand-type-members t "Non-nil if types should have submenus with members in them." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-expand-type-members) @@ -93,7 +88,6 @@ This option is ignored if `semantic-imenu-bucketize-file' is nil." "Non-nil if members of a type should be grouped into buckets. A nil value means to keep them in the same order. Overridden to nil if `semantic-imenu-bucketize-file' is nil." - :group 'semantic-imenu :type 'boolean) (make-variable-buffer-local 'semantic-imenu-bucketize-type-members) @@ -101,7 +95,6 @@ Overridden to nil if `semantic-imenu-bucketize-file' is nil." "Function to use when sorting tags in the buckets of functions. See `semantic-bucketize' and the FILTER argument for more details on this function." - :group 'semantic-imenu :type '(radio (const :tag "No Sorting" nil) (const semantic-sort-tags-by-name-increasing) (const semantic-sort-tags-by-name-decreasing) @@ -119,14 +112,12 @@ on this function." Doesn't actually parse the entire directory, but displays tags for all files currently listed in the current Semantic database. This variable has no meaning if semanticdb is not active." - :group 'semantic-imenu :type 'boolean) (defcustom semantic-imenu-auto-rebuild-directory-indexes nil "If non-nil automatically rebuild directory index imenus. That is when a directory index imenu is updated, automatically rebuild other buffer local ones based on the same semanticdb." - :group 'semantic-imenu :type 'boolean) (defvar semantic-imenu-directory-current-file nil @@ -206,7 +197,7 @@ Optional argument REST is some extra stuff." (setq imenu--index-alist nil))))) )) -(defun semantic-imenu-flush-fcn (&optional ignore) +(defun semantic-imenu-flush-fcn (&optional _ignore) "This function is called as a hook to clear the imenu cache. It is cleared after any parsing. IGNORE arguments." @@ -214,9 +205,9 @@ IGNORE arguments." (setq imenu--index-alist nil imenu-menubar-modified-tick 0)) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-imenu-flush-fcn t) + #'semantic-imenu-flush-fcn t) (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-imenu-flush-fcn t) + #'semantic-imenu-flush-fcn t) ) ;;;###autoload @@ -224,7 +215,7 @@ IGNORE arguments." "Create an imenu index for any buffer which supports Semantic. Uses the output of the Semantic parser to create the index. Optional argument STREAM is an optional stream of tags used to create menus." - (setq imenu-default-goto-function 'semantic-imenu-goto-function) + (setq imenu-default-goto-function #'semantic-imenu-goto-function) (prog1 (if (and semantic-imenu-index-directory (featurep 'semantic/db) @@ -234,9 +225,9 @@ Optional argument STREAM is an optional stream of tags used to create menus." (semantic-create-imenu-index-1 (or stream (semantic-fetch-tags-fast)) nil)) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-imenu-flush-fcn nil t) + #'semantic-imenu-flush-fcn nil t) (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-imenu-flush-fcn nil t))) + #'semantic-imenu-flush-fcn nil t))) (defun semantic-create-imenu-directory-index (&optional stream) "Create an imenu tag index based on all files active in semanticdb. @@ -445,7 +436,7 @@ Clears all imenu menus that may be depending on the database." ;; Clear imenu cache to redraw the imenu. (semantic-imenu-flush-fcn)))) -(add-hook 'semanticdb-mode-hook 'semantic-imenu-semanticdb-hook) +(add-hook 'semanticdb-mode-hook #'semantic-imenu-semanticdb-hook) ;;; Interactive Utilities ;; @@ -484,7 +475,6 @@ Clears all imenu menus that may be depending on the database." (defcustom semantic-which-function-use-color nil "Use color when displaying the current function with `which-function'." - :group 'semantic-imenu :type 'boolean) (defun semantic-default-which-function (taglist) diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index f60f6e87ab7..8cadffa09b6 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -1,6 +1,6 @@ -;;; semantic/java.el --- Semantic functions for Java +;;; semantic/java.el --- Semantic functions for Java -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: David Ponce @@ -148,7 +148,7 @@ corresponding compound declaration." (let* ((name (semantic-tag-name tag)) (rsplit (nreverse (split-string name "\\." t))) (newclassname (car rsplit)) - (newpkg (mapconcat 'identity (reverse (cdr rsplit)) "."))) + (newpkg (mapconcat #'identity (reverse (cdr rsplit)) "."))) (semantic-tag-set-name tag newclassname) (setq xpand (list tag @@ -169,7 +169,7 @@ corresponding compound declaration." (define-mode-local-override semantic-ctxt-scoped-types java-mode (&optional point) "Return a list of type names currently in scope at POINT." - (mapcar 'semantic-tag-name + (mapcar #'semantic-tag-name (semantic-find-tags-by-class 'type (semantic-find-tag-by-overlay point)))) @@ -184,7 +184,7 @@ Override function for `semantic-tag-protection'." ;; Prototype handler ;; -(defun semantic-java-prototype-function (tag &optional parent color) +(defun semantic-java-prototype-function (tag &optional _parent color) "Return a function (method) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -212,7 +212,7 @@ See also `semantic-format-tag-prototype'." (or type "") (if type " " "") name "(" argp ")"))) -(defun semantic-java-prototype-variable (tag &optional parent color) +(defun semantic-java-prototype-variable (tag &optional _parent color) "Return a variable (field) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -227,7 +227,7 @@ See also `semantic-format-tag-prototype'." (semantic--format-colorize-text name 'variable) name)))) -(defun semantic-java-prototype-type (tag &optional parent color) +(defun semantic-java-prototype-type (tag &optional _parent color) "Return a type (class/interface) prototype for TAG. Optional argument PARENT is a parent (containing) item. Optional argument COLOR indicates that color should be mixed in. @@ -260,7 +260,7 @@ Optional argument COLOR indicates that color should be mixed in." (define-mode-local-override semantic-tag-include-filename java-mode (tag) "Return a suitable path for (some) Java imports." (let ((name (semantic-tag-name tag))) - (concat (mapconcat 'identity (split-string name "\\.") "/") ".java"))) + (concat (mapconcat #'identity (split-string name "\\.") "/") ".java"))) ;; Documentation handler ;; @@ -417,15 +417,13 @@ removed from the result list." (or semantic-java-doc-with-name-tags (setq semantic-java-doc-with-name-tags (semantic-java-doc-keywords-map - #'(lambda (k p) - k) + #'(lambda (k _p) k) 'with-name))) (or semantic-java-doc-with-ref-tags (setq semantic-java-doc-with-ref-tags (semantic-java-doc-keywords-map - #'(lambda (k p) - k) + #'(lambda (k _p) k) 'with-ref))) (or semantic-java-doc-extra-type-tags diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index 5675b9f3e37..0b24bd2dc4c 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -850,7 +850,7 @@ Argument BEG and END specify the bounds of SYM in the buffer." )) (define-obsolete-function-alias 'semantic-lex-spp-anlyzer-do-replace - 'semantic-lex-spp-analyzer-do-replace "25.1") + #'semantic-lex-spp-analyzer-do-replace "25.1") (defvar semantic-lex-spp-replacements-enabled t "Non-nil means do replacements when finding keywords. @@ -1070,7 +1070,7 @@ and variable state from the current buffer." (semantic-lex-init) (semantic-clear-toplevel-cache) (remove-hook 'semantic-lex-reset-functions - 'semantic-lex-spp-reset-hook t) + #'semantic-lex-spp-reset-hook t) )) ;; Second Cheat: copy key variables regarding macro state from the diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index 29d8e29ae67..121e5c333f6 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -469,7 +469,7 @@ PROPERTY set." ;;; Lexical Analyzer framework settings ;; -(defvar-local semantic-lex-analyzer 'semantic-lex +(defvar-local semantic-lex-analyzer #'semantic-lex "The lexical analyzer used for a given buffer. See `semantic-lex' for documentation.") diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el index 956eb681f2c..2e77e6b75fb 100644 --- a/lisp/cedet/semantic/mru-bookmark.el +++ b/lisp/cedet/semantic/mru-bookmark.el @@ -1,4 +1,4 @@ -;;; semantic/mru-bookmark.el --- Automatic bookmark tracking +;;; semantic/mru-bookmark.el --- Automatic bookmark tracking -*- lexical-binding: t; -*- ;; Copyright (C) 2007-2021 Free Software Foundation, Inc. @@ -85,7 +85,7 @@ Nice values include the following: ) "A single bookmark.") -(cl-defmethod initialize-instance :after ((sbm semantic-bookmark) &rest fields) +(cl-defmethod initialize-instance :after ((sbm semantic-bookmark) &rest _fields) "Initialize the bookmark SBM with details about :tag." (condition-case nil (save-excursion @@ -216,7 +216,7 @@ Cause tags in the ring to become unlinked." (setq idx (1+ idx))))) (add-hook 'semantic-before-toplevel-cache-flush-hook - 'semantic-mrub-cache-flush-fcn) + #'semantic-mrub-cache-flush-fcn) ;;; EDIT tracker ;; @@ -246,8 +246,8 @@ been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]." :group 'semantic-modes :type 'boolean :require 'semantic/util-modes - :initialize 'custom-initialize-default - :set (lambda (sym val) + :initialize #'custom-initialize-default + :set (lambda (_sym val) (global-semantic-mru-bookmark-mode (if val 1 -1)))) ;;;###autoload @@ -266,7 +266,7 @@ been edited, and you can re-visit them with \\[semantic-mrub-switch-tags]." (defvar semantic-mru-bookmark-mode-map (let ((km (make-sparse-keymap))) - (define-key km "\C-xB" 'semantic-mrub-switch-tags) + (define-key km "\C-xB" #'semantic-mrub-switch-tags) km) "Keymap for mru-bookmark minor mode.") @@ -289,14 +289,14 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) (add-hook 'semantic-edits-new-change-functions - 'semantic-mru-bookmark-change-hook-fcn nil t) + #'semantic-mru-bookmark-change-hook-fcn nil t) (add-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn nil t)) + #'semantic-mru-bookmark-change-hook-fcn nil t)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-mru-bookmark-change-hook-fcn t) + #'semantic-mru-bookmark-change-hook-fcn t) (remove-hook 'semantic-edits-move-change-hooks - 'semantic-mru-bookmark-change-hook-fcn t))) + #'semantic-mru-bookmark-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-mru-bookmark-mode "k") diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el index f33356a170c..19530094fbe 100644 --- a/lisp/cedet/semantic/senator.el +++ b/lisp/cedet/semantic/senator.el @@ -1,4 +1,4 @@ -;;; semantic/senator.el --- SEmantic NAvigaTOR +;;; semantic/senator.el --- SEmantic NAvigaTOR -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -60,7 +60,6 @@ A tag class is a symbol, such as `variable', `function', or `type'. As a special exception, if the value is nil, Senator's navigation commands recognize all tag classes." - :group 'senator :type '(repeat (symbol))) ;;;###autoload (make-variable-buffer-local 'senator-step-at-tag-classes) @@ -78,7 +77,6 @@ commands stop at the beginning of every tag. If t, the navigation commands stop at the start and end of any tag, where possible." - :group 'senator :type '(choice :tag "Identifiers" (repeat :menu-tag "Symbols" (symbol)) (const :tag "All" t))) @@ -87,7 +85,6 @@ tag, where possible." (defcustom senator-highlight-found nil "If non-nil, Senator commands momentarily highlight found tags." - :group 'senator :type 'boolean) (make-variable-buffer-local 'senator-highlight-found) @@ -193,7 +190,6 @@ source." '(code block) "List of ignored tag classes. Tags of those classes are excluded from search." - :group 'senator :type '(repeat (symbol :tag "class"))) (defun senator-search-default-tag-filter (tag) @@ -461,7 +457,7 @@ filters in `senator-search-tag-filter-functions' remain active." ((symbolp classes) (list classes)) ((stringp classes) - (mapcar 'read (split-string classes))) + (mapcar #'read (split-string classes))) (t (signal 'wrong-type-argument (list classes))) )) @@ -470,11 +466,10 @@ filters in `senator-search-tag-filter-functions' remain active." senator--search-filter t) (kill-local-variable 'senator--search-filter) (if classes - (let ((tag (make-symbol "tag")) - (names (mapconcat 'symbol-name classes "', `"))) + (let ((names (mapconcat #'symbol-name classes "', `"))) (setq-local senator--search-filter - `(lambda (,tag) - (memq (semantic-tag-class ,tag) ',classes))) + (lambda (tag) + (memq (semantic-tag-class tag) classes))) (add-hook 'senator-search-tag-filter-functions senator--search-filter nil t) (message "Limit search to `%s' tags" names)) @@ -605,7 +600,7 @@ Makes C/C++ language like assumptions." "Non-nil if isearch does semantic search. This is a buffer local variable.") -(defun senator-beginning-of-defun (&optional arg) +(defun senator-beginning-of-defun (&optional _arg) "Move backward to the beginning of a defun. Use semantic tags to navigate. ARG is the number of tags to navigate (not yet implemented)." @@ -620,7 +615,7 @@ ARG is the number of tags to navigate (not yet implemented)." (goto-char (semantic-tag-start tag))) (beginning-of-line)))) -(defun senator-end-of-defun (&optional arg) +(defun senator-end-of-defun (&optional _arg) "Move forward to next end of defun. Use semantic tags to navigate. ARG is the number of tags to navigate (not yet implemented)." @@ -859,7 +854,7 @@ Use a senator search function when semantic isearch mode is enabled." (setq-local senator-old-isearch-search-fun isearch-search-fun-function)) (setq-local isearch-search-fun-function - 'senator-isearch-search-fun)) + #'senator-isearch-search-fun)) ;; When `senator-isearch-semantic-mode' is off restore the ;; previous `isearch-search-fun-function'. (when (eq isearch-search-fun-function 'senator-isearch-search-fun) diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el index 19f46ff7f15..b4b09dc02c8 100644 --- a/lisp/cedet/semantic/sort.el +++ b/lisp/cedet/semantic/sort.el @@ -1,6 +1,6 @@ -;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables. +;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables. -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: syntax @@ -233,8 +233,7 @@ unmodified as components of their parent tags." (semantic-flatten-tags-table components) lists))))) table) - (apply 'append (nreverse lists)) - )) + (apply #'append (nreverse lists)))) ;;; Buckets: @@ -520,12 +519,11 @@ See `semantic-tag-external-member-children' for details." (semantic-tag-name tag) tag))) (if m (apply #'append (mapcar #'cdr m)))) (semantic--find-tags-by-function - `(lambda (tok) - ;; This bit of annoying backquote forces the contents of - ;; tag into the generated lambda. - (semantic-tag-external-member-p ',tag tok)) - (current-buffer)) - )) + (lambda (tok) + ;; This bit of annoying backquote forces the contents of + ;; tag into the generated lambda. + (semantic-tag-external-member-p tag tok)) + (current-buffer)))) (define-overloadable-function semantic-tag-external-class (tag) "Return a list of real tags that faux TAG might represent. @@ -540,6 +538,8 @@ likely derived, then this function is needed." (:override) ) +(defvar semanticdb-search-system-databases) + (defun semantic-tag-external-class-default (tag) "Return a list of real tags that faux TAG might represent. See `semantic-tag-external-class' for details." diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el index d7f91573d3d..701f9ad3e03 100644 --- a/lisp/cedet/semantic/symref.el +++ b/lisp/cedet/semantic/symref.el @@ -1,4 +1,4 @@ -;;; semantic/symref.el --- Symbol Reference API +;;; semantic/symref.el --- Symbol Reference API -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -144,7 +144,7 @@ ARGS are the initialization arguments to pass to the created class." ) (when (not (class-p class)) (error "Unknown symref tool %s" semantic-symref-tool)) - (setq inst (apply 'make-instance class args)) + (setq inst (apply #'make-instance class args)) inst)) (defvar semantic-symref-last-result nil @@ -427,7 +427,7 @@ until the next command is executed." (kill-buffer buff))) semantic-symref-recently-opened-buffers) (setq semantic-symref-recently-opened-buffers nil) - (remove-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn) + (remove-hook 'post-command-hook #'semantic-symref-cleanup-recent-buffers-fcn) ) (cl-defmethod semantic-symref-result-get-tags ((result semantic-symref-result) @@ -453,7 +453,7 @@ already." lines))) ;; Kill off dead buffers, unless we were requested to leave them open. (if (not open-buffers) - (add-hook 'post-command-hook 'semantic-symref-cleanup-recent-buffers-fcn) + (add-hook 'post-command-hook #'semantic-symref-cleanup-recent-buffers-fcn) ;; Else, just clear the saved buffers so they aren't deleted later. (setq semantic-symref-recently-opened-buffers nil) ) diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el index 50d2e2b1c3e..2e447bbc582 100644 --- a/lisp/cedet/semantic/symref/list.el +++ b/lisp/cedet/semantic/symref/list.el @@ -108,20 +108,20 @@ Display the references in `semantic-symref-results-mode'." (defvar semantic-symref-results-mode-map (let ((km (make-sparse-keymap))) (suppress-keymap km) - (define-key km "\C-i" 'forward-button) - (define-key km "\M-C-i" 'backward-button) - (define-key km " " 'push-button) - (define-key km "-" 'semantic-symref-list-toggle-showing) - (define-key km "=" 'semantic-symref-list-toggle-showing) - (define-key km "+" 'semantic-symref-list-toggle-showing) - (define-key km "n" 'semantic-symref-list-next-line) - (define-key km "p" 'semantic-symref-list-prev-line) - (define-key km "q" 'quit-window) - (define-key km "\C-c\C-e" 'semantic-symref-list-expand-all) - (define-key km "\C-c\C-r" 'semantic-symref-list-contract-all) - (define-key km "R" 'semantic-symref-list-rename-open-hits) - (define-key km "(" 'semantic-symref-list-create-macro-on-open-hit) - (define-key km "E" 'semantic-symref-list-call-macro-on-open-hits) + (define-key km "\C-i" #'forward-button) + (define-key km "\M-C-i" #'backward-button) + (define-key km " " #'push-button) + (define-key km "-" #'semantic-symref-list-toggle-showing) + (define-key km "=" #'semantic-symref-list-toggle-showing) + (define-key km "+" #'semantic-symref-list-toggle-showing) + (define-key km "n" #'semantic-symref-list-next-line) + (define-key km "p" #'semantic-symref-list-prev-line) + (define-key km "q" #'quit-window) + (define-key km "\C-c\C-e" #'semantic-symref-list-expand-all) + (define-key km "\C-c\C-r" #'semantic-symref-list-contract-all) + (define-key km "R" #'semantic-symref-list-rename-open-hits) + (define-key km "(" #'semantic-symref-list-create-macro-on-open-hit) + (define-key km "E" #'semantic-symref-list-call-macro-on-open-hits) km) "Keymap used in `semantic-symref-results-mode'.") diff --git a/lisp/cedet/semantic/tag-file.el b/lisp/cedet/semantic/tag-file.el index fc5c27752a0..06dd274b323 100644 --- a/lisp/cedet/semantic/tag-file.el +++ b/lisp/cedet/semantic/tag-file.el @@ -1,4 +1,4 @@ -;;; semantic/tag-file.el --- Routines that find files based on tags. +;;; semantic/tag-file.el --- Routines that find files based on tags. -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el index 6cef603af35..3aa1a62901c 100644 --- a/lisp/cedet/semantic/tag-ls.el +++ b/lisp/cedet/semantic/tag-ls.el @@ -1,4 +1,4 @@ -;;; semantic/tag-ls.el --- Language Specific override functions for tags +;;; semantic/tag-ls.el --- Language Specific override functions for tags -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2004, 2006-2021 Free Software Foundation, Inc. @@ -97,7 +97,7 @@ Modes that override this function can call `semantic--tag-attribute-similar-p-default' to do the default equality tests if ATTR is not special for that mode.") -(defun semantic--tag-attribute-similar-p-default (attr value1 value2 ignorable-attributes) +(defun semantic--tag-attribute-similar-p-default (_attr value1 value2 ignorable-attributes) "For ATTR, VALUE1, VALUE2 and IGNORABLE-ATTRIBUTES, test for similarity." (cond ;; Tag sublists require special testing. @@ -109,7 +109,7 @@ ATTR is not special for that mode.") (when (not (eq (length taglist1) (length taglist2))) (setq ans nil)) (while (and ans taglist1 taglist2) - (setq ans (apply 'semantic-tag-similar-p + (setq ans (apply #'semantic-tag-similar-p (car taglist1) (car taglist2) ignorable-attributes) taglist1 (cdr taglist1) @@ -205,7 +205,7 @@ stream for a tag of class `package', and return that." (or stream-or-buffer tag)))) (:override-with-args (tag stream)))) -(defun semantic-tag-full-package-default (tag stream) +(defun semantic-tag-full-package-default (_tag stream) "Default method for `semantic-tag-full-package' for TAG. Return the name of the first tag of class `package' in STREAM." (let ((pack (car-safe (semantic-find-tags-by-class 'package stream)))) @@ -285,7 +285,7 @@ is to return a symbol based on type modifiers." (setq parent (semantic-tag-calculate-parent tag))) (:override)) -(defun semantic-tag-protection-default (tag &optional parent) +(defun semantic-tag-protection-default (tag &optional _parent) "Return the protection of TAG as a child of PARENT default action. See `semantic-tag-protection'." (let ((mods (semantic-tag-modifiers tag)) @@ -295,9 +295,7 @@ See `semantic-tag-protection'." (let ((s (car mods))) (setq prot ;; A few silly defaults to get things started. - (cond ((or (string= s "public") - (string= s "extern") - (string= s "export")) + (cond ((member s '("public" "extern" "export")) 'public) ((string= s "private") 'private) @@ -372,15 +370,14 @@ in how methods are overridden. In UML, abstract methods are italicized. The default behavior (if not overridden with `tag-abstract-p' is to return true if `abstract' is in the type modifiers.") -(defun semantic-tag-abstract-p-default (tag &optional parent) +(defun semantic-tag-abstract-p-default (tag &optional _parent) "Return non-nil if TAG is abstract as a child of PARENT default action. See `semantic-tag-abstract-p'." (let ((mods (semantic-tag-modifiers tag)) (abs nil)) (while (and (not abs) mods) (if (stringp (car mods)) - (setq abs (or (string= (car mods) "abstract") - (string= (car mods) "virtual")))) + (setq abs (member (car mods) '("abstract" "virtual")))) (setq mods (cdr mods))) abs)) @@ -392,7 +389,7 @@ In UML, leaf methods and classes have special meaning and behavior. The default behavior (if not overridden with `tag-leaf-p' is to return true if `leaf' is in the type modifiers.") -(defun semantic-tag-leaf-p-default (tag &optional parent) +(defun semantic-tag-leaf-p-default (tag &optional _parent) "Return non-nil if TAG is leaf as a child of PARENT default action. See `semantic-tag-leaf-p'." (let ((mods (semantic-tag-modifiers tag)) @@ -412,7 +409,7 @@ In UML, static methods and attributes mean that they are allocated in the parent class, and are not instance specific. UML notation specifies that STATIC entries are underlined.") -(defun semantic-tag-static-p-default (tag &optional parent) +(defun semantic-tag-static-p-default (tag &optional _parent) "Return non-nil if TAG is static as a child of PARENT default action. See `semantic-tag-static-p'." (let ((mods (semantic-tag-modifiers tag)) diff --git a/lisp/cedet/semantic/tag-write.el b/lisp/cedet/semantic/tag-write.el index f705c89c904..9d5aeea098b 100644 --- a/lisp/cedet/semantic/tag-write.el +++ b/lisp/cedet/semantic/tag-write.el @@ -1,4 +1,4 @@ -;;; semantic/tag-write.el --- Write tags to a text stream +;;; semantic/tag-write.el --- Write tags to a text stream -*- lexical-binding: t; -*- ;; Copyright (C) 2008-2021 Free Software Foundation, Inc. @@ -88,7 +88,7 @@ INDENT is the amount of indentation to use for this tag." (if (semantic-tag-with-position-p tag) (let ((bounds (semantic-tag-bounds tag))) (princ " ") - (prin1 (apply 'vector bounds)) + (prin1 (apply #'vector bounds)) ) (princ " nil")) ;; End it. diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el index a99e2ab279b..b6386d71db0 100644 --- a/lisp/cedet/semantic/tag.el +++ b/lisp/cedet/semantic/tag.el @@ -478,7 +478,7 @@ TYPE is a string or semantic tag representing the type of this variable. Optional DEFAULT-VALUE is a string representing the default value of this variable. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'variable + (apply #'semantic-tag name 'variable :type type :default-value default-value attributes)) @@ -490,7 +490,7 @@ TYPE is a string or semantic tag representing the type of this function. ARG-LIST is a list of strings or semantic tags representing the arguments of this function. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'function + (apply #'semantic-tag name 'function :type type :arguments arg-list attributes)) @@ -513,7 +513,7 @@ This slot can be interesting because the form: is a valid parent where there is no explicit parent, and only an interface. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'type + (apply #'semantic-tag name 'type :type type :members members :superclasses (car parents) @@ -526,7 +526,7 @@ NAME is the name of this include. SYSTEM-FLAG represents that we were able to identify this include as belonging to the system, as opposed to belonging to the local project. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'include + (apply #'semantic-tag name 'include :system-flag system-flag attributes)) @@ -536,7 +536,7 @@ NAME is the name of this package. DETAIL is extra information about this package, such as a location where it can be found. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'package + (apply #'semantic-tag name 'package :detail detail attributes)) @@ -545,7 +545,7 @@ ATTRIBUTES is a list of additional attributes belonging to this tag." NAME is a name for this code. DETAIL is extra information about the code. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'code + (apply #'semantic-tag name 'code :detail detail attributes)) @@ -685,7 +685,7 @@ FILTER takes TAG as an argument, and should return a `semantic-tag'. It is safe for FILTER to modify the input tag and return it." (when (not filter) (setq filter 'identity)) (when (not (semantic-tag-p tag)) - (signal 'wrong-type-argument (list tag 'semantic-tag-p))) + (signal 'wrong-type-argument (list tag #'semantic-tag-p))) (let ((ol (semantic-tag-overlay tag)) (fn (semantic-tag-file-name tag))) (funcall filter (list (semantic-tag-name tag) @@ -937,7 +937,7 @@ NAME is a name for this alias. META-TAG-CLASS is the class of the tag this tag is an alias. VALUE is the aliased definition. ATTRIBUTES is a list of additional attributes belonging to this tag." - (apply 'semantic-tag name 'alias + (apply #'semantic-tag name 'alias :aliasclass meta-tag-class :definition value attributes)) @@ -1093,7 +1093,7 @@ For any given situation, additional ARGS may be passed." (condition-case err ;; If a hook bombs, ignore it! Usually this is tied into ;; some sort of critical system. - (apply 'run-hook-with-args 'semantic--tag-hook-value arglist) + (apply #'run-hook-with-args 'semantic--tag-hook-value arglist) (error (message "Error: %S" err))))) ;;; Tags and Overlays @@ -1104,7 +1104,7 @@ For any given situation, additional ARGS may be passed." (defsubst semantic--tag-unlink-list-from-buffer (tags) "Convert TAGS from using an overlay to using an overlay proxy. This function is for internal use only." - (mapcar 'semantic--tag-unlink-from-buffer tags)) + (mapcar #'semantic--tag-unlink-from-buffer tags)) (defun semantic--tag-unlink-from-buffer (tag) "Convert TAG from using an overlay to using an overlay proxy. @@ -1125,7 +1125,7 @@ This function is for internal use only." (defsubst semantic--tag-link-list-to-buffer (tags) "Convert TAGS from using an overlay proxy to using an overlay. This function is for internal use only." - (mapc 'semantic--tag-link-to-buffer tags)) + (mapc #'semantic--tag-link-to-buffer tags)) (defun semantic--tag-link-to-buffer (tag) "Convert TAG from using an overlay proxy to using an overlay. diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 377cec5455d..5a38280d2a2 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -1,4 +1,4 @@ -;;; semantic/texi.el --- Semantic details for Texinfo files +;;; semantic/texi.el --- Semantic details for Texinfo files -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2005, 2007-2021 Free Software Foundation, Inc. @@ -55,7 +55,7 @@ The field position is the field number (based at 1) where the name of this section is.") ;;; Code: -(defun semantic-texi-parse-region (&rest ignore) +(defun semantic-texi-parse-region (&rest _ignore) "Parse the current texinfo buffer for semantic tags. IGNORE any arguments, always parse the whole buffer. Each tag returned is of the form: @@ -79,7 +79,7 @@ function `semantic-install-function-overrides'." (let ((chil (semantic-tag-components tag))) (if chil (semantic-tag-put-attribute - tag :members (mapcar 'semantic-texi-expand-tag chil))) + tag :members (mapcar #'semantic-texi-expand-tag chil))) (car (semantic--tag-expand tag)))) (defun semantic-texi-parse-headings () @@ -297,7 +297,7 @@ can handle the @menu environment.") nil)) (define-mode-local-override semantic-ctxt-current-class-list - texinfo-mode (&optional point) + texinfo-mode (&optional _point) "Determine the class of tags that can be used at POINT. For texinfo, there two possibilities returned. 1) `function' - for a call to a texinfo function @@ -368,7 +368,7 @@ Optional argument POINT is where to look for the environment." (declare-function semantic-analyze-context "semantic/analyze") (define-mode-local-override semantic-analyze-current-context - texinfo-mode (point) + texinfo-mode (_point) "Analysis context makes no sense for texinfo. Return nil." (let* ((prefixandbounds (semantic-ctxt-current-symbol-and-bounds (point))) (prefix (car prefixandbounds)) @@ -408,7 +408,7 @@ Optional argument POINT is where to look for the environment." "List of commands that we might bother completing.") (define-mode-local-override semantic-analyze-possible-completions - texinfo-mode (context &rest flags) + texinfo-mode (context &rest _flags) "List smart completions at point. Since texinfo is not a programming language the default version is not useful. Instead, look at the current symbol. If it is a command @@ -451,7 +451,7 @@ that start with that symbol." (setq semantic-parser-name "TEXI" ;; Setup a dummy parser table to enable parsing! semantic--parse-table t - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "@" semantic-type-relation-separator-character '(":") semantic-symbol->name-assoc-list '((section . "Section") @@ -466,7 +466,7 @@ that start with that symbol." ;; (local-set-key [(f9)] 'semantic-texi-update-doc-from-texi) ) -(add-hook 'texinfo-mode-hook 'semantic-default-texi-setup) +(add-hook 'texinfo-mode-hook #'semantic-default-texi-setup) ;;; Special features of Texinfo tag streams @@ -500,7 +500,7 @@ that start with that symbol." ;; Turns out this might not be useful. ;; Delete later if that is true. -(defun semantic-texi-find-documentation (name &optional type) +(defun semantic-texi-find-documentation (name &optional _type) "Find the function or variable NAME of TYPE in the texinfo source. NAME is a string representing some functional symbol. TYPE is a string, such as \"variable\" or \"Command\" used to find diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index 0de66d29e3e..a02d5667ef3 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -1,4 +1,4 @@ -;;; semantic/util-modes.el --- Semantic minor modes +;;; semantic/util-modes.el --- Semantic minor modes -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2005, 2007-2021 Free Software Foundation, Inc. @@ -48,7 +48,7 @@ line." :group 'semantic :type 'boolean :require 'semantic/util-modes - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (sym val) (set-default sym val) ;; Update status of all Semantic enabled buffers @@ -60,7 +60,7 @@ line." :group 'semantic :type 'string :require 'semantic/util-modes - :initialize 'custom-initialize-default) + :initialize #'custom-initialize-default) (defvar semantic-minor-modes-format nil "Mode line format showing Semantic minor modes which are locally enabled. @@ -93,7 +93,7 @@ Only minor modes that are locally enabled are shown in the mode line." (match-string 1 semantic-mode-line-prefix) "S"))) (setq semantic-minor-modes-format - `((:eval (if (or ,@(mapcar 'car locals)) + `((:eval (if (or ,@(mapcar #'car locals)) ,(concat " " prefix))))) ;; It would be easier to just put `locals' inside ;; semantic-minor-modes-format, but then things like @@ -111,7 +111,7 @@ Only minor modes that are locally enabled are shown in the mode line." (cons elem minor-mode-alist))))) (setcdr tail (nconc locals (cdr tail))))))))) -(defun semantic-desktop-ignore-this-minor-mode (buffer) +(defun semantic-desktop-ignore-this-minor-mode (_buffer) "Installed as a minor-mode initializer for Desktop mode. BUFFER is the buffer to not initialize a Semantic minor mode in." nil) @@ -221,10 +221,10 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) (add-hook 'semantic-edits-new-change-functions - 'semantic-highlight-edits-new-change-hook-fcn nil t)) + #'semantic-highlight-edits-new-change-hook-fcn nil t)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-highlight-edits-new-change-hook-fcn t))) + #'semantic-highlight-edits-new-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-highlight-edits-mode "e") @@ -345,7 +345,7 @@ Do not search past BOUND if non-nil." (defvar semantic-show-unmatched-syntax-mode-map (let ((km (make-sparse-keymap))) - (define-key km "\C-c,`" 'semantic-show-unmatched-syntax-next) + (define-key km "\C-c,`" #'semantic-show-unmatched-syntax-next) km) "Keymap for command `semantic-show-unmatched-syntax-mode'.") @@ -372,18 +372,18 @@ non-nil if the minor mode is enabled. (buffer-name))) ;; Add hooks (add-hook 'semantic-unmatched-syntax-hook - 'semantic-show-unmatched-syntax nil t) + #'semantic-show-unmatched-syntax nil t) (add-hook 'semantic-pre-clean-token-hooks - 'semantic-clean-token-of-unmatched-syntax nil t) + #'semantic-clean-token-of-unmatched-syntax nil t) ;; Show unmatched syntax elements (if (not (semantic--umatched-syntax-needs-refresh-p)) (semantic-show-unmatched-syntax (semantic-unmatched-syntax-tokens)))) ;; Remove hooks (remove-hook 'semantic-unmatched-syntax-hook - 'semantic-show-unmatched-syntax t) + #'semantic-show-unmatched-syntax t) (remove-hook 'semantic-pre-clean-token-hooks - 'semantic-clean-token-of-unmatched-syntax t) + #'semantic-clean-token-of-unmatched-syntax t) ;; Cleanup unmatched-syntax highlighting (semantic-clean-unmatched-syntax-in-buffer))) @@ -454,46 +454,46 @@ non-nil if the minor mode is enabled." '(semantic-show-parser-state-string)))) ;; Add hooks (add-hook 'semantic-edits-new-change-functions - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-edits-incremental-reparse-failed-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-after-partial-cache-change-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (semantic-show-parser-state-marker) (add-hook 'semantic-before-auto-parse-hooks - 'semantic-show-parser-state-auto-marker nil t) + #'semantic-show-parser-state-auto-marker nil t) (add-hook 'semantic-after-auto-parse-hooks - 'semantic-show-parser-state-marker nil t) + #'semantic-show-parser-state-marker nil t) (add-hook 'semantic-before-idle-scheduler-reparse-hook - 'semantic-show-parser-state-auto-marker nil t) + #'semantic-show-parser-state-auto-marker nil t) (add-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker nil t)) + #'semantic-show-parser-state-marker nil t)) ;; Remove parts of mode line (setq mode-line-modified (delq 'semantic-show-parser-state-string mode-line-modified)) ;; Remove hooks (remove-hook 'semantic-edits-new-change-functions - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-edits-incremental-reparse-failed-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-after-partial-cache-change-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-after-toplevel-cache-change-hook - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-before-auto-parse-hooks - 'semantic-show-parser-state-auto-marker t) + #'semantic-show-parser-state-auto-marker t) (remove-hook 'semantic-after-auto-parse-hooks - 'semantic-show-parser-state-marker t) + #'semantic-show-parser-state-marker t) (remove-hook 'semantic-before-idle-scheduler-reparse-hook - 'semantic-show-parser-state-auto-marker t) + #'semantic-show-parser-state-auto-marker t) (remove-hook 'semantic-after-idle-scheduler-reparse-hook - 'semantic-show-parser-state-marker t))) + #'semantic-show-parser-state-marker t))) (semantic-add-minor-mode 'semantic-show-parser-state-mode "") @@ -502,7 +502,7 @@ non-nil if the minor mode is enabled." "String showing the parser state for this buffer. See `semantic-show-parser-state-marker' for details.") -(defun semantic-show-parser-state-marker (&rest ignore) +(defun semantic-show-parser-state-marker (&rest _ignore) "Set `semantic-show-parser-state-string' to indicate parser state. This marker is one of the following: `-' -> The cache is up to date. @@ -555,7 +555,7 @@ to indicate a parse in progress." (defvar semantic-stickyfunc-mode-map (let ((km (make-sparse-keymap))) - (define-key km [ header-line down-mouse-1 ] 'semantic-stickyfunc-menu) + (define-key km [ header-line down-mouse-1 ] #'semantic-stickyfunc-menu) km) "Keymap for stickyfunc minor mode.") @@ -826,7 +826,7 @@ Argument EVENT describes the event that caused this function to be called." (defvar semantic-highlight-func-mode-map (let ((km (make-sparse-keymap))) - (define-key km [mouse-3] 'semantic-highlight-func-menu) + (define-key km [mouse-3] #'semantic-highlight-func-menu) km) "Keymap for highlight-func minor mode.") @@ -916,10 +916,10 @@ non-nil if the minor mode is enabled." (error "Buffer %s was not set up for parsing" (buffer-name))) ;; Setup our hook (add-hook 'post-command-hook - 'semantic-highlight-func-highlight-current-tag nil t)) + #'semantic-highlight-func-highlight-current-tag nil t)) ;; Disable highlight func mode (remove-hook 'post-command-hook - 'semantic-highlight-func-highlight-current-tag t) + #'semantic-highlight-func-highlight-current-tag t) (semantic-highlight-func-highlight-current-tag t))) (defun semantic-highlight-func-highlight-current-tag (&optional disable) diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el index 8c487e14ed5..bfc923c75b4 100644 --- a/lisp/cedet/semantic/util.el +++ b/lisp/cedet/semantic/util.el @@ -1,6 +1,6 @@ -;;; semantic/util.el --- Utilities for use with semantic tag tables +;;; semantic/util.el --- Utilities for use with semantic tag tables -*- lexical-binding: t; -*- -;;; Copyright (C) 1999-2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 1999-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: syntax @@ -114,7 +114,10 @@ buffer, or a filename. If SOMETHING is nil return nil." ((and (featurep 'semantic/db) (require 'semantic/db-mode) (semanticdb-minor-mode-p) - (cl-typep something 'semanticdb-abstract-table)) + (progn + (declare-function semanticdb-abstract-table--eieio-childp + "semantic/db") + (cl-typep something 'semanticdb-abstract-table))) (semanticdb-refresh-table something) (semanticdb-get-tags something)) ;; Semanticdb find-results @@ -427,7 +430,7 @@ determining which symbols are considered." (setq completion (try-completion pattern collection predicate)) (if (string= pattern completion) (let ((list (all-completions pattern collection predicate))) - (setq list (sort list 'string<)) + (setq list (sort list #'string<)) (if (> (length list) 1) (with-output-to-temp-buffer "*Completions*" (display-completion-list diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index ae0823e669a..6addc134edb 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -3450,7 +3450,7 @@ Automatically called by the Emacs Lisp byte compiler as a `byte-compile' handler." (byte-compile-form (macroexpand-all - (wisent-automaton-lisp-form (eval form))))) + (wisent-automaton-lisp-form (eval form t))))) (defun wisent-compile-grammar (grammar &optional start-list) ;; This is kept for compatibility with FOO-wy.el files generated diff --git a/lisp/cedet/semantic/wisent/java-tags.el b/lisp/cedet/semantic/wisent/java-tags.el index adb9a30894e..b4a87be62a0 100644 --- a/lisp/cedet/semantic/wisent/java-tags.el +++ b/lisp/cedet/semantic/wisent/java-tags.el @@ -111,12 +111,12 @@ Use the alternate LALR(1) parser." (setq ;; Lexical analysis semantic-lex-number-expression semantic-java-number-regexp - semantic-lex-analyzer 'wisent-java-tags-lexer + semantic-lex-analyzer #'wisent-java-tags-lexer ;; Parsing - semantic-tag-expand-function 'semantic-java-expand-tag + semantic-tag-expand-function #'semantic-java-expand-tag ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-prototype - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-prototype + imenu-create-index-function #'semantic-create-imenu-index semantic-type-relation-separator-character '(".") semantic-command-separation-character ";" ;; speedbar and imenu buckets name diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 9db51ad36b6..1932f205ee0 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el @@ -128,14 +128,14 @@ This is currently needed for the mozrepl omniscient database." (wisent-javascript-jv-wy--install-parser) (setq ;; Lexical Analysis - semantic-lex-analyzer 'javascript-lexer-jv + semantic-lex-analyzer #'javascript-lexer-jv semantic-lex-number-expression semantic-java-number-regexp ;; semantic-lex-depth nil ;; Full lexical analysis ;; Parsing - semantic-tag-expand-function 'wisent-javascript-jv-expand-tag + semantic-tag-expand-function #'wisent-javascript-jv-expand-tag ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-name - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-name + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character ";" )) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 8732b2e975c..7a5761ce8c8 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -512,12 +512,12 @@ Shortens `code' tags, but passes through for others." semantic-type-relation-separator-character '(".") semantic-command-separation-character ";" ;; Parsing - semantic-tag-expand-function 'semantic-python-expand-tag + semantic-tag-expand-function #'semantic-python-expand-tag ;; Semantic to take over from the one provided by python. ;; The python one, if it uses the senator advice, will hang ;; Emacs unrecoverably. - imenu-create-index-function 'semantic-create-imenu-index + imenu-create-index-function #'semantic-create-imenu-index ;; I need a python guru to update this list: semantic-symbol->name-assoc-list-for-type-parts '((variable . "Variables") diff --git a/lisp/cedet/semantic/wisent/wisent.el b/lisp/cedet/semantic/wisent/wisent.el index df1fd73e29e..d205c0e6043 100644 --- a/lisp/cedet/semantic/wisent/wisent.el +++ b/lisp/cedet/semantic/wisent/wisent.el @@ -1,6 +1,6 @@ ;;; semantic/wisent/wisent.el --- GNU Bison for Emacs - Runtime -*- lexical-binding: t; -*- -;;; Copyright (C) 2002-2007, 2009-2021 Free Software Foundation, Inc. +;; Copyright (C) 2002-2021 Free Software Foundation, Inc. ;; Author: David Ponce ;; Created: 30 January 2002 diff --git a/lisp/cedet/srecode.el b/lisp/cedet/srecode.el index aa4aa812e02..83e9754a608 100644 --- a/lisp/cedet/srecode.el +++ b/lisp/cedet/srecode.el @@ -1,6 +1,6 @@ ;;; srecode.el --- Semantic buffer evaluator. -*- lexical-binding: t -*- -;;; Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc. +;; Copyright (C) 2005-2021 Free Software Foundation, Inc. ;; Author: Eric M. Ludlam ;; Keywords: codegeneration diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el index 3f66898c9cc..dc5e8da5cdb 100644 --- a/lisp/cedet/srecode/cpp.el +++ b/lisp/cedet/srecode/cpp.el @@ -164,7 +164,7 @@ specified in a C file." ;; when they make sense. My best bet would be ;; (semantic-tag-function-parent tag), but it is not there, when ;; the function is defined in the scope of a class. - (let ((member t) + (let (;; (member t) (templates (semantic-tag-get-attribute tag :template)) (modifiers (semantic-tag-modifiers tag))) @@ -185,7 +185,7 @@ specified in a C file." ;; When the function is a member function, it can have ;; additional modifiers. - (when member + (when t ;; member ;; For member functions, constness is called ;; 'methodconst-flag'. diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el index 022a5db8f2b..9b1c8491a12 100644 --- a/lisp/cedet/srecode/mode.el +++ b/lisp/cedet/srecode/mode.el @@ -224,13 +224,11 @@ MENU-DEF is the menu to bind this into." (if bind (concat name " (" bind ")") name) - `(lambda () (interactive) - (srecode-insert (concat ,ctxt ":" ,name))) + (lambda () (interactive) + (srecode-insert (concat ctxt ":" name))) t))) - (setcdr ctxtcons (cons - new - (cdr ctxtcons))))) + (push new (cdr ctxtcons)))) (setq ltab (cdr ltab)))) (setq subtab (cdr subtab))) diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el index 4f7eaffeb47..1f6f0d345da 100644 --- a/lisp/cedet/srecode/template.el +++ b/lisp/cedet/srecode/template.el @@ -49,11 +49,11 @@ (setq ;; Lexical Analysis - semantic-lex-analyzer 'wisent-srecode-template-lexer + semantic-lex-analyzer #'wisent-srecode-template-lexer ;; Parsing ;; Environment - semantic-imenu-summary-function 'semantic-format-tag-name - imenu-create-index-function 'semantic-create-imenu-index + semantic-imenu-summary-function #'semantic-format-tag-name + imenu-create-index-function #'semantic-create-imenu-index semantic-command-separation-character "\n" semantic-lex-comment-regex ";;" ;; Speedbar -- cgit v1.2.3 From 4c6554413d318069239ba83f4f42fa2452801d30 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 12 Jun 2021 16:22:03 -0400 Subject: EIEIO: Promote the CLOS behavior over the EIEIO-specific behavior Change docs to advertize `slot-value` rather than `oref`. Change the implementation of `:initform` to better match the CLOS semantics, while preserving the EIEIO semantics, but warn when encountering cases where the two diverge. Demote the mostly unused special semantics of `oref-default` on non-class allocated slots. * doc/misc/eieio.texi (Quick Start): Use `slot-value`. (Accessing Slots): Move `slot-value` before `oref`. Fix paren-typo in example (reported by pillule ). (Introspection): Remove mention of `class-slot-initarg`. * lisp/transient.el (transient--parse-group, transient--parse-suffix): Don't use `oref-default` to get the default value. (transient-lisp-variable): Init forms are evaluated. * lisp/emacs-lisp/eieio.el (defclass): Warn about inapplicable `:initarg` and about uses of init forms that are ambiguous. (oref): Don't advertize the deprecated use of initargs as slot names. (oref-default): Don't advertize the deprecated case where it returns the initform's value. (initialize-instance): Use `macroexp-const-p`. * lisp/emacs-lisp/eieio-core.el (eieio--unbound): Rename from `eieio-unbound`. (eieio--unbound-form): New var. (eieio--slot-override): Use it. (eieio-defclass-internal): Use it. Change `init` so it should always be evaluated. (eieio--known-class-slot-names): New var. (eieio--eval-default-p): Rename from `eieio-eval-default-p`. (eieio--perform-slot-validation-for-default): Use `macroexp-const-p` to decide whether to skip the test. (eieio--add-new-slot): Register slot in `eieio--known-class-slot-names` when applicable. (eieio-oref-default, eieio-oset-default): Add warning for unknown slots and slots not known to be allocated to the class. (eieio-default-eval-maybe): Delete function. Use just `eval` instead. (eieio-declare-slots): Allow slots to specify their allocation class. * lisp/cedet/srecode/insert.el (point): Declare the slot instead of moving the class definition before the slot's first use. (srecode-template-inserter-point, srecode-insert-fcn): Use nil instead of unbound for the `point` slot. * lisp/cedet/srecode/compile.el (srecode-template-inserter): Declare the `key` slot that all children should have. * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar) (eieio-speedbar-directory-button, eieio-speedbar-file-button): * lisp/emacs-lisp/eieio-custom.el (eieio-widget-test-class): * lisp/emacs-lisp/chart.el (chart-bar): * lisp/cedet/semantic/ede-grammar.el (semantic-ede-proj-target-grammar): * lisp/cedet/semantic/db.el (semanticdb-project-database): * lisp/cedet/semantic/db-javascript.el (semanticdb-table-javascript) (semanticdb-project-database-javascript): * lisp/cedet/semantic/db-el.el (semanticdb-table-emacs-lisp) (semanticdb-project-database-emacs-lisp): * lisp/cedet/semantic/db-ebrowse.el (semanticdb-table-ebrowse) (semanticdb-project-database-ebrowse): * lisp/cedet/ede/proj.el (ede-proj-project): * lisp/cedet/ede/proj-obj.el (ede-proj-target-makefile-objectcode): * lisp/cedet/ede/generic.el (ede-generic-project): * lisp/cedet/ede/config.el (ede-project-with-config): * lisp/cedet/ede/base.el (ede-target, ede-project): * lisp/auth-source.el (auth-source-backend): Init forms are evaluated, so quote them accordingly. --- doc/misc/eieio.texi | 88 +++++++++++------------- lisp/auth-source.el | 4 +- lisp/cedet/ede/base.el | 46 ++++++------- lisp/cedet/ede/config.el | 2 +- lisp/cedet/ede/generic.el | 2 +- lisp/cedet/ede/proj-obj.el | 4 +- lisp/cedet/ede/proj.el | 12 ++-- lisp/cedet/semantic/db-ebrowse.el | 4 +- lisp/cedet/semantic/db-el.el | 4 +- lisp/cedet/semantic/db-javascript.el | 4 +- lisp/cedet/semantic/db.el | 4 +- lisp/cedet/semantic/ede-grammar.el | 12 ++-- lisp/cedet/srecode/compile.el | 7 +- lisp/cedet/srecode/insert.el | 17 +++-- lisp/emacs-lisp/chart.el | 2 +- lisp/emacs-lisp/eieio-base.el | 2 +- lisp/emacs-lisp/eieio-core.el | 127 ++++++++++++++++++++++------------- lisp/emacs-lisp/eieio-custom.el | 2 +- lisp/emacs-lisp/eieio-speedbar.el | 10 +-- lisp/emacs-lisp/eieio.el | 57 +++++++++------- lisp/transient.el | 8 +-- 21 files changed, 231 insertions(+), 187 deletions(-) (limited to 'lisp/cedet/ede/proj-obj.el') diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 4952e909902..63b42827311 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -115,10 +115,10 @@ Each class can have methods, which are defined like this: (cl-defmethod call-person ((pers person) &optional scriptname) "Dial the phone for the person PERS. Execute the program SCRIPTNAME to dial the phone." - (message "Dialing the phone for %s" (oref pers name)) + (message "Dialing the phone for %s" (slot-value pers 'name)) (shell-command (concat (or scriptname "dialphone.sh") " " - (oref pers phone)))) + (slot-value pers 'phone)))) @end example @noindent @@ -693,16 +693,43 @@ for each slot. For example: @node Accessing Slots @chapter Accessing Slots -There are several ways to access slot values in an object. The naming -and argument-order conventions are similar to those used for -referencing vectors (@pxref{Vectors,,,elisp,GNU Emacs Lisp Reference -Manual}). +There are several ways to access slot values in an object. +The following accessors are defined by CLOS to reference or modify +slot values, and use the previously mentioned set/ref routines. + +@defun slot-value object slot +@anchor{slot-value} +This function retrieves the value of @var{slot} from @var{object}. + +This is a generalized variable that can be used with @code{setf} to +modify the value stored in @var{slot}. @xref{Generalized +Variables,,,elisp,GNU Emacs Lisp Reference Manual}. +@end defun + +@defun set-slot-value object slot value +@anchor{set-slot-value} +This function sets the value of @var{slot} from @var{object}. + +This is not a CLOS function, but is the obsolete setter for +@code{slot-value} used by the @code{setf} macro. It is therefore +recommended to use @w{@code{(setf (slot-value @var{object} @var{slot}) +@var{value})}} instead. +@end defun + +@defun slot-makeunbound object slot +This function unbinds @var{slot} in @var{object}. Referencing an +unbound slot can signal an error. +@end defun + +The following accessors follow a naming and argument-order conventions +are similar to those used for referencing vectors +(@pxref{Vectors,,,elisp,GNU Emacs Lisp Reference Manual}). @defmac oref obj slot @anchor{oref} This macro retrieves the value stored in @var{obj} in the named -@var{slot}. Slot names are determined by @code{defclass} which -creates the slot. +@var{slot}. Unlike @code{slot-value}, the symbol for @var{slot} must +not be quoted. This is a generalized variable that can be used with @code{setf} to modify the value stored in @var{slot}. @xref{Generalized @@ -737,35 +764,6 @@ changed, this can be arranged by simply executing this bit of code: @end example @end defmac -The following accessors are defined by CLOS to reference or modify -slot values, and use the previously mentioned set/ref routines. - -@defun slot-value object slot -@anchor{slot-value} -This function retrieves the value of @var{slot} from @var{object}. -Unlike @code{oref}, the symbol for @var{slot} must be quoted. - -This is a generalized variable that can be used with @code{setf} to -modify the value stored in @var{slot}. @xref{Generalized -Variables,,,elisp,GNU Emacs Lisp Reference Manual}. -@end defun - -@defun set-slot-value object slot value -@anchor{set-slot-value} -This function sets the value of @var{slot} from @var{object}. Unlike -@code{oset}, the symbol for @var{slot} must be quoted. - -This is not a CLOS function, but is the obsolete setter for -@code{slot-value} used by the @code{setf} macro. It is therefore -recommended to use @w{@code{(setf (slot-value @var{object} @var{slot}) -@var{value})}} instead. -@end defun - -@defun slot-makeunbound object slot -This function unbinds @var{slot} in @var{object}. Referencing an -unbound slot can signal an error. -@end defun - @defun object-add-to-list object slot item &optional append @anchor{object-add-to-list} In OBJECT's @var{slot}, add @var{item} to the list of elements. @@ -807,7 +805,7 @@ Where each @var{var} is the local variable given to the associated variable name of the same name as the slot. @example -(defclass myclass () (x :initform 1)) +(defclass myclass () ((x :initform 1))) (setq mc (make-instance 'myclass)) (with-slots (x) mc x) => 1 (with-slots ((something x)) mc something) => 1 @@ -981,8 +979,8 @@ the @code{subclass} specializer with @code{cl-defmethod}: new)) @end example -The first argument of a static method will be a class rather than an -object. Use the functions @code{oref-default} or @code{oset-default} which +The argument of a static method will be a class rather than an object. +Use the functions @code{oref-default} or @code{oset-default} which will work on a class. A class's @code{make-instance} method is defined as a static @@ -1238,12 +1236,6 @@ of CLOS. Return the list of public slots for @var{obj}. @end defun -@defun class-slot-initarg class slot -For the given @var{class} return an :initarg associated with -@var{slot}. Not all slots have initargs, so the return value can be -@code{nil}. -@end defun - @node Base Classes @chapter Base Classes @@ -1656,8 +1648,8 @@ Method invoked when an attempt to access a slot in @var{object} fails. that was requested, and optional @var{new-value} is the value that was desired to be set. -This method is called from @code{oref}, @code{oset}, and other functions which -directly reference slots in EIEIO objects. +This method is called from @code{slot-value}, @code{set-slot-value}, +and other functions which directly reference slots in EIEIO objects. The default method signals an error of type @code{invalid-slot-name}. @xref{Signals}. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 2516b4b9fae..9ca28ebb0a9 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -121,12 +121,12 @@ let-binding." :initform nil :documentation "Internal backend data.") (create-function :initarg :create-function - :initform ignore + :initform #'ignore :type function :custom function :documentation "The create function.") (search-function :initarg :search-function - :initform ignore + :initform #'ignore :type function :custom function :documentation "The search function."))) diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el index 3fcc023e0c6..103a37045cc 100644 --- a/lisp/cedet/ede/base.el +++ b/lisp/cedet/ede/base.el @@ -47,7 +47,7 @@ ;; and features of those files. (defclass ede-target (eieio-speedbar-directory-button eieio-named) - ((buttonface :initform speedbar-file-face) ;override for superclass + ((buttonface :initform 'speedbar-file-face) ;override for superclass (name :initarg :name :type string :custom string @@ -91,16 +91,16 @@ This is used to match target objects with the compilers they can use, and which files this object is interested in." :accessor ede-object-sourcecode) (keybindings :allocation :class - :initform (("D" . ede-debug-target)) + :initform '(("D" . ede-debug-target)) :documentation "Keybindings specialized to this type of target." :accessor ede-object-keybindings) (menu :allocation :class - :initform ( [ "Debug target" ede-debug-target - (ede-buffer-belongs-to-target-p) ] - [ "Run target" ede-run-target - (ede-buffer-belongs-to-target-p) ] - ) + :initform '( [ "Debug target" ede-debug-target + (ede-buffer-belongs-to-target-p) ] + [ "Run target" ede-run-target + (ede-buffer-belongs-to-target-p) ] + ) :documentation "Menu specialized to this type of target." :accessor ede-object-menu) ) @@ -236,7 +236,7 @@ also be of a form used by TRAMP for use with scp, or rcp.") This FTP site should be in Emacs form as needed by `ange-ftp'. If this slot is nil, then use `ftp-site' instead.") (configurations :initarg :configurations - :initform ("debug" "release") + :initform '("debug" "release") :type list :custom (repeat string) :label "Configuration Options" @@ -258,25 +258,25 @@ and target specific elements such as build variables.") :group (settings) :documentation "Project local variables") (keybindings :allocation :class - :initform (("D" . ede-debug-target) - ("R" . ede-run-target)) + :initform '(("D" . ede-debug-target) + ("R" . ede-run-target)) :documentation "Keybindings specialized to this type of target." :accessor ede-object-keybindings) (menu :allocation :class :initform - ( - [ "Update Version" ede-update-version ede-object ] - [ "Version Control Status" ede-vc-project-directory ede-object ] - [ "Edit Project Homepage" ede-edit-web-page - (and ede-object (oref (ede-toplevel) web-site-file)) ] - [ "Browse Project URL" ede-web-browse-home - (and ede-object - (not (string= "" (oref (ede-toplevel) web-site-url)))) ] - "--" - [ "Rescan Project Files" ede-rescan-toplevel t ] - [ "Edit Projectfile" ede-edit-file-target - (ede-buffer-belongs-to-project-p) ] - ) + '( + [ "Update Version" ede-update-version ede-object ] + [ "Version Control Status" ede-vc-project-directory ede-object ] + [ "Edit Project Homepage" ede-edit-web-page + (and ede-object (oref (ede-toplevel) web-site-file)) ] + [ "Browse Project URL" ede-web-browse-home + (and ede-object + (not (string= "" (oref (ede-toplevel) web-site-url)))) ] + "--" + [ "Rescan Project Files" ede-rescan-toplevel t ] + [ "Edit Projectfile" ede-edit-file-target + (ede-buffer-belongs-to-project-p) ] + ) :documentation "Menu specialized to this type of target." :accessor ede-object-menu) ) diff --git a/lisp/cedet/ede/config.el b/lisp/cedet/ede/config.el index bc1810aa84f..98a0419e8bf 100644 --- a/lisp/cedet/ede/config.el +++ b/lisp/cedet/ede/config.el @@ -96,7 +96,7 @@ and also want to save some extra level of configuration.") This filename excludes the directory name and is used to initialize the :file slot of the persistent baseclass.") (config-class - :initform ede-extra-config + :initform 'ede-extra-config :allocation :class :type class :documentation diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el index b3b59b5dc35..4537f59ac9d 100644 --- a/lisp/cedet/ede/generic.el +++ b/lisp/cedet/ede/generic.el @@ -137,7 +137,7 @@ subclasses of this base target will override the default value.") ede-project-with-config-program ede-project-with-config-c ede-project-with-config-java) - ((config-class :initform ede-generic-config) + ((config-class :initform 'ede-generic-config) (config-file-basename :initform "EDEConfig.el") (buildfile :initform "" :type string diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el index 2ae62f4b38e..1b96376d3eb 100644 --- a/lisp/cedet/ede/proj-obj.el +++ b/lisp/cedet/ede/proj-obj.el @@ -34,8 +34,8 @@ ;;; Code: (defclass ede-proj-target-makefile-objectcode (ede-proj-target-makefile) (;; Give this a new default - (configuration-variables :initform ("debug" . (("CFLAGS" . "-g") - ("LDFLAGS" . "-g")))) + (configuration-variables :initform '("debug" . (("CFLAGS" . "-g") + ("LDFLAGS" . "-g")))) ;; @TODO - add an include path. (availablecompilers :initform '(ede-gcc-compiler ede-g++-compiler diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el index 6ff763016ef..c8c34d092f1 100644 --- a/lisp/cedet/ede/proj.el +++ b/lisp/cedet/ede/proj.el @@ -220,7 +220,7 @@ This enables the creation of your target type." ((extension :initform ".ede") (file-header-line :initform ";; EDE Project Files are auto generated: Do Not Edit") (makefile-type :initarg :makefile-type - :initform Makefile + :initform 'Makefile :type symbol :custom (choice (const Makefile) ;(const Makefile.in) @@ -240,7 +240,7 @@ in targets.") :documentation "Variables to set in this Makefile.") (configuration-variables :initarg :configuration-variables - :initform ("debug" (("DEBUG" . "1"))) + :initform '("debug" (("DEBUG" . "1"))) :type list :custom (repeat (cons (string :tag "Configuration") (repeat @@ -269,10 +269,10 @@ These files can contain additional rules, variables, and customizations.") :documentation "Non-nil to do implement automatic dependencies in the Makefile.") (menu :initform - ( - [ "Regenerate Makefiles" ede-proj-regenerate t ] - [ "Upload Distribution" ede-upload-distribution t ] - ) + '( + [ "Regenerate Makefiles" ede-proj-regenerate t ] + [ "Upload Distribution" ede-upload-distribution t ] + ) ) (metasubproject :initarg :metasubproject diff --git a/lisp/cedet/semantic/db-ebrowse.el b/lisp/cedet/semantic/db-ebrowse.el index 682a4ccac48..8bc3b810a65 100644 --- a/lisp/cedet/semantic/db-ebrowse.el +++ b/lisp/cedet/semantic/db-ebrowse.el @@ -79,7 +79,7 @@ be searched." ;;; SEMANTIC Database related Code ;;; Classes: (defclass semanticdb-table-ebrowse (semanticdb-table) - ((major-mode :initform c++-mode) + ((major-mode :initform #'c++-mode) (ebrowse-tree :initform nil :initarg :ebrowse-tree :documentation @@ -95,7 +95,7 @@ This table is composited from the ebrowse *Globals* section.") (defclass semanticdb-project-database-ebrowse (semanticdb-project-database) - ((new-table-class :initform semanticdb-table-ebrowse + ((new-table-class :initform 'semanticdb-table-ebrowse :type class :documentation "New tables created for this database are of this class.") diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el index 78339c375fb..41e48b0bc30 100644 --- a/lisp/cedet/semantic/db-el.el +++ b/lisp/cedet/semantic/db-el.el @@ -40,7 +40,7 @@ ;;; Classes: (defclass semanticdb-table-emacs-lisp (semanticdb-abstract-table) - ((major-mode :initform emacs-lisp-mode) + ((major-mode :initform #'emacs-lisp-mode) ) "A table for returning search results from Emacs.") @@ -63,7 +63,7 @@ It does not need refreshing." (defclass semanticdb-project-database-emacs-lisp (semanticdb-project-database eieio-singleton) - ((new-table-class :initform semanticdb-table-emacs-lisp + ((new-table-class :initform 'semanticdb-table-emacs-lisp :type class :documentation "New tables created for this database are of this class.") diff --git a/lisp/cedet/semantic/db-javascript.el b/lisp/cedet/semantic/db-javascript.el index cad561e7967..bf3d6122954 100644 --- a/lisp/cedet/semantic/db-javascript.el +++ b/lisp/cedet/semantic/db-javascript.el @@ -80,7 +80,7 @@ See bottom of this file for instructions on managing this list.") ;;; Classes: (defclass semanticdb-table-javascript (semanticdb-search-results-table) - ((major-mode :initform javascript-mode) + ((major-mode :initform #'javascript-mode) ) "A table for returning search results from javascript.") @@ -88,7 +88,7 @@ See bottom of this file for instructions on managing this list.") (semanticdb-project-database eieio-singleton ;this db is for js globals, so singleton is appropriate ) - ((new-table-class :initform semanticdb-table-javascript + ((new-table-class :initform 'semanticdb-table-javascript :type class :documentation "New tables created for this database are of this class.") diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el index 8f9eceea554..38e2b34b0db 100644 --- a/lisp/cedet/semantic/db.el +++ b/lisp/cedet/semantic/db.el @@ -321,12 +321,12 @@ Adds the number of tags in this file to the object print name." '(list-of semanticdb-abstract-table)) (defclass semanticdb-project-database (eieio-instance-tracker) - ((tracking-symbol :initform semanticdb-database-list) + ((tracking-symbol :initform 'semanticdb-database-list) (reference-directory :type string :documentation "Directory this database refers to. When a cache directory is specified, then this refers to the directory this database contains symbols for.") - (new-table-class :initform semanticdb-table + (new-table-class :initform 'semanticdb-table :type class :documentation "New tables created for this database are of this class.") diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index 6bb83526f6c..19d4184fa45 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -38,13 +38,13 @@ (keybindings :initform nil) (phony :initform t) (sourcetype :initform - (semantic-ede-source-grammar-wisent - semantic-ede-source-grammar-bovine - )) + '(semantic-ede-source-grammar-wisent + semantic-ede-source-grammar-bovine + )) (availablecompilers :initform - (semantic-ede-grammar-compiler-wisent - semantic-ede-grammar-compiler-bovine - )) + '(semantic-ede-grammar-compiler-wisent + semantic-ede-grammar-compiler-bovine + )) (aux-packages :initform '("semantic" "cedet-compat")) (pre-load-packages :initform '("cedet-compat" "semantic/grammar" "semantic/bovine/grammar" "semantic/wisent/grammar")) ) diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el index 36df1da9e33..15107ef1e43 100644 --- a/lisp/cedet/srecode/compile.el +++ b/lisp/cedet/srecode/compile.el @@ -110,7 +110,12 @@ stack is broken." :type (or null string) :documentation "If there is a colon in the inserter's name, it represents -additional static argument data.")) +additional static argument data.") + (key :initform nil :allocation :class + :documentation + "The character code used to identify inserters of this style. +All children of this class should specify `key' slot with appropriate +:initform value.")) "This represents an item to be inserted via a template macro. Plain text strings are not handled via this baseclass." :abstract t) diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el index ab0503c8d36..f20842b1d8a 100644 --- a/lisp/cedet/srecode/insert.el +++ b/lisp/cedet/srecode/insert.el @@ -89,6 +89,8 @@ DICT-ENTRIES are additional dictionary values to add." ;; for this insertion step. )) +(eieio-declare-slots (point :allocation :class)) + (defun srecode-insert-fcn (template dictionary &optional stream skipresolver) "Insert TEMPLATE using DICTIONARY into STREAM. Optional SKIPRESOLVER means to avoid refreshing the tag list, @@ -134,13 +136,13 @@ has set everything up already." ) (srecode-insert-method template dictionary)) ;; Handle specialization of the POINT inserter. - (when (and (bufferp standard-output) - (slot-boundp 'srecode-template-inserter-point 'point) - ) - (set-buffer standard-output) - (setq end-mark (point-marker)) - (goto-char (oref-default 'srecode-template-inserter-point point))) - (oset-default 'srecode-template-inserter-point point eieio-unbound) + (when (bufferp standard-output) + (let ((point (oref-default 'srecode-template-inserter-point point))) + (when point + (set-buffer standard-output) + (setq end-mark (point-marker)) + (goto-char point)))) + (oset-default 'srecode-template-inserter-point point nil) ;; Return the end-mark. (or end-mark (point))) @@ -733,6 +735,7 @@ DEPTH.") "The character code used to identify inserters of this style.") (point :type (or null marker) :allocation :class + :initform nil :documentation "Record the value of (point) in this class slot. It is the responsibility of the inserter algorithm to clear this diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 5afc6d3bde3..0494497feaf 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -203,7 +203,7 @@ Make sure the width/height is correct." (defclass chart-bar (chart) ((direction :initarg :direction - :initform vertical)) + :initform 'vertical)) "Subclass for bar charts (vertical or horizontal).") (cl-defmethod chart-draw ((c chart) &optional buff) diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 641882c9026..ec7c899bddc 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -156,7 +156,7 @@ only one object ever exists." ;; NOTE TO SELF: In next version, make `slot-boundp' support classes ;; with class allocated slots or default values. (let ((old (oref-default class singleton))) - (if (eq old eieio-unbound) + (if (eq old eieio--unbound) (oset-default class singleton (cl-call-next-method)) old))) diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 34b4575182e..8f1e38b613b 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -71,11 +71,10 @@ Currently under control of this var: - Define -child-p and -list-p predicates. - Allow object names in constructors.") -(defconst eieio-unbound - (if (and (boundp 'eieio-unbound) (symbolp eieio-unbound)) - eieio-unbound - (make-symbol "unbound")) +(define-obsolete-variable-alias 'eieio-unbound 'eieio--unbound "28.1") +(defvar eieio--unbound (make-symbol "eieio--unbound") "Uninterned symbol representing an unbound slot in an object.") +(defvar eieio--unbound-form (macroexp-quote eieio--unbound)) ;; This is a bootstrap for eieio-default-superclass so it has a value ;; while it is being built itself. @@ -264,6 +263,7 @@ use \\='%s or turn off `eieio-backward-compatibility' instead" cname) (object-of-class-p obj class)))) (defvar eieio--known-slot-names nil) +(defvar eieio--known-class-slot-names nil) (defun eieio-defclass-internal (cname superclasses slots options) "Define CNAME as a new subclass of SUPERCLASSES. @@ -381,7 +381,7 @@ See `defclass' for more information." (pcase-dolist (`(,name . ,slot) slots) (let* ((init (or (plist-get slot :initform) (if (member :initform slot) nil - eieio-unbound))) + eieio--unbound-form))) (initarg (plist-get slot :initarg)) (docstr (plist-get slot :documentation)) (prot (plist-get slot :protection)) @@ -395,6 +395,14 @@ See `defclass' for more information." (skip-nil (eieio--class-option-assoc options :allow-nil-initform)) ) + (unless (or (macroexp-const-p init) + (eieio--eval-default-p init)) + ;; FIXME: We duplicate this test here and in `defclass' because + ;; if we move this part to `defclass' we may break some existing + ;; code (because the `fboundp' test in `eieio--eval-default-p' + ;; returns a different result at compile time). + (setq init (macroexp-quote init))) + ;; Clean up the meaning of protection. (setq prot (pcase prot @@ -457,8 +465,9 @@ See `defclass' for more information." (n (length slots)) (v (make-vector n nil))) (dotimes (i n) - (setf (aref v i) (eieio-default-eval-maybe - (cl--slot-descriptor-initform (aref slots i))))) + (setf (aref v i) (eval + (cl--slot-descriptor-initform (aref slots i)) + t))) (setf (eieio--class-class-allocation-values newc) v)) ;; Attach slot symbols into a hash table, and store the index of @@ -513,7 +522,7 @@ See `defclass' for more information." cname )) -(defsubst eieio-eval-default-p (val) +(defun eieio--eval-default-p (val) "Whether the default value VAL should be evaluated for use." (and (consp val) (symbolp (car val)) (fboundp (car val)))) @@ -522,10 +531,10 @@ See `defclass' for more information." If SKIPNIL is non-nil, then if default value is nil return t instead." (let ((value (cl--slot-descriptor-initform slot)) (spec (cl--slot-descriptor-type slot))) - (if (not (or (eieio-eval-default-p value) ;FIXME: Why? + (if (not (or (not (macroexp-const-p value)) eieio-skip-typecheck (and skipnil (null value)) - (eieio--perform-slot-validation spec value))) + (eieio--perform-slot-validation spec (eval value t)))) (signal 'invalid-slot-type (list (cl--slot-descriptor-name slot) spec value))))) (defun eieio--slot-override (old new skipnil) @@ -546,7 +555,7 @@ If SKIPNIL is non-nil, then if default value is nil return t instead." type tp a)) (setf (cl--slot-descriptor-type new) tp)) ;; If we have a repeat, only update the initarg... - (unless (eq d eieio-unbound) + (unless (eq d eieio--unbound-form) (eieio--perform-slot-validation-for-default new skipnil) (setf (cl--slot-descriptor-initform old) d)) @@ -604,6 +613,8 @@ if default value is nil." (cold (car (cl-member a (eieio--class-class-slots newc) :key #'cl--slot-descriptor-name)))) (cl-pushnew a eieio--known-slot-names) + (when (eq alloc :class) + (cl-pushnew a eieio--known-class-slot-names)) (condition-case nil (if (sequencep d) (setq d (copy-sequence d))) ;; This copy can fail on a cons cell with a non-cons in the cdr. Let's @@ -679,7 +690,7 @@ the new child class." (defun eieio--perform-slot-validation (spec value) "Return non-nil if SPEC does not match VALUE." (or (eq spec t) ; t always passes - (eq value eieio-unbound) ; unbound always passes + (eq value eieio--unbound) ; unbound always passes (cl-typep value spec))) (defun eieio--validate-slot-value (class slot-idx value slot) @@ -715,7 +726,7 @@ an error." INSTANCE is the object being referenced. SLOTNAME is the offending slot. If the slot is ok, return VALUE. Argument FN is the function calling this verifier." - (if (and (eq value eieio-unbound) (not eieio-skip-typecheck)) + (if (and (eq value eieio--unbound) (not eieio-skip-typecheck)) (slot-unbound instance (eieio--object-class instance) slotname fn) value)) @@ -755,15 +766,29 @@ Argument FN is the function calling this verifier." (eieio-barf-if-slot-unbound (aref obj c) obj slot 'oref)))) -(defun eieio-oref-default (obj slot) +(defun eieio-oref-default (class slot) "Do the work for the macro `oref-default' with similar parameters. -Fills in OBJ's SLOT with its default value." - (declare (gv-setter eieio-oset-default)) - (cl-check-type obj (or eieio-object class)) +Fills in CLASS's SLOT with its default value." + (declare (gv-setter eieio-oset-default) + (compiler-macro + (lambda (exp) + (ignore class) + (pcase slot + ((and (or `',name (and name (pred keywordp))) + (guard (not (memq name eieio--known-slot-names)))) + (macroexp-warn-and-return + (format-message "Unknown slot `%S'" name) exp 'compile-only)) + ((and (or `',name (and name (pred keywordp))) + (guard (not (memq name eieio--known-class-slot-names)))) + (macroexp-warn-and-return + (format-message "Slot `%S' is not class-allocated" name) + exp 'compile-only)) + (_ exp))))) + (cl-check-type class (or eieio-object class)) (cl-check-type slot symbol) - (let* ((cl (cond ((symbolp obj) (cl--find-class obj)) - ((eieio-object-p obj) (eieio--object-class obj)) - (t obj))) + (let* ((cl (cond ((symbolp class) (cl--find-class class)) + ((eieio-object-p class) (eieio--object-class class)) + (t class))) (c (eieio--slot-name-index cl slot))) (if (not c) ;; It might be missing because it is a :class allocated slot. @@ -773,27 +798,13 @@ Fills in OBJ's SLOT with its default value." ;; Oref that slot. (aref (eieio--class-class-allocation-values cl) c) - (slot-missing obj slot 'oref-default)) + (slot-missing class slot 'oref-default)) (eieio-barf-if-slot-unbound (let ((val (cl--slot-descriptor-initform (aref (eieio--class-slots cl) (- c (eval-when-compile eieio--object-num-slots)))))) - (eieio-default-eval-maybe val)) - obj (eieio--class-name cl) 'oref-default)))) - -(defun eieio-default-eval-maybe (val) - "Check VAL, and return what `oref-default' would provide." - ;; FIXME: What the hell is this supposed to do? Shouldn't it evaluate - ;; variables as well? Why not just always call `eval'? - (cond - ;; Is it a function call? If so, evaluate it. - ((eieio-eval-default-p val) - (eval val t)) - ;;;; check for quoted things, and unquote them - ;;((and (consp val) (eq (car val) 'quote)) - ;; (car (cdr val))) - ;; return it verbatim - (t val))) + (eval val t)) + class (eieio--class-name cl) 'oref-default)))) (defun eieio-oset (obj slot value) "Do the work for the macro `oset'. @@ -820,6 +831,20 @@ Fills in OBJ's SLOT with VALUE." (defun eieio-oset-default (class slot value) "Do the work for the macro `oset-default'. Fills in the default value in CLASS' in SLOT with VALUE." + (declare (compiler-macro + (lambda (exp) + (ignore class value) + (pcase slot + ((and (or `',name (and name (pred keywordp))) + (guard (not (memq name eieio--known-slot-names)))) + (macroexp-warn-and-return + (format-message "Unknown slot `%S'" name) exp 'compile-only)) + ((and (or `',name (and name (pred keywordp))) + (guard (not (memq name eieio--known-class-slot-names)))) + (macroexp-warn-and-return + (format-message "Slot `%S' is not class-allocated" name) + exp 'compile-only)) + (_ exp))))) (setq class (eieio--class-object class)) (cl-check-type class eieio--class) (cl-check-type slot symbol) @@ -836,22 +861,18 @@ Fills in the default value in CLASS' in SLOT with VALUE." (signal 'invalid-slot-name (list (eieio--class-name class) slot))) ;; `oset-default' on an instance-allocated slot is allowed by EIEIO but ;; not by CLOS and is mildly inconsistent with the :initform thingy, so - ;; it'd be nice to get of it. This said, it is/was used at one place by - ;; gnus/registry.el, so it might be used elsewhere as well, so let's - ;; keep it for now. + ;; it'd be nice to get rid of it. + ;; This said, it is/was used at one place by gnus/registry.el, so it + ;; might be used elsewhere as well, so let's keep it for now. ;; FIXME: Generate a compile-time warning for it! ;; (error "Can't `oset-default' an instance-allocated slot: %S of %S" ;; slot class) (eieio--validate-slot-value class c value slot) ;; Set this into the storage for defaults. - (if (eieio-eval-default-p value) - (error "Can't set default to a sexp that gets evaluated again")) (setf (cl--slot-descriptor-initform - ;; FIXME: Apparently we set it both in `slots' and in - ;; `object-cache', which seems redundant. (aref (eieio--class-slots class) (- c (eval-when-compile eieio--object-num-slots)))) - value) + (macroexp-quote value)) ;; Take the value, and put it into our cache object. (eieio-oset (eieio--class-default-object-cache class) slot value) @@ -1093,8 +1114,20 @@ These match if the argument is the name of a subclass of CLASS." (defmacro eieio-declare-slots (&rest slots) "Declare that SLOTS are known eieio object slot names." - `(eval-when-compile - (setq eieio--known-slot-names (append ',slots eieio--known-slot-names)))) + (let ((slotnames (mapcar (lambda (s) (if (consp s) (car s) s)) slots)) + (classslots (delq nil + (mapcar (lambda (s) + (when (and (consp s) + (eq :class (plist-get (cdr s) + :allocation))) + (car s))) + slots)))) + `(eval-when-compile + ,@(when classslots + (mapcar (lambda (s) `(add-to-list 'eieio--known-class-slot-names ',s)) + classslots)) + ,@(mapcar (lambda (s) `(add-to-list 'eieio--known-slot-names ',s)) + slotnames)))) (provide 'eieio-core) diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el index 8257f7a4bae..d7d078b2d94 100644 --- a/lisp/emacs-lisp/eieio-custom.el +++ b/lisp/emacs-lisp/eieio-custom.el @@ -46,7 +46,7 @@ :documentation "A string for testing custom. This is the next line of documentation.") (listostuff :initarg :listostuff - :initform ("1" "2" "3") + :initform '("1" "2" "3") :type list :custom (repeat (string :tag "Stuff")) :label "List of Strings" diff --git a/lisp/emacs-lisp/eieio-speedbar.el b/lisp/emacs-lisp/eieio-speedbar.el index c25ea8acee9..3f2a6537ab8 100644 --- a/lisp/emacs-lisp/eieio-speedbar.el +++ b/lisp/emacs-lisp/eieio-speedbar.el @@ -248,7 +248,7 @@ and take the appropriate action." Possible values are those symbols supported by the `exp-button-type' argument to `speedbar-make-tag-line'." :allocation :class) - (buttonface :initform speedbar-tag-face + (buttonface :initform 'speedbar-tag-face :type (or symbol face) :documentation "The face used on the textual part of the button for this class. @@ -265,15 +265,15 @@ Add one of the child classes to this class to the parent list of a class." :abstract t) (defclass eieio-speedbar-directory-button (eieio-speedbar) - ((buttontype :initform angle) - (buttonface :initform speedbar-directory-face)) + ((buttontype :initform 'angle) + (buttonface :initform 'speedbar-directory-face)) "Class providing support for objects which behave like a directory." :method-invocation-order :depth-first :abstract t) (defclass eieio-speedbar-file-button (eieio-speedbar) - ((buttontype :initform bracket) - (buttonface :initform speedbar-file-face)) + ((buttontype :initform 'bracket) + (buttonface :initform 'speedbar-file-face)) "Class providing support for objects which behave like a file." :method-invocation-order :depth-first :abstract t) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 31b6b0945bb..1c8c372aaef 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -131,6 +131,7 @@ and reference them using the function `class-option'." (let ((testsym1 (intern (concat (symbol-name name) "-p"))) (testsym2 (intern (format "%s--eieio-childp" name))) + (warnings '()) (accessors ())) ;; Collect the accessors we need to define. @@ -145,6 +146,8 @@ and reference them using the function `class-option'." ;; Update eieio--known-slot-names already in case we compile code which ;; uses this before the class is loaded. (cl-pushnew sname eieio--known-slot-names) + (when (eq alloc :class) + (cl-pushnew sname eieio--known-class-slot-names)) (if eieio-error-unsupported-class-tags (let ((tmp soptions)) @@ -176,8 +179,22 @@ and reference them using the function `class-option'." (signal 'invalid-slot-type (list :label label))) ;; Is there an initarg, but allocation of class? - (if (and initarg (eq alloc :class)) - (message "Class allocated slots do not need :initarg")) + (when (and initarg (eq alloc :class)) + (push (format "Meaningless :initarg for class allocated slot '%S'" + sname) + warnings)) + + (let ((init (plist-get soptions :initform))) + (unless (or (macroexp-const-p init) + (eieio--eval-default-p init)) + ;; FIXME: Historically, EIEIO used a heuristic to try and guess + ;; whether the initform is a form to be evaluated or just + ;; a constant. We use `eieio--eval-default-p' to see what the + ;; heuristic says and if it disagrees with normal evaluation + ;; then tweak the initform to make it fit and emit + ;; a warning accordingly. + (push (format "Ambiguous initform needs quoting: %S" init) + warnings))) ;; Anyone can have an accessor function. This creates a function ;; of the specified name, and also performs a `defsetf' if applicable @@ -223,6 +240,8 @@ This method is obsolete." )) `(progn + ,@(mapcar (lambda (w) (macroexp-warn-and-return w `(progn ',w) 'compile-only)) + warnings) ;; This test must be created right away so we can have self- ;; referencing classes. ei, a class whose slot can contain only ;; pointers to itself. @@ -282,9 +301,7 @@ This method is obsolete." ;;; Get/Set slots in an object. ;; (defmacro oref (obj slot) - "Retrieve the value stored in OBJ in the slot named by SLOT. -Slot is the name of the slot when created by `defclass' or the label -created by the :initarg tag." + "Retrieve the value stored in OBJ in the slot named by SLOT." (declare (debug (form symbolp))) `(eieio-oref ,obj (quote ,slot))) @@ -292,13 +309,11 @@ created by the :initarg tag." (defalias 'set-slot-value #'eieio-oset) (make-obsolete 'set-slot-value "use (setf (slot-value ..) ..) instead" "25.1") -(defmacro oref-default (obj slot) - "Get the default value of OBJ (maybe a class) for SLOT. -The default value is the value installed in a class with the :initform -tag. SLOT can be the slot name, or the tag specified by the :initarg -tag in the `defclass' call." +(defmacro oref-default (class slot) + "Get the value of class allocated slot SLOT. +CLASS can also be an object, in which case we use the object's class." (declare (debug (form symbolp))) - `(eieio-oref-default ,obj (quote ,slot))) + `(eieio-oref-default ,class (quote ,slot))) ;;; Handy CLOS macros ;; @@ -538,11 +553,11 @@ OBJECT can be an instance or a class." ((eieio-object-p object) (eieio-oref object slot)) ((symbolp object) (eieio-oref-default object slot)) (t (signal 'wrong-type-argument (list 'eieio-object-p object)))) - eieio-unbound)))) + eieio--unbound)))) (defun slot-makeunbound (object slot) "In OBJECT, make SLOT unbound." - (eieio-oset object slot eieio-unbound)) + (eieio-oset object slot eieio--unbound)) (defun slot-exists-p (object-or-class slot) "Return non-nil if OBJECT-OR-CLASS has SLOT." @@ -740,18 +755,14 @@ dynamically set from SLOTS." (slots (eieio--class-slots this-class))) (dotimes (i (length slots)) ;; For each slot, see if we need to evaluate it. - ;; - ;; Paul Landes said in an email: - ;; > CL evaluates it if it can, and otherwise, leaves it as - ;; > the quoted thing as you already have. This is by the - ;; > Sonya E. Keene book and other things I've look at on the - ;; > web. (let* ((slot (aref slots i)) - (initform (cl--slot-descriptor-initform slot)) - (dflt (eieio-default-eval-maybe initform))) - (when (not (eq dflt initform)) + (initform (cl--slot-descriptor-initform slot))) + ;; Those slots whose initform is constant already have the right + ;; value set in the default-object. + (unless (macroexp-const-p initform) ;; FIXME: We should be able to just do (aset this (+ i ) dflt)! - (eieio-oset this (cl--slot-descriptor-name slot) dflt))))) + (eieio-oset this (cl--slot-descriptor-name slot) + (eval initform t)))))) ;; Shared initialize will parse our slots for us. (shared-initialize this slots)) diff --git a/lisp/transient.el b/lisp/transient.el index 93a643c78e6..6153b502f7a 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -932,7 +932,7 @@ example, sets a variable use `transient-define-infix' instead. (if (eq k :class) (setq class pop) (setq args (plist-put args k pop))))) - (vector (or level (oref-default 'transient-child level)) + (vector (or level 1) (or class (if (vectorp car) 'transient-columns @@ -1003,7 +1003,7 @@ example, sets a variable use `transient-define-infix' instead. (unless (plist-get args :key) (when-let ((shortarg (plist-get args :shortarg))) (setq args (plist-put args :key shortarg)))) - (list (or level (oref-default 'transient-child level)) + (list (or level 1) (or class 'transient-suffix) args))) @@ -3583,9 +3583,9 @@ we stop there." ;;;; `transient-lisp-variable' (defclass transient-lisp-variable (transient-variable) - ((reader :initform transient-lisp-variable--reader) + ((reader :initform #'transient-lisp-variable--reader) (always-read :initform t) - (set-value :initarg :set-value :initform set)) + (set-value :initarg :set-value :initform #'set)) "[Experimental] Class used for Lisp variables.") (cl-defmethod transient-init-value ((obj transient-lisp-variable)) -- cgit v1.2.3