]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
thing-at-point Amazon instance ID
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 12 Feb 2016 16:59:53 +0000 (17:59 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 12 Feb 2016 16:59:53 +0000 (17:59 +0100)
identify an Amazon Instance ID at point.
Use aws cli with Emacs key bindings.

bba.org

diff --git a/bba.org b/bba.org
index 633b9718f576f8aa38c87484d4ca8a8312e070de..0b0344349669aeee78bad14905f20df74bb1efa9 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -2624,6 +2624,26 @@ Use aws command line tool via Emacs.
          'fqdn-bounds-of-fqdn-at-point)
 #+END_SRC
 
+* thing-at-point-instanceID
+[2016-02-12 Fri 14:13]
+
+Amazon instance ID at point.
+
+#+BEGIN_SRC emacs-lisp
+  (defun instanceid-bounds-of-instanceid-at-point ()
+       "Return the start and end points of an Amazon instance ID at the current point.
+     The result is a paired list of character positions for an fqdn
+     located at the current point in the current buffer."
+       (save-excursion
+         (skip-chars-backward "-.0123456789abcdefi")
+         (if (looking-at "i-[-.0-9abcdef]+")
+             (cons (point) (match-end 0)) ; bounds of fqdn
+           nil))) ; no fqdn at point
+
+  (put 'instanceid 'bounds-of-thing-at-point
+         'instanceid-bounds-of-instanceid-at-point)
+#+END_SRC
+
 * post
   [2015-10-02 Fri 13:26]