[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/drupal-mode 9d793aa112 286/308: Add support for gxref/xref
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/drupal-mode 9d793aa112 286/308: Add support for gxref/xref |
Date: |
Tue, 25 Jan 2022 10:59:58 -0500 (EST) |
branch: elpa/drupal-mode
commit 9d793aa1121ab8b8abf57260721082e2666c6490
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>
Add support for gxref/xref
---
drupal-mode.el | 1 +
drupal/gxref.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/drupal-mode.el b/drupal-mode.el
index 4c22434358..01349754f0 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -896,6 +896,7 @@ mode-hook."
(eval-after-load 'eldoc '(require 'drupal/eldoc))
(eval-after-load 'etags '(require 'drupal/etags))
(eval-after-load 'gtags '(require 'drupal/gtags))
+(eval-after-load 'gxref '(require 'drupal/gxref))
(eval-after-load 'helm-gtags '(require 'drupal/helm-gtags))
(eval-after-load 'ggtags '(require 'drupal/ggtags))
(eval-after-load 'ispell '(require 'drupal/ispell))
diff --git a/drupal/gxref.el b/drupal/gxref.el
new file mode 100644
index 0000000000..61afe24398
--- /dev/null
+++ b/drupal/gxref.el
@@ -0,0 +1,68 @@
+;;; drupal/gxref.el --- Drupal-mode support for gxref
+
+;; Copyright (C) 2012, 2013, 2014, 2016, 2017 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+
+;; This file is part of Drupal mode.
+
+;; Drupal mode is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
+
+;; Drupal mode is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with Drupal mode. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Enable drupal-mode support for gxref.
+
+;; You must have enabled gxref for this to take effect:
+
+;; (require 'gxref)
+;; (add-to-list 'xref-backend-functions 'gxref-xref-backend)
+
+;;; Code:
+
+(defvar drupal/gxref-global-command (if (boundp 'gxref-global-exe)
+ gxref-global-exe
+ (executable-find "global"))
+ "Name of the GNU GLOBAL `global' executable.
+Include path to the executable if it is not in your $PATH.")
+
+(defun drupal/gxref-enable ()
+ "Setup gxref for use in `drupal-mode'."
+ ;; We only setup in PHP modes for now.
+ (when (apply 'derived-mode-p drupal-php-modes)
+ ;; Setting the label is safe no matter whether we use gxref or not.
+ (set (make-local-variable 'gxref-gtags-label) "drupal")
+
+ ;; Only set symbol collection and function args getter if we think
+ ;; the user actually uses gxref (that is the user added
+ ;; `gxref-xref-backend' to `xref-backend-functions')
+ (when (and (boundp 'xref-backend-functions)
+ (memq 'gxref-xref-backend xref-backend-functions))
+ (setq drupal-symbol-collection #'(lambda ()
+
(xref-backend-identifier-completion-table (xref-find-backend))))
+ (setq drupal-get-function-args #'drupal/gxref-get-function-args))))
+
+(defun drupal/gxref-get-function-args (symbol &optional version)
+ "Get function arguments for SYMBOL from GNU GLOBAL.
+Optional argument VERSION is ignored."
+ (let* ((line (car (gxref--find-symbol symbol)))
+ (string (xref-item-summary line)))
+ (string-match "(\\(.*\\))" string)
+ (match-string-no-properties 1 string)))
+
+(add-hook 'drupal-mode-hook #'drupal/gxref-enable)
+
+
+
+(provide 'drupal/gxref)
+;;; drupal/gxref.el ends here
- [nongnu] elpa/drupal-mode 1627981c94 210/308: Added a `drupal-drush-php-eval`, (continued)
- [nongnu] elpa/drupal-mode 1627981c94 210/308: Added a `drupal-drush-php-eval`, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 936ca4afcd 219/308: Run flycheck phpcs checker in-place, so info file rules work properly., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 6f2b2174fc 233/308: Don't trigger drupal-mode in vendor dirs. Closes #57., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 5b5ab1fb42 235/308: Merge pull request #58 from arnested/ignore-vendor, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 46205ad74c 244/308: Merge branch 'release/0.6.0', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode cf0364cbaf 248/308: Merge branch 'release/0.6.1', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode d9745316b3 261/308: Merge pull request #62 from arnested/feature/helm-gtags-compatibility, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 0a23dc084a 266/308: Add autoinsert template for .api.php files, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 947b893b37 274/308: Handle case where `c-default-style` is a string, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f93cdfe1b2 278/308: Use proper indent for continuation lines, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 9d793aa112 286/308: Add support for gxref/xref,
ELPA Syncer <=
- [nongnu] elpa/drupal-mode dc82e5430c 295/308: Handle .info.yml files, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode a1c77dca8b 300/308: Prefer HTTPS URLs wherever we can, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 83ee02f80a 024/308: Renamed `drupal-root' to `drupal-rootdir'., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 4ef339db0a 045/308: Don't locate standard for each buffer., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 808d1f1768 080/308: Use `eldoc-mode' for function argument tips., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode ca7773df72 102/308: Added `drupal-mode-beginning-of-line' for .info files., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f17e7088ca 107/308: Provide Drupal projects as webjump sites., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 043644e85d 109/308: Set correct comment style for inline comments., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode dfd4582048 115/308: Fixed argument insert in `drupal-insert-hook'., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode dcea92f3a9 117/308: Added autoinsert skeleton for .test files., ELPA Syncer, 2022/01/25