[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/drupal-mode 8e19894d55 051/308: `drupal-insert-hook' got c
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/drupal-mode 8e19894d55 051/308: `drupal-insert-hook' got completing-read support. |
Date: |
Tue, 25 Jan 2022 10:59:22 -0500 (EST) |
branch: elpa/drupal-mode
commit 8e19894d5556516ebcbf85617e0bed26226ea9f7
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>
`drupal-insert-hook' got completing-read support.
`drupal-insert-hook' can do completing-read on hook name if a symbol
collection of Drupal function names exists.
drupal/etags.el provides a collection based on
`tags-completion-table'.
---
drupal-mode.el | 10 +++++++++-
drupal/etags.el | 10 ++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drupal-mode.el b/drupal-mode.el
index 389472c9b1..7957bec46c 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -310,11 +310,19 @@ should save your files with unix style end of line."
(?s . ,symbol))))))))
+(defvar drupal-symbol-collection nil
+ "A collection or a function returning a collection of Drupal symbols.
+Used by `drupal-insert-hook' to provide completions on hooks.")
+(make-variable-buffer-local 'drupal-symbol-collection)
(define-skeleton drupal-insert-hook
"Insert Drupal hook function skeleton."
nil
- '(setq v1 (skeleton-read "Hook: " "hook_"))
+ '(setq v1 (completing-read "Hook: "
+ (if (functionp drupal-symbol-collection)
+ (funcall drupal-symbol-collection)
+ drupal-symbol-collection)
+ nil nil "hook_"))
"/**\n"
" * Implements " v1 "().\n"
" */\n"
diff --git a/drupal/etags.el b/drupal/etags.el
index 77c9a55253..540c7358e9 100644
--- a/drupal/etags.el
+++ b/drupal/etags.el
@@ -11,8 +11,14 @@
(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")))
- (setq tags-file-name (concat drupal-rootdir "TAGS"))))
+ (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"))
+
+ ;; Set `drupal-symbol-collection' to `tags-completion-table' so
+ ;; that inserting hooks will do completion based on etags.
+ (setq drupal-symbol-collection 'tags-completion-table)))
(add-hook 'drupal-mode-hook 'drupal/etags-enable)
- [nongnu] elpa/drupal-mode f95aa10028 038/308: Optimized variable expansion in Makefile., (continued)
- [nongnu] elpa/drupal-mode f95aa10028 038/308: Optimized variable expansion in Makefile., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f04ae2825d 034/308: Merge branch 'release/0.2.0', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode c8832210b3 032/308: Documentation was rewritten and extended., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode dec5279338 041/308: Removed generated file drupal-mode.info., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode c68f560494 075/308: Fixed regexp for extracting function arguments., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode cda13dfb21 063/308: Added better bootstrapping of Drupal mode., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 55a523b65f 046/308: No need to restart check since flymake-phpcs 1.0.4, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f02cb3d8eb 044/308: Drupal version also outside full projects., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode d9a34a4a5f 065/308: Enabled `gtags-mode` if GTAGS is in use., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f491ac72b9 081/308: Redefined key bindings., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 8e19894d55 051/308: `drupal-insert-hook' got completing-read support.,
ELPA Syncer <=
- [nongnu] elpa/drupal-mode af2b2c5a76 118/308: Changed `replace-regexp-in-string` to `subst-char-in-string`., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 243db30a93 004/308: Compiled elisp should not be committed., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 21a3c7544d 049/308: Drupal menu adjusted., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode d3b4c6f1e7 112/308: Added variable for GNU GLOBAL`global' command., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f150913830 050/308: Added skeletons for functions and hooks., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 6a7322f581 052/308: Optimized for byte-compile by using #' shorthand., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode d0031d4c1f 056/308: Added/adjusted COPYING information., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode b4496a561f 047/308: Revert parts of 55a523b65fe53ca06f429cffd91ead6ff76667d2, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode b34cc6fb8f 042/308: Ensured flymake-phpcs is run in php-mode buffers., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 88d744068c 073/308: Fixed regexp., ELPA Syncer, 2022/01/25