[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole fed1547 09/53: * hib-social.el (hibtypes-soci
From: |
Robert Weiner |
Subject: |
[elpa] externals/hyperbole fed1547 09/53: * hib-social.el (hibtypes-social-default-service): Changed to use a radio |
Date: |
Wed, 15 Nov 2017 22:46:59 -0500 (EST) |
branch: externals/hyperbole
commit fed154781c5bf75e81ab67889b005f4fd00e1a72
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>
* hib-social.el (hibtypes-social-default-service): Changed to use a radio
button choice when customizing this.
(hibtypes-social-hashtag-alist,
hibtypes-social-username-alist): Added
github user and commit lookup via social link syntax.
(hibtypes-social-github-default-user):
(hibtypes-social-github-default-project)
(github-commit-reference): Added this new action and its
above default values.
(hibtypes-social-regexp): Updated to allow
github#user/project/commit-hashtag references. So now all of the
following are recognized as github commit links if the default user
and project settings are set up:
gh#rswgnu/hyperbole/5ae3550 (if include user must include project)
github#hyperbole/5ae3550 (project can be given with user default)
gh#5ae3550 (user and project defaults are used)
Additionally, address@hidden can be used to jump to user rswgnu's github
home page.
DEMO (Github): Added to demonstrate github references.
* hibtypes.el (annot-bib): Moved in priority below social hashtags and
denied matching to anything containing a # or @ character so
address@hidden doesn't match as an annot-bib entry.
* hui-mouse.el (hkey-alist): Added helm support for Smart Key presses in
the minibuffer window (runs the standard RET command).
---
Changes | 30 ++++++++++++++++++++++++
DEMO | 25 +++++++++++++++++++-
hib-social.el | 75 +++++++++++++++++++++++++++++++++++++++++++++--------------
hibtypes.el | 30 +++++++++++++-----------
hui-menu.el | 2 +-
hui-mouse.el | 7 ++++--
6 files changed, 133 insertions(+), 36 deletions(-)
diff --git a/Changes b/Changes
index 44b7f55..d645ec2 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,36 @@
+2017-09-19 Bob Weiner <address@hidden>
+
+* hib-social.el (hibtypes-social-default-service): Changed to use a radio
+ button choice when customizing this.
+ (hibtypes-social-hashtag-alist,
hibtypes-social-username-alist): Added
+ github user and commit lookup via social link syntax.
+ (hibtypes-social-github-default-user):
+ (hibtypes-social-github-default-project)
+ (github-commit-reference): Added this new action and its
+ above default values.
+ (hibtypes-social-regexp): Updated to allow
+ github#user/project/commit-hashtag references. So now all of the
+ following are recognized as github commit links if the default user
+ and project settings are set up:
+ gh#rswgnu/hyperbole/5ae3550 (if include user must include project)
+ github#hyperbole/5ae3550 (project can be given with user default)
+ gh#5ae3550 (user and project defaults are used)
+
+ Additionally, address@hidden can be used to jump to user rswgnu's github
+ home page.
+ DEMO (Github): Added to demonstrate github references.
+
+* hibtypes.el (annot-bib): Moved in priority below social hashtags and
+ denied matching to anything containing a # or @ character so
+ address@hidden doesn't match as an annot-bib entry.
+
+* hui-mouse.el (hkey-alist): Added helm support for Smart Key presses in
+ the minibuffer window (runs the standard RET command).
+
2017-09-18 Bob Weiner <address@hidden>
* hui-mouse.el (smart-helm): Finalized and added doc. of contexts and actions.
+ Made smart-helm ignore helm candidate separator lines.
* hui-window.el (smart-coords-in-window-p):
(hmouse-drag-window-side): Handled null value of coords.
diff --git a/DEMO b/DEMO
index 53d0a58..f9a6e42 100644
--- a/DEMO
+++ b/DEMO
@@ -1,3 +1,6 @@
+
+
+
* GNU Hyperbole Demonstration and Introduction by Bob Weiner
Welcome to GNU Hyperbole. Hyperbole will super-charge your GNU Emacs
@@ -441,7 +444,7 @@ includes your system information.
** Social Media Hashtags and Usernames
-An Action Key press a social media hashtag or username reference at point
+An Action Key press on a social media hashtag or username reference at point
displays the web page associated with the reference at the associated
service. References are of the form:
[facebook|instagram|address@hidden<hashtag-or-username> or
@@ -456,6 +459,26 @@ at instagram. Try pressing the Action Key on these if you
like.
The file "hib-social.el" has more details on this.
+** Github Commit Hashtags and Usernames
+
+For software developers who use Github for publishing and version control,
+Github links are similar to social media links but reference specific Github
+web pages.
+
+Press the Action Key on address@hidden to go to RSW's gihub home page.
address@hidden works too.
+
+References to specific commits use the # hash symbol and short versions
+of the git commit hash code:
+ gh#rswgnu/hyperbole/5ae3550 (if include user, must include project)
+ github#hyperbole/5ae3550 (project can be given with user default)
+ gh#5ae3550 (user and project defaults are used)
+
+An Action Key presses on the first one will work because user, project
+and commit hash code are all included. The second and third versions
+require the setup of default values as explained in
+"(hyperbole)github-reference".
+
** Grep, Occurrence, Debugger and Compiler Error Buttons, and Cscope Analyzer
Lines
diff --git a/hib-social.el b/hib-social.el
index 62e441d..fda669f 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -37,7 +37,10 @@
(defcustom hibtypes-social-default-service "twitter"
"Lowercase string matching the name of the default social media service to
use when none is specified."
- :type 'string
+ :type '(radio (const "facebook")
+ (const "github")
+ (const "instagram")
+ (const "twitter"))
:group 'hyperbole-button)
(defcustom hibtypes-social-display-function #'browse-url
@@ -45,23 +48,37 @@
:type 'function
:group 'hyperbole-button)
+(defcustom hibtypes-social-github-default-project nil
+ "Default project name to associate with any Github commit link."
+ :type 'string
+ :group 'hyperbole-button)
+
+(defcustom hibtypes-social-github-default-user nil
+ "Default user name to associate with any Github commit link."
+ :type 'string
+ :group 'hyperbole-button)
+
;;; ************************************************************************
;;; Private variables
;;; ************************************************************************
(defconst hibtypes-social-hashtag-alist
- '(("\\`\\(fb\\|facebook\\)\\'" . "https://www.facebook.com/hashtag/%s")
- ("\\`\\(tw\\|twitter\\)\\'" .
"https://twitter.com/search?q=%%23%s&src=hashtag")
- ("\\`\\(in\\|instagram\\)\\'" .
"https://www.instagram.com/explore/tags/%s/"))
+ '(("\\`\\(fb\\|facebook\\)\\'" . "https://www.facebook.com/hashtag/%s")
+ ("\\`\\(gh\\|github\\)\\'" . "https://github.com/%s/%s/commit/%s")
+ ("\\`\\(in\\|instagram\\)\\'" .
"https://www.instagram.com/explore/tags/%s/")
+ ("\\`\\(tw\\|twitter\\)\\'" .
"https://twitter.com/search?q=%%23%s&src=hashtag")
+)
"Alist of (social-media-service-regexp . url-with-%s-for-hashtag)
elements.")
(defconst hibtypes-social-username-alist
- '(("\\`\\(fb\\|facebook\\)\\'" . "https://www.facebook.com/%s")
- ("\\`\\(tw\\|twitter\\)\\'" . "https://twitter.com/address@hidden")
- ("\\`\\(in\\|instagram\\)\\'" . "https://www.instagram.com/%s/"))
+ '(("\\`\\(fb\\|facebook\\)\\'" . "https://www.facebook.com/%s")
+ ("\\`\\(gh\\|github\\)\\'" . "https://github.com/%s/")
+ ("\\`\\(in\\|instagram\\)\\'" . "https://www.instagram.com/%s/")
+ ("\\`\\(tw\\|twitter\\)\\'" . "https://twitter.com/address@hidden")
+ )
"Alist of (social-media-service-regexp . url-with-%s-for-username)
elements.")
-(defconst hibtypes-social-regexp
"\\([[:alpha:]]*\\)\\(address@hidden)\\([._[:alnum:]]*[_[:alnum:]]\\)"
+(defconst hibtypes-social-regexp
"\\([[:alpha:]]*\\)\\(address@hidden)\\([[:alnum:]]*[._/[:alnum:]]*[_[:alnum:]]\\)"
"Regular expression that matches a social media hashtag or username
reference.
See `ibtypes::social-reference' for format details.")
@@ -93,8 +110,8 @@ listed in `hibtypes-social-inhibit-modes'."
(and (eq major-mode 'markdown-mode)
(hargs:delimited "(" ")"))))
(save-excursion
- (if (looking-at "address@hidden:alnum:]]")
- (skip-chars-backward "address@hidden:alnum:]"))
+ (if (looking-at "[#@/._[:alnum:]]")
+ (skip-chars-backward "#@/._[:alnum:]"))
(and (looking-at hibtypes-social-regexp)
(save-match-data
;; Heuristic to ensure this is not an email address
@@ -104,19 +121,41 @@ listed in `hibtypes-social-inhibit-modes'."
(match-string-no-properties
1)))))))))
(save-match-data
(ibut:label-set (match-string-no-properties 0) (match-beginning 0)
(match-end 0)))
- (hact 'social-reference (match-string-no-properties 1)
- (match-string-no-properties 2) (match-string-no-properties 3))))
-
-(defact social-reference (service ref-type-char hashtag-or-username)
- "Display the web page at social media SERVICE for REF-TYPE-CHAR and
HASHTAG-OR-USERNAME.
-REF-TYPE-CHAR is either \"#\" for a hashtag reference or \"@\" for a username
reference."
+ (if (save-match-data (and (equal (match-string-no-properties 2) "#")
+ (string-match "\\`\\(gh\\|github\\)\\'"
(match-string-no-properties 1))))
+ (hact 'github-commit-reference (match-string-no-properties 3))
+ (hact 'social-reference (match-string-no-properties 1)
+ (match-string-no-properties 2) (match-string-no-properties 3)))))
+
+(defact github-commit-reference (commit-hashtag &optional user project)
+ "Display the Github web page showing a commit given by COMMIT-HASHTAG and
optional USER and PROJECT.
+USER defaults to the value of `hibtypes-social-github-default-user'.
+PROJECT defaults to the value of `hibtypes-social-github-default-project'."
+ (if (or (null commit-hashtag) (string-empty-p commit-hashtag))
+ (error "(github-commit-reference): Github commit hashtag must not be
empty")
+ (let ((case-fold-search t)
+ (url-to-format (assoc-default "github" hibtypes-social-hashtag-alist
#'string-match)))
+ (when url-to-format
+ (when (string-match
"\\(\\([^/address@hidden)/\\)?\\([^/address@hidden)/" commit-hashtag)
+ (setq user (or (match-string-no-properties 2 commit-hashtag) user)
+ project (or (match-string-no-properties 3 commit-hashtag)
project)
+ commit-hashtag (substring commit-hashtag (match-end 0))))
+ (unless (stringp user) (setq user hibtypes-social-github-default-user))
+ (unless (stringp project) (setq project
hibtypes-social-github-default-project))
+ (when (and (stringp user) (stringp project))
+ (funcall hibtypes-social-display-function
+ (format url-to-format user project commit-hashtag)))))))
+
+(defact social-reference (service ref-type-str hashtag-or-username)
+ "Display the web page at social media SERVICE for REF-TYPE-STR and
HASHTAG-OR-USERNAME.
+REF-TYPE-STR is either \"#\" for a hashtag reference or \"@\" for a username
reference."
(if (or (null service) (equal service "")) (setq service
hibtypes-social-default-service))
(let ((case-fold-search t)
url-to-format)
- (when (or (and (equal ref-type-char "#")
+ (when (or (and (equal ref-type-str "#")
(setq url-to-format
(assoc-default service hibtypes-social-hashtag-alist
#'string-match)))
- (and (equal ref-type-char "@")
+ (and (equal ref-type-str "@")
(setq url-to-format
(assoc-default service hibtypes-social-username-alist
#'string-match))))
(funcall hibtypes-social-display-function (format url-to-format
hashtag-or-username)))))
diff --git a/hibtypes.el b/hibtypes.el
index 795bd6a..b96ecad 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -212,26 +212,15 @@ current major mode is one handled by func-menu."
;; (hact 'imenu-display-item-where item-name item-pos)))))))
;;; ========================================================================
-;;; Handles social media hashtag and username references, e.g.
twitter#myhashtag
-;;; ========================================================================
-
-(require 'hib-social)
-
-;;; ========================================================================
-;;; Handles Gnu debbugs issue ids, e.g. bug#45678 or just 45678.
-;;; ========================================================================
-
-(require 'hib-debbugs)
-
-;;; ========================================================================
;;; Handles internal references within an annotated bibliography, delimiters=[]
;;; ========================================================================
(defib annot-bib ()
"Displays annotated bibliography entries referenced internally.
References must be delimited by square brackets, must begin with a word
-constituent character, and must not be in buffers whose names begin with a
-` ' or `*' character or which do not have an attached file."
+constituent character, not contain @ or # characters, must not be
+in buffers whose names begin with a space or asterisk character, and
+must have an attached file."
(and (not (bolp))
buffer-file-name
(let ((chr (aref (buffer-name) 0)))
@@ -240,10 +229,23 @@ constituent character, and must not be in buffers whose
names begin with a
(let* ((ref-and-pos (hbut:label-p t "[" "]" t))
(ref (car ref-and-pos)))
(and ref (eq ?w (char-syntax (aref ref 0)))
+ (not (string-match "address@hidden" ref))
(progn (ibut:label-set ref-and-pos)
(hact 'annot-bib ref))))))
;;; ========================================================================
+;;; Handles social media hashtag and username references, e.g.
twitter#myhashtag
+;;; ========================================================================
+
+(require 'hib-social)
+
+;;; ========================================================================
+;;; Handles Gnu debbugs issue ids, e.g. bug#45678 or just 45678.
+;;; ========================================================================
+
+(require 'hib-debbugs)
+
+;;; ========================================================================
;;; Displays in-file Markdown link referents.
;;; ========================================================================
diff --git a/hui-menu.el b/hui-menu.el
index 16b387c..637e22e 100644
--- a/hui-menu.el
+++ b/hui-menu.el
@@ -246,7 +246,7 @@ Return t if cutoff, else nil."
:style toggle :selected (and (boundp 'hyrolo-add-hook)
(listp hyrolo-add-hook)
(memq 'hyrolo-set-date
hyrolo-add-hook))]
- ["Toggle-Smart-Key-Debug" hkey-toggle-debug
+ ["Toggle-Smart-Key-Debug (HyDebug)" hkey-toggle-debug
:style toggle :selected hkey-debug]
))
"Untitled menu of Hyperbole options.")
diff --git a/hui-mouse.el b/hui-mouse.el
index d17a05b..23a5fc4 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -103,9 +103,11 @@ Its default value is #'smart-scroll-down."
(hargs:select-p hkey-value 'assist)))
;;
;; If reading a Hyperbole menu item and nothing is selected, just return.
+ ;; If in a helm session, quit the session and activate the selected item.
((and (> (minibuffer-depth) 0)
(eq (selected-window) (minibuffer-window))
- (eq hargs:reading-p 'hmenu)) .
+ (or (eq hargs:reading-p 'hmenu)
+ (smart-helm-alive-p))) .
((funcall (key-binding (kbd "RET"))) . (funcall (key-binding (kbd
"RET")))))
;;
;; The ID-edit package supports rapid killing, copying, yanking and
@@ -446,7 +448,8 @@ Assumes Hyperbole has already checked that point is in a
helm buffer."
On the first header line, displays a list of actions available for the
selected candidate;
On an action list line, performs the action after exiting the minibuffer;
At the end of the buffer, quits from helm and exits the minibuffer.
- On a candidate separator line, does nothing."
+ On a candidate separator line, does nothing.
+ In the minibuffer window, ends the helm session and performs the selected
item's action."
(let ((non-text-area-p (and (eventp action-key-depress-args)
(posn-area (event-start
action-key-depress-args))))
(separator (helm-pos-candidate-separator-p))
- [elpa] externals/hyperbole 4fdcb7d 02/53: 2016-08-17 Bob Weiner <address@hidden>, (continued)
- [elpa] externals/hyperbole 4fdcb7d 02/53: 2016-08-17 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 3aea4ee 07/53: Changes to hui-window.el had not been saved in prior commit., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a2e2dc3 08/53: Made smart-helm ignore helm candidate separator lines., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a6acb39 04/53: 2016-09-08 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 488bb31 13/53: hib-debbugs.el: Removed dependency on package.el which some people don't want/need loaded., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addition of a single git project to the dir cache., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1b40c4e 14/53: hib-social.el: When a git-reference is activated, trigger an error if `locate' command is not found., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole ddd114d 01/53: 2016-08-12 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 4ace769 17/53: Added brief pulsing/flashing from source line to line in destination buffer., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 632789b 18/53: Made Action Key display selected buffer menu item in the same window as the buffer menu., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole fed1547 09/53: * hib-social.el (hibtypes-social-default-service): Changed to use a radio,
Robert Weiner <=
- [elpa] externals/hyperbole a933051 19/53: Supported Emacs button mouse action; improved Lisp outlining support; improved load library links, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 06d6cf1 16/53: V6.0.2a; Action Key drag from buffer, file and helm buffer item menus to another window to display., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 9457b27 03/53: * hmouse-drv.el (hkey-help-show): Modified to invoke help-mode only if buffer name includes 'Help' to, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 2b9d47e 33/53: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with Mats assist-flag fix., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 943dba1 28/53: Added 'topwin' Python script to determine topmost app window at a screen position under macOS., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 2e55c34 31/53: Add defvar for assist-flag, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 620685a 11/53: Add git and github reference support for branches, issues, pull requests and tags., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 6b68100 40/53: Fixed predicate test in kbd-key:key-and-arguments., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole bf0e9fb 24/53: Added new git-find-file command and associated git#=file implicit button type., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1a85b83 10/53: * DEMO (Git References): Added., Robert Weiner, 2017/11/15