[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/drupal-mode 97b60197d0 151/308: Improved rootdir detection
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/drupal-mode 97b60197d0 151/308: Improved rootdir detection for etags and gtags. |
Date: |
Tue, 25 Jan 2022 10:59:40 -0500 (EST) |
branch: elpa/drupal-mode
commit 97b60197d00b29e3fc47a38b79ccfbc4a0e4ff64
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>
Improved rootdir detection for etags and gtags.
No need to rely on `drupal-rootdir`. Use root directories based on the
TAGS and GTAGS files.
---
drupal/emacs-drush.el | 9 +++++----
drupal/etags.el | 32 +++++++++++++++++---------------
drupal/gtags.el | 26 +++++++++++++-------------
3 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/drupal/emacs-drush.el b/drupal/emacs-drush.el
index df7d808682..d483e6c2ee 100644
--- a/drupal/emacs-drush.el
+++ b/drupal/emacs-drush.el
@@ -1,6 +1,6 @@
;;; drupal/emacs-drush.el --- Drupal-mode support for Drush utilities for
Emacs users
-;; Copyright (C) 2012 Arne Jørgensen
+;; Copyright (C) 2012, 2013 Arne Jørgensen
;; Author: Arne Jørgensen <arne@arnested.dk>
@@ -47,11 +47,12 @@ Requires `Drush utilities for Emacs users' to be installed."
(defun drupal/emacs-drush-run-after-save ()
"Run drush etags/gtags on after-save-hook."
(when (and drupal/emacs-drush-update-tags-after-save
- (boundp 'drupal-rootdir)
drupal-drush-program)
- (when (file-exists-p (concat drupal-rootdir "TAGS"))
+ (when (and (boundp 'drupal/etags-rootdir)
+ (file-exists-p (concat drupal/etags-rootdir "TAGS")))
(call-process drupal-drush-program nil 0 nil "etags"))
- (when (file-exists-p (concat drupal-rootdir "GTAGS"))
+ (when (and (boundp 'gtags-rootdir)
+ (file-exists-p (concat gtags-rootdir "GTAGS")))
(call-process drupal-drush-program nil 0 nil "gtags"))))
(defun drupal/emacs-drush-enable ()
diff --git a/drupal/etags.el b/drupal/etags.el
index a22b49e0f5..9dfda51d0a 100644
--- a/drupal/etags.el
+++ b/drupal/etags.el
@@ -1,6 +1,6 @@
;;; drupal/etags.el --- Drupal-mode support for etags
-;; Copyright (C) 2012 Arne Jørgensen
+;; Copyright (C) 2012, 2013 Arne Jørgensen
;; Author: Arne Jørgensen <arne@arnested.dk>
@@ -29,23 +29,25 @@
(require 'drupal/emacs-drush)
(defun drupal/etags-enable ()
- "Setup TAGS file for etags if it exists in DRUPAL_ROOT."
- (when (and (boundp 'drupal-rootdir)
- (file-exists-p (concat drupal-rootdir "TAGS")))
- ;; Set `tags-file-name' to the TAGS file located in
- ;; `drupal-rootdir'.
- (setq tags-file-name (concat drupal-rootdir "TAGS"))
- (tags-completion-table)
-
- ;; Set `drupal-symbol-collection' to `tags-completion-table' so
- ;; that inserting hooks will do completion based on etags.
- (setq drupal-get-function-args #'drupal/etags-get-function-args)
- (setq drupal-symbol-collection #'tags-completion-table)))
+ "Setup TAGS file for etags if it exists."
+ (let ((dir (locate-dominating-file (buffer-file-name) "TAGS")))
+ (when dir
+ (set (make-local-variable 'drupal/etags-rootdir) dir)
+
+ ;; Set `tags-file-name' to the TAGS file located in
+ ;; `drupal-rootdir'.
+ (setq tags-file-name (concat drupal/etags-rootdir "TAGS"))
+ (tags-completion-table)
+
+ ;; Set `drupal-symbol-collection' to `tags-completion-table' so
+ ;; that inserting hooks will do completion based on etags.
+ (setq drupal-get-function-args #'drupal/etags-get-function-args)
+ (setq drupal-symbol-collection #'tags-completion-table))))
(defun drupal/etags-get-function-args (symbol &optional version)
"Get function arguments from etags TAGS."
- (when (and (boundp 'drupal-rootdir)
- (file-exists-p (concat drupal-rootdir "TAGS")))
+ (when (and (boundp 'drupal/etags-rootdir)
+ (file-exists-p (concat drupal/etags-rootdir "TAGS")))
(with-current-buffer (find-tag-noselect symbol nil nil)
(goto-char (point-min))
(when (re-search-forward
diff --git a/drupal/gtags.el b/drupal/gtags.el
index e2267ac54f..2b7959eadf 100644
--- a/drupal/gtags.el
+++ b/drupal/gtags.el
@@ -35,22 +35,22 @@
Include path to the executable if it is not in your $PATH.")
(defun drupal/gtags-enable ()
- "Setup rootdir for gtags to be DRUPAL_ROOT."
- (when (and (boundp 'drupal-rootdir)
- (file-exists-p (concat drupal-rootdir "GTAGS")))
- (setq gtags-rootdir drupal-rootdir)
-
- ;; Set `drupal-symbol-collection' to a call to
- ;; `gtags-completing-gtags' so that inserting hooks will do
- ;; completion based on gtags.
- (setq drupal-symbol-collection #'(lambda() (gtags-completing-gtags "" nil
t)))
- (setq drupal-get-function-args #'drupal/gtags-get-function-args)
- (gtags-mode 1)))
+ "Setup rootdir for gtags."
+ (let ((dir (locate-dominating-file (buffer-file-name) "GTAGS")))
+ (when dir
+ (set (make-local-variable 'gtags-rootdir) dir)
+
+ ;; Set `drupal-symbol-collection' to a call to
+ ;; `gtags-completing-gtags' so that inserting hooks will do
+ ;; completion based on gtags.
+ (setq drupal-symbol-collection #'(lambda() (gtags-completing-gtags ""
nil t)))
+ (setq drupal-get-function-args #'drupal/gtags-get-function-args)
+ (gtags-mode 1))))
(defun drupal/gtags-get-function-args (symbol &optional version)
"Get function arguments from GNU GLOBAL."
- (when (and (boundp 'drupal-rootdir)
- (file-exists-p (concat drupal-rootdir "GTAGS")))
+ (when (and (boundp 'gtags-rootdir)
+ (file-exists-p (concat gtags-rootdir "GTAGS")))
(with-temp-buffer
(ignore-errors
(call-process drupal/gtags-global-command nil t nil "-x" symbol)
- [nongnu] elpa/drupal-mode c81cdfd343 096/308: Made `drupal-search-url' et el safe for `string-or-null-p'., (continued)
- [nongnu] elpa/drupal-mode c81cdfd343 096/308: Made `drupal-search-url' et el safe for `string-or-null-p'., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 05e0a86bed 099/308: Added keyboard shortcut for `drupal-module-name'., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode ae4dd40f05 122/308: Added pcomplete for drush., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 57897dbed5 125/308: Fixed locating drush version number., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 0b9e5d25b4 129/308: Added basic support for flycheck., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 4f54f8bcb8 134/308: Fixed documentation., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode bd22697642 135/308: Mark `drupal/flymake-phpcs-standard' as obsolete., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 3ba088c812 139/308: No need for make-local-variable., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode a6a4bfa842 144/308: No quoting necessary, says wiser minds than mine., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 996081be40 157/308: Merge branch 'release/0.3.0', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 97b60197d0 151/308: Improved rootdir detection for etags and gtags.,
ELPA Syncer <=
- [nongnu] elpa/drupal-mode 8733eb2d1e 160/308: Bumped versio to 0.3.1., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 31c2b672aa 168/308: Added Api.drupalize.me as `drupal-search-url` option., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 6bb266bc11 172/308: Fixed typo in latest commit., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 2b71509ac3 171/308: Used `(buffer-name)` as fallback if `buffer-file-name` us not set., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 135c5f669e 197/308: Add interface with gtags via `ggtags.el', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode b929895d51 184/308: Added own implementation of flymake init and temp names., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 7402b9e9fb 201/308: Merge pull request #43 from arnested/flycheck-update, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 60b231a125 202/308: Bumped version to 0.5.0., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode c83705239e 214/308: Merge pull request #50 from kaaresl/develop, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 5911ac2158 211/308: Fixed bad indentation., ELPA Syncer, 2022/01/25