emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/drupal-mode 50fb7ad1f9 007/308: Add api.drupalcontrib.org


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 50fb7ad1f9 007/308: Add api.drupalcontrib.org for doc search.
Date: Tue, 25 Jan 2022 10:59:02 -0500 (EST)

branch: elpa/drupal-mode
commit 50fb7ad1f9e6639ff52d9c6b8fcb03c2aeee9da2
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Add api.drupalcontrib.org for doc search.
    
    Closes #1.
---
 drupal-mode.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index 56c06d9d3a..f1bd7ce162 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -34,6 +34,7 @@
 ;;; Code:
 
 (require 'php-mode)
+(require 'format-spec)
 
 
 
@@ -65,11 +66,14 @@ According to http://drupal.org/coding-standards#indenting.";
          (const :tag "Never" nil))
   :group 'drupal)
 
-;; 
-(defcustom drupal-search-url "http://api.drupal.org/api/search/%s/%s";
+;; Where to lookup symbols
+(defcustom drupal-search-url "http://api.drupal.org/api/search/%v/%s";
   "The URL to search the Drupal API.
-First parameter is the Drupal version. Second parameter is the search term."
-  :type 'string
+%v is the Drupal major version.
+%s is the search term."
+  :type '(choice (const :tag "Drupal.org" 
"http://api.drupal.org/api/search/%v/%s";)
+                (const :tag "DrupalContrib.org" 
"http://api.drupalcontrib.org/api/search/%v/%s";)
+                (string :tag "Other" 
"http://example.com/search?q=%s&version=%v";))
   :group 'drupal)
 
 (defvar drupal-version nil "Drupal version as auto detected.")
@@ -173,7 +177,9 @@ should save your files with unix style end of line."
 (defun drupal-search-documentation ()
   "Search Drupal documentation for symbol at point."
   (interactive)
-  (browse-url(format drupal-search-url (drupal-major-version drupal-version) 
(symbol-at-point))))
+  (browse-url
+   (format-spec drupal-search-url `((?v . ,(drupal-major-version 
drupal-version))
+                                   (?s . ,(symbol-at-point))))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]