emacs-btap

Emacs library to browse thing at point
Log | Files | Refs

commit 2568d13858872bd93145b00a3afa43e446381af4
parent 496e0de35ec616ddd21ced3cfea94d9f34b1e662
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun,  3 Oct 2021 22:01:51 +0200

add examples

Diffstat:
Memacs-btap.el | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/emacs-btap.el b/emacs-btap.el @@ -21,6 +21,8 @@ ;;; M-x btap will browse the thing at point. ;;; ;;; Some variables can be customized in the btap group. +;;; +;;; To see a few examples, evaluate: (occur "example:") (require 'browse-url) (require 'cl) @@ -67,6 +69,7 @@ handles the btap action." (when (and x (string-match "^man:" x)) (funcall browse-url-man-function x) x)))) +;; example: man:printf (defun btap-try-url (&optional string) (when ffap-url-fetcher @@ -77,6 +80,7 @@ handles the btap action." (let (current-prefix-arg) (funcall ffap-url-fetcher url) url))))))) +;; example: https://logand.com (defun btap-try-cc-mode (&optional string) (when (and (boundp 'c-buffer-is-cc-mode) @@ -95,6 +99,8 @@ handles the btap action." (when (file-exists-p x) (funcall ffap-file-finder (expand-file-name x)) x))))))) +;; example: ~/.emacs +;; example: ~/.emacs.d (defun btap-try-wild-file (&optional string) (when (and ffap-dired-wildcards @@ -116,6 +122,7 @@ handles the btap action." (when (and x (string-match "^clhs:" x)) (funcall 'hyperspec-lookup (substring x 5)) x)))) +;; example: clhs:delete-if (defun btap-try-lisp-mode (&optional string) (when (and (fboundp 'hyperspec-lookup) @@ -129,9 +136,11 @@ handles the btap action." (let ((x (or string (thing-at-point 'filename t)))) (when (and x (string-match "^lp#" x)) (btap-try-url (concat "https://bugs.launchpad.net/bugs/" (substring x 3)))))) +;; example: lp#1903901 (defun btap-try-missing () (signal 'btap-try-missing (list "Nothing at point to browse"))) +;; example: /does-not-exist (defun btap--memoize-thunk (thunk) (let (z)