U2P52KU34QWFKCHOLF2OCGMJWUDSQ7KJZGTR53KFJ6OORICF3PPQC
;;; yaml-mode.el --- Major mode for editing YAML files -*- lexical-binding: t -*-
;; Copyright (C) 2010-2014 Yoshiki Kurihara
;; Author: Yoshiki Kurihara <clouder@gmail.com>
;; Marshall T. Vandegrift <llasram@gmail.com>
;; Maintainer: Vasilij Schneidermann <mail@vasilij.de>
;; URL: https://github.com/yoshiki/yaml-mode
;; Package-Requires: ((emacs "24.1"))
;; Keywords: data yaml
;; Version: 0.0.16
;; This file is not part of Emacs
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a major mode for editing files in the YAML data
;; serialization format. It was initially developed by Yoshiki
;; Kurihara and many features were added by Marshall Vandegrift. As
;; YAML and Python share the fact that indentation determines
;; structure, this mode provides indentation and indentation command
;; behavior very similar to that of python-mode.
;;; Installation:
;; To install, just drop this file into a directory in your
;; `load-path' and (optionally) byte-compile it. To automatically
;; handle files ending in '.yml', add something like:
;;
;; (require 'yaml-mode)
;; (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
;;
;; to your .emacs file.
;;
;; Unlike python-mode, this mode follows the Emacs convention of not
;; binding the ENTER key to `newline-and-indent'. To get this
;; behavior, add the key definition to `yaml-mode-hook':
;;
;; (add-hook 'yaml-mode-hook
;; '(lambda ()
;; (define-key yaml-mode-map "\C-m" 'newline-and-indent)))
;;; Known Bugs:
;; YAML is easy to write but complex to parse, and this mode doesn't
;; even really try. Indentation and highlighting will break on
;; abnormally complicated structures.
;;; Code:
;; User definable variables
;;;###autoload
(defgroup yaml nil
"Support for the YAML serialization format"
:group 'languages
:prefix "yaml-")
(defcustom yaml-mode-hook nil
"*Hook run by `yaml-mode'."
:type 'hook
:group 'yaml)
(defcustom yaml-indent-offset 2
"*Amount of offset per level of indentation."
:type 'integer
:safe 'natnump
:group 'yaml)
(defcustom yaml-backspace-function 'backward-delete-char-untabify
"*Function called by `yaml-electric-backspace' when deleting backwards.
It will receive one argument, the numeric prefix value."
:type 'function
:group 'yaml)
(defcustom yaml-block-literal-search-lines 100
"*Maximum number of lines to search for start of block literals."
:type 'integer
:group 'yaml)
(defcustom yaml-block-literal-electric-alist
'((?| . "") (?> . "-"))
"*Characters for which to provide electric behavior.
The association list key should be a key code and the associated value
should be a string containing additional characters to insert when
that key is pressed to begin a block literal."
:type 'alist
:group 'yaml)
(defface yaml-tab-face
'((((class color)) (:background "red" :foreground "red" :bold t))
(t (:reverse-video t)))
"Face to use for highlighting tabs in YAML files."
:group 'faces
:group 'yaml)
(defcustom yaml-imenu-generic-expression
'((nil "^\\(:?[a-zA-Z_-]+\\):" 1))
"The imenu regex to parse an outline of the yaml file."
:type 'string
:group 'yaml)
;; Constants
(defconst yaml-mode-version "0.0.15" "Version of `yaml-mode'.")
(defconst yaml-blank-line-re "^ *$"
"Regexp matching a line containing only (valid) whitespace.")
(defconst yaml-directive-re "^\\(?:--- \\)? *%\\(\\w+\\)"
"Regexp matching a line containing a YAML directive.")
(defconst yaml-document-delimiter-re "^\\(?:---\\|[.][.][.]\\)"
"Rexexp matching a YAML document delimiter line.")
(defconst yaml-node-anchor-alias-re "[&*][a-zA-Z0-9_-]+"
"Regexp matching a YAML node anchor or alias.")
(defconst yaml-tag-re "!!?[^ \n]+"
"Rexexp matching a YAML tag.")
(defconst yaml-bare-scalar-re
"\\(?:[^-:,#!\n{\\[ ]\\|[^#!\n{\\[ ]\\S-\\)[^#\n]*?"
"Rexexp matching a YAML bare scalar.")
(defconst yaml-hash-key-re
(concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?:[-,] +\\)+\\) *"
"\\(?:" yaml-tag-re " +\\)?"
"\\(" yaml-bare-scalar-re "\\) *:"
"\\(?: +\\|$\\)")
"Regexp matching a single YAML hash key.")
(defconst yaml-scalar-context-re
(concat "\\(?:^\\(?:--- \\)?\\|{\\|\\(?: *[-,] +\\)+\\) *"
"\\(?:" yaml-bare-scalar-re " *: \\)?")
"Regexp indicating the beginning of a scalar context.")
(defconst yaml-nested-map-re
(concat "[^#\n]*: *\\(?:&.*\\|{ *\\|" yaml-tag-re " *\\)?$")
"Regexp matching a line beginning a YAML nested structure.")
(defconst yaml-block-literal-base-re " *[>|][-+0-9]* *\\(?:\n\\|\\'\\)"
"Regexp matching the substring start of a block literal.")
(defconst yaml-block-literal-re
(concat yaml-scalar-context-re
"\\(?:" yaml-tag-re "\\)?"
yaml-block-literal-base-re)
"Regexp matching a line beginning a YAML block literal.")
(defconst yaml-nested-sequence-re
(concat "^\\(?:\\(?: *- +\\)+\\|\\(:? *-$\\)\\)"
"\\(?:" yaml-bare-scalar-re " *:\\(?: +.*\\)?\\)?$")
"Regexp matching a line containing one or more nested YAML sequences.")
(defconst yaml-constant-scalars-re
(concat "\\(?:^\\|\\(?::\\|-\\|,\\|{\\|\\[\\) +\\) *"
(regexp-opt
'("~" "null" "Null" "NULL"
".nan" ".NaN" ".NAN"
".inf" ".Inf" ".INF"
"-.inf" "-.Inf" "-.INF"
"y" "Y" "yes" "Yes" "YES" "n" "N" "no" "No" "NO"
"true" "True" "TRUE" "false" "False" "FALSE"
"on" "On" "ON" "off" "Off" "OFF") t)
"\\_>")
"Regexp matching certain scalar constants in scalar context.")
;; Mode setup
(defvar yaml-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "|" 'yaml-electric-bar-and-angle)
(define-key map ">" 'yaml-electric-bar-and-angle)
(define-key map "-" 'yaml-electric-dash-and-dot)
(define-key map "." 'yaml-electric-dash-and-dot)
(define-key map (kbd "DEL") 'yaml-electric-backspace)
map)
"Keymap used in `yaml-mode' buffers.")
(defvar yaml-mode-syntax-table
(let ((syntax-table (make-syntax-table)))
(modify-syntax-entry ?\' "\"" syntax-table)
(modify-syntax-entry ?\" "\"" syntax-table)
(modify-syntax-entry ?# "<" syntax-table)
(modify-syntax-entry ?\n ">" syntax-table)
(modify-syntax-entry ?\\ "\\" syntax-table)
(modify-syntax-entry ?- "_" syntax-table)
(modify-syntax-entry ?_ "_" syntax-table)
(modify-syntax-entry ?& "." syntax-table)
(modify-syntax-entry ?* "." syntax-table)
(modify-syntax-entry ?\( "." syntax-table)
(modify-syntax-entry ?\) "." syntax-table)
(modify-syntax-entry ?\{ "(}" syntax-table)
(modify-syntax-entry ?\} "){" syntax-table)
(modify-syntax-entry ?\[ "(]" syntax-table)
(modify-syntax-entry ?\] ")[" syntax-table)
syntax-table)
"Syntax table in use in `yaml-mode' buffers.")
;;;###autoload
(define-derived-mode yaml-mode text-mode "YAML"
"Simple mode to edit YAML.
\\{yaml-mode-map}"
:syntax-table yaml-mode-syntax-table
(set (make-local-variable 'comment-start) "# ")
(set (make-local-variable 'comment-start-skip) "#+ *")
(set (make-local-variable 'indent-line-function) 'yaml-indent-line)
(set (make-local-variable 'indent-tabs-mode) nil)
(set (make-local-variable 'fill-paragraph-function) 'yaml-fill-paragraph)
(set (make-local-variable 'page-delimiter) "^---\\([ \t].*\\)*\n")
(set (make-local-variable 'syntax-propertize-function)
'yaml-mode-syntax-propertize-function)
(setq font-lock-defaults '(yaml-font-lock-keywords)))
;; Font-lock support
(defvar yaml-font-lock-keywords
`((yaml-font-lock-block-literals 0 font-lock-string-face)
(,yaml-constant-scalars-re . (1 font-lock-constant-face))
(,yaml-tag-re . (0 font-lock-type-face))
(,yaml-node-anchor-alias-re . (0 font-lock-function-name-face))
(,yaml-hash-key-re . (1 font-lock-variable-name-face))
(,yaml-document-delimiter-re . (0 font-lock-comment-face))
(,yaml-directive-re . (1 font-lock-builtin-face))
("^[\t]+" 0 'yaml-tab-face t))
"Additional expressions to highlight in YAML mode.")
(defun yaml-mode-syntax-propertize-function (beg end)
"Override buffer's syntax table for special syntactic constructs."
;; Unhighlight foo#bar tokens between BEG and END.
(save-excursion
(goto-char beg)
(while (search-forward "#" end t)
(save-excursion
(forward-char -1)
;; both ^# and [ \t]# are comments
(when (and (not (bolp))
(not (memq (preceding-char) '(?\s ?\t))))
(put-text-property (point) (1+ (point))
'syntax-table (string-to-syntax "_"))))))
(save-excursion
(goto-char beg)
(while (and
(> end (point))
(re-search-forward "['\"]" end t))
(when (get-text-property (point) 'yaml-block-literal)
(put-text-property (1- (point)) (point)
'syntax-table (string-to-syntax "w")))
(let* ((pt (point))
(sps (save-excursion (syntax-ppss (1- pt)))))
(when (not (nth 8 sps))
(cond
((and (char-equal ?' (char-before (1- pt)))
(char-equal ?' (char-before pt)))
(put-text-property (- pt 2) pt
'syntax-table (string-to-syntax "w"))
;; Workaround for https://debbugs.gnu.org/41195.
(let ((syntax-propertize--done syntax-propertize--done))
;; Carefully invalidate the last cached ppss.
(syntax-ppss-flush-cache (- pt 2))))
;; If quote is detected as a syntactic string start but appeared
;; after a non-whitespace character, then mark it as syntactic word.
((and (char-before (1- pt))
(char-equal ?w (char-syntax (char-before (1- pt)))))
(put-text-property (1- pt) pt
'syntax-table (string-to-syntax "w")))
(t
;; We're right after a quote that opens a string literal.
;; Skip over it (big speedup for long JSON strings).
(goto-char (1- pt))
(condition-case nil
(forward-sexp)
(scan-error
(goto-char end))))))))))
(defun yaml-font-lock-block-literals (bound)
"Find lines within block literals.
Find the next line of the first (if any) block literal after point and
prior to BOUND. Returns the beginning and end of the block literal
line in the match data, as consumed by `font-lock-keywords' matcher
functions. The function begins by searching backwards to determine
whether or not the current line is within a block literal. This could
be time-consuming in large buffers, so the number of lines searched is
artificially limited to the value of
`yaml-block-literal-search-lines'."
(if (eolp) (goto-char (1+ (point))))
(unless (or (eobp) (>= (point) bound))
(let ((begin (point))
(end (min (1+ (line-end-position)) bound)))
(goto-char (line-beginning-position))
(while (and (looking-at yaml-blank-line-re)
(not (bobp)))
(forward-line -1))
(let ((nlines yaml-block-literal-search-lines)
(min-level (current-indentation)))
(forward-line -1)
(while (and (/= nlines 0)
(/= min-level 0)
(not (looking-at yaml-block-literal-re))
(not (bobp)))
(setq nlines (1- nlines))
(unless (looking-at yaml-blank-line-re)
(setq min-level (min min-level (current-indentation))))
(forward-line -1))
(when (looking-at-p " *- ")
(setq min-level (- min-level 2)))
(cond
((and (< (current-indentation) min-level)
(looking-at yaml-block-literal-re))
(goto-char end)
(put-text-property begin end 'yaml-block-literal t)
(set-match-data (list begin end))
t)
((progn
(goto-char begin)
(re-search-forward (concat yaml-block-literal-re
" *\\(.*\\)\n")
bound t))
(let ((range (nthcdr 2 (match-data))))
(put-text-property (car range) (cadr range) 'yaml-block-literal t)
(set-match-data range))
t))))))
;; Indentation and electric keys
(defun yaml-compute-indentation ()
"Calculate the maximum sensible indentation for the current line."
(save-excursion
(beginning-of-line)
(if (looking-at yaml-document-delimiter-re) 0
(forward-line -1)
(while (and (looking-at yaml-blank-line-re)
(> (point) (point-min)))
(forward-line -1))
(+ (current-indentation)
(if (looking-at yaml-nested-map-re) yaml-indent-offset 0)
(if (looking-at yaml-nested-sequence-re) yaml-indent-offset 0)
(if (looking-at yaml-block-literal-re) yaml-indent-offset 0)))))
(defun yaml-indent-line ()
"Indent the current line.
The first time this command is used, the line will be indented to the
maximum sensible indentation. Each immediately subsequent usage will
back-dent the line by `yaml-indent-offset' spaces. On reaching column
0, it will cycle back to the maximum sensible indentation."
(interactive "*")
(let ((ci (current-indentation))
(need (yaml-compute-indentation)))
(save-excursion
(if (and (equal last-command this-command) (/= ci 0))
(indent-line-to (* (/ (- ci 1) yaml-indent-offset) yaml-indent-offset))
(indent-line-to need)))
(if (< (current-column) (current-indentation))
(forward-to-indentation 0))))
(defun yaml-electric-backspace (arg)
"Delete characters or back-dent the current line.
If invoked following only whitespace on a line, will back-dent to the
immediately previous multiple of `yaml-indent-offset' spaces."
(interactive "*p")
(if (or (/= (current-indentation) (current-column)) (bolp))
(funcall yaml-backspace-function arg)
(let ((ci (current-column)))
(beginning-of-line)
(delete-horizontal-space)
(indent-to (* (/ (- ci (* arg yaml-indent-offset))
yaml-indent-offset)
yaml-indent-offset)))))
(defun yaml-electric-bar-and-angle (arg)
"Insert the bound key and possibly begin a block literal.
Inserts the bound key. If inserting the bound key causes the current
line to match the initial line of a block literal, then inserts the
matching string from `yaml-block-literal-electric-alist', a newline,
and indents appropriately."
(interactive "*P")
(self-insert-command (prefix-numeric-value arg))
(let ((extra-chars
(assoc last-command-event
yaml-block-literal-electric-alist)))
(cond
((and extra-chars (not arg) (eolp)
(save-excursion
(beginning-of-line)
(looking-at yaml-block-literal-re)))
(insert (cdr extra-chars))
(newline-and-indent)))))
(defun yaml-electric-dash-and-dot (arg)
"Insert the bound key and possibly de-dent line.
Inserts the bound key. If inserting the bound key causes the current
line to match a document delimiter, de-dent the line to the left
margin."
(interactive "*P")
(self-insert-command (prefix-numeric-value arg))
(save-excursion
(beginning-of-line)
(when (and (not arg) (looking-at yaml-document-delimiter-re))
(delete-horizontal-space))))
(defun yaml-narrow-to-block-literal ()
"Narrow the buffer to block literal if the point is in it,
otherwise do nothing."
(interactive)
(save-excursion
(goto-char (line-beginning-position))
(while (and (looking-at-p yaml-blank-line-re) (not (bobp)))
(forward-line -1))
(let ((nlines yaml-block-literal-search-lines)
(min-level (current-indentation))
beg)
(forward-line -1)
(while (and (/= nlines 0)
(/= min-level 0)
(not (looking-at-p yaml-block-literal-re))
(not (bobp)))
(setq nlines (1- nlines))
(unless (looking-at-p yaml-blank-line-re)
(setq min-level (min min-level (current-indentation))))
(forward-line -1))
(when (and (< (current-indentation) min-level)
(looking-at-p yaml-block-literal-re))
(setq min-level (current-indentation))
(forward-line)
(setq beg (point))
(while (and (not (eobp))
(or (looking-at-p yaml-blank-line-re)
(> (current-indentation) min-level)))
(forward-line))
(narrow-to-region beg (point))))))
(defun yaml-fill-paragraph (&optional justify region)
"Fill paragraph.
Outside of comments, this behaves as `fill-paragraph' except that
filling does not cross boundaries of block literals. Inside comments,
this will do usual adaptive fill behaviors."
(interactive "*P")
(save-restriction
(yaml-narrow-to-block-literal)
(let ((fill-paragraph-function nil))
(or (fill-comment-paragraph justify)
(fill-paragraph justify region)))))
(defun yaml-set-imenu-generic-expression ()
(make-local-variable 'imenu-generic-expression)
(make-local-variable 'imenu-create-index-function)
(setq imenu-create-index-function 'imenu-default-create-index-function)
(setq imenu-generic-expression yaml-imenu-generic-expression))
(add-hook 'yaml-mode-hook 'yaml-set-imenu-generic-expression)
(defun yaml-mode-version ()
"Display version of `yaml-mode'."
(interactive)
(message "yaml-mode %s" yaml-mode-version)
yaml-mode-version)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode))
;;;###autoload
(add-to-list 'magic-mode-alist
'("^%YAML\\s-+[0-9]+\\.[0-9]+\\(\\s-+#\\|\\s-*$\\)" . yaml-mode))
(provide 'yaml-mode)
;;; yaml-mode.el ends here
(define-package "yaml-mode" "20231120.546" "Major mode for editing YAML files"
'((emacs "24.1"))
:commit "aa7f04d8aaeb1b580904a84cadf561721d9acdbb" :authors
'(("Yoshiki Kurihara" . "clouder@gmail.com")
("Marshall T. Vandegrift" . "llasram@gmail.com"))
:maintainers
'(("Vasilij Schneidermann" . "mail@vasilij.de"))
:maintainer
'("Vasilij Schneidermann" . "mail@vasilij.de")
:keywords
'("data" "yaml")
:url "https://github.com/yoshiki/yaml-mode")
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; yaml-mode-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "yaml-mode" "yaml-mode.el" (0 0 0 0))
;;; Generated autoloads from yaml-mode.el
(let ((loads (get 'yaml 'custom-loads))) (if (member '"yaml-mode" loads) nil (put 'yaml 'custom-loads (cons '"yaml-mode" loads))))
(autoload 'yaml-mode "yaml-mode" "\
Simple mode to edit YAML.
\\{yaml-mode-map}
\(fn)" t nil)
(add-to-list 'auto-mode-alist '("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode))
(add-to-list 'magic-mode-alist '("^%YAML\\s-+[0-9]+\\.[0-9]+\\(\\s-+#\\|\\s-*$\\)" . yaml-mode))
(register-definition-prefixes "yaml-mode" '("yaml-"))
;;;***
;;;### (autoloads nil nil ("yaml-mode-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; yaml-mode-autoloads.el ends here
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2023-06-06T17:05:03-0400 using RSA
;;; spacious-padding.el --- Increase the padding/spacing of frames and windows -*- lexical-binding: t -*-
;; Copyright (C) 2023 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou General Issues <~protesilaos/general-issues@lists.sr.ht>
;; URL: https://git.sr.ht/~protesilaos/spacious-padding
;; Mailing-List: https://lists.sr.ht/~protesilaos/general-issues
;; Version: 0.1.0
;; Package-Requires: ((emacs "28.1"))
;; Keywords: convenience, focus, writing, presentation
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This package provides a global minor mode to increase the
;; spacing/padding of Emacs windows and frames. The idea is to make
;; editing and reading feel more comfortable. Enable the
;; `spacious-padding-mode'. Adjust the exact spacing values by
;; modifying the user option `spacious-padding-widths'.
;;
;; Inspiration for this package comes from Nicolas Rougier's
;; impressive designs[1] and Daniel Mendler's `org-modern`
;; package[2]
;;
;; 1. <https://github.com/rougier>
;; 2. <https://github.com/minad/org-modern>
;;
;; While obvious to everyone, here are the backronyms for this
;; package: Space Perception Adjusted Consistently Impacts Overall
;; Usability State ... padding; Spacious ... Precise Adjustments to
;; Desktop Divider Internals Neatly Generated.
;;; Code:
(defgroup spacious-padding ()
"Increase the padding/spacing of frames and windows."
:group 'frames)
(defcustom spacious-padding-widths
'( :internal-border-width 15
:right-divider-width 30
:scroll-bar-width 8)
"Number of pixels for frame and window divider border width."
:type '(plist
:key-type (choice (const :internal-border-width)
(const :right-divider-width)
(const :scroll-bar-width))
:value-type natnum)
:group 'spacious-padding)
(defun spacious-padding-set-invisible-dividers (_theme)
"Make window dividers for THEME invisible."
(let ((bg (face-background 'default)))
(custom-set-faces
`(fringe ((t :background ,bg)))
`(window-divider ((t :background ,bg :foreground ,bg)))
`(window-divider-first-pixel ((t :background ,bg :foreground ,bg)))
`(window-divider-last-pixel ((t :background ,bg :foreground ,bg))))))
(defun spacious-padding-unset-invisible-dividers ()
"Make window dividers for THEME invisible."
(custom-set-faces
'(fringe (( )))
'(window-divider (( )))
'(window-divider-first-pixel (( )))
'(window-divider-last-pixel (( )))))
(defvar spacious-padding--internal-border-width nil
"Default value of frame parameter `internal-border-width'.")
(defvar spacious-padding--right-divider-width nil
"Default value of frame parameter `right-divider-width'.")
(defvar spacious-padding--scroll-bar-width nil
"Default value of frame parameter `scroll-bar-width'.")
(defun spacious-padding--store-default-parameters ()
"Store default frame parameter values."
(unless spacious-padding--internal-border-width
(setq spacious-padding--internal-border-width
(frame-parameter nil 'internal-border-width)))
(unless spacious-padding--right-divider-width
(setq spacious-padding--right-divider-width
(frame-parameter nil 'right-divider-width)))
(unless spacious-padding--scroll-bar-width
(setq spacious-padding--scroll-bar-width
(frame-parameter nil 'scroll-bar-width))))
(defun spacious-padding--get-internal-border-width (&optional reset)
"Return value of frame parameter `internal-border-width'.
With optional RESET argument as non-nil, restore the default
parameter value."
(if reset
(or spacious-padding--internal-border-width 0)
(plist-get spacious-padding-widths :internal-border-width)))
(defun spacious-padding--get-right-divider-width (&optional reset)
"Return value of frame parameter `right-divider-width'.
With optional RESET argument as non-nil, restore the default
parameter value."
(if reset
(or spacious-padding--right-divider-width 1)
(plist-get spacious-padding-widths :right-divider-width)))
(defun spacious-padding--get-scroll-bar-width (&optional reset)
"Return value of frame parameter `scroll-bar-width'.
With optional RESET argument as non-nil, restore the default
parameter value."
(if reset
(or spacious-padding--scroll-bar-width 16)
(plist-get spacious-padding-widths :scroll-bar-width)))
(defun spacious-padding-modify-frame-parameters (reset)
"Modify all frame parameters to specify spacing.
With optional RESET argument as non-nil, restore the default
parameter values."
(modify-all-frames-parameters
`((internal-border-width . ,(spacious-padding--get-internal-border-width reset))
(right-divider-width . ,(spacious-padding--get-right-divider-width reset))
(scroll-bar-width . ,(spacious-padding--get-scroll-bar-width reset)))))
;;;###autoload
(define-minor-mode spacious-padding-mode
"Increase the padding/spacing of frames and windows."
:global t
(if spacious-padding-mode
(spacious-padding--enable-mode)
(spacious-padding--disable-mode)))
(defun spacious-padding--enable-mode ()
"Enable `spacious-padding-mode'."
(spacious-padding--store-default-parameters)
(spacious-padding-modify-frame-parameters nil)
(spacious-padding-set-invisible-dividers nil)
(add-hook 'enable-theme-functions #'spacious-padding-set-invisible-dividers))
(defun spacious-padding--disable-mode ()
"Disable `spacious-padding-mode'."
(spacious-padding-modify-frame-parameters :reset)
(spacious-padding-unset-invisible-dividers)
(remove-hook 'enable-theme-functions #'spacious-padding-set-invisible-dividers))
(provide 'spacious-padding)
;;; spacious-padding.el ends here
;; Generated package description from spacious-padding.el -*- no-byte-compile: t -*-
(define-package "spacious-padding" "0.1.0" "Increase the padding/spacing of frames and windows" '((emacs "28.1")) :commit "8e4877c807b164d602a9482595b138aeebd94967" :authors '(("Protesilaos Stavrou" . "info@protesilaos.com")) :maintainer '("Protesilaos Stavrou General Issues" . "~protesilaos/general-issues@lists.sr.ht") :keywords '("convenience" "focus" "writing" "presentation") :url "https://git.sr.ht/~protesilaos/spacious-padding")
;;; spacious-padding-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "spacious-padding" "spacious-padding.el" (0
;;;;;; 0 0 0))
;;; Generated autoloads from spacious-padding.el
(defvar spacious-padding-mode nil "\
Non-nil if Spacious-Padding mode is enabled.
See the `spacious-padding-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `spacious-padding-mode'.")
(custom-autoload 'spacious-padding-mode "spacious-padding" nil)
(autoload 'spacious-padding-mode "spacious-padding" "\
Increase the padding/spacing of frames and windows.
This is a minor mode. If called interactively, toggle the
`Spacious-Padding mode' mode. If the prefix argument is
positive, enable the mode, and if it is zero or negative, disable
the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `(default-value \\='spacious-padding-mode)'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(register-definition-prefixes "spacious-padding" '("spacious-padding-"))
;;;***
;;;### (autoloads nil nil ("spacious-padding-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; spacious-padding-autoloads.el ends here
# spacious-padding for GNU Emacs
This package provides a global minor mode to increase the
spacing/padding of Emacs windows and frames. The idea is to make
editing and reading feel more comfortable. Enable the mode with `M-x
spacious-padding-mode`. Adjust the exact spacing values by modifying
the user option `spacious-padding-widths`.
Inspiration for this package comes from [Nicolas Rougier's impressive
designs](https://github.com/rougier) and [Daniel Mendler's
`org-modern` package](https://github.com/minad/org-modern).
+ Package name (GNU ELPA): `spacious-padding`
+ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/spacious-padding>
- Mirrors:
+ GitHub: <https://github.com/protesilaos/spacious-padding>
+ GitLab: <https://gitlab.com/protesilaos/spacious-padding>
+ Mailing list: <https://lists.sr.ht/~protesilaos/general-issues>
+ Backronyms: Space Perception Adjusted Consistently Impacts Overall
Usability State ... padding; Spacious ... Precise Adjustments to
Desktop Divider Internals Neatly Generated.
# spacious-padding for GNU Emacs
This package provides a global minor mode to increase the
spacing/padding of Emacs windows and frames. The idea is to make
editing and reading feel more comfortable. Enable the mode with `M-x
spacious-padding-mode`. Adjust the exact spacing values by modifying
the user option `spacious-padding-widths`.
Inspiration for this package comes from [Nicolas Rougier's impressive
designs](https://github.com/rougier) and [Daniel Mendler's
`org-modern` package](https://github.com/minad/org-modern).
+ Package name (GNU ELPA): `spacious-padding`
+ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/spacious-padding>
- Mirrors:
+ GitHub: <https://github.com/protesilaos/spacious-padding>
+ GitLab: <https://gitlab.com/protesilaos/spacious-padding>
+ Mailing list: <https://lists.sr.ht/~protesilaos/general-issues>
+ Backronyms: Space Perception Adjusted Consistently Impacts Overall
Usability State ... padding; Spacious ... Precise Adjustments to
Desktop Divider Internals Neatly Generated.
;;; org-present.el --- Minimalist presentation minor-mode for Emacs org-mode.
;;
;; Copyright (C) 2012 by Ric Lister
;;
;; Author: Ric Lister
;; Version: 0.1
;; Package-Requires: ((org "7"))
;; URL: https://github.com/rlister/org-present
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; This is meant to be an extremely minimalist presentation tool for
;; Emacs org-mode.
;;
;; Usage:
;;
;; Add the following to your emacs config:
;;
;; (add-to-list 'load-path "~/path/to/org-present")
;; (autoload 'org-present "org-present" nil t)
;;
;; (add-hook 'org-present-mode-hook
;; (lambda ()
;; (org-present-big)
;; (org-display-inline-images)))
;;
;; (add-hook 'org-present-mode-quit-hook
;; (lambda ()
;; (org-present-small)
;; (org-remove-inline-images)))
;;
;; Open an org-mode file with each slide under a top-level heading.
;; Start org-present with org-present-mode, left and right keys will move forward
;; and backward through slides. C-c C-q will quit org-present.
;;
;; This works well with hide-mode-line (http://webonastick.com/emacs-lisp/hide-mode-line.el),
;; which hides the mode-line when only one frame and buffer are open.
;;
;; If you're on a Mac you might also want to look at the fullscreen patch here:
;; http://cloud.github.com/downloads/typester/emacs/feature-fullscreen.patch
(defvar org-present-mode-keymap (make-keymap) "org-present-mode keymap.")
;; left and right page keys
(define-key org-present-mode-keymap [right] 'org-present-next)
(define-key org-present-mode-keymap [left] 'org-present-prev)
(define-key org-present-mode-keymap (kbd "C-c C-=") 'org-present-big)
(define-key org-present-mode-keymap (kbd "C-c C--") 'org-present-small)
(define-key org-present-mode-keymap (kbd "C-c C-q") 'org-present-quit)
(define-key org-present-mode-keymap (kbd "C-c C-r") 'org-present-read-only)
(define-key org-present-mode-keymap (kbd "C-c C-w") 'org-present-read-write)
(define-key org-present-mode-keymap (kbd "C-c <") 'org-present-beginning)
(define-key org-present-mode-keymap (kbd "C-c >") 'org-present-end)
(define-key org-present-mode-keymap (kbd "C-c C-1") 'org-present-toggle-one-big-page)
;; how much to scale up font size
(defvar org-present-text-scale 5)
(defvar org-present-cursor-cache (or cursor-type nil)
"Holds the user set value of cursor for `org-present-read-only'")
(defvar org-present-overlays-list nil)
(defvar org-present-one-big-page nil)
(define-minor-mode org-present-mode
"Minimalist presentation minor mode for org-mode."
:init-value nil
:lighter " OP"
:keymap org-present-mode-keymap)
(make-variable-buffer-local 'org-present-mode)
(defun org-present-top ()
"Jump to current top-level heading, should be safe outside a heading."
(unless (org-at-heading-p) (outline-previous-heading))
(let ((level (org-current-level)))
(when (and level (> level 1))
(outline-up-heading (- level 1) t))))
(defun org-present-next ()
"Jump to next top-level heading."
(interactive)
(widen)
(if (org-current-level) ;inside any heading
(progn
(org-present-top)
(or
(org-get-next-sibling) ;next top-level heading
(org-present-top))) ;if that was last, go back to top before narrow
;; else handle title page before first heading
(outline-next-heading))
(org-present-narrow)
(org-present-run-after-navigate-functions))
(defun org-present-prev ()
"Jump to previous top-level heading."
(interactive)
(if (org-current-level)
(progn
(widen)
(org-present-top)
(org-get-last-sibling)))
(org-present-narrow)
(org-present-run-after-navigate-functions))
(defun org-present-narrow ()
"Show just current page; in a heading we narrow, else show title page (before first heading)."
(if (org-current-level)
(progn
(org-narrow-to-subtree)
(show-all))
;; else narrow to area before first heading
(outline-next-heading)
(narrow-to-region (point-min) (point))
(goto-char (point-min))))
(defun org-present-beginning ()
"Jump to first slide of presentation."
(interactive)
(widen)
(goto-char (point-min))
(org-present-narrow)
(org-present-run-after-navigate-functions))
(defun org-present-end ()
"Jump to last slide of presentation."
(interactive)
(widen)
(goto-char (point-max))
(org-present-top)
(org-present-narrow)
(org-present-run-after-navigate-functions))
(defun org-present-big ()
"Make font size larger."
(interactive)
(text-scale-increase 0)
(text-scale-increase org-present-text-scale)) ;MAKE THIS BUFFER-LOCAL
(defun org-present-small ()
"Change font size back to original."
(interactive)
(text-scale-increase 0))
(defun org-present-add-overlay (beginning end)
"Create a single overlay over given region and remember it."
(let ((overlay (make-overlay beginning end)))
(push overlay org-present-overlays-list)
(overlay-put overlay 'invisible 'org-present)))
(defun org-present-show-option (string)
"Returns non-nil if string is an org-mode exporter option whose value we want to show."
(save-match-data
(string-match
(regexp-opt '("title:" "author:" "date:" "email:"))
string)))
(defvar org-present-hide-stars-in-headings t
"Whether to hide the asterisk characters in headings while in presentation
mode. If you turn this off (by setting it to nil) make sure to set
`org-hide-emphasis-markers' non-nil, since currently `org-present''s algorithm
for hiding emphasis markers has a bad interaction with bullets. This combo also
makes tabs work in presentation mode as in the rest of Org mode.")
(defun org-present-add-overlays ()
"Add overlays for this mode."
(add-to-invisibility-spec '(org-present))
(save-excursion
;; hide org-mode options starting with #+
(goto-char (point-min))
(while (re-search-forward "^[[:space:]]*\\(#\\+\\)\\([^[:space:]]+\\).*" nil t)
(let ((end (if (org-present-show-option (match-string 2)) 2 0)))
(org-present-add-overlay (match-beginning 1) (match-end end))))
;; hide stars in headings
(if org-present-hide-stars-in-headings
(progn (goto-char (point-min))
(while (re-search-forward "^\\(*+\\)" nil t)
(org-present-add-overlay (match-beginning 1) (match-end 1)))))
;; hide emphasis/verbatim markers if not already hidden by org
(if org-hide-emphasis-markers nil
;; TODO https://github.com/rlister/org-present/issues/12
;; It would be better to reuse org's own facility for this, if possible.
;; However it is not obvious how to do this.
(progn
;; hide emphasis markers
(goto-char (point-min))
(while (re-search-forward org-emph-re nil t)
(org-present-add-overlay (match-beginning 2) (1+ (match-beginning 2)))
(org-present-add-overlay (1- (match-end 2)) (match-end 2)))
;; hide verbatim markers
(goto-char (point-min))
(while (re-search-forward org-verbatim-re nil t)
(org-present-add-overlay (match-beginning 2) (1+ (match-beginning 2)))
(org-present-add-overlay (1- (match-end 2)) (match-end 2)))))))
(defun org-present-rm-overlays ()
"Remove overlays for this mode."
(mapc #'delete-overlay org-present-overlays-list)
(remove-from-invisibility-spec '(org-present)))
(defun org-present-read-only ()
"Make buffer read-only."
(interactive)
(setq buffer-read-only t)
(setq org-present-cursor-cache cursor-type
cursor-type nil)
(define-key org-present-mode-keymap (kbd "SPC") #'org-present-next))
(defun org-present-read-write ()
"Make buffer read/write."
(interactive)
(setq buffer-read-only nil)
(define-key org-present-mode-keymap (kbd "SPC") 'self-insert-command))
(defun org-present-hide-cursor ()
"Hide the cursor for current window."
(interactive)
(if cursor-type
(setq-local org-present-cursor-cache cursor-type
cursor-type nil))
(internal-show-cursor (selected-window) nil))
(defun org-present-show-cursor ()
"Show the cursor for current window."
(interactive)
(if org-present-cursor-cache
(setq-local cursor-type org-present-cursor-cache))
(internal-show-cursor (selected-window) t))
;;;###autoload
(defun org-present ()
"Start org presentation."
(interactive)
(setq org-present-mode t)
(org-present-add-overlays)
(run-hooks 'org-present-mode-hook)
(org-present-narrow)
(org-present-run-after-navigate-functions))
(defun org-present-toggle-one-big-page ()
"Toggle showing all pages in a buffer."
(interactive)
(if org-present-one-big-page
(progn
(org-present-narrow)
(setq-local org-present-one-big-page nil))
(widen)
(setq-local org-present-one-big-page t)))
(defun org-present-quit ()
"Quit the minor-mode."
(interactive)
(org-present-small)
(org-present-rm-overlays)
(widen)
;; Exit from read-only mode before exiting the minor mode
(when buffer-read-only
(org-present-read-write))
(run-hooks 'org-present-mode-quit-hook)
(setq org-present-mode nil))
(defvar org-present-startup-folded nil
"Like `org-startup-folded', but for presentation mode. Also analogous to
introduction of slide items by effects in other presentation programs: i.e., if
you do not want to show the whole slide at first, but to unfurl it slowly, set
this to non-nil.")
(defvar org-present-after-navigate-functions nil
"Abnormal hook run after org-present navigates to a new heading.")
;; courtesy Xah Lee ( http://ergoemacs.org/emacs/modernization_elisp_lib_problem.html )
(defun org-present-trim-string (string)
"Remove whitespace (space, tab, emacs newline (LF, ASCII 10)) in beginning and ending of STRING."
(replace-regexp-in-string
"\\`[ \t\n]*" ""
(replace-regexp-in-string "[ \t\n]*\\'" "" string)))
(defun org-present-run-after-navigate-functions ()
"Fold slide if `org-present-startup-folded' is non-nil.
Run org-present-after-navigate hook, passing the name of the presentation buffer and the current heading."
(progn
(if org-present-startup-folded (org-cycle))
(let* ((title-text (thing-at-point 'line))
(safe-title-text (replace-regexp-in-string "^[ \*]" "" title-text))
(current-heading (org-present-trim-string safe-title-text)))
(run-hook-with-args 'org-present-after-navigate-functions (buffer-name) current-heading))))
(provide 'org-present)
;;; org-present.el ends here
(define-package "org-present" "20220806.1847" "Minimalist presentation minor-mode for Emacs org-mode."
'((org "7"))
:commit "4ec04e1b77dea76d7c30066ccf3200d2e0b7bee9" :authors
'(("Ric Lister"))
:maintainers
'(("Ric Lister"))
:maintainer
'("Ric Lister")
:url "https://github.com/rlister/org-present")
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; org-present-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "org-present" "org-present.el" (0 0 0 0))
;;; Generated autoloads from org-present.el
(autoload 'org-present "org-present" "\
Start org presentation." t nil)
(register-definition-prefixes "org-present" '("org-present-"))
;;;***
;;;### (autoloads nil nil ("org-present-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; org-present-autoloads.el ends here
;;; org-parser.el --- parse org files into structured datatypes. -*- lexical-binding: t; -*-
;; Version: 0.4
;; This file is not part of GNU Emacs.
;; Copyright (C) 2016-2017 Zachary Kanfer
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;; Keywords: files, outlines, tools
;; Homepage: https://hg.sr.ht/~zck/org-parser
;; Package-Requires: ((emacs "25.1") (dash "2.12.0") (ht "2.1"))
;;; Commentary:
;; This library parses org files into structured datatypes.
;; Its repository is https://hg.sr.ht/~zck/org-parser
;; In its simplest use, call #'org-parser-parse-buffer with the name of an org buffer.
;;; Code:
(require 'seq)
(require 'subr-x)
(require 'cl-lib)
(require 'dash)
(require 'ht)
;;;###autoload
(defun org-parser-parse-buffer (buffer)
"Parse BUFFER into a list of structure items."
(with-current-buffer buffer
(org-parser-parse-string (buffer-string))))
;;;###autoload
(defun org-parser-parse-file (filename)
"Parse FILENAME into a list of structure items."
(with-temp-buffer
(insert-file-contents filename)
(org-parser-parse-buffer (current-buffer))))
;;;###autoload
(defun org-parser-parse-string (string)
"Parse STRING into a list of structure items."
(cl-destructuring-bind (settings content) (-split-with (lambda (ele) (string-prefix-p "#+" ele))
(split-string (string-remove-suffix "\n" (substring-no-properties string))
"\n"))
(ht (:in-buffer-settings (org-parser--get-in-buffer-settings settings))
(:content (org-parser--convert-text-tree (org-parser--make-text-tree (org-parser--split-into-blocks content)))))))
(defun org-parser--split-into-blocks (lines)
"Split LINES into blocks; one block for each headline or plain list.
A block is a single string (with newlines in it if necessary) that,
optionally, begins with a headline or plain list, but otherwise has
no headlines or plain lists in it."
(when lines
(org-parser--split-into-blocks-helper lines)))
(defun org-parser--split-into-blocks-helper (lines)
"Split LINES into blocks; one block for each headline or plain list.
A block is a single string (with newlines in it if necessary) that,
optionally, begins with a headline or plain list, but otherwise has
no headlines or plain lists in it."
(when lines
(let* ((this-block-end (-find-index #'org-parser--title-line-p
(cl-rest lines)))
(next-block-start (if this-block-end
(1+ this-block-end)
(length lines))))
(cons (string-join (seq-subseq lines 0 next-block-start)
"\n")
(org-parser--split-into-blocks-helper (seq-subseq lines next-block-start))))))
(defun org-parser--drop-single-empty-string-at-beginning-and-end (string-list)
"Drop a maximum of one empty string from each of the beginning and end of STRING-LIST."
(when string-list
(seq-subseq string-list
(if (equal (cl-first string-list)
"")
1
0)
(if (equal (-last-item string-list)
"")
(1- (length string-list))
(length string-list)))))
(defun org-parser--get-in-buffer-settings (lines)
"Get the buffer settings out of the initial lines of LINES.
In-buffer settings are described at http://orgmode.org/manual/In_002dbuffer-settings.html#In_002dbuffer-settings"
(when lines
(cl-destructuring-bind (first . rest) lines
(if (string-match "#\\+\\([[:graph:]]+\\):\\(.*\\)" first)
(cons (cons (match-string 1 first)
(split-string (match-string 2 first)))
(org-parser--get-in-buffer-settings rest))
(org-parser--get-in-buffer-settings rest)))))
(defun org-parser--guess-level (text)
"Attempts to guess the level of the TEXT.
This method will definitely work for headlines,
and will probably work for plain lists.
The situations where this breaks are where there have been multiple
ordered lists in parents for TEXT, as the bullet for ordered lists
is more than one character."
(cond ((string-match "\\`\\(\\*+\\) " text)
(length (match-string 1 text)))
((string-match "\\`\\(\s*\\)[-+[:digit:]]" text)
(1+ (/ (length (match-string 1 text)) 2)))
(t 1)))
(defun org-parser--bullet-type (full-bullet)
"Return the bullet-type of FULL-BULLET.
For example, \"** \" has a bullet type of ?*.
Plain lists are the leading symbol (+ or -).
Ordered lists are ?. or ?)"
(cond ((string-match "\\`\\*+ " full-bullet)
?*)
((string-match "\\`\s*\\([+-]\\) " full-bullet)
(elt (match-string 1 full-bullet) 0))
((string-match "\\`\s*[[:digit:]]+\\([.)]\\) " full-bullet)
(elt (match-string 1 full-bullet) 0))))
(defun org-parser--convert-text-tree (text-tree)
"Convert TEXT-TREE to a list of org structures.
TEXT-TREE is a list generated by make-text-tree. Each element could
be a single string, or a list where the head is the headline or plain
list, and the rest of the list is all the children."
(mapcar #'org-parser--convert-text-block
text-tree))
(defun org-parser--convert-text-block (text-block)
"Convert TEXT-BLOCK to an org structure.
A TEXT-BLOCK is an element generated by make-text-tree. This could be
a single string, or a list where the head is the headline or plain
list, and the rest of the list is all the children.
Return a single thing representing the block. If the block is a
headline, it will be an org structure hash. If the block is not a
headline, it'll be a list of strings.
Properties of structure hashes:
:text -- the text on the first line of the block.
:body -- the text on following lines of the block, as a list, where each line
is represented by a list of items.
For example:
* this is the 'text'
This is the 'body', which can
continue to multiple lines.
Results in:
'((\"This is the 'body', which can\") (\"continue to multiple lines.\"))
:properties -- the org properties of the block, as an association list
of property-name to property-value. Each name and value is a string,
so you can't use #'alist-get, but must use #'assoc.
:children -- a list of child structure objects.
:bullet-type -- a character indicating the type of bullet used,
either ?*, ?-, ?+, ?., or ?) . For ordered lists --
(either ?\) or ?.) -- this is the character /after/ the number.
For other types of blocks, the bullet is the entire number."
(if (org-parser--title-line-p (car text-block))
(let ((table (make-hash-table))
(text (car text-block)))
(puthash :text (org-parser--get-text text) table)
(puthash :body (org-parser--get-body text) table)
(puthash :properties (org-parser--get-properties text) table)
(puthash :tags (org-parser--get-tags text) table)
(puthash :bullet-type (org-parser--bullet-type text) table)
(puthash :children (org-parser--convert-text-tree (cdr text-block)) table)
table)
text-block))
(defun org-parser--remove-bullet (text)
"Return TEXT without the bullet at the beginning."
(cond ((string-match "\\`\\*+ ?\\(\\(.\\|\n\\)+\\)" text)
(match-string 1 text))
((string-match "\\` *[-+*] ?\\(\\(.\\|\n\\)+\\)" text)
(match-string 1 text))
((string-match "\\` *[[:digit:]]+[.)] ?\\(\\(.\\|\n\\)+\\)" text)
(match-string 1 text))))
(defun org-parser--remove-tags (text)
"Return TEXT, a single line, without tags at the end.
If TEXT has any tags, strip whitespace between the text and the
tags. If there are no tags, don't strip ending whitespace.
The org manual says tags consist of \"letters, numbers, ‘_’, and ‘@’.\""
(replace-regexp-in-string "[ \t]+\\(:[[:alnum:]@_]+\\)+:$"
""
text))
(defun org-parser--parse-for-markup (text)
"Parse TEXT into its structure, respecting markup.
This handles things like links and italic text.
This will return a list of things. Each thing in this list will be
either a string (for no markup), or a hash, with a :type key to
indicate what the type of the markup is.
Possible :type values are :link, :block."
(cond ((null text) nil)
((string-empty-p text) (list ""))
((string-prefix-p "#+BEGIN_" text)
(org-parser--make-block text))
((string-match "\\(.*?\\)\\[\\[\\([^][]+\\)\\]\\[\\([^][]+\\)\\]\\]\\(.*\\)"
text)
(let* ((text-before-link (match-string 1 text))
(target-text (match-string 2 text))
(link-text (match-string 3 text))
(link-hash (org-parser--make-link-hash target-text link-text))
(raw-text-after-link (match-string 4 text))
(text-after-link (if (string-empty-p raw-text-after-link)
nil
raw-text-after-link)))
(if (string-empty-p text-before-link)
(cons link-hash
(org-parser--parse-for-markup text-after-link))
(cl-list* text-before-link
link-hash
(org-parser--parse-for-markup text-after-link)))))
(t (list text))))
(defun org-parser--make-link-hash (target-text link-text)
"Make a link hash pointing to TARGET-TEXT with text LINK-TEXT.
It will have keys :target, :text, and :type. The :type value will be :link."
(let ((link-hash (make-hash-table)))
(puthash :target target-text link-hash)
(puthash :text link-text link-hash)
(puthash :type :link link-hash)
link-hash))
(defun org-parser--make-block (text)
"Make a block from TEXT, some text representing a block.
TEXT should have both the beginning #+BEGIN_whatever and the ending
#+END_whatever lines."
(let ((block (make-hash-table)))
(when (string-match "^#\\+BEGIN_\\(\\w+\\) ?\\([^\n]*\\)\n\\(.*\\(\n.*\\)*\\)\n#\\+END_\\1\n?$" text)
(puthash :type :block block)
(puthash :block-type (match-string 1 text) block)
(puthash :arguments (match-string 2 text) block)
(puthash :body (match-string 3 text) block))
block))
(defun org-parser--get-text (text)
"Return the first line of TEXT without the bullet, parsed for org formatting.
This is a list of items."
(--> text
(org-parser--remove-bullet it)
(split-string it "\n" t)
(car it)
(org-parser--remove-tags it)
(org-parser--parse-for-markup it)))
(defun org-parser--get-body (text)
"Return the body of a given TEXT.
This method will drop initial newlines of TEXT, drop any properties,
then treat everything after a newline as the body.
The body is returned as a list, where each item in the list represents
either a line in TEXT, or a #+BEGIN_ block. Each line in TEXT is a
list of items itself, and a block is just a hash."
(let ((lines (org-parser--split-body-text-into-groups text)))
(when (cdr lines)
;;properties are not part of the body, so we drop properties
(mapcar #'org-parser--parse-for-markup
;;zck maybe keeping property lines together should be done in the split-body-text-into-groups.
(if (string-match-p "^\s*:PROPERTIES:$"
(upcase (cl-second lines)))
(cdr (-drop-while (lambda (line) (not (string-match-p "^\s*:END:$" line)))
(cddr lines)))
(cdr lines))))))
(defun org-parser--split-body-text-into-groups (body-text)
"Split BODY-TEXT into groups.
Normally this is just on newlines, but blocks are multiline."
(let ((lines (org-parser--drop-single-empty-string-at-beginning-and-end (split-string body-text "\n")))
(result nil)
(cur-line nil))
(while lines
(let ((cur-line (pop lines)))
(when (or (string-prefix-p "#+BEGIN_" cur-line t)
(string-prefix-p "#+NAME: " cur-line t))
(cl-destructuring-bind (rest-of-block post-block-body-text) (-split-with (lambda (line) (not (string-prefix-p "#+END_" line)))
lines)
(setq cur-line (concat cur-line "\n" (string-join rest-of-block "\n")))
(setq lines post-block-body-text)
(when (string-prefix-p "#+END_" (car lines))
(setq cur-line (concat cur-line "\n" (pop lines))))))
(push cur-line result)))
(nreverse result)))
(defun org-parser--get-properties (text)
"Return the properties of TEXT.
Properties are an alist, where the key is the property key, and the
value is the property value."
(let ((properties-alist nil)
(property-text (org-parser--extract-property-text text)))
(when property-text
(dolist (line (split-string property-text "\n" t))
(when (string-match ":\\([^:]*\\):\s*\\(.*\\)"
line)
(push (cons (match-string 1 line)
(match-string 2 line))
properties-alist))))
(nreverse properties-alist)))
(defun org-parser--get-tags (text)
"Return the tags of TEXT, a string representing a block.
The tags are returned as a list of strings. The org manual says tags
consist of \"letters, numbers, ‘_’, and ‘@’.\""
(let ((first-line (car (split-string text "\n"))))
(-some--> first-line
(string-match "[ \t]+\\(\\(?::[[:alnum:]@_]+\\)+\\):$"
it)
(match-string 1 first-line)
(split-string it ":" t))))
(defun org-parser--extract-property-text (text)
"Extract the property text from TEXT.
Property text is the text between :PROPERTIES: and :END: of a
string."
(let* ((begin-regexp "\n\s*:PROPERTIES:\n")
(end-regexp "\n\s*:END:\\(:?\n\\|$\\)")
(begin-match (string-match begin-regexp text))
(beginning-of-drawer-internals (match-end 0))
(end-match (string-match end-regexp text begin-match))
(end-of-drawer-internals (match-beginning 0)))
(when (and begin-match end-match)
(substring text
beginning-of-drawer-internals
end-of-drawer-internals))))
(defun org-parser--make-text-tree (blocks)
"Organize BLOCKS, a list of text blocks, into the overall tree structure.
Blocks are defined in org-parser--split-into-blocks
Return a list that represents the structure of BLOCKS. Each element
is either a list or a string. If an element is a list, the first item
in it is the headline, plain list head, or the bare string. If it's a
bare string, there are no more elements in the list. (This bare
string happens only when an org file doesn't start with a headline.)"
(when blocks
(let* ((first-line (car blocks))
(first-block (seq-take-while (lambda (line)
(org-parser--descendent-p first-line line))
(cdr blocks))))
(cons (cons first-line
(org-parser--make-text-tree first-block))
(org-parser--make-text-tree (seq-drop blocks
(+ 1 (length first-block))))))))
(defun org-parser--descendent-p (root possible-descendent)
"Whether ROOT and POSSIBLE-DESCENDENT should be in the same block.
For example, a block that starts '* headline' should be in the same block
at '** nested', but not the same block as '* another headline.'"
(if (org-parser--headline-p root)
(or (and (org-parser--headline-p possible-descendent)
(< (org-parser--guess-level root)
(org-parser--guess-level possible-descendent)))
(org-parser--plain-list-p possible-descendent))
(and (org-parser--plain-list-p possible-descendent)
(< (org-parser--guess-level root)
(org-parser--guess-level possible-descendent)))))
(defun org-parser--title-line-p (line)
"Return whether LINE corresponds to a title line.
A title line is the first line of a headline or plain list."
(or (org-parser--headline-p line)
(org-parser--plain-list-p line)))
(defun org-parser--headline-p (line-or-char)
"Return t if LINE-OR-CHAR is a headline.
LINE-OR-CHAR can be either a line, or the character in a structure
indicating the bullet type."
(if (characterp line-or-char)
(equal line-or-char ?*)
(and (> (length line-or-char)
0)
(equal (elt line-or-char 0)
?*))))
(defun org-parser--plain-list-p (line-or-char)
"Return t if LINE-OR-CHAR is a plain list.
LINE-OR-CHAR can be either a line, or the character in a structure
indicating the bullet type."
(if (characterp line-or-char)
(not (org-parser--headline-p line-or-char))
(and (> (length line-or-char)
0)
(or (org-parser--ordered-list-p line-or-char)
(string-match "\\`\s*[-*+] " line-or-char))
(not (org-parser--headline-p line-or-char)))))
(defun org-parser--ordered-list-p (line-or-char)
"Return t if LINE-OR-CHAR is an ordered list.
LINE-OR-CHAR can be either a line, or the character in a structure
indicating the bullet type."
(if (characterp line-or-char)
(or (= ?. line-or-char)
(= ?\) line-or-char))
(and (string-match "\\` *[[:digit:]]+[.)] " line-or-char) t)))
(defun org-parser--make-bullet (structure parent-bullet older-sibling-count)
"Return the string representing the bullet for STRUCTURE.
This bullet includes the whitespace after the bullet.
PARENT-BULLET is used to determine indentation.
There should be OLDER-SIBLING-COUNT siblings before this one. This only matters for ordered lists."
(cond ((org-parser--headline-p (gethash :bullet-type structure))
;;we have a headline, so we must be under a headline (right?)
(if (string-match "\\`\\(\\*+ \\)$" parent-bullet)
(format "*%s" (match-string 1 parent-bullet))
"* "))
((org-parser--ordered-list-p (gethash :bullet-type structure))
(format "%s%d%c "
(org-parser--get-nested-whitespace parent-bullet)
(1+ older-sibling-count)
(gethash :bullet-type structure)))
((org-parser--plain-list-p (gethash :bullet-type structure))
;;zck plain lists can be under headlines, or under other plain lists
(if t ;; (org-parser--headline-p parent-bullet)
(format "%s%c "
(org-parser--get-nested-whitespace parent-bullet)
(gethash :bullet-type structure))))
(t 'whaaat?)))
(defun org-parser--get-nested-whitespace (bullet)
"Gets the nested whitespace for a plain list under BULLET.
BULLET can be the bullet for a plain list or a headline."
(if (org-parser--headline-p bullet)
""
(if (string-match "\\`\\(\s*[^\s]+\\)\s" bullet)
(make-string (1+ (length (match-string 1 bullet)))
?\s)
"")))
(defun org-parser--to-string (org-file-structure)
"Convert ORG-FILE-STRUCTURE to a string.
ORG-FILE-STRUCTURE is a structure created by org-parser
representing an org file.
The result should be identical to the org file parsed to create the
structure."
(concat (when (gethash :in-buffer-settings org-file-structure)
(concat (org-parser--in-buffer-settings-to-string (gethash :in-buffer-settings org-file-structure))
"\n"))
(org-parser--to-string-helper (gethash :content org-file-structure) "")))
(defun org-parser--in-buffer-settings-to-string (in-buffer-properties-list)
"Convert the IN-BUFFER-PROPERTIES-LIST to a string."
(string-join (mapcar (lambda (property)
(format "#+%s: %s"
(cl-first property)
(string-join (cl-rest property) " ")))
in-buffer-properties-list)
"\n"))
(defun org-parser--to-string-helper (org-file-structure parent-bullet)
"Convert ORG-FILE-STRUCTURE, a list of structure hash tables, to a string.
These structure hash tables all have the same parent, whose bullet
is PARENT-BULLET.
This should be identical to the org file parsed to create the structure."
(string-join (cl-mapcar (lambda (structure siblings-before-this-one)
(org-parser--single-to-string structure parent-bullet siblings-before-this-one))
org-file-structure
(number-sequence 0
(1- (length org-file-structure))))))
(defun org-parser--single-to-string (structure parent-headline siblings-before-this-one)
"Create the string for STRUCTURE, with parent having PARENT-HEADLINE.
SIBLINGS-BEFORE-THIS-ONE is the count of older siblings with the same parent."
(cond ((hash-table-p structure)
(let* ((this-bullet (org-parser--make-bullet structure parent-headline siblings-before-this-one))
(title-line (org-parser--format-title-line structure this-bullet))
(body-text (org-parser--format-body (gethash :body structure)))
(properties-text (org-parser--format-properties (gethash :properties structure)))
(children-text (org-parser--to-string-helper (gethash :children structure)
this-bullet)))
(concat title-line
properties-text
body-text
children-text)))
((listp structure)
(string-join (cl-mapcar (lambda (structure siblings-before-this-one)
(org-parser--single-to-string structure parent-headline siblings-before-this-one))
structure
(number-sequence 0
(1- (length structure))))))
((stringp structure)
(format "%s\n" structure))))
(defun org-parser--format-title-line (structure formatted-bullets)
"Format STRUCTURE's title line, including FORMATTED-BULLETS.
This can't calculate FORMATTED-BULLETS because we don't pass in
enough information to know how much to indent STRUCTURE."
(let ((pre-tags (format "%s%s"
formatted-bullets
(org-parser--format-text (gethash :text structure))))
(tags (string-join (gethash :tags structure)
":")))
(if (string-empty-p tags)
(format "%s\n"
pre-tags)
(format "%s%s:%s:\n"
pre-tags
;;even if the text is very long, put in at least one space.
(make-string (max 1
(- 77
(length pre-tags)
2 ;;the colons at the beginning and end of tags.
(length tags)))
?\s)
tags))))
(defun org-parser--format-text (structure-text)
"Format STRUCTURE-TEXT into a string.
STRUCTURE-TEXT is either a single string (in which case it returns
unchanged), or a list of structure items, in which case this returns a
string that's the formatted representation of the list."
(if (stringp structure-text)
structure-text
(string-join (mapcar #'org-parser--format-text-single-item
;;should this add newlines between items? Probably not. But does that mean that if we have a structure object with a body with multiple things in it, what happens?
structure-text))))
(defun org-parser--format-properties (properties-alist)
"Format PROPERTIES-ALIST into a string."
(when properties-alist
(format ":PROPERTIES:\n%s\n:END:\n"
(string-join (mapcar (lambda (ele)
(format ":%s: %s"
(car ele)
(cdr ele)))
properties-alist)
"\n"))))
(defun org-parser--format-body (body-list)
"Format the body represented by BODY-LIST.
Each element of BODY-LIST should be a list itself."
(when body-list
(concat (string-join (mapcar #'org-parser--format-body-line
body-list)
"\n")
"\n")))
;;zck rename body-line? It can be a line, or a block.
(defun org-parser--format-body-line (body-line)
"Format BODY-LINE into a string."
(if (listp body-line)
(string-join (mapcar #'org-parser--format-text-single-item
body-line))
;;then single-item can handle it by itself.
(org-parser--format-text-single-item body-line)))
(defun org-parser--format-text-single-item (structure-item)
"Format STRUCTURE-ITEM, a string or hash, into a string."
(cond ((stringp structure-item)
structure-item)
((hash-table-p structure-item)
(cl-case (gethash :type structure-item)
(:link (format "[[%s][%s]]"
(gethash :target structure-item)
(gethash :text structure-item)))
(:block (let ((block-type (gethash :block-type structure-item))
(args (gethash :arguments structure-item)))
(string-join (list (format "#+BEGIN_%s%s"
block-type
(if (and args (not (string-empty-p args)))
(format " %s" args)
""))
(gethash :body structure-item)
(format "#+END_%s" block-type))
"\n")))))
(t "")))
(defun org-parser--get-nested-children (structure &rest children-indices)
"Get children recursively from STRUCTURE; at each level, take the nth child, where n is the next element in CHILDREN-INDICES."
(if (not children-indices)
structure
(apply #'org-parser--get-nested-children
(elt (gethash :children structure)
(cl-first children-indices))
(cl-rest children-indices))))
(defun org-parser--get-bullet (text)
"Get the bullet form from TEXT, including the space after.
If TEXT does not start with a bullet form, this will error."
(cond ((string-match "\\`\\(\\*+ \\)" text)
(match-string 1 text))
((string-match "\\`\\(\s*[+-] \\)" text)
(match-string 1 text))
((string-match "\\`\\(\s*[[:digit:]]+[.)]\s\\)" text)
(match-string 1 text))
(t (error "Error calling org-parser--get-bullet on a string that doesn't have bullets"))))
(provide 'org-parser)
;;; org-parser.el ends here
(define-package "org-parser" "20200417.301" "parse org files into structured datatypes."
'((emacs "25.1")
(dash "2.12.0")
(ht "2.1"))
:commit "fd4cb7035ff649378cc968b1ec2c386b5c565706" :keywords
'("files" "outlines" "tools")
:url "https://hg.sr.ht/~zck/org-parser")
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; org-parser-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "org-parser" "org-parser.el" (0 0 0 0))
;;; Generated autoloads from org-parser.el
(autoload 'org-parser-parse-buffer "org-parser" "\
Parse BUFFER into a list of structure items.
\(fn BUFFER)" nil nil)
(autoload 'org-parser-parse-file "org-parser" "\
Parse FILENAME into a list of structure items.
\(fn FILENAME)" nil nil)
(autoload 'org-parser-parse-string "org-parser" "\
Parse STRING into a list of structure items.
\(fn STRING)" nil nil)
(register-definition-prefixes "org-parser" '("org-parser--"))
;;;***
;;;### (autoloads nil nil ("org-parser-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; org-parser-autoloads.el ends here
;;; ht.el --- The missing hash table library for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 2013 Wilfred Hughes
;; Author: Wilfred Hughes <me@wilfred.me.uk>
;; Version: 2.4
;; Keywords: hash table, hash map, hash
;; Package-Requires: ((dash "2.12.0"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; The missing hash table library for Emacs.
;;
;; See documentation at https://github.com/Wilfred/ht.el
;;; Code:
(require 'dash)
(require 'gv)
(eval-when-compile
(require 'inline))
(defmacro ht (&rest pairs)
"Create a hash table with the key-value pairs given.
Keys are compared with `equal'.
\(fn (KEY-1 VALUE-1) (KEY-2 VALUE-2) ...)"
(let* ((table-symbol (make-symbol "ht-temp"))
(assignments
(mapcar
(lambda (pair) `(ht-set! ,table-symbol ,@pair))
pairs)))
`(let ((,table-symbol (ht-create)))
,@assignments
,table-symbol)))
(define-inline ht-set! (table key value)
"Associate KEY in TABLE with VALUE."
(inline-quote
(prog1 nil
(puthash ,key ,value ,table))))
(defalias 'ht-set 'ht-set!)
(define-inline ht-create (&optional test)
"Create an empty hash table.
TEST indicates the function used to compare the hash
keys. Default is `equal'. It can be `eq', `eql', `equal' or a
user-supplied test created via `define-hash-table-test'."
(declare (side-effect-free t))
(inline-quote (make-hash-table :test (or ,test 'equal))))
(defun ht<-alist (alist &optional test)
"Create a hash table with initial values according to ALIST.
TEST indicates the function used to compare the hash
keys. Default is `equal'. It can be `eq', `eql', `equal' or a
user-supplied test created via `define-hash-table-test'."
(declare (side-effect-free t))
(let ((h (ht-create test)))
;; the first key-value pair in an alist gets precedence, so we
;; start from the end of the list:
(dolist (pair (reverse alist) h)
(let ((key (car pair))
(value (cdr pair)))
(ht-set! h key value)))))
(defalias 'ht-from-alist 'ht<-alist)
(defun ht<-plist (plist &optional test)
"Create a hash table with initial values according to PLIST.
TEST indicates the function used to compare the hash
keys. Default is `equal'. It can be `eq', `eql', `equal' or a
user-supplied test created via `define-hash-table-test'."
(declare (side-effect-free t))
(let ((h (ht-create test)))
(dolist (pair (nreverse (-partition 2 plist)) h)
(let ((key (car pair))
(value (cadr pair)))
(ht-set! h key value)))))
(defalias 'ht-from-plist 'ht<-plist)
(define-inline ht-get (table key &optional default)
"Look up KEY in TABLE, and return the matching value.
If KEY isn't present, return DEFAULT (nil if not specified)."
(declare (side-effect-free t))
(inline-quote
(gethash ,key ,table ,default)))
;; Don't use `ht-set!' here, gv setter was assumed to return the value
;; to be set.
(gv-define-setter ht-get (value table key) `(puthash ,key ,value ,table))
(define-inline ht-get* (table &rest keys)
"Look up KEYS in nested hash tables, starting with TABLE.
The lookup for each key should return another hash table, except
for the final key, which may return any value."
(declare (side-effect-free t))
(inline-letevals (table keys)
(inline-quote
(progn
(while ,keys
(setf ,table (ht-get ,table (pop ,keys))))
,table))))
(put 'ht-get* 'compiler-macro
(lambda (_ table &rest keys)
(--reduce-from `(ht-get ,acc ,it) table keys)))
(defun ht-update! (table from-table)
"Update TABLE according to every key-value pair in FROM-TABLE."
(maphash
(lambda (key value) (puthash key value table))
from-table)
nil)
(defalias 'ht-update 'ht-update!)
(define-inline ht-update-with! (table key updater &optional default)
"Update the value of KEY in TABLE with UPDATER.
If the value does not exist, do nothing, unless DEFAULT is
non-nil, in which case act as if the value is DEFAULT.
UPDATER receives one argument, the value, and its return value
becomes the new value of KEY."
(inline-quote
(let* ((not-found-symbol (make-symbol "ht--not-found"))
(v (gethash ,key ,table
(or ,default not-found-symbol))))
(unless (eq v not-found-symbol)
(prog1 nil
(puthash ,key (funcall ,updater v) ,table))))))
(defun ht-merge (&rest tables)
"Crete a new table that includes all the key-value pairs from TABLES.
If multiple tables have the same key, the value in the last
table is used."
(let ((merged (ht-create)))
(mapc (lambda (table) (ht-update! merged table)) tables)
merged))
(define-inline ht-remove! (table key)
"Remove KEY from TABLE."
(inline-quote (remhash ,key ,table)))
(defalias 'ht-remove 'ht-remove!)
(define-inline ht-clear! (table)
"Remove all keys from TABLE."
(inline-quote
(prog1 nil
(clrhash ,table))))
(defalias 'ht-clear 'ht-clear!)
(defun ht-map (function table)
"Apply FUNCTION to each key-value pair of TABLE, and make a list of the results.
FUNCTION is called with two arguments, KEY and VALUE."
(let (results)
(maphash
(lambda (key value)
(push (funcall function key value) results))
table)
results))
(defmacro ht-amap (form table)
"Anaphoric version of `ht-map'.
For every key-value pair in TABLE, evaluate FORM with the
variables KEY and VALUE bound. If you don't use both of
these variables, then use `ht-map' to avoid warnings."
`(ht-map (lambda (key value) ,form) ,table))
(defun ht-keys (table)
"Return a list of all the keys in TABLE."
(declare (side-effect-free t))
(ht-map (lambda (key _value) key) table))
(defun ht-values (table)
"Return a list of all the values in TABLE."
(declare (side-effect-free t))
(ht-map (lambda (_key value) value) table))
(defun ht-items (table)
"Return a list of two-element lists \\='(key value) from TABLE."
(declare (side-effect-free t))
(ht-amap (list key value) table))
(defalias 'ht-each 'maphash
"Apply FUNCTION to each key-value pair of TABLE.
Returns nil, used for side-effects only.")
(defmacro ht-aeach (form table)
"Anaphoric version of `ht-each'.
For every key-value pair in TABLE, evaluate FORM with the
variables key and value bound."
`(ht-each (lambda (key value) ,form) ,table))
(defun ht-select-keys (table keys)
"Return a copy of TABLE with only the specified KEYS."
(declare (side-effect-free t))
(let ((not-found-symbol (make-symbol "ht--not-found"))
result)
(setq result (make-hash-table :test (hash-table-test table)))
(dolist (key keys result)
(if (not (equal (gethash key table not-found-symbol) not-found-symbol))
(puthash key (gethash key table) result)))))
(defun ht->plist (table)
"Return a flat list \\='(key1 value1 key2 value2...) from TABLE.
Note that hash tables are unordered, so this cannot be an exact
inverse of `ht<-plist'. The following is not guaranteed:
\(let ((data \\='(a b c d)))
(equalp data
(ht->plist (ht<-plist data))))"
(declare (side-effect-free t))
(apply 'append (ht-items table)))
(defalias 'ht-to-plist 'ht->plist)
(define-inline ht-copy (table)
"Return a shallow copy of TABLE (keys and values are shared)."
(declare (side-effect-free t))
(inline-quote (copy-hash-table ,table)))
(defun ht->alist (table)
"Return a list of two-element lists \\='(key . value) from TABLE.
Note that hash tables are unordered, so this cannot be an exact
inverse of `ht<-alist'. The following is not guaranteed:
\(let ((data \\='((a . b) (c . d))))
(equalp data
(ht->alist (ht<-alist data))))"
(declare (side-effect-free t))
(ht-amap (cons key value) table))
(defalias 'ht-to-alist 'ht->alist)
(defalias 'ht? 'hash-table-p)
(defalias 'ht-p 'hash-table-p)
(define-inline ht-contains? (table key)
"Return \\='t if TABLE contains KEY."
(declare (side-effect-free t))
(inline-quote
(let ((not-found-symbol (make-symbol "ht--not-found")))
(not (eq (ht-get ,table ,key not-found-symbol) not-found-symbol)))))
(defalias 'ht-contains-p 'ht-contains?)
(define-inline ht-size (table)
"Return the actual number of entries in TABLE."
(declare (side-effect-free t))
(inline-quote
(hash-table-count ,table)))
(define-inline ht-empty? (table)
"Return true if the actual number of entries in TABLE is zero."
(declare (side-effect-free t))
(inline-quote
(zerop (ht-size ,table))))
(defalias 'ht-empty-p 'ht-empty?)
(defun ht-select (function table)
"Return a hash table containing all entries in TABLE for which
FUNCTION returns a truthy value.
FUNCTION is called with two arguments, KEY and VALUE."
(let ((results (ht-create)))
(ht-each
(lambda (key value)
(when (funcall function key value)
(ht-set! results key value)))
table)
results))
(defun ht-reject (function table)
"Return a hash table containing all entries in TABLE for which
FUNCTION returns a falsy value.
FUNCTION is called with two arguments, KEY and VALUE."
(let ((results (ht-create)))
(ht-each
(lambda (key value)
(unless (funcall function key value)
(ht-set! results key value)))
table)
results))
(defun ht-reject! (function table)
"Delete entries from TABLE for which FUNCTION returns non-nil.
FUNCTION is called with two arguments, KEY and VALUE."
(ht-each
(lambda (key value)
(when (funcall function key value)
(remhash key table)))
table)
nil)
(defalias 'ht-delete-if 'ht-reject!)
(defun ht-find (function table)
"Return (key, value) from TABLE for which FUNCTION returns a truthy value.
Return nil otherwise.
FUNCTION is called with two arguments, KEY and VALUE."
(catch 'break
(ht-each
(lambda (key value)
(when (funcall function key value)
(throw 'break (list key value))))
table)))
(defun ht-equal? (table1 table2)
"Return t if TABLE1 and TABLE2 have the same keys and values.
Does not compare equality predicates."
(declare (side-effect-free t))
(let ((keys1 (ht-keys table1))
(keys2 (ht-keys table2))
(sentinel (make-symbol "ht-sentinel")))
(and (equal (length keys1) (length keys2))
(--all?
(if (ht-p (ht-get table1 it))
(ht-equal-p (ht-get table1 it)
(ht-get table2 it))
(equal (ht-get table1 it)
(ht-get table2 it sentinel)))
keys1))))
(defalias 'ht-equal-p 'ht-equal?)
(provide 'ht)
;;; ht.el ends here
(define-package "ht" "20230703.558" "The missing hash table library for Emacs"
'((dash "2.12.0"))
:commit "1c49aad1c820c86f7ee35bf9fff8429502f60fef" :authors
'(("Wilfred Hughes" . "me@wilfred.me.uk"))
:maintainers
'(("Wilfred Hughes" . "me@wilfred.me.uk"))
:maintainer
'("Wilfred Hughes" . "me@wilfred.me.uk")
:keywords
'("hash table" "hash map" "hash"))
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; ht-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "ht" "ht.el" (0 0 0 0))
;;; Generated autoloads from ht.el
(register-definition-prefixes "ht" 'nil)
;;;***
;;;### (autoloads nil nil ("ht-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; ht-autoloads.el ends here
text-mode
# name : Manages local Windows user accounts
# key : win_user
# condition: ansible
# --
- name: ${1:Manages local Windows user accounts}
win_user: name=$2 password=$3 $0
# name : returns information about a Windows file
# key : win_stat
# condition: ansible
# --
- name: ${1:returns information about a Windows file}
win_stat: path=$2 $0
# name : Manages Windows services
# key : win_service
# condition: ansible
# --
- name: ${1:Manages Windows services}
win_service: name=$2 $0
# name : A windows version of the classic ping module.
# key : win_ping
# condition: ansible
# --
- name: ${1:A windows version of the classic ping module.}
win_ping: $0
# name : Installs and uninstalls Windows MSI files
# key : win_msi
# condition: ansible
# --
- name: ${1:Installs and uninstalls Windows MSI files}
win_msi: path=$2 $0
# name : Add and remove local groups
# key : win_group
# condition: ansible
# --
- name: ${1:Add and remove local groups}
win_group: name=$2 $0
# name : Fetches a file from a given URL
# key : win_get_url
# condition: ansible
# --
- name: ${1:Fetches a file from a given URL}
win_get_url: url=$2 $0
# name : Installs and uninstalls Windows Features
# key : win_feature
# condition: ansible
# --
- name: ${1:Installs and uninstalls Windows Features}
win_feature: name=$2 $0
# name : Manage the state of a program or group of programs running via supervisord
# key : supervisorctl
# condition: ansible
# --
- name: ${1:Manage the state of a program or group of programs running via supervisord}
supervisorctl: name=$2 state=$3 $0
# name : create and modify issues in a JIRA instance
# key : jira
# condition: ansible
# --
- name: ${1:create and modify issues in a JIRA instance}
jira: uri=$2 operation=$3 username=$4 password=$5 $0
# name : deploy applications to JBoss
# key : jboss
# condition: ansible
# --
- name: ${1:deploy applications to JBoss}
jboss: deployment=$2 $0
# name : manage user files for basic authentication
# key : htpasswd
# condition: ansible
# --
- name: ${1:manage user files for basic authentication}
htpasswd: path=$2 name=$3 $0
# name : Manages users for ejabberd servers
# key : ejabberd_user
# condition: ansible
# --
- name: ${1:Manages users for ejabberd servers}
ejabberd_user: username=$2 host=$3 $0
# name : Manages a Django application.
# key : django_manage
# condition: ansible
# --
- name: ${1:Manages a Django application.}
django_manage: command=$2 app_path=$3 $0
# name : enables/disables a module of the Apache2 webserver
# key : apache2_module
# condition: ansible
# --
- name: ${1:enables/disables a module of the Apache2 webserver}
apache2_module: name=$2 $0
# name : Create/delete/manage a guest VM through VMware vSphere.
# key : vsphere_guest
# condition: ansible
# --
- name: ${1:Create/delete/manage a guest VM through VMware vSphere.}
vsphere_guest: vcenter_hostname=$2 guest=$3 username=$4 password=$5 $0
# name : Manage zfs
# key : zfs
# condition: ansible
# --
- name: ${1:Manage zfs}
zfs: name=$2 state=$3 $0
# name : Manage user accounts
# key : user
# condition: ansible
# --
- name: ${1:Manage user accounts}
user: name=$2 $0
# name : Manage firewall with UFW
# key : ufw
# condition: ansible
# --
- name: ${1:Manage firewall with UFW}
ufw: $0
# name : Manage entries in sysctl.conf.
# key : sysctl
# condition: ansible
# --
- name: ${1:Manage entries in sysctl.conf.}
sysctl: name=$2 $0
# name : Gathers facts about remote hosts
# key : setup
# condition: ansible
# --
- name: ${1:Gathers facts about remote hosts}
setup: $0
# name : Manage services.
# key : service
# condition: ansible
# --
- name: ${1:Manage services.}
service: name=$2 $0
# name : Change policy and state of SELinux
# key : selinux
# condition: ansible
# --
- name: ${1:Change policy and state of SELinux}
selinux: state=$2 $0
# name : Toggles SELinux booleans.
# key : seboolean
# condition: ansible
# --
- name: ${1:Toggles SELinux booleans.}
seboolean: name=$2 state=$3 $0
# name : Try to connect to host and return C(pong) on success.
# key : ping
# condition: ansible
# --
- name: ${1:Try to connect to host and return C(pong) on success.}
ping: $0
# name : Manage iscsi targets with open-iscsi
# key : open_iscsi
# condition: ansible
# --
- name: ${1:Manage iscsi targets with open-iscsi}
open_iscsi: $0
# name : Returns inventory data from I(Ohai)
# key : ohai
# condition: ansible
# --
- name: ${1:Returns inventory data from I(Ohai)}
ohai: $0
# name : Control active and configured mount points
# key : mount
# condition: ansible
# --
- name: ${1:Control active and configured mount points}
mount: name=$2 src=$3 fstype=$4 state=$5 $0
# name : Add or remove kernel modules
# key : modprobe
# condition: ansible
# --
- name: ${1:Add or remove kernel modules}
modprobe: name=$2 $0
# name : Configure LVM logical volumes
# key : lvol
# condition: ansible
# --
- name: ${1:Configure LVM logical volumes}
lvol: vg=$2 lv=$3 $0
# name : Configure LVM volume groups
# key : lvg
# condition: ansible
# --
- name: ${1:Configure LVM volume groups}
lvg: vg=$2 $0
# name : Creates or removes locales.
# key : locale_gen
# condition: ansible
# --
- name: ${1:Creates or removes locales.}
locale_gen: name=$2 $0
# name : Blacklist kernel modules
# key : kernel_blacklist
# condition: ansible
# --
- name: ${1:Blacklist kernel modules}
kernel_blacklist: name=$2 $0
# name : Manage hostname
# key : hostname
# condition: ansible
# --
- name: ${1:Manage hostname}
hostname: name=$2 $0
# name : Add or remove groups
# key : group
# condition: ansible
# --
- name: ${1:Add or remove groups}
group: name=$2 $0
# name : a wrapper to the unix getent utility
# key : getent
# condition: ansible
# --
- name: ${1:a wrapper to the unix getent utility}
getent: database=$2 $0
# name : Manage arbitrary ports/services with firewalld
# key : firewalld
# condition: ansible
# --
- name: ${1:Manage arbitrary ports/services with firewalld}
firewalld: permanent=${2:true} state=${3:enabled} $0
# name : Makes file system on block device
# key : filesystem
# condition: ansible
# --
- name: ${1:Makes file system on block device}
filesystem: fstype=$2 dev=$3 $0
# name : Runs the discovery program I(facter) on the remote system
# key : facter
# condition: ansible
# --
- name: ${1:Runs the discovery program I(facter) on the remote system}
facter: $0
# name : Configure a .deb package
# key : debconf
# condition: ansible
# --
- name: ${1:Configure a .deb package}
debconf: name=$2 $0
# name : Manage cron.d and crontab entries.
# key : cron
# condition: ansible
# --
- name: ${1:Manage cron.d and crontab entries.}
cron: name=$2 $0
# name : Manage Linux capabilities
# key : capabilities
# condition: ansible
# --
- name: ${1:Manage Linux capabilities}
capabilities: path=$2 capability=$3 $0
# name : Adds or removes an SSH authorized key
# key : authorized_key
# condition: ansible
# --
- name: ${1:Adds or removes an SSH authorized key}
authorized_key: user=$2 key=$3 $0
# name : Schedule the execution of a command or script file via the at command.
# key : at
# condition: ansible
# --
- name: ${1:Schedule the execution of a command or script file via the at command.}
at: count=$2 units=$3 $0
# name : Manages alternative programs for common commands
# key : alternatives
# condition: ansible
# --
- name: ${1:Manages alternative programs for common commands}
alternatives: name=$2 path=$3 $0
# name : Deploys a subversion repository.
# key : subversion
# condition: ansible
# --
- name: ${1:Deploys a subversion repository.}
subversion: repo=$2 dest=$3 $0
# name : Manages Mercurial (hg) repositories.
# key : hg
# condition: ansible
# --
- name: ${1:Manages Mercurial (hg) repositories.}
hg: repo=$2 dest=$3 $0
# name : Manages github service hooks.
# key : github_hooks
# condition: ansible
# --
- name: ${1:Manages github service hooks.}
github_hooks: user=$2 oauthkey=$3 repo=$4 action=$5 $0
# name : Deploy software (or files) from git checkouts
# key : git
# condition: ansible
# --
- name: ${1:Deploy software (or files) from git checkouts}
git: repo=$2 dest=$3 $0
# name : Deploy software (or files) from bzr branches
# key : bzr
# condition: ansible
# --
- name: ${1:Deploy software (or files) from bzr branches}
bzr: name=$2 dest=$3 $0
# name : Manipulate Rackspace Cloud Autoscale Scaling Policy
# key : rax_scaling_policy
# condition: ansible
# --
- name: ${1:Manipulate Rackspace Cloud Autoscale Scaling Policy}
rax_scaling_policy: name=$2 policy_type=$3 scaling_group=$4 $0
# name : Manipulate Rackspace Cloud Autoscale Groups
# key : rax_scaling_group
# condition: ansible
# --
- name: ${1:Manipulate Rackspace Cloud Autoscale Groups}
rax_scaling_group: flavor=$2 image=$3 max_entities=$4 min_entities=$5 name=$6 server_name=$7 $0
# name : create / delete a queue in Rackspace Public Cloud
# key : rax_queue
# condition: ansible
# --
- name: ${1:create / delete a queue in Rackspace Public Cloud}
rax_queue: $0
# name : create / delete an isolated network in Rackspace Public Cloud
# key : rax_network
# condition: ansible
# --
- name: ${1:create / delete an isolated network in Rackspace Public Cloud}
rax_network: $0
# name : Manipulate metadata for Rackspace Cloud Servers
# key : rax_meta
# condition: ansible
# --
- name: ${1:Manipulate metadata for Rackspace Cloud Servers}
rax_meta: $0
# name : Create a keypair for use with Rackspace Cloud Servers
# key : rax_keypair
# condition: ansible
# --
- name: ${1:Create a keypair for use with Rackspace Cloud Servers}
rax_keypair: name=$2 $0
# name : Load Rackspace Cloud Identity
# key : rax_identity
# condition: ansible
# --
- name: ${1:Load Rackspace Cloud Identity}
rax_identity: $0
# name : Upload, download, and delete objects in Rackspace Cloud Files
# key : rax_files_objects
# condition: ansible
# --
- name: ${1:Upload, download, and delete objects in Rackspace Cloud Files}
rax_files_objects: container=$2 $0
# name : Manipulate Rackspace Cloud Files Containers
# key : rax_files
# condition: ansible
# --
- name: ${1:Manipulate Rackspace Cloud Files Containers}
rax_files: container=$2 $0
# name : Gather facts for Rackspace Cloud Servers
# key : rax_facts
# condition: ansible
# --
- name: ${1:Gather facts for Rackspace Cloud Servers}
rax_facts: $0
# name : Manage DNS records on Rackspace Cloud DNS
# key : rax_dns_record
# condition: ansible
# --
- name: ${1:Manage DNS records on Rackspace Cloud DNS}
rax_dns_record: data=$2 name=$3 type=$4 $0
# name : Manage domains on Rackspace Cloud DNS
# key : rax_dns
# condition: ansible
# --
- name: ${1:Manage domains on Rackspace Cloud DNS}
rax_dns: $0
# name : add, modify and remove nodes from a Rackspace Cloud Load Balancer
# key : rax_clb_nodes
# condition: ansible
# --
- name: ${1:add, modify and remove nodes from a Rackspace Cloud Load Balancer}
rax_clb_nodes: load_balancer_id=$2 $0
# name : create / delete a load balancer in Rackspace Public Cloud
# key : rax_clb
# condition: ansible
# --
- name: ${1:create / delete a load balancer in Rackspace Public Cloud}
rax_clb: $0
# name : create / delete a Rackspace Cloud Database
# key : rax_cdb_user
# condition: ansible
# --
- name: ${1:create / delete a Rackspace Cloud Database}
rax_cdb_user: $0
# name : create / delete a database in the Cloud Databases
# key : rax_cdb_database
# condition: ansible
# --
- name: ${1:create / delete a database in the Cloud Databases}
rax_cdb_database: $0
# name : create/delete or resize a Rackspace Cloud Databases instance
# key : rax_cdb
# condition: ansible
# --
- name: ${1:create/delete or resize a Rackspace Cloud Databases instance}
rax_cdb: $0
# name : Manipulate Rackspace Cloud Block Storage Volume Attachments
# key : rax_cbs_attachments
# condition: ansible
# --
- name: ${1:Manipulate Rackspace Cloud Block Storage Volume Attachments}
rax_cbs_attachments: device=$2 volume=$3 server=$4 state=${5:present} $0
# name : Manipulate Rackspace Cloud Block Storage Volumes
# key : rax_cbs
# condition: ansible
# --
- name: ${1:Manipulate Rackspace Cloud Block Storage Volumes}
rax_cbs: name=$2 size=${3:100} state=${4:present} volume_type=${5:SATA} $0
# name : create / delete an instance in Rackspace Public Cloud
# key : rax
# condition: ansible
# --
- name: ${1:create / delete an instance in Rackspace Public Cloud}
rax: $0
# name : Adds or removes a users (roles) from a PostgreSQL database.
# key : postgresql_user
# condition: ansible
# --
- name: ${1:Adds or removes a users (roles) from a PostgreSQL database.}
postgresql_user: name=$2 $0
# name : Grant or revoke privileges on PostgreSQL database objects.
# key : postgresql_privs
# condition: ansible
# --
- name: ${1:Grant or revoke privileges on PostgreSQL database objects.}
postgresql_privs: database=$2 roles=$3 $0
# name : Add or remove PostgreSQL databases from a remote host.
# key : postgresql_db
# condition: ansible
# --
- name: ${1:Add or remove PostgreSQL databases from a remote host.}
postgresql_db: name=$2 $0
# name : Add and remove Zypper repositories
# key : zypper_repository
# condition: ansible
# --
- name: ${1:Add and remove Zypper repositories}
zypper_repository: $0
# name : Manage packages on SUSE and openSUSE
# key : zypper
# condition: ansible
# --
- name: ${1:Manage packages on SUSE and openSUSE}
zypper: name=$2 $0
# name : Manages packages with the I(yum) package manager
# key : yum
# condition: ansible
# --
- name: ${1:Manages packages with the I(yum) package manager}
yum: name=$2 $0
# name : Urpmi manager
# key : urpmi
# condition: ansible
# --
- name: ${1:Urpmi manager}
urpmi: pkg=$2 $0
# name : Manage packages with swdepot package manager (HP-UX)
# key : swdepot
# condition: ansible
# --
- name: ${1:Manage packages with swdepot package manager (HP-UX)}
swdepot: name=$2 state=$3 $0
# name : Manage Solaris SVR4 packages
# key : svr4pkg
# condition: ansible
# --
- name: ${1:Manage Solaris SVR4 packages}
svr4pkg: name=$2 state=$3 $0
# name : Adds or removes a gpg key from the rpm db
# key : rpm_key
# condition: ansible
# --
- name: ${1:Adds or removes a gpg key from the rpm db}
rpm_key: key=$2 $0
# name : Manage Red Hat Network registration using the C(rhnreg_ks) command
# key : rhn_register
# condition: ansible
# --
- name: ${1:Manage Red Hat Network registration using the C(rhnreg_ks) command}
rhn_register: $0
# name : Adds or removes Red Hat software channels
# key : rhn_channel
# condition: ansible
# --
- name: ${1:Adds or removes Red Hat software channels}
rhn_channel: name=$2 sysname=$3 url=$4 user=$5 password=$6 $0
# name : Manage Red Hat Network registration and subscriptions using the C(subscription-manager) command
# key : redhat_subscription
# condition: ansible
# --
- name: ${1:Manage Red Hat Network registration and subscriptions using the C(subscription-manager) command}
redhat_subscription: $0
# name : Installing packages from FreeBSD's ports system
# key : portinstall
# condition: ansible
# --
- name: ${1:Installing packages from FreeBSD's ports system}
portinstall: name=$2 $0
# name : Package manager for Gentoo
# key : portage
# condition: ansible
# --
- name: ${1:Package manager for Gentoo}
portage: $0
# name : Manage CSW-Packages on Solaris
# key : pkgutil
# condition: ansible
# --
- name: ${1:Manage CSW-Packages on Solaris}
pkgutil: name=$2 state=$3 $0
# name : Package manager for FreeBSD >= 9.0
# key : pkgng
# condition: ansible
# --
- name: ${1:Package manager for FreeBSD >= 9.0}
pkgng: name=$2 $0
# name : Package manager for SmartOS
# key : pkgin
# condition: ansible
# --
- name: ${1:Package manager for SmartOS}
pkgin: name=$2 $0
# name : Manage packages with I(pacman)
# key : pacman
# condition: ansible
# --
- name: ${1:Manage packages with I(pacman)}
pacman: $0
# name : Package manager for OpenWrt
# key : opkg
# condition: ansible
# --
- name: ${1:Package manager for OpenWrt}
opkg: name=$2 $0
# name : Manage packages on OpenBSD.
# key : openbsd_pkg
# condition: ansible
# --
- name: ${1:Manage packages on OpenBSD.}
openbsd_pkg: name=$2 state=$3 $0
# name : Package manager for MacPorts
# key : macports
# condition: ansible
# --
- name: ${1:Package manager for MacPorts}
macports: name=$2 $0
# name : Manage Gentoo overlays
# key : layman
# condition: ansible
# --
- name: ${1:Manage Gentoo overlays}
layman: name=$2 $0
# name : Tap a Homebrew repository.
# key : homebrew_tap
# condition: ansible
# --
- name: ${1:Tap a Homebrew repository.}
homebrew_tap: tap=$2 $0
# name : Install/uninstall homebrew casks.
# key : homebrew_cask
# condition: ansible
# --
- name: ${1:Install/uninstall homebrew casks.}
homebrew_cask: name=$2 $0
# name : Package manager for Homebrew
# key : homebrew
# condition: ansible
# --
- name: ${1:Package manager for Homebrew}
homebrew: name=$2 $0
# name : apt_rpm package manager
# key : apt_rpm
# condition: ansible
# --
- name: ${1:apt_rpm package manager}
apt_rpm: pkg=$2 $0
# name : Add and remove APT repositories
# key : apt_repository
# condition: ansible
# --
- name: ${1:Add and remove APT repositories}
apt_repository: repo=${2:none} $0
# name : Add or remove an apt key
# key : apt_key
# condition: ansible
# --
- name: ${1:Add or remove an apt key}
apt_key: $0
# name : Manages apt-packages
# key : apt
# condition: ansible
# --
- name: ${1:Manages apt-packages}
apt: $0
# name : Add/remove subnet from a network
# key : quantum_subnet
# condition: ansible
# --
- name: ${1:Add/remove subnet from a network}
quantum_subnet: login_username=${2:admin} login_password=${3:true} login_tenant_name=${4:true} network_name=${5:None} name=${6:None} cidr=${7:None} $0
# name : Attach/Dettach a subnet's interface to a router
# key : quantum_router_interface
# condition: ansible
# --
- name: ${1:Attach/Dettach a subnet's interface to a router}
quantum_router_interface: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} router_name=${5:None} subnet_name=${6:None} $0
# name : set/unset a gateway interface for the router with the specified external network
# key : quantum_router_gateway
# condition: ansible
# --
- name: ${1:set/unset a gateway interface for the router with the specified external network}
quantum_router_gateway: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} router_name=${5:None} network_name=${6:None} $0
# name : Create or Remove router from openstack
# key : quantum_router
# condition: ansible
# --
- name: ${1:Create or Remove router from openstack}
quantum_router: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} name=${5:None} $0
# name : Creates/Removes networks from OpenStack
# key : quantum_network
# condition: ansible
# --
- name: ${1:Creates/Removes networks from OpenStack}
quantum_network: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} name=${5:None} $0
# name : Associate or disassociate a particular floating IP with an instance
# key : quantum_floating_ip_associate
# condition: ansible
# --
- name: ${1:Associate or disassociate a particular floating IP with an instance}
quantum_floating_ip_associate: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:true} instance_name=${5:None} ip_address=${6:None} $0
# name : Add/Remove floating IP from an instance
# key : quantum_floating_ip
# condition: ansible
# --
- name: ${1:Add/Remove floating IP from an instance}
quantum_floating_ip: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} network_name=${5:None} instance_name=${6:None} $0
# name : Add/Delete key pair from nova
# key : nova_keypair
# condition: ansible
# --
- name: ${1:Add/Delete key pair from nova}
nova_keypair: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} name=${5:None} $0
# name : Create/Delete VMs from OpenStack
# key : nova_compute
# condition: ansible
# --
- name: ${1:Create/Delete VMs from OpenStack}
nova_compute: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} name=${5:None} image_id=${6:None} image_name=${7:None} $0
# name : Manage OpenStack Identity (keystone) users, tenants and roles
# key : keystone_user
# condition: ansible
# --
- name: ${1:Manage OpenStack Identity (keystone) users, tenants and roles}
keystone_user: $0
# name : Add/Delete images from glance
# key : glance_image
# condition: ansible
# --
- name: ${1:Add/Delete images from glance}
glance_image: login_username=${2:admin} login_password=${3:yes} login_tenant_name=${4:yes} name=${5:None} $0
# name : Send a message to typetalk
# key : typetalk
# condition: ansible
# --
- name: ${1:Send a message to typetalk}
typetalk: client_id=$2 client_secret=$3 topic=$4 msg=$5 $0
# name : Sends a text message to a mobile phone through Twilio.
# key : twilio
# condition: ansible
# --
- name: ${1:Sends a text message to a mobile phone through Twilio.}
twilio: account_sid=$2 auth_token=$3 msg=$4 to_number=$5 from_number=$6 $0
# name : Send Amazon Simple Notification Service (SNS) messages
# key : sns
# condition: ansible
# --
- name: ${1:Send Amazon Simple Notification Service (SNS) messages}
sns: msg=$2 topic=$3 $0
# name : Send Slack notifications
# key : slack
# condition: ansible
# --
- name: ${1:Send Slack notifications}
slack: domain=$2 token=$3 msg=$4 $0
# name : Makes an OSX computer to speak.
# key : osx_say
# condition: ansible
# --
- name: ${1:Makes an OSX computer to speak.}
osx_say: msg=$2 $0
# name : Send a SMS via nexmo
# key : nexmo
# condition: ansible
# --
- name: ${1:Send a SMS via nexmo}
nexmo: api_key=$2 api_secret=$3 src=$4 dest=$5 msg=$6 $0
# name : Publish a message on an MQTT topic for the IoT
# key : mqtt
# condition: ansible
# --
- name: ${1:Publish a message on an MQTT topic for the IoT}
mqtt: topic=$2 payload=$3 $0
# name : Send an email
# key : mail
# condition: ansible
# --
- name: ${1:Send an email}
mail: subject=$2 $0
# name : Send a message to jabber user or chat room
# key : jabber
# condition: ansible
# --
- name: ${1:Send a message to jabber user or chat room}
jabber: user=$2 password=$3 to=$4 msg=$5 $0
# name : Send a message to an IRC channel
# key : irc
# condition: ansible
# --
- name: ${1:Send a message to an IRC channel}
irc: msg=$2 channel=$3 $0
# name : Send a message to hipchat
# key : hipchat
# condition: ansible
# --
- name: ${1:Send a message to hipchat}
hipchat: token=$2 room=$3 msg=$4 $0
# name : Sends a notification to a grove.io channel
# key : grove
# condition: ansible
# --
- name: ${1:Sends a notification to a grove.io channel}
grove: channel_token=$2 message=$3 $0
# name : Send a message to a flowdock
# key : flowdock
# condition: ansible
# --
- name: ${1:Send a message to a flowdock}
flowdock: token=$2 type=$3 msg=$4 $0
# name : Send a message to Campfire
# key : campfire
# condition: ansible
# --
- name: ${1:Send a message to Campfire}
campfire: subscription=$2 token=$3 room=$4 msg=$5 $0
# name : Manage Open vSwitch ports
# key : openvswitch_port
# condition: ansible
# --
- name: ${1:Manage Open vSwitch ports}
openvswitch_port: bridge=$2 port=$3 $0
# name : Manage Open vSwitch bridges
# key : openvswitch_bridge
# condition: ansible
# --
- name: ${1:Manage Open vSwitch bridges}
openvswitch_bridge: bridge=$2 $0
# name : get details reported by lldp
# key : lldp
# condition: ansible
# --
- name: ${1:get details reported by lldp}
lldp: $0
# name : Interface with dnsmadeeasy.com (a DNS hosting service).
# key : dnsmadeeasy
# condition: ansible
# --
- name: ${1:Interface with dnsmadeeasy.com (a DNS hosting service).}
dnsmadeeasy: account_key=$2 account_secret=$3 domain=$4 state=$5 $0
# name : Interface with dnsimple.com (a DNS hosting service).
# key : dnsimple
# condition: ansible
# --
- name: ${1:Interface with dnsimple.com (a DNS hosting service).}
dnsimple: $0
# name : Manage MySQL global variables
# key : mysql_variables
# condition: ansible
# --
- name: ${1:Manage MySQL global variables}
mysql_variables: variable=$2 $0
# name : Adds or removes a user from a MySQL database.
# key : mysql_user
# condition: ansible
# --
- name: ${1:Adds or removes a user from a MySQL database.}
mysql_user: name=$2 $0
# name : Manage MySQL replication
# key : mysql_replication
# condition: ansible
# --
- name: ${1:Manage MySQL replication}
mysql_replication: $0
# name : Add or remove MySQL databases from a remote host.
# key : mysql_db
# condition: ansible
# --
- name: ${1:Add or remove MySQL databases from a remote host.}
mysql_db: name=$2 $0
# name : Create Zabbix maintenance windows
# key : zabbix_maintenance
# condition: ansible
# --
- name: ${1:Create Zabbix maintenance windows}
zabbix_maintenance: server_url=$2 login_user=$3 login_password=$4 name=$5 desc=${6:Created by Ansible} $0
# name : Send code deploy and annotation events to stackdriver
# key : stackdriver
# condition: ansible
# --
- name: ${1:Send code deploy and annotation events to stackdriver}
stackdriver: key=$2 $0
# name : Notify Rollbar about app deployments
# key : rollbar_deployment
# condition: ansible
# --
- name: ${1:Notify Rollbar about app deployments}
rollbar_deployment: token=$2 environment=$3 revision=$4 $0
# name : Pause/unpause Pingdom alerts
# key : pingdom
# condition: ansible
# --
- name: ${1:Pause/unpause Pingdom alerts}
pingdom: state=$2 checkid=$3 uid=$4 passwd=$5 key=$6 $0
# name : Create PagerDuty maintenance windows
# key : pagerduty
# condition: ansible
# --
- name: ${1:Create PagerDuty maintenance windows}
pagerduty: state=$2 name=$3 user=$4 passwd=$5 token=$6 requester_id=$7 $0
# name : Notify newrelic about app deployments
# key : newrelic_deployment
# condition: ansible
# --
- name: ${1:Notify newrelic about app deployments}
newrelic_deployment: token=$2 $0
# name : Perform common tasks in Nagios related to downtime and notifications.
# key : nagios
# condition: ansible
# --
- name: ${1:Perform common tasks in Nagios related to downtime and notifications.}
nagios: action=$2 services=$3 command=$4 $0
# name : Manage the state of a program monitored via Monit
# key : monit
# condition: ansible
# --
- name: ${1:Manage the state of a program monitored via Monit}
monit: name=$2 state=$3 $0
# name : Module for tracking logs via logentries.com
# key : logentries
# condition: ansible
# --
- name: ${1:Module for tracking logs via logentries.com}
logentries: path=$2 $0
# name : create an annotation in librato
# key : librato_annotation
# condition: ansible
# --
- name: ${1:create an annotation in librato}
librato_annotation: user=$2 api_key=$3 title=$4 links=$5 $0
# name : Posts events to DataDog service
# key : datadog_event
# condition: ansible
# --
- name: ${1:Posts events to DataDog service}
datadog_event: api_key=$2 title=$3 text=$4 $0
# name : Manage boundary meters
# key : boundary_meter
# condition: ansible
# --
- name: ${1:Manage boundary meters}
boundary_meter: name=$2 apiid=$3 apikey=$4 $0
# name : Notify BigPanda about deployments
# key : bigpanda
# condition: ansible
# --
- name: ${1:Notify BigPanda about deployments}
bigpanda: component=$2 version=$3 token=$4 state=$5 $0
# name : Notify airbrake about app deployments
# key : airbrake_deployment
# condition: ansible
# --
- name: ${1:Notify airbrake about app deployments}
airbrake_deployment: token=$2 environment=$3 $0
# name : Manages virtual machines supported by libvirt
# key : virt
# condition: ansible
# --
- name: ${1:Manages virtual machines supported by libvirt}
virt: name=$2 $0
# name : This module handles some common Riak operations
# key : riak
# condition: ansible
# --
- name: ${1:This module handles some common Riak operations}
riak: $0
# name : Various redis commands, slave and flush
# key : redis
# condition: ansible
# --
- name: ${1:Various redis commands, slave and flush}
redis: command=$2 $0
# name : oVirt/RHEV platform management
# key : ovirt
# condition: ansible
# --
- name: ${1:oVirt/RHEV platform management}
ovirt: user=$2 url=$3 instance_name=$4 password=$5 $0
# name : Adds or removes a user from a MongoDB database.
# key : mongodb_user
# condition: ansible
# --
- name: ${1:Adds or removes a user from a MongoDB database.}
mongodb_user: database=$2 user=$3 $0
# name : Manage the state of a virtual host in RabbitMQ
# key : rabbitmq_vhost
# condition: ansible
# --
- name: ${1:Manage the state of a virtual host in RabbitMQ}
rabbitmq_vhost: name=$2 $0
# name : Adds or removes users to RabbitMQ
# key : rabbitmq_user
# condition: ansible
# --
- name: ${1:Adds or removes users to RabbitMQ}
rabbitmq_user: user=$2 $0
# name : Manage the state of policies in RabbitMQ.
# key : rabbitmq_policy
# condition: ansible
# --
- name: ${1:Manage the state of policies in RabbitMQ.}
rabbitmq_policy: name=$2 pattern=$3 tags=$4 $0
# name : Adds or removes plugins to RabbitMQ
# key : rabbitmq_plugin
# condition: ansible
# --
- name: ${1:Adds or removes plugins to RabbitMQ}
rabbitmq_plugin: names=$2 $0
# name : Adds or removes parameters to RabbitMQ
# key : rabbitmq_parameter
# condition: ansible
# --
- name: ${1:Adds or removes parameters to RabbitMQ}
rabbitmq_parameter: component=$2 name=$3 $0
# name : Waits for a condition before continuing.
# key : wait_for
# condition: ansible
# --
- name: ${1:Waits for a condition before continuing.}
wait_for: $0
# name : Set host facts from a task
# key : set_fact
# condition: ansible
# --
- name: ${1:Set host facts from a task}
set_fact: key_value=$2 $0
# name : Pause playbook execution
# key : pause
# condition: ansible
# --
- name: ${1:Pause playbook execution}
pause: $0
# name : Load variables from files, dynamically within a task.
# key : include_vars
# condition: ansible
# --
- name: ${1:Load variables from files, dynamically within a task.}
include_vars: free-form=$2 $0
# name : Fail with custom message
# key : fail
# condition: ansible
# --
- name: ${1:Fail with custom message}
fail: $0
# name : Print statements during execution
# key : debug
# condition: ansible
# --
- name: ${1:Print statements during execution}
debug: $0
# name : Obtain status of asynchronous task
# key : async_status
# condition: ansible
# --
- name: ${1:Obtain status of asynchronous task}
async_status: jid=$2 $0
# name : Fail with custom message
# key : assert
# condition: ansible
# --
- name: ${1:Fail with custom message}
assert: that=$2 $0
# name : create / delete / stop / restart an instance in Linode Public Cloud
# key : linode
# condition: ansible
# --
- name: ${1:create / delete / stop / restart an instance in Linode Public Cloud}
linode: $0
# name : Manages Python library dependencies.
# key : pip
# condition: ansible
# --
- name: ${1:Manages Python library dependencies.}
pip: $0
# name : Manage node.js packages with npm
# key : npm
# condition: ansible
# --
- name: ${1:Manage node.js packages with npm}
npm: $0
# name : Manage Ruby gems
# key : gem
# condition: ansible
# --
- name: ${1:Manage Ruby gems}
gem: name=$2 $0
# name : Installs Python libraries
# key : easy_install
# condition: ansible
# --
- name: ${1:Installs Python libraries}
easy_install: name=$2 $0
# name : Manages Perl library dependencies.
# key : cpanm
# condition: ansible
# --
- name: ${1:Manages Perl library dependencies.}
cpanm: $0
# name : Dependency Manager for PHP
# key : composer
# condition: ansible
# --
- name: ${1:Dependency Manager for PHP}
composer: working_dir=$2 $0
# name : Create Ansible groups based on facts
# key : group_by
# condition: ansible
# --
- name: ${1:Create Ansible groups based on facts}
group_by: key=$2 $0
# name : add a host (and alternatively a group) to the ansible-playbook in-memory inventory
# key : add_host
# condition: ansible
# --
- name: ${1:add a host (and alternatively a group) to the ansible-playbook in-memory inventory}
add_host: name=$2 $0
# name : Enable fireball mode on remote node
# key : fireball
# condition: ansible
# --
- name: ${1:Enable fireball mode on remote node}
fireball: $0
# name : Enable accelerated mode on remote node
# key : accelerate
# condition: ansible
# --
- name: ${1:Enable accelerated mode on remote node}
accelerate: $0
# name : utilize GCE persistent disk resources
# key : gce_pd
# condition: ansible
# --
- name: ${1:utilize GCE persistent disk resources}
gce_pd: name=$2 $0
# name : create/destroy GCE networks and firewall rules
# key : gce_net
# condition: ansible
# --
- name: ${1:create/destroy GCE networks and firewall rules}
gce_net: $0
# name : create/destroy GCE load-balancer resources
# key : gce_lb
# condition: ansible
# --
- name: ${1:create/destroy GCE load-balancer resources}
gce_lb: $0
# name : create or terminate GCE instances
# key : gce
# condition: ansible
# --
- name: ${1:create or terminate GCE instances}
gce: zone=${2:us-central1-a} $0
# name : This module manages objects/buckets in Google Cloud Storage.
# key : gc_storage
# condition: ansible
# --
- name: ${1:This module manages objects/buckets in Google Cloud Storage.}
gc_storage: bucket=$2 mode=$3 gcs_secret_key=$4 gcs_access_key=$5 $0
# name : set/retrieve extended attributes
# key : xattr
# condition: ansible
# --
- name: ${1:set/retrieve extended attributes}
xattr: name=${2:None} $0
# name : Copies an archive to a remote location and unpack it
# key : unarchive
# condition: ansible
# --
- name: ${1:Copies an archive to a remote location and unpack it}
unarchive: src=$2 dest=$3 $0
# name : Templates a file out to a remote server.
# key : template
# condition: ansible
# --
- name: ${1:Templates a file out to a remote server.}
template: src=$2 dest=$3 $0
# name : Uses rsync to make synchronizing file paths in your playbooks quick and easy.
# key : synchronize
# condition: ansible
# --
- name: ${1:Uses rsync to make synchronizing file paths in your playbooks quick and easy.}
synchronize: src=$2 dest=$3 $0
# name : retrieve file or file system status
# key : stat
# condition: ansible
# --
- name: ${1:retrieve file or file system status}
stat: path=$2 $0
# name : Replace all instances of a particular string in a file using a back-referenced regular expression.
# key : replace
# condition: ansible
# --
- name: ${1:Replace all instances of a particular string in a file using a back-referenced regular expression.}
replace: dest=$2 regexp=$3 $0
# name : Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.
# key : lineinfile
# condition: ansible
# --
- name: ${1:Ensure a particular line is in a file, or replace an existing line using a back-referenced regular expression.}
lineinfile: dest=$2 $0
# name : Tweak settings in INI files
# key : ini_file
# condition: ansible
# --
- name: ${1:Tweak settings in INI files}
ini_file: dest=$2 section=$3 $0
# name : Sets attributes of files
# key : file
# condition: ansible
# --
- name: ${1:Sets attributes of files}
file: path=${2:[]} $0
# name : Fetches a file from remote nodes
# key : fetch
# condition: ansible
# --
- name: ${1:Fetches a file from remote nodes}
fetch: src=$2 dest=$3 $0
# name : Copies files to remote locations.
# key : copy
# condition: ansible
# --
- name: ${1:Copies files to remote locations.}
copy: dest=$2 $0
# name : Assembles a configuration file from fragments
# key : assemble
# condition: ansible
# --
- name: ${1:Assembles a configuration file from fragments}
assemble: src=$2 dest=$3 $0
# name : Sets and retrieves file ACL information.
# key : acl
# condition: ansible
# --
- name: ${1:Sets and retrieves file ACL information.}
acl: name=$2 $0
# name : Manages F5 BIG-IP LTM pool members
# key : bigip_pool_member
# condition: ansible
# --
- name: ${1:Manages F5 BIG-IP LTM pool members}
bigip_pool_member: server=$2 user=$3 password=$4 state=${5:present} pool=$6 host=$7 port=$8 $0
# name : Manages F5 BIG-IP LTM pools
# key : bigip_pool
# condition: ansible
# --
- name: ${1:Manages F5 BIG-IP LTM pools}
bigip_pool: server=$2 user=$3 password=$4 name=$5 $0
# name : Manages F5 BIG-IP LTM nodes
# key : bigip_node
# condition: ansible
# --
- name: ${1:Manages F5 BIG-IP LTM nodes}
bigip_node: server=$2 user=$3 password=$4 state=${5:present} host=$6 $0
# name : Manages F5 BIG-IP LTM tcp monitors
# key : bigip_monitor_tcp
# condition: ansible
# --
- name: ${1:Manages F5 BIG-IP LTM tcp monitors}
bigip_monitor_tcp: server=$2 user=$3 password=$4 name=$5 send=${6:none} receive=${7:none} $0
# name : Manages F5 BIG-IP LTM http monitors
# key : bigip_monitor_http
# condition: ansible
# --
- name: ${1:Manages F5 BIG-IP LTM http monitors}
bigip_monitor_http: server=$2 user=$3 password=$4 name=$5 send=${6:none} receive=${7:none} receive_disable=${8:none} $0
# name : Collect facts from F5 BIG-IP devices
# key : bigip_facts
# condition: ansible
# --
- name: ${1:Collect facts from F5 BIG-IP devices}
bigip_facts: server=$2 user=$3 password=$4 include=$5 $0
# name : manage docker containers
# key : docker
# condition: ansible
# --
- name: ${1:manage docker containers}
docker: image=$2 $0
# name : manage docker images
# key : docker_image
# condition: ansible
# --
- name: ${1:manage docker images}
docker_image: name=$2 $0
# name : Create/delete an SSH key in DigitalOcean
# key : digital_ocean_sshkey
# condition: ansible
# --
- name: ${1:Create/delete an SSH key in DigitalOcean}
digital_ocean_sshkey: $0
# name : Create/delete a DNS record in DigitalOcean
# key : digital_ocean_domain
# condition: ansible
# --
- name: ${1:Create/delete a DNS record in DigitalOcean}
digital_ocean_domain: $0
# name : Create/delete a droplet/SSH_key in DigitalOcean
# key : digital_ocean
# condition: ansible
# --
- name: ${1:Create/delete a droplet/SSH_key in DigitalOcean}
digital_ocean: $0
# name : Execute commands in nodes.
# key : shell
# condition: ansible
# --
- name: ${1:Execute commands in nodes.}
shell: free_form=$2 $0
# name : Runs a local script on a remote node after transferring it
# key : script
# condition: ansible
# --
- name: ${1:Runs a local script on a remote node after transferring it}
script: free_form=$2 $0
# name : Executes a low-down and dirty SSH command
# key : raw
# condition: ansible
# --
- name: ${1:Executes a low-down and dirty SSH command}
raw: free_form=$2 $0
# name : Executes a command on a remote node
# key : command
# condition: ansible
# --
- name: ${1:Executes a command on a remote node}
command: free_form=$2 $0
# name : Manages Citrix NetScaler entities
# key : netscaler
# condition: ansible
# --
- name: ${1:Manages Citrix NetScaler entities}
netscaler: nsc_host=$2 user=$3 password=$4 name=${5:hostname} $0
# name : Interacts with webservices
# key : uri
# condition: ansible
# --
- name: ${1:Interacts with webservices}
uri: url=$2 $0
# name : Slurps a file from remote nodes
# key : slurp
# condition: ansible
# --
- name: ${1:Slurps a file from remote nodes}
slurp: src=$2 $0
# name : Downloads files from HTTP, HTTPS, or FTP to node
# key : get_url
# condition: ansible
# --
- name: ${1:Downloads files from HTTP, HTTPS, or FTP to node}
get_url: url=$2 dest=$3 $0
# name : create or terminate a virtual machine in azure
# key : azure
# condition: ansible
# --
- name: ${1:create or terminate a virtual machine in azure}
azure: name=$2 location=$3 storage_account=$4 image=$5 $0
# name : S3 module putting a file into S3.
# key : s3
# condition: ansible
# --
- name: ${1:S3 module putting a file into S3.}
s3: bucket=$2 mode=$3 $0
# name : add or delete entries in Amazons Route53 DNS service
# key : route53
# condition: ansible
# --
- name: ${1:add or delete entries in Amazons Route53 DNS service}
route53: command=$2 zone=$3 record=$4 type=$5 $0
# name : manage RDS database subnet groups
# key : rds_subnet_group
# condition: ansible
# --
- name: ${1:manage RDS database subnet groups}
rds_subnet_group: state=${2:present} name=$3 region=$4 $0
# name : manage RDS parameter groups
# key : rds_param_group
# condition: ansible
# --
- name: ${1:manage RDS parameter groups}
rds_param_group: state=${2:present} name=$3 region=$4 $0
# name : create, delete, or modify an Amazon rds instance
# key : rds
# condition: ansible
# --
- name: ${1:create, delete, or modify an Amazon rds instance}
rds: command=$2 instance_name=$3 region=$4 $0
# name : Manage cache clusters in Amazon Elasticache.
# key : elasticache
# condition: ansible
# --
- name: ${1:Manage cache clusters in Amazon Elasticache.}
elasticache: state=$2 name=$3 $0
# name : configure AWS virtual private clouds
# key : ec2_vpc
# condition: ansible
# --
- name: ${1:configure AWS virtual private clouds}
ec2_vpc: cidr_block=$2 resource_tags=$3 state=${4:present} $0
# name : create and attach a volume, return volume id and device map
# key : ec2_vol
# condition: ansible
# --
- name: ${1:create and attach a volume, return volume id and device map}
ec2_vol: $0
# name : create and remove tag(s) to ec2 resources.
# key : ec2_tag
# condition: ansible
# --
- name: ${1:create and remove tag(s) to ec2 resources.}
ec2_tag: resource=$2 $0
# name : creates a snapshot from an existing volume
# key : ec2_snapshot
# condition: ansible
# --
- name: ${1:creates a snapshot from an existing volume}
ec2_snapshot: $0
# name : Create or delete AWS scaling policies for Autoscaling groups
# key : ec2_scaling_policy
# condition: ansible
# --
- name: ${1:Create or delete AWS scaling policies for Autoscaling groups}
ec2_scaling_policy: state=$2 name=$3 asg_name=$4 $0
# name : Create/update or delete AWS Cloudwatch 'metric alarms'
# key : ec2_metric_alarm
# condition: ansible
# --
- name: ${1:Create/update or delete AWS Cloudwatch 'metric alarms'}
ec2_metric_alarm: state=$2 name=$3 $0
# name : Create or delete AWS Autoscaling Launch Configurations
# key : ec2_lc
# condition: ansible
# --
- name: ${1:Create or delete AWS Autoscaling Launch Configurations}
ec2_lc: state=$2 name=$3 instance_type=$4 $0
# name : maintain an ec2 key pair.
# key : ec2_key
# condition: ansible
# --
- name: ${1:maintain an ec2 key pair.}
ec2_key: name=$2 $0
# name : Gather information about ec2 instances in AWS.
# key : ec2_instance_info
# condition: ansible
# --
- name: ${1:Gathers facts about remote hosts within ec2 (aws)}
ec2_facts: $0
# name : create, terminate, start or stop an instance in ec2, return instanceid
# key : ec2_instance
# condition: ansible
# --
- name: ${1:create, terminate, start or stop an instance in ec2, return instanceid}
ec2_instance: instance_type=$2 image_id=$3 region=$4 $0
# name : maintain an ec2 VPC security group.
# key : ec2_group
# condition: ansible
# --
- name: ${1:maintain an ec2 VPC security group.}
ec2_group: name=$2 description=$3 $0
# name : Gathers facts about remote hosts within ec2 (aws)
# key : ec2_facts
# condition: ansible
# --
- name: ${1:Gathers facts about remote hosts within ec2 (aws)}
ec2_facts: $0
# name : Creates or destroys Amazon ELB.
# key : ec2_elb_lb
# condition: ansible
# --
- name: ${1:Creates or destroys Amazon ELB.}
ec2_elb_lb: state=$2 name=$3 $0
# name : De-registers or registers instances from EC2 ELBs
# key : ec2_elb
# condition: ansible
# --
- name: ${1:De-registers or registers instances from EC2 ELBs}
ec2_elb: state=$2 instance_id=$3 $0
# name : associate an EC2 elastic IP with an instance.
# key : ec2_eip
# condition: ansible
# --
- name: ${1:associate an EC2 elastic IP with an instance.}
ec2_eip: $0
# name : Create or delete AWS Autoscaling Groups
# key : ec2_asg
# condition: ansible
# --
- name: ${1:Create or delete AWS Autoscaling Groups}
ec2_asg: state=$2 name=$3 $0
# name : Retrieve AWS AMI for a given operating system.
# key : ec2_ami_search
# condition: ansible
# --
- name: ${1:Retrieve AWS AMI for a given operating system.}
ec2_ami_search: distro=$2 release=$3 $0
# name : create or destroy an image in ec2, return imageid
# key : ec2_ami
# condition: ansible
# --
- name: ${1:create or destroy an image in ec2, return imageid}
ec2_ami: $0
# name : create, terminate, start or stop an instance in ec2, return instanceid
# key : ec2
# condition: ansible
# --
- name: ${1:create, terminate, start or stop an instance in ec2, return instanceid}
ec2: instance_type=$2 image=$3 $0
# name : create a AWS CloudFormation stack
# key : cloudformation
# condition: ansible
# --
- name: ${1:create a AWS CloudFormation stack}
cloudformation: stack_name=$2 state=$3 template=$4 $0
# name : Manage A10 Networks AX/SoftAX/Thunder/vThunder devices
# key : a10_virtual_server
# condition: ansible
# --
- name: ${1:Manage A10 Networks AX/SoftAX/Thunder/vThunder devices}
a10_virtual_server: host=$2 username=$3 password=$4 virtual_server=$5 $0
# name : Manage A10 Networks AX/SoftAX/Thunder/vThunder devices
# key : a10_service_group
# condition: ansible
# --
- name: ${1:Manage A10 Networks AX/SoftAX/Thunder/vThunder devices}
a10_service_group: host=$2 username=$3 password=$4 service_group=$5 $0
# name : Manage A10 Networks AX/SoftAX/Thunder/vThunder devices
# key : a10_server
# condition: ansible
# --
- name: ${1:Manage A10 Networks AX/SoftAX/Thunder/vThunder devices}
a10_server: host=$2 username=$3 password=$4 server_name=$5 $0
tower_callback
termination_protection
tenancy
security_token
purge_tags
launch_template
instance_role
instance_initiated_shutdown_behavior
ec2_url
detailed_monitoring
debug_botocore_endpoint_logs
cpu_credit_specification
cpu_options
stack_name
disable_rollback
template_parameters
region
state
template
tags
aws_secret_key
aws_access_key
key_name
id
group
group_id
zone
instance_type
spot_price
image
kernel
ramdisk
wait
wait_timeout
spot_wait_timeout
count
monitoring
user_data
instance_tags
placement_group
vpc_subnet_id
assign_public_ip
private_ip
instance_profile_name
instance_ids
source_dest_check
volumes
ebs_optimized
exact_count
count_tag
instance_id
name
description
no_reboot
image_id
delete_snapshot
distro
release
stream
store
arch
virt
load_balancers
availability_zones
launch_config_name
min_size
max_size
desired_capacity
replace_all_instances
replace_batch_size
replace_instances
lc_check
vpc_zone_identifier
health_check_period
health_check_type
public_ip
in_vpc
reuse_existing_ip_allowed
ec2_elbs
enable_availability_zone
validate_certs
listeners
purge_listeners
zones
purge_zones
security_group_ids
security_group
health_check
subnets
purge_subnets
scheme
connection_draining_timeout
cross_az_load_balancing
vpc_id
rules
rules_egress
purge_rules
purge_rules_egress
key_material
security_groups
kernel_id
instance_monitoring
ramdisk_id
metric
namespace
statistic
comparison
threshold
period
evaluation_periods
unit
dimensions
alarm_actions
insufficient_data_actions
ok_actions
asg_name
adjustment_type
scaling_adjustment
min_adjustment_step
cooldown
volume_id
device_name
snapshot_tags
resource
instance
volume_size
iops
encrypted
snapshot
cidr_block
instance_tenancy
dns_support
dns_hostnames
resource_tags
internet_gateway
route_tables
engine
cache_engine_version
node_type
num_nodes
cache_port
cache_security_groups
hard_modify
command
instance_name
source_instance
db_engine
size
username
password
db_name
engine_version
parameter_group
license_model
multi_zone
vpc_security_groups
port
upgrade
option_group
maint_window
backup_window
backup_retention
subnet
apply_immediately
new_instance_name
immediate
params
record
ttl
type
value
overwrite
retry_interval
bucket
object
src
dest
mode
expiration
s3_url
metadata
location
subscription_id
management_cert_path
storage_account
role_size
endpoints
user
ssh_cert_path
virtual_network_name
hostname
wait_timeout_redirects
client_id
api_key
unique_name
size_id
region_id
ssh_key_ids
virtio
private_networking
backups_enabled
ssh_pub_key
ip
path
tag
nocache
docker_url
timeout
ports
expose
publish_all_ports
volumes_from
links
memory_limit
docker_api_version
env
dns
detach
privileged
lxc_conf
stdin_open
tty
net
registry
force
permission
gcs_secret_key
gcs_access_key
instance_names
machine_type
service_account_email
pem_file
project_id
network
persistent_boot_disk
disks
httphealthcheck_name
httphealthcheck_port
httphealthcheck_path
httphealthcheck_interval
httphealthcheck_timeout
httphealthcheck_unhealthy_count
httphealthcheck_healthy_count
httphealthcheck_host
protocol
external_ip
port_range
members
allowed
ipv4_range
fwname
src_range
src_tags
detach_only
size_gb
linode_id
plan
payment_term
swap
distribution
datacenter
login_username
login_password
login_tenant_name
auth_url
region_name
disk_format
container_format
owner
min_disk
min_ram
is_public
copy_from
file
endpoint_type
login_user
token
endpoint
tenant
tenant_description
role
image_name
image_exclude
flavor_id
flavor_ram
flavor_include
nics
auto_floating_ip
floating_ips
floating_ip_pools
availability_zone
meta
wait_for
config_drive
public_key
network_name
internal_network_name
ip_address
tenant_name
provider_network_type
provider_physical_network
provider_segmentation_id
router_external
shared
admin_state_up
router_name
subnet_name
cidr
ip_version
enable_dhcp
gateway_ip
dns_nameservers
allocation_pool_start
allocation_pool_end
auto_increment
count_offset
disk_config
extra_client_args
extra_create_args
files
flavor
networks
snapshot_id
volume_type
device
volume
server
cdb_id
character_set
collate
db_username
db_password
databases
host
algorithm
vip_id
address
condition
load_balancer_id
node_id
weight
comment
data
domain
loadbalancer
priority
clear_meta
container
private
public
web_error
web_index
expires
method
structure
label
loadbalancers
max_entities
min_entities
server_name
at
change
cron
is_percent
policy_type
scaling_group
vcenter_hostname
guest
resource_pool
cluster
esxi
vm_disk
vm_hardware
vm_nic
vm_extra_config
vm_hw_version
vmware_guest_facts
free_form
creates
removes
chdir
executable
warn
login_host
login_port
login_unix_socket
collation
encoding
target
priv
append_privs
check_implicit_admin
variable
lc_collate
lc_ctype
database
privs
objs
schema
roles
grant_option
login
db
fail_on_user
role_attr_flags
follow
default
entity
etype
permissions
entry
backup
delimiter
remote_src
regexp
content
validate
directory_mode
fail_on_missing
validate_checksum
flat
recurse
section
option
others
line
backrefs
insertafter
insertbefore
create
replace
get_md5
get_checksum
dest_port
archive
checksum
compress
existing_only
delete
dirs
recursive
copy_links
perms
times
rsync_path
rsync_timeout
set_remote_user
rsync_opts
copy
key
groups
url
sha256sum
use_proxy
url_username
url_password
body
return_content
force_basic_auth
follow_redirects
status_code
HEADER_
virtualenv
virtualenv_site_packages
virtualenv_command
gem_source
include_dependencies
repository
user_install
version
pre_release
requirements
extra_args
update_cache
cache_valid_time
purge
default_release
install_recommends
dpkg_options
deb
keyring
keyserver
repo
pkg
server_hostname
server_insecure
rhsm_baseurl
autosubscribe
activationkey
pool
sysname
server_url
channels
list
enablerepo
disablerepo
conf_file
disable_gpg_check
accept_hostkey
ssh_opts
key_file
reference
remote
depth
update
bare
track_submodules
revision
export
manage_dir
key_options
job
cron_file
minute
hour
day
month
weekday
reboot
special_time
gid
system
fstype
opts
dump
passno
fstab
persistent
policy
conf
sleep
pattern
enabled
runlevel
arguments
filter
filters
fact_path
ignoreerrors
reload
sysctl_file
sysctl_set
uid
non_unique
append
shell
home
createhome
move_home
login_class
remove
generate_ssh_key
ssh_key_bits
ssh_key_type
ssh_key_file
ssh_key_comment
ssh_key_passphrase
update_password
minutes
ipv6
multi_key
that
jid
msg
var
free-form
seconds
prompt
key_value
delay
search_regex
exclude_hosts
app_path
settings
pythonpath
apps
cache_table
failfast
fixtures
skip
merge
link
crypt_scheme
config
supervisorctl_path
restart
include_sub_features
include_management_tools
start_mode
resource_type
instance_disksize
instance_cpus
instance_nic
instance_network
instance_mem
disk_alloc
disk_int
instance_os
instance_cores
sdomain
uri
xml
replica_set
ssl
master_host
master_port
slave_mode
flush_mode
config_dir
http_conn
target_node
wait_for_handoffs
wait_for_ring
wait_for_service
master_user
master_password
master_connect_retry
master_log_file
master_log_pos
relay_log_file
relay_log_pos
master_ssl
master_ssl_ca
master_ssl_capath
master_ssl_cert
master_ssl_key
master_ssl_cipher
component
vhost
node
names
new_only
prefix
configure_priv
write_priv
read_priv
tracing
environment
hosts
apiid
apikey
title
text
date_happened
alert_type
aggregation_key
source
start_time
end_time
action
cmdfile
author
services
app_name
application_id
changelog
appname
passwd
requester_id
service
hours
desc
checkid
rollbar_user
event
revision_id
deployed_by
deployed_to
annotated_by
level
event_epoch
host_names
host_groups
collect_data
server_ip
server_status
server_ports
service_group
service_group_protocol
service_group_method
servers
write_config
virtual_server
virtual_server_ip
virtual_server_status
virtual_server_ports
nsc_host
nsc_protocol
account_email
account_api_token
record_ids
solo
account_key
account_secret
record_name
record_type
record_value
record_ttl
session
include
partition
parent
parent_partition
send
receive
receive_disable
interval
time_until_up
lb_method
monitor_type
quorum
monitors
slow_ramp_time
service_down_action
connection_limit
rate_limit
ratio
bridge
subscription
room
notify
external_user_name
from_address
subject
from_name
reply_to
project
channel_token
message
icon_url
from
color
msg_format
api
nick
channel
use_ssl
to
cc
bcc
attach
headers
charset
topic
payload
qos
retain
api_secret
voice
icon_emoji
link_names
parse
sqs
sms
http
https
account_sid
auth_token
to_number
from_number
client_secret
working_dir
prefer_source
prefer_dist
no_dev
no_scripts
no_plugins
optimize_autoloader
from_path
notest
locallib
mirror
global
ignore_scripts
production
update_homebrew
upgrade_all
install_options
tap
list_url
cached
annotation
pkgsite
site
package
deep
newuse
changed_use
oneshot
noreplace
nodeps
onlydeps
depclean
quiet
verbose
sync
use_packages
proxy
response_file
category
depot
no-suggests
disable_recommends
oauthkey
hookurl
script_file
units
unique
capability
question
vtype
unseen
dev
rich_rule
permanent
split
fail_key
blacklist_file
vg
pvs
pesize
vg_options
lv
portal
node_auth
node_user
node_pass
auto_node_startup
discover
show_nodes
direction
logging
insert
rule
log
from_ip
from_port
to_ip
to_port
proto
interface
aclinherit
aclmode
atime
canmount
casesensitivity
compression
copies
dedup
devices
exec
jailed
logbias
mountpoint
nbmand
normalization
primarycache
quota
readonly
recordsize
refquota
refreservation
reservation
secondarycache
setuid
shareiscsi
sharenfs
sharesmb
snapdir
utf8only
volsize
volblocksize
vscan
xattr
zoned
deployment
deploy_path
operation
summary
issuetype
issue
status
assignee
fields
;;; ansible.el --- Ansible minor mode
;; -*- Mode: Emacs-Lisp -*-
;; Copyright (C) 2014 by 101000code/101000LAB
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
;; Version: 0.3.2
;; Author: k1LoW (Kenichirou Oyama), <k1lowxb [at] gmail [dot] com> <k1low [at] 101000lab [dot] org>
;; URL: https://github.com/k1LoW/emacs-ansible
;; Package-Requires: ((s "1.9.0") (f "0.16.2"))
;;; Install
;; Put this file into load-path'ed directory, and byte compile it if
;; desired. And put the following expression into your ~/.emacs.
;;
;; (require 'ansible)
;;; Commentary:
;; This is minor-mode for editing ansible files.
;;; Commands:
;;
;; Below are complete command list:
;;
;; `ansible'
;; Ansible minor mode.
;;
;;; Customizable Options:
;;
;; Below are customizable option list:
;;
;; `ansible-dir-search-limit'
;; Search limit
;; default = 5
;;; Code:
;;require
(require 's)
(require 'f)
;; the 'cl package has been deprecated in favour of 'cl-lib. Load 'cl
;; on emacs < 26, otherwise load 'cl-lib.
(eval-when-compile
(if (version< emacs-version "26")
(require 'cl)
(require 'cl-lib)))
(require 'easy-mmode)
(defgroup ansible nil
"Ansible minor mode"
:group 'languages
:prefix "ansible-")
(defcustom ansible-dir-search-limit 5
"Search limit."
:type 'integer
:group 'ansible)
(defcustom ansible-vault-password-file "~/.vault_pass.txt"
"Filename containing ansible-vault password."
:type 'file
:group 'ansible)
;;;###autoload
(defvar ansible-key-map
(make-sparse-keymap)
"Keymap for Ansible.")
(defvar ansible-root-path nil
"Ansible spec directory path.")
(defvar ansible-hook nil
"Hook.")
(defvar ansible-section-face 'ansible-section-face)
(defface ansible-section-face
'((((class color) (min-colors 88) (background dark)) :foreground "indian red" ))
"Face for ansible first level section names (i.e.: vars, tasks, handlers) in playbooks."
:group 'ansible)
(defvar ansible-task-label-face 'ansible-task-label-face)
(defface ansible-task-label-face
'((((class color) (min-colors 88) (background dark)) :foreground "green" ))
"Face for ansible task names in playbooks"
:group 'ansible)
(defconst ansible-section-keywords-regex
(concat
"^ *-? "
(regexp-opt
'("hosts" "vars" "vars_prompt" "vars_files" "role" "include" "include_tasks"
"roles" "tasks" "import_tasks" "handlers" "pre_tasks" "post_tasks" "environment" ) t)
":")
"Special keywords used to identify toplevel information in a playbook.")
(defconst ansible-task-keywords-regex
(concat
"^ *-? "
(regexp-opt
'("a10_server" "a10_service_group" "a10_virtual_server" "acl" "add_host"
"airbrake_deployment" "alternatives" "apache2_module" "apk" "apt" "apt_key"
"apt_repository" "apt_rpm" "assemble" "assert" "async_status" "at" "authorized_key"
"azure" "azure_rm_deployment" "azure_rm_networkinterface"
"azure_rm_networkinterface_facts" "azure_rm_publicipaddress"
"azure_rm_publicipaddress_facts" "azure_rm_resourcegroup"
"azure_rm_resourcegroup_facts" "azure_rm_securitygroup"
"azure_rm_securitygroup_facts" "azure_rm_storageaccount"
"azure_rm_storageaccount_facts" "azure_rm_storageblob" "azure_rm_subnet"
"azure_rm_virtualmachine" "azure_rm_virtualmachineimage_facts"
"azure_rm_virtualnetwork" "azure_rm_virtualnetwork_facts" "bigip_facts"
"bigip_gtm_wide_ip" "bigip_monitor_http" "bigip_monitor_tcp" "bigip_node"
"bigip_pool" "bigip_pool_member" "bigip_virtual_server" "bigpanda" "blockinfile"
"boundary_meter" "bower" "bundler" "bzr" "campfire" "capabilities"
"circonus_annotation" "cl_bond" "cl_bridge" "cl_img_install" "cl_interface"
"cl_interface_policy" "cl_license" "cl_ports" "clc_aa_policy" "clc_alert_policy"
"clc_blueprint_package" "clc_firewall_policy" "clc_group" "clc_loadbalancer"
"clc_modify_server" "clc_publicip" "clc_server" "clc_server_snapshot"
"cloudflare_dns" "cloudformation" "cloudtrail" "command" "composer" "consul"
"consul_acl" "consul_kv" "consul_session" "copy" "cpanm" "cron" "cronvar" "crypttab"
"cs_account" "cs_affinitygroup" "cs_cluster" "cs_configuration" "cs_domain"
"cs_facts" "cs_firewall" "cs_instance" "cs_instance_facts" "cs_instancegroup"
"cs_ip_address" "cs_iso" "cs_loadbalancer_rule" "cs_loadbalancer_rule_member"
"cs_network" "cs_pod" "cs_portforward" "cs_project" "cs_resourcelimit"
"cs_securitygroup" "cs_securitygroup_rule" "cs_sshkeypair" "cs_staticnat"
"cs_template" "cs_user" "cs_vmsnapshot" "cs_volume" "cs_zone" "cs_zone_facts"
"datadog_event" "datadog_monitor" "debconf" "debug" "deploy_helper" "digital_ocean"
"digital_ocean_domain" "digital_ocean_sshkey" "django_manage" "dnf" "dnsimple"
"dnsmadeeasy" "docker" "docker_container" "docker_image" "docker_image_facts"
"docker_login" "docker_service" "dpkg_selections" "dynamodb_table" "easy_install"
"ec2" "ec2_ami" "ec2_ami_copy" "ec2_ami_find" "ec2_asg" "ec2_eip" "ec2_elb"
"ec2_elb_facts" "ec2_elb_lb" "ec2_eni" "ec2_eni_facts" "ec2_facts" "ec2_group"
"ec2_instance" "ec2_instance_info"
"ec2_key" "ec2_lc" "ec2_metric_alarm" "ec2_remote_facts" "ec2_scaling_policy"
"ec2_snapshot" "ec2_snapshot_facts" "ec2_tag" "ec2_vol" "ec2_vol_facts" "ec2_vpc"
"ec2_vpc_dhcp_options" "ec2_vpc_igw" "ec2_vpc_net" "ec2_vpc_net_facts"
"ec2_vpc_route_table" "ec2_vpc_route_table_facts" "ec2_vpc_subnet"
"ec2_vpc_subnet_facts" "ec2_win_password" "ecs_cluster" "ecs_service"
"ecs_service_facts" "ecs_task" "ecs_taskdefinition" "ejabberd_user" "elasticache"
"elasticache_subnet_group" "elasticsearch_plugin" "eos_command" "eos_config"
"eos_eapi" "eos_template" "expect" "facter" "fail" "fetch" "file" "filesystem"
"find" "firewalld" "flowdock" "gc_storage" "gce" "gce_img" "gce_lb" "gce_net"
"gce_pd" "gce_tag" "gem" "get_url" "getent" "git" "git_config" "github_hooks"
"gitlab_group" "gitlab_project" "gitlab_user" "gluster_volume" "group" "group_by"
"grove" "hall" "haproxy" "hg" "hipchat" "homebrew" "homebrew_cask" "homebrew_tap"
"hostname" "htpasswd" "iam" "iam_cert" "iam_policy" "include_vars"
"influxdb_database" "influxdb_retention_policy" "ini_file" "ios_command"
"ios_config" "ios_template" "iosxr_command" "iosxr_config" "iosxr_template"
"ipify_facts" "iptables" "irc" "jabber" "jboss" "jira" "junos_command"
"junos_config" "junos_facts" "junos_netconf" "junos_package" "junos_template"
"kernel_blacklist" "known_hosts" "kubernetes" "layman" "librato_annotation"
"lineinfile" "linode" "lldp" "locale_gen" "logentries" "lvg" "lvol" "lxc_container"
"macports" "mail" "make" "maven_artifact" "modprobe" "mongodb_parameter"
"mongodb_user" "monit" "mount" "mqtt" "mysql_db" "mysql_replication" "mysql_user"
"mysql_variables" "nagios" "netscaler" "newrelic_deployment" "nexmo" "nmcli" "npm"
"nxos_command" "nxos_config" "nxos_facts" "nxos_feature" "nxos_interface"
"nxos_ip_interface" "nxos_nxapi" "nxos_ping" "nxos_switchport" "nxos_template"
"nxos_vlan" "nxos_vrf" "nxos_vrf_interface" "nxos_vrrp" "ohai" "open_iscsi"
"openbsd_pkg" "openvswitch_bridge" "openvswitch_db" "openvswitch_port" "opkg"
"ops_command" "ops_config" "ops_facts" "ops_template" "os_auth" "os_client_config"
"os_flavor_facts" "os_floating_ip" "os_group" "os_image" "os_image_facts"
"os_ironic" "os_ironic_inspect" "os_ironic_node" "os_keypair" "os_keystone_domain"
"os_keystone_domain_facts" "os_keystone_role" "os_network" "os_networks_facts"
"os_nova_flavor" "os_object" "os_port" "os_port_facts" "os_project"
"os_project_facts" "os_router" "os_security_group" "os_security_group_rule"
"os_server" "os_server_actions" "os_server_facts" "os_server_volume" "os_subnet"
"os_subnets_facts" "os_user" "os_user_facts" "os_user_group" "os_user_role"
"os_volume" "osx_defaults" "osx_say" "ovirt" "package" "pacman" "pagerduty"
"pagerduty_alert" "pam_limits" "patch" "pause" "pear" "ping" "pingdom" "pip" "pkg5"
"pkg5_publisher" "pkgin" "pkgng" "pkgutil" "portage" "portinstall" "postgresql_db"
"postgresql_ext" "postgresql_lang" "postgresql_privs" "postgresql_user"
"profitbricks" "profitbricks_datacenter" "profitbricks_nic" "profitbricks_volume"
"profitbricks_volume_attachments" "proxmox" "proxmox_template" "puppet" "pushbullet"
"pushover" "rabbitmq_binding" "rabbitmq_exchange" "rabbitmq_parameter"
"rabbitmq_plugin" "rabbitmq_policy" "rabbitmq_queue" "rabbitmq_user"
"rabbitmq_vhost" "raw" "rax" "rax_cbs" "rax_cbs_attachments" "rax_cdb"
"rax_cdb_database" "rax_cdb_user" "rax_clb" "rax_clb_nodes" "rax_clb_ssl" "rax_dns"
"rax_dns_record" "rax_facts" "rax_files" "rax_files_objects" "rax_identity"
"rax_keypair" "rax_meta" "rax_mon_alarm" "rax_mon_check" "rax_mon_entity"
"rax_mon_notification" "rax_mon_notification_plan" "rax_network" "rax_queue"
"rax_scaling_group" "rax_scaling_policy" "rds" "rds_param_group" "rds_subnet_group"
"redhat_subscription" "redis" "replace" "rhn_channel" "rhn_register" "riak"
"rollbar_deployment" "route53" "route53_facts" "route53_health_check" "route53_zone"
"rpm_key" "s3" "s3_bucket" "s3_lifecycle" "s3_logging" "script" "seboolean"
"selinux" "selinux_permissive" "sendgrid" "sensu_check" "seport" "service"
"set_fact" "setup" "shell" "sl_vm" "slack" "slackpkg" "slurp" "snmp_facts" "sns"
"sns_topic" "solaris_zone" "sqs_queue" "stackdriver" "stat" "sts_assume_role"
"subversion" "supervisorctl" "svc" "svr4pkg" "swdepot" "synchronize" "sysctl" "systemd"
"taiga_issue" "template" "twilio" "typetalk" "ufw" "unarchive" "uptimerobot" "uri"
"urpmi" "user" "vca_fw" "vca_nat" "vca_vapp" "vertica_configuration" "vertica_facts"
"vertica_role" "vertica_schema" "vertica_user" "virt" "virt_net" "virt_pool"
"vmware_cluster" "vmware_datacenter" "vmware_dns_config" "vmware_dvs_host"
"vmware_dvs_portgroup" "vmware_dvswitch" "vmware_host" "vmware_maintenancemode"
"vmware_migrate_vmk" "vmware_portgroup" "vmware_target_canonical_facts"
"vmware_vm_facts" "vmware_vm_shell" "vmware_vm_vss_dvs_migrate" "vmware_vmkernel"
"vmware_vmkernel_ip_config" "vmware_vsan_cluster" "vmware_vswitch" "vsphere_copy"
"vsphere_guest" "wait_for" "webfaction_app" "webfaction_db" "webfaction_domain"
"webfaction_mailbox" "webfaction_site" "win_acl" "win_acl_inheritance"
"win_chocolatey" "win_copy" "win_dotnet_ngen" "win_environment" "win_feature"
"win_file" "win_file_version" "win_firewall_rule" "win_get_url" "win_group"
"win_iis_virtualdirectory" "win_iis_webapplication" "win_iis_webapppool"
"win_iis_webbinding" "win_iis_website" "win_lineinfile" "win_msi" "win_nssm"
"win_owner" "win_package" "win_ping" "win_reboot" "win_regedit" "win_regmerge"
"win_scheduled_task" "win_service" "win_share" "win_stat" "win_template"
"win_timezone" "win_unzip" "win_updates" "win_uri" "win_user" "win_webpicmd" "xattr"
"xenserver_facts" "yum" "yum_repository" "zabbix_group" "zabbix_host"
"zabbix_hostmacro" "zabbix_maintenance" "zabbix_screen" "zfs" "znode" "zypper"
"zypper_repository") t)
":")
"List of ansible task names.")
(defconst ansible-keywords-regex
(concat
"^ +"
(regexp-opt
'("with_items" "with_dict" "with_nested" "with_first_found" "with_fileglob"
"with_together" "with_subelements" "with_sequence" "with_random_choice" "until"
"retries" "delay" "with_lines" "with_indexed_items" "with_ini" "with_flattened"
"with_inventory_hostnames" "when" "notify" "register" "tags" "gather_facts"
"connection" "tags" "become" "become_user" "args" "local_action" "delegate_to"
"strategy") t)
":")
"Ansible keywords used with tasks.")
(defvar ansible-playbook-font-lock
`(("\\({{\\)\\([^}]+\\)\\(}}\\)"
(1 font-lock-builtin-face t)
(2 font-lock-function-name-face t)
(3 font-lock-builtin-face t))
(,ansible-section-keywords-regex (1 ansible-section-face t))
(,ansible-task-keywords-regex (1 font-lock-keyword-face t))
("^ *- \\(name\\):\\(.*\\)"
(1 font-lock-builtin-face t)
(2 ansible-task-label-face t))
(,ansible-keywords-regex (1 font-lock-builtin-face t)))
"Font lock definitions for ansible playbooks.")
(defun ansible-add-font-lock()
"Extend YAML with syntax highlight for ansible playbooks."
(interactive)
(font-lock-add-keywords 'nil ansible-playbook-font-lock 'append)
(font-lock-flush))
(defun ansible-remove-font-lock()
"Add syntax highlight to ansible playbooks."
(interactive)
(font-lock-remove-keywords 'nil ansible-playbook-font-lock)
(font-lock-flush))
(defun ansible-maybe-unload-snippets(&optional buffer-count)
"Unload ansible snippets in case no other ansible buffers exists."
;; mitigates: https://github.com/k1LoW/emacs-ansible/issues/5
(when (and (featurep 'yasnippet)
(= (or buffer-count 1) ;when called via kill-hook, the buffer is still existent
(seq-count (lambda (b) (with-current-buffer b ansible)) (buffer-list))))
(setq yas-snippet-dirs (delete ansible-snip-dir yas-snippet-dirs))
(yas-reload-all)))
;;;###autoload
(define-minor-mode ansible
"Ansible minor mode."
:lighter " Ansible"
:group 'ansible
(if ansible
(progn
(setq minor-mode-map-alist
(cons (cons 'ansible ansible-key-map)
minor-mode-map-alist))
(ansible-dict-initialize)
(ansible-remove-font-lock)
(ansible-add-font-lock)
(when (featurep 'yasnippet)
(add-to-list 'yas-snippet-dirs ansible-snip-dir t)
(yas-load-directory ansible-snip-dir))
(add-hook 'kill-buffer-hook #'ansible-maybe-unload-snippets nil t)
(run-hooks 'ansible-hook))
(ansible-remove-font-lock)
(ansible-maybe-unload-snippets 0)))
(defun ansible-update-root-path ()
"Update ansible-root-path."
(let ((spec-path (ansible-find-root-path)))
(unless (not spec-path)
(setq ansible-root-path spec-path))
(when ansible-root-path t)))
(defun ansible-find-root-path ()
"Find ansible directory."
(let ((current-dir (f-expand default-directory)))
(loop with count = 0
until (f-exists? (f-join current-dir "roles"))
;; Return nil if outside the value of
if (= count ansible-dir-search-limit)
do (return nil)
;; Or search upper directories.
else
do (incf count)
(unless (f-root? current-dir)
(setq current-dir (f-dirname current-dir)))
finally return current-dir)))
(defun ansible-list-playbooks ()
"Find .yml files in ansible-root-path."
(if (ansible-update-root-path)
(mapcar
(lambda (file) (f-relative file ansible-root-path))
(f-files ansible-root-path (lambda (file) (s-matches? ".yml" (f-long file))) t))
nil))
(defun ansible-vault-buffer (mode)
"Execute ansible-vault (MODE STR should be 'decrypt' or 'encrypt') and update current buffer."
(let* ((input (buffer-substring-no-properties (point-min) (point-max)))
(output (ansible-vault mode input)))
(delete-region (point-min) (point-max))
(insert output)))
(defun ansible-get-string-from-file (file-path)
"Return FILE-PATH's file content."
(with-temp-buffer
(insert-file-contents file-path)
(buffer-string)))
(defun ansible-vault (mode str)
"Execute ansible-vault (MODE STR should be 'decrypt' or 'encrypt')."
(let ((temp-file (make-temp-file "ansible-vault-ansible")))
(write-region str nil temp-file 'append)
(let* ((vault-str (if ansible-vault-password-file
(format "--vault-password-file=%s" ansible-vault-password-file)
""))
(command (format "ansible-vault %s %s %s"
mode vault-str temp-file))
(status (shell-command command))
(output (ansible-get-string-from-file temp-file)))
(if (/= status 0)
(error "Error in ansible-vault running %s!" command)
(delete-file temp-file)
output))))
(defun ansible-decrypt-buffer ()
"Decrypt current buffer."
(interactive)
(ansible-vault-buffer "decrypt")
;; force buffer to be marked as unmodified
(set-buffer-modified-p nil))
(defun ansible-encrypt-buffer ()
"Encrypt current buffer."
(interactive)
(ansible-vault-buffer "encrypt"))
(defconst ansible-dir (file-name-directory (or load-file-name
buffer-file-name)))
(defconst ansible-snip-dir (expand-file-name "snippets" ansible-dir))
(defun ansible-auto-decrypt-encrypt ()
"Decrypt current buffer if it is a vault encrypted file.
Also, automatically encrypts the file before saving the buffer."
(let ((vault-file? (string-match-p "\$ANSIBLE_VAULT;[0-9]+\.[0-9]+"
(buffer-substring-no-properties (point-min)
(point-max)))))
(when vault-file?
(condition-case ex
(progn
(ansible-decrypt-buffer)
(add-hook 'before-save-hook 'ansible-encrypt-buffer nil t)
(add-hook 'after-save-hook 'ansible-decrypt-buffer nil t))
('error
(message "Could not decrypt file. Make sure `ansible-vault-password-file' or the environment variable ANSIBLE_VAULT_PASSWORD_FILE is correctly set"))))))
;;;###autoload
(defun ansible-dict-initialize ()
"Initialize Ansible auto-complete."
(let ((dict-dir (expand-file-name "dict" ansible-dir)))
(when (and (f-directory? dict-dir) (boundp 'ac-user-dictionary-files))
(add-to-list 'ac-user-dictionary-files (f-join dict-dir "ansible") t))))
(provide 'ansible)
;;; ansible.el ends here
(define-package "ansible" "20220114.45" "Ansible minor mode"
'((s "1.9.0")
(f "0.16.2"))
:commit "d89ac0ee57742cca0f0e0a3453d9dcc521575690" :authors
'(("k1LoW (Kenichirou Oyama), <k1lowxb [at] gmail [dot] com> <k1low [at] 101000lab [dot] org>"))
:maintainers
'(("k1LoW (Kenichirou Oyama), <k1lowxb [at] gmail [dot] com> <k1low [at] 101000lab [dot] org>"))
:maintainer
'("k1LoW (Kenichirou Oyama), <k1lowxb [at] gmail [dot] com> <k1low [at] 101000lab [dot] org>")
:url "https://github.com/k1LoW/emacs-ansible")
;; Local Variables:
;; no-byte-compile: t
;; End:
;;; ansible-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*-
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "ansible" "ansible.el" (0 0 0 0))
;;; Generated autoloads from ansible.el
(defvar ansible-key-map (make-sparse-keymap) "\
Keymap for Ansible.")
(autoload 'ansible "ansible" "\
Ansible minor mode.
This is a minor mode. If called interactively, toggle the
`Ansible mode' mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is `toggle'. Enable
the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate `ansible'.
The mode's hook is called both when the mode is enabled and when
it is disabled.
\(fn &optional ARG)" t nil)
(autoload 'ansible-dict-initialize "ansible" "\
Initialize Ansible auto-complete." nil nil)
(register-definition-prefixes "ansible" '("ansible-"))
;;;***
;;;### (autoloads nil nil ("ansible-pkg.el") (0 0 0 0))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; ansible-autoloads.el ends here