[Top][All Lists]

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

[ELPA-diffs] ELPA branch, master, updated. 9cb8d5c83a8fabb80576937e7a0df

From: Leo Liu
Subject: [ELPA-diffs] ELPA branch, master, updated. 9cb8d5c83a8fabb80576937e7a0df0b2a4389665
Date: Sun, 03 Nov 2013 05:01:04 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "ELPA".

The branch, master has been updated
       via  9cb8d5c83a8fabb80576937e7a0df0b2a4389665 (commit)
       via  5e0082e8128e516652de0274f1440f5610483d3f (commit)
       via  8a97edfaee5d550d1ea1b9dd6806ada6a8886e62 (commit)
      from  0cdc945e2cdc9e1f7a72ed03639cff7edecc12ea (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9cb8d5c83a8fabb80576937e7a0df0b2a4389665
Merge: 0cdc945 5e0082e
Author: Leo Liu <address@hidden>
Date:   Sun Nov 3 13:00:40 2013 +0800

    Merge branch 'master' of github.com:leoliu/ggtags

commit 5e0082e8128e516652de0274f1440f5610483d3f
Author: Leo Liu <address@hidden>
Date:   Sun Nov 3 12:56:37 2013 +0800

    New command ggtags-browse-file-as-hypertext

diff --git a/ggtags.el b/ggtags.el
index 5bc27eb..54fa3db 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -480,6 +480,24 @@ Global and Emacs."
           (when (window-live-p win)
             (quit-window t win)))))))
+(defun ggtags-browse-file-as-hypertext (file)
+  "Browse FILE in hypertext (HTML) form."
+  (interactive (list (if (or current-prefix-arg (not buffer-file-name))
+                         (read-file-name "Browse file: " nil nil t)
+                       buffer-file-name)))
+  (or (and file (file-exists-p file)) (error "File `%s' doesn't exist" file))
+  (ggtags-check-project)
+  (or (file-exists-p (expand-file-name "HTML" (ggtags-current-project-root)))
+      (if (yes-or-no-p "No hypertext form exists; run htags? ")
+          (let ((default-directory (ggtags-current-project-root)))
+            (ggtags-with-ctags-maybe (ggtags-process-string "htags")))
+        (user-error "Aborted")))
+  (let ((url (ggtags-process-string
+              "gozilla" "-p" (format "+%d" (line-number-at-pos)) file)))
+    (when (called-interactively-p 'interactive)
+      (message "Browsing %s" url))
+    (browse-url url)))
 (defvar ggtags-current-mark nil)
 (defun ggtags-next-mark (&optional arg)
@@ -802,6 +820,7 @@ Global and Emacs."
     (define-key m "\M-s" 'ggtags-find-other-symbol)
     (define-key m "\M-g" 'ggtags-grep)
     (define-key m "\M-i" 'ggtags-idutils-query)
+    (define-key m "\M-b" 'ggtags-browse-file-as-hypertext)
     (define-key m "\M-k" 'ggtags-kill-file-buffers)
     (define-key m (kbd "M-%") 'ggtags-query-replace)
@@ -826,6 +845,9 @@ Global and Emacs."
       '(menu-item "Customize Ggtags"
                   (lambda () (interactive) (customize-group 'ggtags))))
     (define-key menu [sep2] menu-bar-separator)
+    (define-key menu [browse-hypertext]
+      '(menu-item "Browse as hypertext" ggtags-browse-file-as-hypertext
+                  :enable (ggtags-find-project)))
     (define-key menu [delete-tags]
       '(menu-item "Delete tag files" ggtags-delete-tag-files
                   :enable (ggtags-find-project)))

commit 8a97edfaee5d550d1ea1b9dd6806ada6a8886e62
Author: Leo Liu <address@hidden>
Date:   Sun Nov 3 11:00:16 2013 +0800

    New variable ggtags-bounds-of-tag-function
    to customise how ggtags determines the tag at point.
    (thing-at-point 'symbol) doesn't work for some major modes.

diff --git a/ggtags.el b/ggtags.el
index dbe8d62..5bc27eb 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -143,6 +143,12 @@ properly update `ggtags-mode-map'."
   :type 'function
   :group 'ggtags)
+(defcustom ggtags-bounds-of-tag-function (lambda ()
+                                           (bounds-of-thing-at-point 'symbol))
+  "Function to get the start and end locations of the tag at point."
+  :type 'function
+  :group 'ggtags)
 (defvar ggtags-bug-url "https://github.com/leoliu/ggtags/issues";)
 (defvar ggtags-current-tag-name nil)
@@ -195,6 +201,10 @@ properly update `ggtags-mode-map'."
           (error "`%s' non-zero exit: %s" program output))
+(defun ggtags-tag-at-point ()
+  (let ((bounds (funcall ggtags-bounds-of-tag-function)))
+    (and bounds (buffer-substring (car bounds) (cdr bounds)))))
 ;;; Store for project settings
 (defvar ggtags-projects (make-hash-table :size 7 :test #'equal))
@@ -297,7 +307,7 @@ properly update `ggtags-mode-map'."
 (defun ggtags-read-tag ()
-  (let ((default (thing-at-point 'symbol))
+  (let ((default (ggtags-tag-at-point))
         (completing-read-function ggtags-completing-read-function))
     (setq ggtags-current-tag-name
           (cond (current-prefix-arg
@@ -385,7 +395,7 @@ With a prefix arg (non-nil DEFINITION) always find 
   (let ((prompt (if (string-match ": *\\'" prompt)
                     (substring prompt 0 (match-beginning 0))
-        (default (thing-at-point 'symbol)))
+        (default (ggtags-tag-at-point)))
     (read-string (format (if default "%s (default `%s'): "
                            "%s: ")
                          prompt default)
@@ -883,7 +893,7 @@ Global and Emacs."
     (unless (overlayp ggtags-tag-overlay)
       (setq ggtags-tag-overlay (make-overlay (point) (point)))
       (overlay-put ggtags-tag-overlay 'ggtags t))
-    (let* ((bounds (bounds-of-thing-at-point 'symbol))
+    (let* ((bounds (funcall ggtags-bounds-of-tag-function))
            (valid-tag (when bounds
                          (buffer-substring (car bounds) (cdr bounds))


Summary of changes:
 packages/ggtags/ggtags.el |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)


reply via email to

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