"
- (if (plist-get info :with-toc) "
"
- "
")
- ;; Document title.
- (let ((title (plist-get info :title)))
- (format "
%s \n" (org-export-data (or title "") info)))
- contents
- ""
- ;; Table of contents.
- (let ((depth (plist-get info :with-toc)))
- (when depth
- (concat
- "
"
- (org-twbs-toc depth info)
- "
")))
- "
"
- (format "%s>\n"
- (nth 1 (assq 'content org-twbs-divs)))
- ;; Postamble.
- (org-twbs--build-pre/postamble 'postamble info)
- ;; Google Analytics
- (let ((gid (plist-get info :gid)))
- (when gid
- (format org-twbs-google-analytics gid)))
- ;; Closing document.
- "\n"))
-
-(defun org-twbs--translate (s info)
- "Translate string S according to specified language.
-INFO is a plist used as a communication channel."
- (org-export-translate s :html info))
-
-;;;; Anchor
-
-(defun org-twbs--anchor (&optional id desc attributes)
- "Format a HTML anchor."
- (let* ((name (and org-twbs-allow-name-attribute-in-anchors id))
- (attributes (concat (and id (format " id=\"%s\"" id))
- (and name (format " name=\"%s\"" name))
- attributes)))
- (format "
%s " attributes (or desc ""))))
-
-;;;; Todo
-
-(defun org-twbs--todo (todo)
- "Format TODO keywords into HTML."
- (when todo
- (let* ((is-done (member todo org-done-keywords))
- (class (if is-done org-twbs-todo-kwd-class-done
- org-twbs-todo-kwd-class-undone))
- (is-label (string-prefix-p "label-" class)))
- (format "
%s "
- (if is-label "label " "")
- class
- org-twbs-todo-kwd-class-prefix (org-twbs-fix-class-name todo)
- todo))))
-
-;;;; Tags
-
-(defun org-twbs--tags (tags)
- "Format TAGS into HTML."
- (when tags
- (format "
%s "
- (mapconcat
- (lambda (tag)
- (format "
%s "
- org-twbs-tag-class
- (concat org-twbs-tag-class-prefix
- (org-twbs-fix-class-name tag))
- tag))
- tags " "))))
-
-;;;; Headline
-
-(defun* org-twbs-format-headline
- (todo todo-type priority text tags
- &key level section-number headline-label &allow-other-keys)
- "Format a headline in HTML."
- (let ((section-number
- (when section-number
- (format "
%s "
- level section-number)))
- (todo (org-twbs--todo todo))
- (tags (org-twbs--tags tags)))
- (concat section-number todo (and todo " ") text
- (and tags " ") tags)))
-
-;;;; Src Code
-
-(defun org-twbs-fontify-code (code lang)
- "Color CODE with htmlize library.
-CODE is a string representing the source code to colorize. LANG
-is the language used for CODE, as a string, or nil."
- (when code
- (cond
- ;; Case 1: No lang. Possibly an example block.
- ((not lang)
- ;; Simple transcoding.
- (org-twbs-encode-plain-text code))
- ;; Case 2: No htmlize or an inferior version of htmlize
- ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
- ;; Emit a warning.
- (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
- ;; Simple transcoding.
- (org-twbs-encode-plain-text code))
- (t
- ;; Map language
- (setq lang (or (assoc-default lang org-src-lang-modes) lang))
- (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
- (cond
- ;; Case 1: Language is not associated with any Emacs mode
- ((not (functionp lang-mode))
- ;; Simple transcoding.
- (org-twbs-encode-plain-text code))
- ;; Case 2: Default. Fontify code.
- (t
- ;; htmlize
- (setq code (with-temp-buffer
- ;; Switch to language-specific mode.
- (funcall lang-mode)
- (insert code)
- ;; Fontify buffer.
- (font-lock-fontify-buffer)
- ;; Remove formatting on newline characters.
- (save-excursion
- (let ((beg (point-min))
- (end (point-max)))
- (goto-char beg)
- (while (progn (end-of-line) (< (point) end))
- (put-text-property (point) (1+ (point)) 'face nil)
- (forward-char 1))))
- (org-src-mode)
- (set-buffer-modified-p nil)
- ;; Htmlize region.
- (org-twbs-htmlize-region-for-paste
- (point-min) (point-max))))
- ;; Strip any enclosing
tags.
- (let* ((beg (and (string-match "\\`
]*>\n*" code) (match-end 0)))
- (end (and beg (string-match " \\'" code))))
- (if (and beg end) (substring code beg end) code)))))))))
-
-(defun org-twbs-do-format-code
- (code &optional lang refs retain-labels num-start)
- "Format CODE string as source code.
-Optional arguments LANG, REFS, RETAIN-LABELS and NUM-START are,
-respectively, the language of the source code, as a string, an
-alist between line numbers and references (as returned by
-`org-export-unravel-code'), a boolean specifying if labels should
-appear in the source code, and the number associated to the first
-line of code."
- (let* ((code-lines (org-split-string code "\n"))
- (code-length (length code-lines))
- (num-fmt
- (and num-start
- (format "%%%ds: "
- (length (number-to-string (+ code-length num-start))))))
- (code (org-twbs-fontify-code code lang)))
- (org-export-format-code
- code
- (lambda (loc line-num ref)
- (setq loc
- (concat
- ;; Add line number, if needed.
- (when num-start
- (format "
%s "
- (format num-fmt line-num)))
- ;; Transcoded src line.
- loc
- ;; Add label, if needed.
- (when (and ref retain-labels) (format " (%s)" ref))))
- ;; Mark transcoded line as an anchor, if needed.
- (if (not ref) loc
- (format "
%s "
- ref loc)))
- num-start refs)))
-
-(defun org-twbs-format-code (element info)
- "Format contents of ELEMENT as source code.
-ELEMENT is either an example block or a src block. INFO is
-a plist used as a communication channel."
- (let* ((lang (org-element-property :language element))
- ;; Extract code and references.
- (code-info (org-export-unravel-code element))
- (code (car code-info))
- (refs (cdr code-info))
- ;; Does the src block contain labels?
- (retain-labels (org-element-property :retain-labels element))
- ;; Does it have line numbers?
- (num-start (case (org-element-property :number-lines element)
- (continued (org-export-get-loc element info))
- (new 0))))
- (org-twbs-do-format-code code lang refs retain-labels num-start)))
-
-
-;;; Tables of Contents
-
-(defun org-twbs-display-headline-number-p (headline-number info)
- "Predicate deciding if headline number should be displayed."
- (let ((whn (plist-get info :with-headline-numbers)))
- (or (eq whn t) (and (wholenump whn) (<= (length headline-number) whn)))))
-
-(defun org-twbs-collect-headlines (info depth &optional scope)
- "Another arity change in org:
-http://orgmode.org/w/?p=org-mode.git;a=commit;h=b07e2f6ff1feddde83506b7fdb370bfe8e0a5337
-Try new 3-arity first, then old 2-arity."
- (with-no-warnings
- (condition-case nil
- (org-export-collect-headlines info depth scope)
- (error (org-export-collect-headlines info depth)))))
-
-(defun org-twbs-toc (depth info &optional scope)
- "Build a table of contents.
-DEPTH is an integer specifying the depth of the table. INFO is a
-plist used as a communication channel. Return the table of
-contents as a string, or nil if it is empty."
- (let ((toc-entries
- (mapcar (lambda (headline)
- (cons (org-twbs--format-toc-headline headline info)
- (org-export-get-relative-level headline info)))
- (org-twbs-collect-headlines info depth scope)))
- (outer-tag "nav"))
- (when toc-entries
- (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
- "\n"
- (format "%s>\n" outer-tag)))))
-
-(defun org-twbs--toc-text (toc-entries)
- "Return innards of a table of contents, as a string.
-TOC-ENTRIES is an alist where key is an entry title, as a string,
-and value is its relative level, as an integer."
- (let* ((prev-level (1- (cdar toc-entries)))
- (start-level prev-level))
- (concat
- (mapconcat
- (lambda (entry)
- (let ((headline (car entry))
- (level (cdr entry)))
- (concat
- (let* ((cnt (- level prev-level))
- (times (if (> cnt 0) (1- cnt) (- cnt)))
- rtn)
- (setq prev-level level)
- (concat
- (org-twbs--make-string
- times (cond ((> cnt 0) "\n
\n")))
- (if (> cnt 0) "\n
\n" " \n")))
- headline)))
- toc-entries "")
- (org-twbs--make-string (- prev-level start-level) " \n \n"))))
-
-(defun org-twbs--format-toc-headline (headline info)
- "Return an appropriate table of contents entry for HEADLINE.
-INFO is a plist used as a communication channel."
- (let* ((headline-number (org-export-get-headline-number headline info))
- (todo (and (plist-get info :with-todo-keywords)
- (plist-get info :with-toc-todo-keywords)
- (let ((todo (org-element-property :todo-keyword headline)))
- (and todo (org-export-data todo info)))))
- (todo-type (and todo (org-element-property :todo-type headline)))
- (priority (and (plist-get info :with-priority)
- (org-element-property :priority headline)))
- (text (org-export-data-with-backend
- (org-export-get-alt-title headline info)
- ;; Create an anonymous back-end that will ignore any
- ;; footnote-reference, link, radio-target and target
- ;; in table of contents.
- (org-export-create-backend
- :parent 'twbs
- :transcoders '((footnote-reference . ignore)
- (link . (lambda (object c i) c))
- (radio-target . (lambda (object c i) c))
- (target . ignore)))
- info))
- (tags (and (plist-get info :with-tags)
- (plist-get info :with-toc-tags)
- (org-export-get-tags headline info))))
- (format "
%s "
- ;; Label.
- (or (org-element-property :CUSTOM_ID headline)
- (concat "sec-"
- (mapconcat #'number-to-string headline-number "-")))
- ;; Body.
- (concat
- (and (not (org-export-low-level-p headline info))
- (org-export-numbered-headline-p headline info)
- (org-twbs-display-headline-number-p headline-number info)
- (concat (mapconcat #'number-to-string headline-number ".")
- ". "))
- (apply (if (not (eq org-twbs-format-headline-function 'ignore))
- (lambda (todo todo-type priority text tags &rest ignore)
- (funcall org-twbs-format-headline-function
- todo todo-type priority text tags))
- #'org-twbs-format-headline)
- todo todo-type priority text tags :section-number nil)))))
-
-(defun org-twbs-list-of-listings (info)
- "Build a list of listings.
-INFO is a plist used as a communication channel. Return the list
-of listings as a string, or nil if it is empty."
- (let ((lol-entries (org-export-collect-listings info)))
- (when lol-entries
- (concat "
\n"
- (format "
%s \n"
- org-twbs-toplevel-hlevel
- (org-twbs--translate "List of Listings" info)
- org-twbs-toplevel-hlevel)
- "
\n
\n"
- (let ((count 0)
- (initial-fmt (format "%s "
- (org-twbs--translate "Listing %d:" info))))
- (mapconcat
- (lambda (entry)
- (let ((label (org-element-property :name entry))
- (title (org-trim
- (org-export-data
- (or (org-export-get-caption entry t)
- (org-export-get-caption entry))
- info))))
- (concat
- ""
- (if (not label)
- (concat (format initial-fmt (incf count)) " " title)
- (format "%s %s "
- label
- (format initial-fmt (incf count))
- title))
- " ")))
- lol-entries "\n"))
- "\n \n
\n
"))))
-
-(defun org-twbs-list-of-tables (info)
- "Build a list of tables.
-INFO is a plist used as a communication channel. Return the list
-of tables as a string, or nil if it is empty."
- (let ((lol-entries (org-export-collect-tables info)))
- (when lol-entries
- (concat "
\n"
- (format "
%s \n"
- org-twbs-toplevel-hlevel
- (org-twbs--translate "List of Tables" info)
- org-twbs-toplevel-hlevel)
- "
\n
\n"
- (let ((count 0)
- (initial-fmt (format "%s "
- (org-twbs--translate "Table %d:" info))))
- (mapconcat
- (lambda (entry)
- (let ((label (org-element-property :name entry))
- (title (org-trim
- (org-export-data
- (or (org-export-get-caption entry t)
- (org-export-get-caption entry))
- info))))
- (concat
- ""
- (if (not label)
- (concat (format initial-fmt (incf count)) " " title)
- (format "%s %s "
- label
- (format initial-fmt (incf count))
- title))
- " ")))
- lol-entries "\n"))
- "\n \n
\n
"))))
-
-
-;;; Transcode Functions
-
-;;;; Bold
-
-(defun org-twbs-bold (bold contents info)
- "Transcode BOLD from Org to HTML.
-CONTENTS is the text with bold markup. INFO is a plist holding
-contextual information."
- (format (or (cdr (assq 'bold org-twbs-text-markup-alist)) "%s")
- contents))
-
-;;;; Center Block
-
-(defun org-twbs-center-block (center-block contents info)
- "Transcode a CENTER-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information."
- (format "
\n%s
" contents))
-
-;;;; Clock
-
-(defun org-twbs-clock (clock contents info)
- "Transcode a CLOCK element from Org to HTML.
-CONTENTS is nil. INFO is a plist used as a communication
-channel."
- (format "
-
-%s %s %s
-
-
"
- org-clock-string
- (org-timestamp-translate (org-element-property :value clock))
- (let ((time (org-element-property :duration clock)))
- (and time (format "
(%s) " time)))))
-
-;;;; Code
-
-(defun org-twbs-code (code contents info)
- "Transcode CODE from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (format (or (cdr (assq 'code org-twbs-text-markup-alist)) "%s")
- (org-twbs-encode-plain-text (org-element-property :value code))))
-
-;;;; Drawer
-
-(defun org-twbs-drawer (drawer contents info)
- "Transcode a DRAWER element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information."
- (if (functionp org-twbs-format-drawer-function)
- (funcall org-twbs-format-drawer-function
- (org-element-property :drawer-name drawer)
- contents)
- ;; If there's no user defined function: simply
- ;; display contents of the drawer.
- contents))
-
-;;;; Dynamic Block
-
-(defun org-twbs-dynamic-block (dynamic-block contents info)
- "Transcode a DYNAMIC-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information. See `org-export-data'."
- contents)
-
-;;;; Entity
-
-(defun org-twbs-entity (entity contents info)
- "Transcode an ENTITY object from Org to HTML.
-CONTENTS are the definition itself. INFO is a plist holding
-contextual information."
- (org-element-property :html entity))
-
-;;;; Example Block
-
-(defun org-twbs-example-block (example-block contents info)
- "Transcode a EXAMPLE-BLOCK element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (if (org-export-read-attribute :attr_html example-block :textarea)
- (org-twbs--textarea-block example-block)
- (format "
\n%s "
- (org-twbs-format-code example-block info))))
-
-;;;; Export Snippet
-
-(defun org-twbs-export-snippet (export-snippet contents info)
- "Transcode a EXPORT-SNIPPET object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (when (eq (org-export-snippet-backend export-snippet) 'html)
- (org-element-property :value export-snippet)))
-
-;;;; Export Block
-
-(defun org-twbs-export-block (export-block contents info)
- "Transcode a EXPORT-BLOCK element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (when (string= (org-element-property :type export-block) "HTML")
- (org-remove-indentation (org-element-property :value export-block))))
-
-;;;; Fixed Width
-
-(defun org-twbs-fixed-width (fixed-width contents info)
- "Transcode a FIXED-WIDTH element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (format "
\n%s "
- (org-twbs-do-format-code
- (org-remove-indentation
- (org-element-property :value fixed-width)))))
-
-;;;; Footnote Reference
-
-(defun org-twbs-footnote-reference (footnote-reference contents info)
- "Transcode a FOOTNOTE-REFERENCE element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (concat
- ;; Insert separator between two footnotes in a row.
- (let ((prev (org-export-get-previous-element footnote-reference info)))
- (when (eq (org-element-type prev) 'footnote-reference)
- org-twbs-footnote-separator))
- (cond
- ((not (org-export-footnote-first-reference-p footnote-reference info))
- (org-twbs-format-footnote-reference
- (org-export-get-footnote-number footnote-reference info)
- "IGNORED" 100))
- ;; Inline definitions are secondary strings.
- ((eq (org-element-property :type footnote-reference) 'inline)
- (org-twbs-format-footnote-reference
- (org-export-get-footnote-number footnote-reference info)
- "IGNORED" 1))
- ;; Non-inline footnotes definitions are full Org data.
- (t (org-twbs-format-footnote-reference
- (org-export-get-footnote-number footnote-reference info)
- "IGNORED" 1)))))
-
-;;;; Headline
-
-(defun org-twbs-format-headline--wrap
- (headline info &optional format-function &rest extra-keys)
- "Transcode a HEADLINE element from Org to HTML.
-CONTENTS holds the contents of the headline. INFO is a plist
-holding contextual information."
- (let* ((level (+ (org-export-get-relative-level headline info)
- (1- org-twbs-toplevel-hlevel)))
- (headline-number (org-export-get-headline-number headline info))
- (section-number (and (not (org-export-low-level-p headline info))
- (org-export-numbered-headline-p headline info)
- (org-twbs-display-headline-number-p headline-number info)
- (mapconcat 'number-to-string
- headline-number ".")))
- (todo (and (plist-get info :with-todo-keywords)
- (let ((todo (org-element-property :todo-keyword headline)))
- (and todo (org-export-data todo info)))))
- (todo-type (and todo (org-element-property :todo-type headline)))
- (priority (and (plist-get info :with-priority)
- (org-element-property :priority headline)))
- (text (org-export-data (org-element-property :title headline) info))
- (tags (and (plist-get info :with-tags)
- (org-export-get-tags headline info)))
- (headline-label (or (org-element-property :CUSTOM_ID headline)
- (concat "sec-" (mapconcat 'number-to-string
- headline-number "-"))))
- (format-function
- (cond ((functionp format-function) format-function)
- ((not (eq org-twbs-format-headline-function 'ignore))
- (lambda (todo todo-type priority text tags &rest ignore)
- (funcall org-twbs-format-headline-function
- todo todo-type priority text tags)))
- (t 'org-twbs-format-headline))))
- (apply format-function
- todo todo-type priority text tags
- :headline-label headline-label :level level
- :section-number section-number extra-keys)))
-
-(defun org-twbs-headline (headline contents info)
- "Transcode a HEADLINE element from Org to HTML.
-CONTENTS holds the contents of the headline. INFO is a plist
-holding contextual information."
- (unless (org-element-property :footnote-section-p headline)
- (let* ((contents (or contents ""))
- (numberedp (org-export-numbered-headline-p headline info))
- (level (org-export-get-relative-level headline info))
- (text (org-export-data (org-element-property :title headline) info))
- (todo (and (plist-get info :with-todo-keywords)
- (let ((todo (org-element-property :todo-keyword headline)))
- (and todo (org-export-data todo info)))))
- (todo-type (and todo (org-element-property :todo-type headline)))
- (tags (and (plist-get info :with-tags)
- (org-export-get-tags headline info)))
- (priority (and (plist-get info :with-priority)
- (org-element-property :priority headline)))
- (section-number (mapconcat #'number-to-string
- (org-export-get-headline-number
- headline info) "-"))
- (ids (delq 'nil
- (list (org-element-property :CUSTOM_ID headline)
- (concat "sec-" section-number)
- (org-element-property :ID headline))))
- (preferred-id (car ids))
- (extra-ids (mapconcat
- (lambda (id)
- (org-twbs--anchor
- (if (org-uuidgen-p id) (concat "ID-" id) id)))
- (cdr ids) ""))
- ;; Create the headline text.
- (full-text (org-twbs-format-headline--wrap headline info)))
- (if (org-export-low-level-p headline info)
- ;; This is a deep sub-tree: export it as a list item.
- (let* ((type (if numberedp 'ordered 'unordered))
- (itemized-body
- (org-twbs-format-list-item
- contents type nil info nil
- (concat (org-twbs--anchor preferred-id) extra-ids
- full-text))))
- (concat
- (and (org-export-first-sibling-p headline info)
- (org-twbs-begin-plain-list type))
- itemized-body
- (and (org-export-last-sibling-p headline info)
- (org-twbs-end-plain-list type))))
- ;; Standard headline. Export it as a section.
- (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
- (level1 (+ level (1- org-twbs-toplevel-hlevel)))
- (first-content (car (org-element-contents headline))))
- (format "<%s id=\"%s\" class=\"%s\">%s%s%s>\n"
- (org-twbs--container headline info)
- (format "outline-container-%s"
- (or (org-element-property :CUSTOM_ID headline)
- (concat "sec-" section-number)))
- (concat (format "outline-%d" level1) (and extra-class " ")
- extra-class)
- (format "\n
%s%s \n"
- level1 preferred-id extra-ids full-text level1)
- ;; When there is no section, pretend there is an
- ;; empty one to get the correct
\n" class extra) text "
\n")))
-
-(defun org-twbs-inlinetask (inlinetask contents info)
- "Transcode an INLINETASK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information."
- (cond
- ;; If `org-twbs-format-inlinetask-function' is not 'ignore, call it
- ;; with appropriate arguments.
- ((not (eq org-twbs-format-inlinetask-function 'ignore))
- (let ((format-function
- (function*
- (lambda (todo todo-type priority text tags
- &key contents &allow-other-keys)
- (funcall org-twbs-format-inlinetask-function
- todo todo-type priority text tags contents)))))
- (org-twbs-format-headline--wrap
- inlinetask info format-function :contents contents)))
- ;; Otherwise, use a default template.
- (t (format "
\n%s %s\n%s
"
- (org-twbs-format-headline--wrap inlinetask info)
- (org-twbs-close-tag "br" nil info)
- contents))))
-
-;;;; Italic
-
-(defun org-twbs-italic (italic contents info)
- "Transcode ITALIC from Org to HTML.
-CONTENTS is the text with italic markup. INFO is a plist holding
-contextual information."
- (format (or (cdr (assq 'italic org-twbs-text-markup-alist)) "%s") contents))
-
-;;;; Item
-
-(defun org-twbs-checkbox (checkbox)
- "Format CHECKBOX into HTML."
- (case checkbox (on "
[X]
")
- (off "
[ ]
")
- (trans "
[-]
")
- (t "")))
-
-(defun org-twbs-format-list-item (contents type checkbox info
- &optional term-counter-id
- headline)
- "Format a list item into HTML."
- (let ((checkbox (concat (org-twbs-checkbox checkbox) (and checkbox " ")))
- (br (org-twbs-close-tag "br" nil info)))
- (concat
- (case type
- (ordered
- (let* ((counter term-counter-id)
- (extra (if counter (format " value=\"%s\"" counter) "")))
- (concat
- (format "
" extra)
- (when headline (concat headline br)))))
- (unordered
- (let* ((id term-counter-id)
- (extra (if id (format " id=\"%s\"" id) "")))
- (concat
- (format " " extra)
- (when headline (concat headline br)))))
- (descriptive
- (let* ((term term-counter-id))
- (setq term (or term "(no term)"))
- ;; Check-boxes in descriptive lists are associated to tag.
- (concat (format " %s "
- (concat checkbox term))
- ""))))
- (unless (eq type 'descriptive) checkbox)
- contents
- (case type
- (ordered " ")
- (unordered "")
- (descriptive "")))))
-
-(defun org-twbs-item (item contents info)
- "Transcode an ITEM element from Org to HTML.
-CONTENTS holds the contents of the item. INFO is a plist holding
-contextual information."
- (let* ((plain-list (org-export-get-parent item))
- (type (org-element-property :type plain-list))
- (counter (org-element-property :counter item))
- (checkbox (org-element-property :checkbox item))
- (tag (let ((tag (org-element-property :tag item)))
- (and tag (org-export-data tag info)))))
- (org-twbs-format-list-item
- contents type checkbox info (or tag counter))))
-
-;;;; Keyword
-
-(defun org-twbs-keyword (keyword contents info)
- "Transcode a KEYWORD element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((key (org-element-property :key keyword))
- (value (org-element-property :value keyword)))
- (cond
- ((string= key "HTML") value)
- ((string= key "TOC")
- (let ((value (downcase value)))
- (cond
- ((string-match "\\
" value)
- (let ((depth (or (and (string-match "[0-9]+" value)
- (string-to-number (match-string 0 value)))
- (plist-get info :with-toc))))
- (org-twbs-toc depth info)))
- ((string= "listings" value) (org-twbs-list-of-listings info))
- ((string= "tables" value) (org-twbs-list-of-tables info))))))))
-
-;;;; Latex Environment
-
-(defun org-twbs-format-latex-arity (prefix &optional dir overlays msg
- at forbuffer processing-type)
- "Arity fix for org-format-latex signature change here:
-http://orgmode.org/w/?p=org-mode.git;a=commit;h=8daf4a89f1a157c0ee2c91e5b990203679b31cf7
-Call 7-arity first, then 6-arity if first fails."
- (with-no-warnings
- (condition-case nil
- (org-format-latex prefix nil nil dir overlays msg forbuffer processing-type)
- (error
- (condition-case nil
- (org-format-latex prefix dir overlays msg at forbuffer processing-type)
- (error
- (org-format-latex prefix dir overlays msg forbuffer processing-type)))))))
-
-(defun org-twbs-format-latex (latex-frag processing-type info)
- "Format a LaTeX fragment LATEX-FRAG into HTML.
-PROCESSING-TYPE designates the tool used for conversion. It is
-a symbol among `mathjax', `dvipng', `imagemagick', `verbatim' nil
-and t. See `org-twbs-with-latex' for more information. INFO is
-a plist containing export properties."
- (let ((cache-relpath "") (cache-dir ""))
- (unless (eq processing-type 'mathjax)
- (let ((bfn (or (buffer-file-name)
- (make-temp-name
- (expand-file-name "latex" temporary-file-directory))))
- (latex-header
- (let ((header (plist-get info :latex-header)))
- (and header
- (concat (mapconcat
- (lambda (line) (concat "#+LATEX_HEADER: " line))
- (org-split-string header "\n")
- "\n")
- "\n")))))
- (setq cache-relpath
- (concat "ltxpng/"
- (file-name-sans-extension
- (file-name-nondirectory bfn)))
- cache-dir (file-name-directory bfn))
- ;; Re-create LaTeX environment from original buffer in
- ;; temporary buffer so that dvipng/imagemagick can properly
- ;; turn the fragment into an image.
- (setq latex-frag (concat latex-header latex-frag))))
- (with-temp-buffer
- (insert latex-frag)
- (org-twbs-format-latex-arity cache-relpath cache-dir nil
- "Creating LaTeX Image..."
- nil nil processing-type)
- (buffer-string))))
-
-(defun org-twbs-latex-environment (latex-environment contents info)
- "Transcode a LATEX-ENVIRONMENT element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((processing-type (plist-get info :with-latex))
- (latex-frag (org-remove-indentation
- (org-element-property :value latex-environment)))
- (attributes (org-export-read-attribute :attr_html latex-environment)))
- (case processing-type
- ((t mathjax)
- (org-twbs-format-latex latex-frag 'mathjax info))
- ((dvipng imagemagick)
- (let ((formula-link
- (org-twbs-format-latex latex-frag processing-type info)))
- (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
- ;; Do not provide a caption or a name to be consistent with
- ;; `mathjax' handling.
- (org-twbs--wrap-image
- (org-twbs--format-image
- (match-string 1 formula-link) attributes info) info))))
- (t latex-frag))))
-
-;;;; Latex Fragment
-
-(defun org-twbs-latex-fragment (latex-fragment contents info)
- "Transcode a LATEX-FRAGMENT object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((latex-frag (org-element-property :value latex-fragment))
- (processing-type (plist-get info :with-latex)))
- (case processing-type
- ((t mathjax)
- (org-twbs-format-latex latex-frag 'mathjax info))
- ((dvipng imagemagick)
- (let ((formula-link
- (org-twbs-format-latex latex-frag processing-type info)))
- (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
- (org-twbs--format-image (match-string 1 formula-link) nil info))))
- (t latex-frag))))
-
-;;;; Line Break
-
-(defun org-twbs-line-break (line-break contents info)
- "Transcode a LINE-BREAK object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (concat (org-twbs-close-tag "br" nil info) "\n"))
-
-;;;; Link
-
-(defun org-twbs-inline-image-p (link info)
- "Non-nil when LINK is meant to appear as an image.
-INFO is a plist used as a communication channel. LINK is an
-inline image when it has no description and targets an image
-file (see `org-twbs-inline-image-rules' for more information), or
-if its description is a single link targeting an image file."
- (if (not (org-element-contents link))
- (org-export-inline-image-p link org-twbs-inline-image-rules)
- (not
- (let ((link-count 0))
- (org-element-map (org-element-contents link)
- (cons 'plain-text org-element-all-objects)
- (lambda (obj)
- (case (org-element-type obj)
- (plain-text (org-string-nw-p obj))
- (link (if (= link-count 1) t
- (incf link-count)
- (not (org-export-inline-image-p
- obj org-twbs-inline-image-rules))))
- (otherwise t)))
- info t)))))
-
-(defvar org-twbs-standalone-image-predicate)
-(defun org-twbs-standalone-image-p (element info)
- "Non-nil if ELEMENT is a standalone image.
-
-INFO is a plist holding contextual information.
-
-An element or object is a standalone image when
-
- - its type is `paragraph' and its sole content, save for white
- spaces, is a link that qualifies as an inline image;
-
- - its type is `link' and its containing paragraph has no other
- content save white spaces.
-
-Bind `org-twbs-standalone-image-predicate' to constrain paragraph
-further. For example, to check for only captioned standalone
-images, set it to:
-
- \(lambda (paragraph) (org-element-property :caption paragraph))"
- (let ((paragraph (case (org-element-type element)
- (paragraph element)
- (link (org-export-get-parent element)))))
- (and (eq (org-element-type paragraph) 'paragraph)
- (or (not (fboundp 'org-twbs-standalone-image-predicate))
- (funcall org-twbs-standalone-image-predicate paragraph))
- (catch 'exit
- (let ((link-count 0))
- (org-element-map (org-element-contents paragraph)
- (cons 'plain-text org-element-all-objects)
- #'(lambda (obj)
- (when (case (org-element-type obj)
- (plain-text (org-string-nw-p obj))
- (link (or (> (incf link-count) 1)
- (not (org-twbs-inline-image-p obj info))))
- (otherwise t))
- (throw 'exit nil)))
- info nil 'link)
- (= link-count 1))))))
-
-(defun org-twbs-export-file-uri (filename)
- "Return file URI associated to FILENAME."
- (cond ((org-string-match-p "\\`//" filename) (concat "file:" filename))
- ((not (file-name-absolute-p filename)) filename)
- ((org-file-remote-p filename) (concat "file:/" filename))
- (t (concat "file://" (expand-file-name filename)))))
-
-(defun org-twbs-fuzzy (file search)
- (cond ((fboundp 'org-publish-resolve-external-fuzzy-link)
- (let ((numbers
- (org-publish-resolve-external-fuzzy-link file search)))
- (and numbers (concat "#sec-"
- (mapconcat 'number-to-string
- numbers "-")))))
- ((fboundp 'org-publish-resolve-external-link)
- (let ((rez (org-publish-resolve-external-link search file)))
- (concat "#" rez)))
- (t "")))
-
-(defun org-twbs-link (link desc info)
- "Transcode a LINK object from Org to HTML.
-DESC is the description part of the link, or the empty string.
-INFO is a plist holding contextual information. See
-`org-export-data'."
- (let* ((home (when (plist-get info :html-link-home)
- (org-trim (plist-get info :html-link-home))))
- (use-abs-url (plist-get info :html-link-use-abs-url))
- (link-org-files-as-html-maybe
- (lambda (raw-path info)
- ;; Treat links to `file.org' as links to `file.html', if
- ;; needed. See `org-twbs-link-org-files-as-html'.
- (cond
- ((and (plist-get info :html-link-org-files-as-html)
- (string= ".org"
- (downcase (file-name-extension raw-path "."))))
- (concat (file-name-sans-extension raw-path) "."
- (plist-get info :html-extension)))
- (t raw-path))))
- (type (org-element-property :type link))
- (raw-path (org-element-property :path link))
- ;; Ensure DESC really exists, or set it to nil.
- (desc (org-string-nw-p desc))
- (path
- (cond
- ((member type '("http" "https" "ftp" "mailto"))
- (org-link-escape
- (org-link-unescape
- (concat type ":" raw-path)) '(32 91 93 37)))
- ((string= type "file")
- ;; Treat links to ".org" files as ".html", if needed.
- (setq raw-path
- (funcall link-org-files-as-html-maybe raw-path info))
- ;; If file path is absolute, prepend it with protocol
- ;; component - "file://".
- (cond
- ((file-name-absolute-p raw-path)
- (setq raw-path (org-twbs-export-file-uri raw-path)))
- ((and home use-abs-url)
- (setq raw-path (concat (file-name-as-directory home) raw-path))))
- ;; Add search option, if any. A search option can be
- ;; relative to a custom-id, a headline title a name,
- ;; a target or a radio-target.
- (let ((option (org-element-property :search-option link)))
- (cond ((not option) raw-path)
- ;; Since HTML back-end use custom-id value as-is,
- ;; resolving is them is trivial.
- ((eq (string-to-char option) ?#) (concat raw-path option))
- (t
- (concat raw-path
- (org-twbs-fuzzy
- (org-element-property :path link)
- option))))))
- (t raw-path)))
- ;; Extract attributes from parent's paragraph. HACK: Only do
- ;; this for the first link in parent (inner image link for
- ;; inline images). This is needed as long as attributes
- ;; cannot be set on a per link basis.
- (attributes-plist
- (let* ((parent (org-export-get-parent-element link))
- (link (let ((container (org-export-get-parent link)))
- (if (and (eq (org-element-type container) 'link)
- (org-twbs-inline-image-p link info))
- container
- link))))
- (and (eq (org-element-map parent 'link 'identity info t) link)
- (org-export-read-attribute :attr_html parent))))
- (attributes
- (let ((attr (org-twbs--make-attribute-string attributes-plist)))
- (if (org-string-nw-p attr) (concat " " attr) ""))))
- (cond
- ;; Image file.
- ((and (plist-get info :html-inline-images)
- (org-export-inline-image-p
- link (plist-get info :html-inline-image-rules)))
- (org-twbs--format-image path attributes-plist info))
- ;; Radio target: Transcode target's contents and use them as
- ;; link's description.
- ((string= type "radio")
- (let ((destination (org-export-resolve-radio-link link info)))
- (if (not destination) desc
- (format "%s "
- (org-element-property :value destination)
- attributes desc))))
- ;; Links pointing to a headline: Find destination and build
- ;; appropriate referencing command.
- ((member type '("custom-id" "fuzzy" "id"))
- (let ((destination (if (string= type "fuzzy")
- (org-export-resolve-fuzzy-link link info)
- (org-export-resolve-id-link link info))))
- (case (org-element-type destination)
- ;; ID link points to an external file.
- (plain-text
- (let ((fragment (concat "ID-" path))
- ;; Treat links to ".org" files as ".html", if needed.
- (path (funcall link-org-files-as-html-maybe
- destination info)))
- (format "%s "
- path fragment attributes (or desc destination))))
- ;; Fuzzy link points nowhere.
- ((nil)
- (format "%s "
- (or desc
- (org-export-data
- (org-element-property :raw-link link) info))))
- ;; Link points to a headline.
- (headline
- (let ((href
- ;; What href to use?
- (cond
- ;; Case 1: Headline is linked via it's CUSTOM_ID
- ;; property. Use CUSTOM_ID.
- ((string= type "custom-id")
- (org-element-property :CUSTOM_ID destination))
- ;; Case 2: Headline is linked via it's ID property
- ;; or through other means. Use the default href.
- ((member type '("id" "fuzzy"))
- (format "sec-%s"
- (mapconcat 'number-to-string
- (org-export-get-headline-number
- destination info) "-")))
- (t (error "Shouldn't reach here"))))
- ;; What description to use? Previously, we'd look if
- ;; section numbering was enabled, and use that
- ;; number, however, rendering a link description as
- ;; number seems less useful than destination title.
- ;; And since Org 8.3 there has been a lot of
- ;; dependencies on :section-number, so will do
- ;; something simple here for now.
- (desc
- (or desc (org-export-data (org-element-property
- :title destination) info))))
- (format "%s "
- href attributes desc)))
- ;; Fuzzy link points to a target or an element.
- (t
- (let* ((path path)
- (org-twbs-standalone-image-predicate 'org-twbs--has-caption-p)
- (number (cond
- (desc nil)
- ((org-twbs-standalone-image-p destination info)
- (org-export-get-ordinal
- (org-element-map destination 'link
- 'identity info t)
- info 'link 'org-twbs-standalone-image-p))
- (t (org-export-get-ordinal
- destination info nil 'org-twbs--has-caption-p))))
- (desc (cond (desc)
- ((not number) "No description for this link")
- ((numberp number) (number-to-string number))
- (t (mapconcat 'number-to-string number ".")))))
- (format "%s " path attributes desc))))))
- ;; Coderef: replace link with the reference name or the
- ;; equivalent line number.
- ((string= type "coderef")
- (let ((fragment (concat "coderef-" (org-twbs-encode-plain-text path))))
- (format "%s "
- fragment
- (format "class=\"coderef\" onmouseover=\"CodeHighlightOn(this, \
-'%s');\" onmouseout=\"CodeHighlightOff(this, '%s');\""
- fragment fragment)
- attributes
- (format (org-export-get-coderef-format path desc)
- (org-export-resolve-coderef path info)))))
- ;; External link with a description part.
- ((and path desc) (format "%s "
- (org-twbs-encode-plain-text path)
- attributes
- desc))
- ;; External link without a description part.
- (path (let ((path (org-twbs-encode-plain-text path)))
- (format "%s " path attributes path)))
- ;; No path, only description. Try to do something useful.
- (t (format "%s " desc)))))
-
-;;;; Paragraph
-
-(defun org-twbs-paragraph (paragraph contents info)
- "Transcode a PARAGRAPH element from Org to HTML.
-CONTENTS is the contents of the paragraph, as a string. INFO is
-the plist used as a communication channel."
- (let* ((parent (org-export-get-parent paragraph))
- (parent-type (org-element-type parent))
- (style '((footnote-definition " class=\"footpara\"")))
- (extra (or (cadr (assoc parent-type style)) "")))
- (cond
- ((and (eq (org-element-type parent) 'item)
- (= (org-element-property :begin paragraph)
- (org-element-property :contents-begin parent)))
- ;; Leading paragraph in a list item have no tags.
- contents)
- ((org-twbs-standalone-image-p paragraph info)
- ;; Standalone image.
- (let ((caption
- (let ((raw (org-export-data
- (org-export-get-caption paragraph) info))
- (org-twbs-standalone-image-predicate
- 'org-twbs--has-caption-p))
- (if (not (org-string-nw-p raw)) raw
- (concat
- ""
- (format (org-twbs--translate "Figure %d:" info)
- (org-export-get-ordinal
- (org-element-map paragraph 'link
- 'identity info t)
- info nil 'org-twbs-standalone-image-p))
- " " raw))))
- (label (org-element-property :name paragraph)))
- (org-twbs--wrap-image contents info caption label)))
- ;; Regular paragraph.
- (t (format "\n%s
" extra contents)))))
-
-;;;; Plain List
-
-;; FIXME Maybe arg1 is not needed because already sets
-;; the correct value for the item counter
-(defun org-twbs-begin-plain-list (type &optional arg1)
- "Insert the beginning of the HTML list depending on TYPE.
-When ARG1 is a string, use it as the start parameter for ordered
-lists."
- (case type
- (ordered
- (format ""
- (if arg1 (format " start=\"%d\"" arg1) "")))
- (unordered "")
- (descriptive "")))
-
-(defun org-twbs-end-plain-list (type)
- "Insert the end of the HTML list depending on TYPE."
- (case type
- (ordered " ")
- (unordered "")
- (descriptive "")))
-
-(defun org-twbs-plain-list (plain-list contents info)
- "Transcode a PLAIN-LIST element from Org to HTML.
-CONTENTS is the contents of the list. INFO is a plist holding
-contextual information."
- (let* (arg1 ;; (assoc :counter (org-element-map plain-list 'item
- (type (org-element-property :type plain-list)))
- (format "%s\n%s%s"
- (org-twbs-begin-plain-list type)
- contents (org-twbs-end-plain-list type))))
-
-;;;; Plain Text
-
-(defun org-twbs-convert-special-strings (string)
- "Convert special characters in STRING to HTML."
- (let ((all org-twbs-special-string-regexps)
- e a re rpl start)
- (while (setq a (pop all))
- (setq re (car a) rpl (cdr a) start 0)
- (while (string-match re string start)
- (setq string (replace-match rpl t nil string))))
- string))
-
-(defun org-twbs-encode-plain-text (text)
- "Convert plain text characters from TEXT to HTML equivalent.
-Possible conversions are set in `org-twbs-protect-char-alist'."
- (mapc
- (lambda (pair)
- (setq text (replace-regexp-in-string (car pair) (cdr pair) text t t)))
- org-twbs-protect-char-alist)
- text)
-
-(defun org-twbs-plain-text (text info)
- "Transcode a TEXT string from Org to HTML.
-TEXT is the string to transcode. INFO is a plist holding
-contextual information."
- (let ((output text))
- ;; Protect following characters: <, >, &.
- (setq output (org-twbs-encode-plain-text output))
- ;; Handle smart quotes. Be sure to provide original string since
- ;; OUTPUT may have been modified.
- (when (plist-get info :with-smart-quotes)
- (setq output (org-export-activate-smart-quotes output :html info text)))
- ;; Handle special strings.
- (when (plist-get info :with-special-strings)
- (setq output (org-twbs-convert-special-strings output)))
- ;; Handle break preservation if required.
- (when (plist-get info :preserve-breaks)
- (setq output
- (replace-regexp-in-string
- "\\(\\\\\\\\\\)?[ \t]*\n"
- (concat (org-twbs-close-tag "br" nil info) "\n") output)))
- ;; Return value.
- output))
-
-
-;; Planning
-
-(defun org-twbs-planning (planning contents info)
- "Transcode a PLANNING element from Org to HTML.
-CONTENTS is nil. INFO is a plist used as a communication
-channel."
- (let ((span-fmt "%s %s "))
- (format
- "%s
"
- (mapconcat
- 'identity
- (delq nil
- (list
- (let ((closed (org-element-property :closed planning)))
- (when closed
- (format span-fmt org-closed-string
- (org-timestamp-translate closed))))
- (let ((deadline (org-element-property :deadline planning)))
- (when deadline
- (format span-fmt org-deadline-string
- (org-timestamp-translate deadline))))
- (let ((scheduled (org-element-property :scheduled planning)))
- (when scheduled
- (format span-fmt org-scheduled-string
- (org-timestamp-translate scheduled))))))
- " "))))
-
-;;;; Property Drawer
-
-(defun org-twbs-property-drawer (property-drawer contents info)
- "Transcode a PROPERTY-DRAWER element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- ;; The property drawer isn't exported but we want separating blank
- ;; lines nonetheless.
- "")
-
-;;;; Quote Block
-
-(defun org-twbs-quote-block (quote-block contents info)
- "Transcode a QUOTE-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information."
- (format "\n%s " contents))
-
-;;;; Quote Section
-
-(defun org-twbs-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format "\n%s " value))))
-
-;;;; Section
-
-(defun org-twbs-section (section contents info)
- "Transcode a SECTION element from Org to HTML.
-CONTENTS holds the contents of the section. INFO is a plist
-holding contextual information."
- (let ((parent (org-export-get-parent-headline section)))
- ;; Before first headline: no container, just return CONTENTS.
- (if (not parent) contents
- ;; Get div's class and id references.
- (let* ((class-num (+ (org-export-get-relative-level parent info)
- (1- org-twbs-toplevel-hlevel)))
- (section-number
- (mapconcat
- 'number-to-string
- (org-export-get-headline-number parent info) "-")))
- ;; Build return value.
- (format "\n%s
"
- class-num
- (or (org-element-property :CUSTOM_ID parent) section-number)
- (or contents ""))))))
-
-;;;; Radio Target
-
-(defun org-twbs-radio-target (radio-target text info)
- "Transcode a RADIO-TARGET object from Org to HTML.
-TEXT is the text of the target. INFO is a plist holding
-contextual information."
- (let ((id (org-element-property :value radio-target)))
- (org-twbs--anchor id text)))
-
-;;;; Special Block
-
-(defun org-twbs-special-block (special-block contents info)
- "Transcode a SPECIAL-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
-holding contextual information."
- (let* ((block-type (downcase
- (org-element-property :type special-block)))
- (contents (or contents ""))
- (is-html5-tag? (member block-type org-html-html5-elements))
- (attributes (org-export-read-attribute :attr_html special-block)))
- (unless is-html5-tag?
- (let ((class (plist-get attributes :class)))
- (setq attributes (plist-put attributes :class
- (if class (concat class " " block-type)
- block-type)))))
- (setq attributes (org-twbs--make-attribute-string attributes))
- (when (not (equal attributes ""))
- (setq attributes (concat " " attributes)))
- (if is-html5-tag?
- (format "<%s%s>\n%s%s>" block-type attributes contents block-type)
- (format "\n%s\n
" attributes contents))))
-
-;;;; Src Block
-
-(defun org-twbs-src-block (src-block contents info)
- "Transcode a SRC-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the item. INFO is a plist holding
-contextual information."
- (if (org-export-read-attribute :attr_html src-block :textarea)
- (org-twbs--textarea-block src-block)
- (let ((lang (org-element-property :language src-block))
- (caption (org-export-get-caption src-block))
- (code (org-twbs-format-code src-block info))
- (label (let ((lbl (org-element-property :name src-block)))
- (if (not lbl) ""
- (format " id=\"%s\""
- lbl)))))
- (if (not lang) (format "\n%s " label code)
- (format
- "\n%s%s\n
"
- (if (not caption) ""
- (format "%s "
- (org-export-data caption info)))
- (format "\n%s " lang label code))))))
-
-;;;; Statistics Cookie
-
-(defun org-twbs-statistics-cookie (statistics-cookie contents info)
- "Transcode a STATISTICS-COOKIE object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((cookie-value (org-element-property :value statistics-cookie)))
- (format "%s
" cookie-value)))
-
-;;;; Strike-Through
-
-(defun org-twbs-strike-through (strike-through contents info)
- "Transcode STRIKE-THROUGH from Org to HTML.
-CONTENTS is the text with strike-through markup. INFO is a plist
-holding contextual information."
- (format (or (cdr (assq 'strike-through org-twbs-text-markup-alist)) "%s")
- contents))
-
-;;;; Subscript
-
-(defun org-twbs-subscript (subscript contents info)
- "Transcode a SUBSCRIPT object from Org to HTML.
-CONTENTS is the contents of the object. INFO is a plist holding
-contextual information."
- (format "%s " contents))
-
-;;;; Superscript
-
-(defun org-twbs-superscript (superscript contents info)
- "Transcode a SUPERSCRIPT object from Org to HTML.
-CONTENTS is the contents of the object. INFO is a plist holding
-contextual information."
- (format "%s " contents))
-
-;;;; Table Cell
-
-(defun org-twbs-table-cell (table-cell contents info)
- "Transcode a TABLE-CELL element from Org to HTML.
-CONTENTS is nil. INFO is a plist used as a communication
-channel."
- (let* ((table-row (org-export-get-parent table-cell))
- (table (org-export-get-parent-table table-cell))
- (cell-attrs
- (if (not org-twbs-table-align-individual-fields) ""
- (format (if (and (boundp 'org-twbs-format-table-no-css)
- org-twbs-format-table-no-css)
- " align=\"%s\"" " class=\"text-%s\"")
- (org-export-table-cell-alignment table-cell info)))))
- (when (or (not contents) (string= "" (org-trim contents)))
- (setq contents " "))
- (cond
- ((and (org-export-table-has-header-p table info)
- (= 1 (org-export-table-row-group table-row info)))
- (concat "\n" (format (car org-twbs-table-header-tags) "col" cell-attrs)
- contents (cdr org-twbs-table-header-tags)))
- ((and org-twbs-table-use-header-tags-for-first-column
- (zerop (cdr (org-export-table-cell-address table-cell info))))
- (concat "\n" (format (car org-twbs-table-header-tags) "row" cell-attrs)
- contents (cdr org-twbs-table-header-tags)))
- (t (concat "\n" (format (car org-twbs-table-data-tags) cell-attrs)
- contents (cdr org-twbs-table-data-tags))))))
-
-;;;; Table Row
-
-(defun org-twbs-table-row (table-row contents info)
- "Transcode a TABLE-ROW element from Org to HTML.
-CONTENTS is the contents of the row. INFO is a plist used as a
-communication channel."
- ;; Rules are ignored since table separators are deduced from
- ;; borders of the current row.
- (when (eq (org-element-property :type table-row) 'standard)
- (let* ((rowgroup-number (org-export-table-row-group table-row info))
- (row-number (org-export-table-row-number table-row info))
- (start-rowgroup-p
- (org-export-table-row-starts-rowgroup-p table-row info))
- (end-rowgroup-p
- (org-export-table-row-ends-rowgroup-p table-row info))
- ;; `top-row-p' and `end-rowgroup-p' are not used directly
- ;; but should be set so that `org-twbs-table-row-tags' can
- ;; use them (see the docstring of this variable.)
- (top-row-p (and (equal start-rowgroup-p '(top))
- (equal end-rowgroup-p '(below top))))
- (bottom-row-p (and (equal start-rowgroup-p '(above))
- (equal end-rowgroup-p '(bottom above))))
- (rowgroup-tags
- (cond
- ;; Case 1: Row belongs to second or subsequent rowgroups.
- ((not (= 1 rowgroup-number))
- '("" . "\n "))
- ;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups.
- ((org-export-table-has-header-p
- (org-export-get-parent-table table-row) info)
- '("" . "\n "))
- ;; Case 2: Row is from first and only row group.
- (t '("" . "\n ")))))
- (concat
- ;; Begin a rowgroup?
- (when start-rowgroup-p (car rowgroup-tags))
- ;; Actual table row
- (concat "\n" (eval (car org-twbs-table-row-tags))
- contents
- "\n"
- (eval (cdr org-twbs-table-row-tags)))
- ;; End a rowgroup?
- (when end-rowgroup-p (cdr rowgroup-tags))))))
-
-;;;; Table
-
-(defun org-twbs-table-first-row-data-cells (table info)
- "Transcode the first row of TABLE.
-INFO is a plist used as a communication channel."
- (let ((table-row
- (org-element-map table 'table-row
- (lambda (row)
- (unless (eq (org-element-property :type row) 'rule) row))
- info 'first-match))
- (special-column-p (org-export-table-has-special-column-p table)))
- (if (not special-column-p) (org-element-contents table-row)
- (cdr (org-element-contents table-row)))))
-
-(defun org-twbs-table--table.el-table (table info)
- "Format table.el tables into HTML.
-INFO is a plist used as a communication channel."
- (when (eq (org-element-property :type table) 'table.el)
- (require 'table)
- (let ((outbuf (with-current-buffer
- (get-buffer-create "*org-export-table*")
- (erase-buffer) (current-buffer))))
- (with-temp-buffer
- (insert (org-element-property :value table))
- (goto-char 1)
- (re-search-forward "^[ \t]*|[^|]" nil t)
- (table-generate-source 'html outbuf))
- (with-current-buffer outbuf
- (prog1 (org-trim (buffer-string))
- (kill-buffer) )))))
-
-(defun org-twbs-table (table contents info)
- "Transcode a TABLE element from Org to HTML.
-CONTENTS is the contents of the table. INFO is a plist holding
-contextual information."
- (case (org-element-property :type table)
- ;; Case 1: table.el table. Convert it using appropriate tools.
- (table.el (org-twbs-table--table.el-table table info))
- ;; Case 2: Standard table.
- (t
- (let* ((label (org-element-property :name table))
- (caption (org-export-get-caption table))
- (number (org-export-get-ordinal
- table info nil 'org-twbs--has-caption-p))
- (attributes
- (org-twbs--make-attribute-string
- (org-combine-plists
- (and label (list :id label))
- (plist-get info :html-table-attributes)
- (org-export-read-attribute :attr_html table))))
- (alignspec
- (if (and (boundp 'org-twbs-format-table-no-css)
- org-twbs-format-table-no-css)
- "align=\"%s\"" "class=\"%s\""))
- (table-column-specs
- (function
- (lambda (table info)
- (mapconcat
- (lambda (table-cell)
- (let ((alignment (org-export-table-cell-alignment
- table-cell info)))
- (concat
- ;; Begin a colgroup?
- (when (org-export-table-cell-starts-colgroup-p
- table-cell info)
- "\n")
- ;; Add a column. Also specify it's alignment.
- (format "\n%s"
- (org-twbs-close-tag
- "col" (concat " " (format alignspec alignment)) info))
- ;; End a colgroup?
- (when (org-export-table-cell-ends-colgroup-p
- table-cell info)
- "\n "))))
- (org-twbs-table-first-row-data-cells table info) "\n")))))
- (format ""
- (if (equal attributes "") "" (concat " " attributes))
- (if (not caption) ""
- (format (if org-twbs-table-caption-above
- "%s "
- "%s ")
- (concat
- ""
- (format (org-twbs--translate "Table %d:" info) number)
- " " (org-export-data caption info))))
- (funcall table-column-specs table info)
- contents)))))
-
-;;;; Target
-
-(defun org-twbs-target (target contents info)
- "Transcode a TARGET object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (let ((id (org-element-property :value target)))
- (org-twbs--anchor id)))
-
-;;;; Timestamp
-
-(defun org-twbs-timestamp (timestamp contents info)
- "Transcode a TIMESTAMP object from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (let ((value (org-twbs-plain-text
- (org-timestamp-translate timestamp) info)))
- (format "%s "
- (replace-regexp-in-string "--" "–" value))))
-
-;;;; Underline
-
-(defun org-twbs-underline (underline contents info)
- "Transcode UNDERLINE from Org to HTML.
-CONTENTS is the text with underline markup. INFO is a plist
-holding contextual information."
- (format (or (cdr (assq 'underline org-twbs-text-markup-alist)) "%s")
- contents))
-
-;;;; Verbatim
-
-(defun org-twbs-verbatim (verbatim contents info)
- "Transcode VERBATIM from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual
-information."
- (format (or (cdr (assq 'verbatim org-twbs-text-markup-alist)) "%s")
- (org-twbs-encode-plain-text (org-element-property :value verbatim))))
-
-;;;; Verse Block
-
-(defun org-twbs-verse-block (verse-block contents info)
- "Transcode a VERSE-BLOCK element from Org to HTML.
-CONTENTS is verse block contents. INFO is a plist holding
-contextual information."
- ;; Replace each newline character with line break. Also replace
- ;; each blank line with a line break.
- (setq contents (replace-regexp-in-string
- "^ *\\\\\\\\$" (format "%s\n" (org-twbs-close-tag "br" nil info))
- (replace-regexp-in-string
- "\\(\\\\\\\\\\)?[ \t]*\n"
- (format "%s\n" (org-twbs-close-tag "br" nil info)) contents)))
- ;; Replace each white space at beginning of a line with a
- ;; non-breaking space.
- (while (string-match "^[ \t]+" contents)
- (let* ((num-ws (length (match-string 0 contents)))
- (ws (let (out) (dotimes (i num-ws out)
- (setq out (concat out " "))))))
- (setq contents (replace-match ws nil t contents))))
- (format "\n%s
" contents))
-
-
-;;; Filter Functions
-
-(defun org-twbs-final-function (contents backend info)
- "Filter to indent the HTML and convert HTML entities."
- (with-temp-buffer
- (insert contents)
- (set-auto-mode t)
- (if org-twbs-indent
- (indent-region (point-min) (point-max)))
- (when org-twbs-use-unicode-chars
- (require 'mm-url)
- (mm-url-decode-entities))
- (buffer-substring-no-properties (point-min) (point-max))))
-
-
-;;; End-user functions
-
-;;;###autoload
-(defun org-twbs-export-as-html
- (&optional async subtreep visible-only body-only ext-plist)
- "Export current buffer to an HTML buffer.
-
-If narrowing is active in the current buffer, only export its
-narrowed part.
-
-If a region is active, export that region.
-
-A non-nil optional argument ASYNC means the process should happen
-asynchronously. The resulting buffer should be accessible
-through the `org-export-stack' interface.
-
-When optional argument SUBTREEP is non-nil, export the sub-tree
-at point, extracting information from the headline properties
-first.
-
-When optional argument VISIBLE-ONLY is non-nil, don't export
-contents of hidden elements.
-
-When optional argument BODY-ONLY is non-nil, only write code
-between \"\" and \"\" tags.
-
-EXT-PLIST, when provided, is a property list with external
-parameters overriding Org default settings, but still inferior to
-file-local settings.
-
-Export is done in a buffer named \"*Org HTML Export*\", which
-will be displayed when `org-export-show-temporary-export-buffer'
-is non-nil."
- (interactive)
- (org-export-to-buffer 'twbs "*Org HTML Export*"
- async subtreep visible-only body-only ext-plist
- (lambda () (set-auto-mode t))))
-
-;;;###autoload
-(defun org-twbs-convert-region-to-html ()
- "Assume the current region has org-mode syntax, and convert it to HTML.
-This can be used in any buffer. For example, you can write an
-itemized list in org-mode syntax in an HTML buffer and use this
-command to convert it."
- (interactive)
- (org-export-replace-region-by 'twbs))
-
-;;;###autoload
-(defun org-twbs-export-to-html
- (&optional async subtreep visible-only body-only ext-plist)
- "Export current buffer to a HTML file.
-
-If narrowing is active in the current buffer, only export its
-narrowed part.
-
-If a region is active, export that region.
-
-A non-nil optional argument ASYNC means the process should happen
-asynchronously. The resulting file should be accessible through
-the `org-export-stack' interface.
-
-When optional argument SUBTREEP is non-nil, export the sub-tree
-at point, extracting information from the headline properties
-first.
-
-When optional argument VISIBLE-ONLY is non-nil, don't export
-contents of hidden elements.
-
-When optional argument BODY-ONLY is non-nil, only write code
-between \"\" and \"\" tags.
-
-EXT-PLIST, when provided, is a property list with external
-parameters overriding Org default settings, but still inferior to
-file-local settings.
-
-Return output file's name."
- (interactive)
- (let* ((extension (concat "." org-twbs-extension))
- (file (org-export-output-file-name extension subtreep))
- (org-export-coding-system org-twbs-coding-system))
- (org-export-to-file 'twbs file
- async subtreep visible-only body-only ext-plist)))
-
-;;;###autoload
-(defun org-twbs-publish-to-html (plist filename pub-dir)
- "Publish an org file to HTML.
-
-FILENAME is the filename of the Org file to be published. PLIST
-is the property list for the given project. PUB-DIR is the
-publishing directory.
-
-Return output file name."
- (org-publish-org-to 'twbs filename
- (concat "." (or (plist-get plist :html-extension)
- org-twbs-extension "html"))
- plist pub-dir))
-
-
-(provide 'ox-twbs)
-
-;; Local variables:
-;; coding: utf-8
-;; End:
-
-;;; ox-twbs.el ends here
diff --git a/emacs/.emacs.d/elpa/ox-twbs-20161103.1316/ox-twbs.elc b/emacs/.emacs.d/elpa/ox-twbs-20161103.1316/ox-twbs.elc
deleted file mode 100644
index b0e13eb..0000000
Binary files a/emacs/.emacs.d/elpa/ox-twbs-20161103.1316/ox-twbs.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-autoloads.el b/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-autoloads.el
deleted file mode 100644
index 64afb75..0000000
--- a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-autoloads.el
+++ /dev/null
@@ -1,15 +0,0 @@
-;;; pcache-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil nil ("pcache.el") (23124 14355 195447 116000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; pcache-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-pkg.el b/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-pkg.el
deleted file mode 100644
index ab4a5fa..0000000
--- a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "pcache" "20170105.1414" "persistent caching for Emacs." '((eieio "1.3")) :commit "1f8086077d770e524492e6fa59b07856e85a6fea")
diff --git a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.el b/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.el
deleted file mode 100644
index 8b70057..0000000
--- a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.el
+++ /dev/null
@@ -1,249 +0,0 @@
-;;; pcache.el --- persistent caching for Emacs.
-
-;; Copyright (C) 2011 Yann Hodique
-
-;; Author: Yann Hodique
-;; Keywords:
-;; Package-Version: 20170105.1414
-;; Version: 0.4.2
-;; Package-Requires: ((eieio "1.3"))
-
-;; This file 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, or (at your option)
-;; any later version.
-
-;; This file 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 GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; pcache provides a persistent way of caching data, in a hashtable-like
-;; structure. It relies on `eieio-persistent' in the backend, so that any
-;; object that can be serialized by EIEIO can be stored with pcache.
-
-;; pcache handles objects called "repositories" (`pcache-repository') and
-;; "entries" (`pcache-entry'). Each repository is identified by a unique name,
-;; that defines an entry in `pcache-directory'. Subdirectories are allowed, by
-;; the use of a directory separator in the repository name.
-
-;; Example:
-;; (let ((repo (pcache-repository "plop")))
-;; (pcache-put repo 'foo 42) ; store value 42 with key 'foo
-;; (pcache-get repo 'foo) ; => 42
-;; )
-
-;; Keys can be pretty much any Lisp object, and are compared for equality using
-;; `eql'
-
-;; Optionally, cache entries can expire:
-;; (let ((repo (pcache-repository "plop")))
-;; (pcache-put repo 'foo 42 1) ; store value 42 with key 'foo for 1 second
-;; (sleep-for 1)
-;; (pcache-get repo 'foo) ; => nil
-;; )
-
-;;; Code:
-
-(require 'cl)
-(require 'eieio)
-(require 'eieio-base)
-
-(defvar pcache-directory
- (let ((dir (concat user-emacs-directory "var/pcache/")))
- (make-directory dir t)
- dir))
-
-(defvar *pcache-repositories* (make-hash-table :test 'equal))
-
-(defconst pcache-default-save-delay 300)
-
-(defconst pcache-internal-version-constant "0.4")
-
-(defconst pcache-version-constant
- (format "%s/%s" emacs-version pcache-internal-version-constant))
-
-(defclass pcache-repository (eieio-persistent eieio-named)
- ((version :initarg :version :initform nil)
- (version-constant :allocation :class)
- (entries :initarg :entries :initform (make-hash-table))
- (entry-cls :initarg :entry-cls :initform pcache-entry)
- (timestamp :initarg :timestamp :initform (float-time (current-time)))
- (save-delay :initarg :save-delay)))
-
-(oset-default 'pcache-repository :save-delay pcache-default-save-delay)
-(oset-default 'pcache-repository version-constant pcache-version-constant)
-
-(defvar *pcache-repository-name* nil)
-
-(defmethod constructor :static ((cache pcache-repository) &rest args)
- (let* ((newname (or (and (stringp (car args)) (car args))
- (plist-get args :object-name)
- *pcache-repository-name*
- (symbol-name cache)))
- (e (gethash newname *pcache-repositories*))
- (path (concat pcache-directory newname)))
- (setq args (append args (list :object-name newname)))
- (or e
- (and (not (boundp 'pcache-avoid-recursion))
- (file-exists-p path)
- (condition-case nil
- (let* ((pcache-avoid-recursion t)
- (*pcache-repository-name* newname)
- (obj (eieio-persistent-read path 'pcache-repository t)))
- (and (or (pcache-validate-repo obj)
- (error "wrong version"))
- (puthash newname obj *pcache-repositories*)
- obj))
- (error nil)))
- (let ((obj (call-next-method))
- (dir (file-name-directory path)))
- (unless (file-exists-p dir)
- (make-directory dir t))
- (oset obj :file path)
- (oset obj :version (oref-default obj version-constant))
- (puthash newname obj *pcache-repositories*)
- obj))))
-
-(defun pcache-hash-table-values (h)
- (let (values)
- (maphash (lambda (k v) (push v values)) h)
- values))
-
-(defun pcache-validate-repo (cache)
- (and
- (equal (oref cache :version)
- (oref-default (object-class cache) version-constant))
- (hash-table-p (oref cache :entries))
- (every
- (lambda (entry)
- (and (object-of-class-p entry (oref cache :entry-cls))
- (or (null (oref entry :value-cls))
- (object-of-class-p
- (oref entry :value) (oref entry :value-cls)))))
- (pcache-hash-table-values (oref cache :entries)))))
-
-(defclass pcache-entry ()
- ((timestamp :initarg :timestamp
- :initform (float-time (current-time)))
- (ttl :initarg :ttl :initform nil)
- (value :initarg :value :initform nil)
- (value-cls :initarg :value-cls :initform nil)))
-
-(defmethod pcache-entry-valid-p ((entry pcache-entry))
- (let ((ttl (oref entry :ttl)))
- (or (null ttl)
- (let ((time (float-time (current-time))))
- (< time (+ ttl (oref entry :timestamp)))))))
-
-(defmethod pcache-get ((cache pcache-repository) key &optional default)
- (let* ((table (oref cache :entries))
- (entry (gethash key table)))
- (if entry
- (if (pcache-entry-valid-p entry)
- (oref entry :value)
- (remhash key table)
- default)
- default)))
-
-(defmethod pcache-has ((cache pcache-repository) key)
- (let* ((default (make-symbol ":nil"))
- (table (oref cache :entries))
- (entry (gethash key table default)))
- (if (eq entry default) nil
- (if (pcache-entry-valid-p entry)
- t nil))))
-
-(defmethod pcache-put ((cache pcache-repository) key value &optional ttl)
- (let ((table (oref cache :entries))
- (entry (or (and (eieio-object-p value)
- (object-of-class-p value 'pcache-entry)
- value)
- (make-instance
- (oref cache :entry-cls)
- :value value
- :value-cls (and (object-p value) (object-class value))))))
- (when ttl
- (oset entry :ttl ttl))
- (prog1
- (puthash key entry table)
- (pcache-save cache))))
-
-(defmethod pcache-invalidate ((cache pcache-repository) key)
- (let ((table (oref cache :entries)))
- (remhash key table)
- (pcache-save cache)))
-
-(defmethod pcache-clear ((cache pcache-repository))
- (let* ((entries (oref cache :entries))
- (test (hash-table-test entries))
- (resize (hash-table-rehash-size entries))
- (threshold (hash-table-rehash-threshold entries))
- (weakness (hash-table-weakness entries)))
- (oset cache :entries (make-hash-table :test test :rehash-size resize
- :rehash-threshold threshold
- :weakness weakness)))
- (pcache-save cache))
-
-(defmethod pcache-purge-invalid ((cache pcache-repository))
- (let ((table (oref cache :entries)))
- (maphash #'(lambda (k e)
- (unless (pcache-entry-valid-p e)
- (remhash k table)))
- table)
- (pcache-save cache)))
-
-(defmethod pcache-save ((cache pcache-repository) &optional force)
- (let ((timestamp (oref cache :timestamp))
- (delay (oref cache :save-delay))
- (time (float-time (current-time))))
- (when (or force (> time (+ timestamp delay)))
- (oset cache :timestamp time)
- ;; make sure version is saved to file
- (oset cache :version (oref-default (object-class cache) version-constant))
- (eieio-persistent-save cache))))
-
-(defmethod pcache-map ((cache pcache-repository) func)
- (let ((table (oref cache :entries)))
- (maphash func table)))
-
-(defun pcache-kill-emacs-hook ()
- (maphash #'(lambda (k v)
- (condition-case nil
- (pcache-purge-invalid v)
- (error nil))
- (condition-case nil
- (pcache-save v t)
- (error nil)))
- *pcache-repositories*))
-
-(defun pcache-destroy-repository (name)
- (remhash name *pcache-repositories*)
- (let ((fname (concat pcache-directory name)))
- (when (file-exists-p fname)
- (delete-file fname))))
-
-(add-hook 'kill-emacs-hook 'pcache-kill-emacs-hook)
-
-;; in case we reload in place, clean all repositories with invalid version
-(let (to-clean)
- (maphash #'(lambda (k v)
- (condition-case nil
- (unless (eql (oref v :version)
- pcache-version-constant)
- (signal 'error nil))
- (error
- (setq to-clean (cons k to-clean)))))
- *pcache-repositories*)
- (dolist (k to-clean)
- (remhash k *pcache-repositories*)))
-
-(provide 'pcache)
-;;; pcache.el ends here
diff --git a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.elc b/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.elc
deleted file mode 100644
index 9878532..0000000
Binary files a/emacs/.emacs.d/elpa/pcache-20170105.1414/pcache.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el b/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el
deleted file mode 100644
index 26bdc59..0000000
--- a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads.el
+++ /dev/null
@@ -1,122 +0,0 @@
-;;; pkg-info-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "pkg-info" "pkg-info.el" (23124 14351 828764
-;;;;;; 583000))
-;;; Generated autoloads from pkg-info.el
-
-(autoload 'pkg-info-library-original-version "pkg-info" "\
-Get the original version in the header of LIBRARY.
-
-The original version is stored in the X-Original-Version header.
-This header is added by the MELPA package archive to preserve
-upstream version numbers.
-
-LIBRARY is either a symbol denoting a named feature, or a library
-name as string.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version from the header of LIBRARY as list. Signal an
-error if the LIBRARY was not found or had no X-Original-Version
-header.
-
-See Info node `(elisp)Library Headers' for more information
-about library headers.
-
-\(fn LIBRARY &optional SHOW)" t nil)
-
-(autoload 'pkg-info-library-version "pkg-info" "\
-Get the version in the header of LIBRARY.
-
-LIBRARY is either a symbol denoting a named feature, or a library
-name as string.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version from the header of LIBRARY as list. Signal an
-error if the LIBRARY was not found or had no proper header.
-
-See Info node `(elisp)Library Headers' for more information
-about library headers.
-
-\(fn LIBRARY &optional SHOW)" t nil)
-
-(autoload 'pkg-info-defining-library-original-version "pkg-info" "\
-Get the original version of the library defining FUNCTION.
-
-The original version is stored in the X-Original-Version header.
-This header is added by the MELPA package archive to preserve
-upstream version numbers.
-
-If SHOW is non-nil, show the version in mini-buffer.
-
-This function is mainly intended to find the version of a major
-or minor mode, i.e.
-
- (pkg-info-defining-library-version 'flycheck-mode)
-
-Return the version of the library defining FUNCTION. Signal an
-error if FUNCTION is not a valid function, if its defining
-library was not found, or if the library had no proper version
-header.
-
-\(fn FUNCTION &optional SHOW)" t nil)
-
-(autoload 'pkg-info-defining-library-version "pkg-info" "\
-Get the version of the library defining FUNCTION.
-
-If SHOW is non-nil, show the version in mini-buffer.
-
-This function is mainly intended to find the version of a major
-or minor mode, i.e.
-
- (pkg-info-defining-library-version 'flycheck-mode)
-
-Return the version of the library defining FUNCTION. Signal an
-error if FUNCTION is not a valid function, if its defining
-library was not found, or if the library had no proper version
-header.
-
-\(fn FUNCTION &optional SHOW)" t nil)
-
-(autoload 'pkg-info-package-version "pkg-info" "\
-Get the version of an installed PACKAGE.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version as list, or nil if PACKAGE is not installed.
-
-\(fn PACKAGE &optional SHOW)" t nil)
-
-(autoload 'pkg-info-version-info "pkg-info" "\
-Obtain complete version info for LIBRARY and PACKAGE.
-
-LIBRARY is a symbol denoting a named feature, or a library name
-as string. PACKAGE is a symbol denoting an ELPA package. If
-omitted or nil, default to LIBRARY.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-When called interactively, prompt for LIBRARY. When called
-interactively with prefix argument, prompt for PACKAGE as well.
-
-Return a string with complete version information for LIBRARY.
-This version information contains the version from the headers of
-LIBRARY, and the version of the installed PACKAGE, the LIBRARY is
-part of. If PACKAGE is not installed, or if the PACKAGE version
-is the same as the LIBRARY version, do not include a package
-version.
-
-\(fn LIBRARY &optional PACKAGE SHOW)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; pkg-info-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el b/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el
deleted file mode 100644
index e1c04bc..0000000
--- a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "pkg-info" "20150517.443" "Information about packages" '((epl "0.8")) :commit "76ba7415480687d05a4353b27fea2ae02b8d9d61" :url "https://github.com/lunaryorn/pkg-info.el" :keywords '("convenience"))
diff --git a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.el b/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.el
deleted file mode 100644
index 98ecc15..0000000
--- a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.el
+++ /dev/null
@@ -1,331 +0,0 @@
-;;; pkg-info.el --- Information about packages -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2013-2015 Sebastian Wiesner
-
-;; Author: Sebastian Wiesner
-;; URL: https://github.com/lunaryorn/pkg-info.el
-;; Package-Version: 20150517.443
-;; Keywords: convenience
-;; Version: 0.7-cvs
-;; Package-Requires: ((epl "0.8"))
-
-;; 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 .
-
-;;; Commentary:
-
-;; This library extracts information from installed packages.
-
-;;;; Functions:
-
-;; `pkg-info-library-version' extracts the version from the header of a library.
-;;
-;; `pkg-info-defining-library-version' extracts the version from the header of a
-;; library defining a function.
-;;
-;; `pkg-info-package-version' gets the version of an installed package.
-;;
-;; `pkg-info-format-version' formats a version list as human readable string.
-;;
-;; `pkg-info-version-info' returns complete version information for a specific
-;; package.
-;;
-;; `pkg-info-get-melpa-recipe' gets the MELPA recipe for a package.
-;;
-;; `pkg-info-get-melpa-fetcher' gets the fetcher used to build a package on
-;; MELPA.
-;;
-;; `pkg-info-wiki-package-p' determines whether a package was build from
-;; EmacsWiki on MELPA.
-
-;;; Code:
-
-(require 'epl)
-
-(require 'lisp-mnt)
-(require 'find-func)
-(require 'json) ; `json-read'
-(require 'url-http) ; `url-http-parse-response'
-
-(defvar url-http-end-of-headers)
-
-
-;;; Version information
-(defun pkg-info-format-version (version)
- "Format VERSION as human-readable string.
-
-Return a human-readable string representing VERSION."
- ;; XXX: Find a better, more flexible way of formatting?
- (package-version-join version))
-
-(defsubst pkg-info--show-version-and-return (version show)
- "Show and return VERSION.
-
-When SHOW is non-nil, show VERSION in minibuffer.
-
-Return VERSION."
- (when show
- (message (if (listp version) (pkg-info-format-version version) version)))
- version)
-
-(defun pkg-info--read-library ()
- "Read a library from minibuffer."
- (completing-read "Load library: "
- (apply-partially 'locate-file-completion-table
- load-path
- (get-load-suffixes))))
-
-(defun pkg-info--read-function ()
- "Read a function name from minibuffer."
- (let ((input (completing-read "Function: " obarray #'boundp :require-match)))
- (if (string= input "") nil (intern input))))
-
-(defun pkg-info--read-package ()
- "Read a package name from minibuffer."
- (let* ((installed (epl-installed-packages))
- (names (sort (mapcar (lambda (pkg)
- (symbol-name (epl-package-name pkg)))
- installed)
- #'string<))
- (default (car names)))
- (completing-read "Installed package: " names nil 'require-match
- nil nil default)))
-
-(defun pkg-info-library-source (library)
- "Get the source file of LIBRARY.
-
-LIBRARY is either a symbol denoting a named feature, or a library
-name as string.
-
-Return the source file of LIBRARY as string."
- (find-library-name (if (symbolp library) (symbol-name library) library)))
-
-(defun pkg-info-defining-library (function)
- "Get the source file of the library defining FUNCTION.
-
-FUNCTION is a function symbol.
-
-Return the file name of the library as string. Signal an error
-if the library does not exist, or if the definition of FUNCTION
-was not found."
- (unless (functionp function)
- (signal 'wrong-type-argument (list 'functionp function)))
- (let ((library (symbol-file function 'defun)))
- (unless library
- (error "Can't find definition of %s" function))
- library))
-
-(defun pkg-info-x-original-version (file)
- "Read the X-Original-Version header from FILE.
-
-Return the value as version list, or return nil if FILE lacks
-this header. Signal an error, if the value of the header is not
-a valid version."
- (let ((version-str (with-temp-buffer
- (insert-file-contents file)
- (lm-header "X-Original-Version"))))
- (when version-str
- (version-to-list version-str))))
-
-;;;###autoload
-(defun pkg-info-library-original-version (library &optional show)
- "Get the original version in the header of LIBRARY.
-
-The original version is stored in the X-Original-Version header.
-This header is added by the MELPA package archive to preserve
-upstream version numbers.
-
-LIBRARY is either a symbol denoting a named feature, or a library
-name as string.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version from the header of LIBRARY as list. Signal an
-error if the LIBRARY was not found or had no X-Original-Version
-header.
-
-See Info node `(elisp)Library Headers' for more information
-about library headers."
- (interactive (list (pkg-info--read-library) t))
- (let ((version (pkg-info-x-original-version
- (pkg-info-library-source library))))
- (if version
- (pkg-info--show-version-and-return version show)
- (error "Library %s has no original version" library))))
-
-;;;###autoload
-(defun pkg-info-library-version (library &optional show)
- "Get the version in the header of LIBRARY.
-
-LIBRARY is either a symbol denoting a named feature, or a library
-name as string.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version from the header of LIBRARY as list. Signal an
-error if the LIBRARY was not found or had no proper header.
-
-See Info node `(elisp)Library Headers' for more information
-about library headers."
- (interactive (list (pkg-info--read-library) t))
- (let* ((source (pkg-info-library-source library))
- (version (epl-package-version (epl-package-from-file source))))
- (pkg-info--show-version-and-return version show)))
-
-;;;###autoload
-(defun pkg-info-defining-library-original-version (function &optional show)
- "Get the original version of the library defining FUNCTION.
-
-The original version is stored in the X-Original-Version header.
-This header is added by the MELPA package archive to preserve
-upstream version numbers.
-
-If SHOW is non-nil, show the version in mini-buffer.
-
-This function is mainly intended to find the version of a major
-or minor mode, i.e.
-
- (pkg-info-defining-library-version 'flycheck-mode)
-
-Return the version of the library defining FUNCTION. Signal an
-error if FUNCTION is not a valid function, if its defining
-library was not found, or if the library had no proper version
-header."
- (interactive (list (pkg-info--read-function) t))
- (pkg-info-library-original-version (pkg-info-defining-library function) show))
-
-;;;###autoload
-(defun pkg-info-defining-library-version (function &optional show)
- "Get the version of the library defining FUNCTION.
-
-If SHOW is non-nil, show the version in mini-buffer.
-
-This function is mainly intended to find the version of a major
-or minor mode, i.e.
-
- (pkg-info-defining-library-version 'flycheck-mode)
-
-Return the version of the library defining FUNCTION. Signal an
-error if FUNCTION is not a valid function, if its defining
-library was not found, or if the library had no proper version
-header."
- (interactive (list (pkg-info--read-function) t))
- (pkg-info-library-version (pkg-info-defining-library function) show))
-
-;;;###autoload
-(defun pkg-info-package-version (package &optional show)
- "Get the version of an installed PACKAGE.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-Return the version as list, or nil if PACKAGE is not installed."
- (interactive (list (pkg-info--read-package) t))
- (let* ((name (if (stringp package) (intern package) package))
- (package (car (epl-find-installed-packages name))))
- (unless package
- (error "Can't find installed package %s" name))
- (pkg-info--show-version-and-return (epl-package-version package) show)))
-
-;;;###autoload
-(defun pkg-info-version-info (library &optional package show)
- "Obtain complete version info for LIBRARY and PACKAGE.
-
-LIBRARY is a symbol denoting a named feature, or a library name
-as string. PACKAGE is a symbol denoting an ELPA package. If
-omitted or nil, default to LIBRARY.
-
-If SHOW is non-nil, show the version in the minibuffer.
-
-When called interactively, prompt for LIBRARY. When called
-interactively with prefix argument, prompt for PACKAGE as well.
-
-Return a string with complete version information for LIBRARY.
-This version information contains the version from the headers of
-LIBRARY, and the version of the installed PACKAGE, the LIBRARY is
-part of. If PACKAGE is not installed, or if the PACKAGE version
-is the same as the LIBRARY version, do not include a package
-version."
- (interactive (list (pkg-info--read-library)
- (when current-prefix-arg
- (pkg-info--read-package))
- t))
- (let* ((package (or package (if (stringp library) (intern library) library)))
- (orig-version (condition-case nil
- (pkg-info-library-original-version library)
- (error nil)))
- ;; If we have X-Original-Version, we assume that MELPA replaced the
- ;; library version with its generated version, so we use the
- ;; X-Original-Version header instead, and ignore the library version
- ;; header
- (lib-version (or orig-version (pkg-info-library-version library)))
- (pkg-version (condition-case nil
- (pkg-info-package-version package)
- (error nil)))
- (version (if (and pkg-version
- (not (version-list-= lib-version pkg-version)))
- (format "%s (package: %s)"
- (pkg-info-format-version lib-version)
- (pkg-info-format-version pkg-version))
- (pkg-info-format-version lib-version))))
- (pkg-info--show-version-and-return version show)))
-
-(defconst pkg-info-melpa-recipe-url "http://melpa.org/recipes.json"
- "The URL from which to fetch MELPA recipes.")
-
-(defvar pkg-info-melpa-recipes nil
- "An alist of MELPA recipes.")
-
-(defun pkg-info-retrieve-melpa-recipes ()
- "Retrieve MELPA recipes from MELPA archive."
- (let ((buffer (url-retrieve-synchronously pkg-info-melpa-recipe-url)))
- (with-current-buffer buffer
- (unwind-protect
- (let ((response-code (url-http-parse-response)))
- (unless (equal response-code 200)
- (error "Failed to retrieve MELPA recipes from %s (code %s)"
- pkg-info-melpa-recipe-url response-code))
- (goto-char url-http-end-of-headers)
- (json-read))
- (when (and buffer (buffer-live-p buffer))
- (kill-buffer buffer))))))
-
-(defun pkg-info-get-melpa-recipes ()
- "Get MELPA recipes."
- (setq pkg-info-melpa-recipes
- (or pkg-info-melpa-recipes
- (pkg-info-retrieve-melpa-recipes))))
-
-(defun pkg-info-get-melpa-recipe (package)
- "Get the MELPA recipe for PACKAGE.
-
-Return nil if PACKAGE is not on MELPA."
- (cdr (assq package (pkg-info-get-melpa-recipes))))
-
-(defun pkg-info-get-melpa-fetcher (package)
- "Get the MELPA fetcher for PACKAGE."
- (cdr (assq 'fetcher (pkg-info-get-melpa-recipe package))))
-
-(defun pkg-info-wiki-package-p (package)
- "Determine whether PACKAGE is build from the EmacsWiki."
- (equal (pkg-info-get-melpa-fetcher package) "wiki"))
-
-(provide 'pkg-info)
-
-;; Local Variables:
-;; indent-tabs-mode: nil
-;; coding: utf-8
-;; End:
-
-;;; pkg-info.el ends here
diff --git a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.elc b/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.elc
deleted file mode 100644
index ba375af..0000000
Binary files a/emacs/.emacs.d/elpa/pkg-info-20150517.443/pkg-info.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-autoloads.el b/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-autoloads.el
deleted file mode 100644
index 75442be..0000000
--- a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-autoloads.el
+++ /dev/null
@@ -1,32 +0,0 @@
-;;; rainbow-delimiters-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "rainbow-delimiters" "rainbow-delimiters.el"
-;;;;;; (23124 14380 945569 456000))
-;;; Generated autoloads from rainbow-delimiters.el
-
-(autoload 'rainbow-delimiters-mode "rainbow-delimiters" "\
-Highlight nested parentheses, brackets, and braces according to their depth.
-
-\(fn &optional ARG)" t nil)
-
-(autoload 'rainbow-delimiters-mode-enable "rainbow-delimiters" "\
-Enable `rainbow-delimiters-mode'.
-
-\(fn)" nil nil)
-
-(autoload 'rainbow-delimiters-mode-disable "rainbow-delimiters" "\
-Disable `rainbow-delimiters-mode'.
-
-\(fn)" nil nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; rainbow-delimiters-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-pkg.el b/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-pkg.el
deleted file mode 100644
index 45dac2d..0000000
--- a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "rainbow-delimiters" "20170929.432" "Highlight brackets according to their depth" 'nil :commit "19b93892afa0494ba749c2ca9c154e04447ad778" :url "https://github.com/Fanael/rainbow-delimiters" :keywords '("faces" "convenience" "lisp" "tools"))
diff --git a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.el b/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.el
deleted file mode 100644
index 97588cf..0000000
--- a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.el
+++ /dev/null
@@ -1,300 +0,0 @@
-;;; rainbow-delimiters.el --- Highlight brackets according to their depth -*- lexical-binding: t -*-
-
-;; Copyright (C)
-;; 2010-2013 Jeremy Rayman
-;; 2013-2016 Fanael Linithien
-;; Author: Jeremy Rayman
-;; Fanael Linithien
-;; Maintainer: Fanael Linithien
-;; Created: 2010-09-02
-;; Version: 2.1.3
-;; Package-Version: 20170929.432
-;; Keywords: faces, convenience, lisp, tools
-;; Homepage: https://github.com/Fanael/rainbow-delimiters
-
-;; Note: despite `lexical-binding', there's no Emacs 24 dependency.
-;; This is merely an optimization for Emacs 24+, the code is supposed to work
-;; with *both* dynamic and lexical binding.
-
-;; 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 .
-
-;;; Installation:
-
-;; The recommended way is to use MELPA (http://melpa.org/) or MELPA Stable
-;; (http://stable.melpa.org/). If either is in your `package-archives', do
-;; M-x package-install RET rainbow-delimiters RET
-;; Otherwise, open `rainbow-delimiters.el' in Emacs and use
-;; M-x package-install-from-buffer
-;; Any other methods of installation are unsupported.
-
-;;; Commentary:
-;;
-;; Rainbow-delimiters is a "rainbow parentheses"-like mode which highlights
-;; parentheses, brackets, and braces according to their depth. Each
-;; successive level is highlighted in a different color. This makes it easy
-;; to spot matching delimiters, orient yourself in the code, and tell which
-;; statements are at a given level.
-;;
-;; Great care has been taken to make this mode fast. You shouldn't see
-;; any discernible change in scrolling or editing speed while using it,
-;; even in delimiter-rich languages like Clojure, Lisp, and Scheme.
-;;
-;; Usage:
-;;
-;; To toggle the mode in the current buffer:
-;; M-x rainbow-delimiters-mode
-;; To start the mode automatically in `foo-mode', add the following to your init
-;; file:
-;; (add-hook 'foo-mode-hook #'rainbow-delimiters-mode)
-;; To start the mode automatically in most programming modes (Emacs 24 and
-;; above):
-;; (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
-;;
-;; Customization:
-;;
-;; To customize various options, including the color theme:
-;; M-x customize-group rainbow-delimiters
-;;
-;; You can specify custom colors by customizing following faces:
-;; - Faces take the form `rainbow-delimiters-depth-N-face', with N being the
-;; depth. Depth begins at 1, the outermost color. Faces exist for depths 1-9.
-;; - The unmatched delimiter face: `rainbow-delimiters-unmatched-face'.
-;; - The mismatched delimiter face: `rainbow-delimiters-mismatched-face'.
-
-;;; Code:
-
-(defgroup rainbow-delimiters nil
- "Highlight nested parentheses, brackets, and braces according to their depth."
- :prefix "rainbow-delimiters-"
- :link '(url-link :tag "Website for rainbow-delimiters"
- "https://github.com/Fanael/rainbow-delimiters")
- :group 'applications)
-
-(defgroup rainbow-delimiters-faces nil
- "Faces for successively nested pairs of delimiters.
-
-When depth exceeds innermost defined face, colors cycle back through."
- :group 'rainbow-delimiters
- :group 'faces
- :link '(custom-group-link "rainbow-delimiters")
- :prefix "rainbow-delimiters-")
-
-(defcustom rainbow-delimiters-pick-face-function
- #'rainbow-delimiters-default-pick-face
- "The function used to pick a face used to highlight a delimiter.
-The function should take three arguments (DEPTH MATCH LOC), where:
- - DEPTH is the delimiter depth; when zero or negative, it's an unmatched
- delimiter.
- - MATCH is nil iff the delimiter is a mismatched closing delimiter.
- - LOC is the location of the delimiter.
-The function should return a value suitable to use as a value of the `face' text
-property, or nil, in which case the delimiter is not highlighted.
-The function should not move the point or mark or change the match data."
- :tag "Pick face function"
- :type 'function
- :group 'rainbow-delimiters)
-
-(defface rainbow-delimiters-base-face
- '((default (:inherit unspecified)))
- "Face inherited by all other rainbow-delimiter faces."
- :group 'rainbow-delimiters-faces)
-
-(defface rainbow-delimiters-unmatched-face
- '((default (:inherit rainbow-delimiters-base-face))
- (((background light)) (:foreground "#88090B"))
- (((background dark)) (:inherit rainbow-delimiters-base-face :foreground "#88090B")))
- "Face to highlight unmatched closing delimiters in."
- :group 'rainbow-delimiters-faces)
-
-(defface rainbow-delimiters-mismatched-face
- '((t :inherit (rainbow-delimiters-unmatched-face rainbow-delimiters-base-face)))
- "Face to highlight mismatched closing delimiters in."
- :group 'rainbow-delimiters-faces)
-
-(eval-when-compile
- (defmacro rainbow-delimiters--define-depth-faces ()
- (let ((faces '())
- (light-colors ["#707183" "#7388d6" "#909183" "#709870" "#907373"
- "#6276ba" "#858580" "#80a880" "#887070"])
- (dark-colors ["grey55" "#93a8c6" "#b0b1a3" "#97b098" "#aebed8"
- "#b0b0b3" "#90a890" "#a2b6da" "#9cb6ad"]))
- (dotimes (i 9)
- (push `(defface ,(intern (format "rainbow-delimiters-depth-%d-face" (1+ i)))
- '((default (:inherit rainbow-delimiters-base-face))
- (((class color) (background light)) :foreground ,(aref light-colors i))
- (((class color) (background dark)) :foreground ,(aref dark-colors i)))
- ,(format "Nested delimiter face, depth %d." (1+ i))
- :group 'rainbow-delimiters-faces)
- faces))
- `(progn ,@faces))))
-(rainbow-delimiters--define-depth-faces)
-
-(defcustom rainbow-delimiters-max-face-count 9
- "Number of faces defined for highlighting delimiter levels.
-
-Determines depth at which to cycle through faces again.
-
-It's safe to change this variable provided that for all integers from 1 to the
-new value inclusive, a face `rainbow-delimiters-depth-N-face' is defined."
- :type 'integer
- :group 'rainbow-delimiters)
-
-(defcustom rainbow-delimiters-outermost-only-face-count 0
- "Number of faces to be used only for N outermost delimiter levels.
-
-This should be smaller than `rainbow-delimiters-max-face-count'."
- :type 'integer
- :group 'rainbow-delimiters)
-
-
-(defun rainbow-delimiters-default-pick-face (depth match _loc)
- "Return a face name appropriate for nesting depth DEPTH.
-DEPTH and MATCH are as in `rainbow-delimiters-pick-face-function'.
-
-The returned value is either `rainbow-delimiters-unmatched-face',
-`rainbow-delimiters-mismatched-face', or one of the
-`rainbow-delimiters-depth-N-face' faces, obeying
-`rainbow-delimiters-max-face-count' and
-`rainbow-delimiters-outermost-only-face-count'."
- (cond
- ((<= depth 0)
- 'rainbow-delimiters-unmatched-face)
- ((not match)
- 'rainbow-delimiters-mismatched-face)
- (t
- (intern-soft
- (concat "rainbow-delimiters-depth-"
- (number-to-string
- (if (<= depth rainbow-delimiters-max-face-count)
- ;; Our nesting depth has a face defined for it.
- depth
- ;; Deeper than # of defined faces; cycle back through to
- ;; `rainbow-delimiters-outermost-only-face-count' + 1.
- ;; Return face # that corresponds to current nesting level.
- (+ 1 rainbow-delimiters-outermost-only-face-count
- (mod (- depth rainbow-delimiters-max-face-count 1)
- (- rainbow-delimiters-max-face-count
- rainbow-delimiters-outermost-only-face-count)))))
- "-face")))))
-
-(defun rainbow-delimiters--apply-color (loc depth match)
- "Highlight a single delimiter at LOC according to DEPTH.
-
-LOC is the location of the character to add text properties to.
-DEPTH is the nested depth at LOC, which determines the face to use.
-MATCH is nil iff it's a mismatched closing delimiter."
- (let ((face (funcall rainbow-delimiters-pick-face-function depth match loc)))
- (when face
- (font-lock-prepend-text-property loc (1+ loc) 'face face))))
-
-(defun rainbow-delimiters--char-ineligible-p (loc ppss delim-syntax-code)
- "Return t if char at LOC should not be highlighted.
-PPSS is the `parse-partial-sexp' state at LOC.
-DELIM-SYNTAX-CODE is the `car' of a raw syntax descriptor at LOC.
-
-Returns t if char at loc meets one of the following conditions:
-- Inside a string.
-- Inside a comment.
-- Is an escaped char, e.g. ?\)"
- (or
- (nth 3 ppss) ; inside string?
- (nth 4 ppss) ; inside comment?
- (nth 5 ppss) ; escaped according to the syntax table?
- ;; Note: no need to consider single-char openers, they're already handled
- ;; by looking at ppss.
- (cond
- ;; Two character opener, LOC at the first character?
- ((/= 0 (logand #x10000 delim-syntax-code))
- (/= 0 (logand #x20000 (or (car (syntax-after (1+ loc))) 0))))
- ;; Two character opener, LOC at the second character?
- ((/= 0 (logand #x20000 delim-syntax-code))
- (/= 0 (logand #x10000 (or (car (syntax-after (1- loc))) 0))))
- (t
- nil))))
-
-;; Main function called by font-lock.
-(defun rainbow-delimiters--propertize (end)
- "Highlight delimiters in region between point and END.
-
-Used by font-lock for dynamic highlighting."
- (let* ((last-ppss-pos (point))
- (ppss (syntax-ppss)))
- (while (> end (progn (skip-syntax-forward "^()" end)
- (point)))
- (let* ((delim-pos (point))
- (delim-syntax (syntax-after delim-pos)))
- (setq ppss (parse-partial-sexp last-ppss-pos delim-pos nil nil ppss))
- (setq last-ppss-pos delim-pos)
- ;; `skip-syntax-forward' leaves the point at the delimiter, move past
- ;; it.
- (forward-char)
- (let ((delim-syntax-code (car delim-syntax)))
- (cond
- ((rainbow-delimiters--char-ineligible-p delim-pos ppss delim-syntax-code)
- nil)
- ((= 4 (logand #xFFFF delim-syntax-code))
- ;; The (1+ ...) is needed because `parse-partial-sexp' returns the
- ;; depth at the opening delimiter, not in the block being started.
- (rainbow-delimiters--apply-color delim-pos (1+ (nth 0 ppss)) t))
- (t
- ;; Not an opening delimiter, so it's a closing delimiter.
- (let ((matches-p (eq (cdr delim-syntax) (char-after (nth 1 ppss)))))
- (rainbow-delimiters--apply-color delim-pos (nth 0 ppss) matches-p))))))))
- ;; We already fontified the delimiters, tell font-lock there's nothing more
- ;; to do.
- nil)
-
-;; NB: no face defined here because we apply the faces ourselves instead of
-;; leaving that to font-lock.
-(defconst rainbow-delimiters--font-lock-keywords
- '(rainbow-delimiters--propertize))
-
-;;;###autoload
-(define-minor-mode rainbow-delimiters-mode
- "Highlight nested parentheses, brackets, and braces according to their depth."
- nil "" nil ; No modeline lighter - it's already obvious when the mode is on.
- (font-lock-remove-keywords nil rainbow-delimiters--font-lock-keywords)
- (when rainbow-delimiters-mode
- (font-lock-add-keywords nil rainbow-delimiters--font-lock-keywords 'append)
- (set (make-local-variable 'jit-lock-contextually) t)
- (when (or (bound-and-true-p syntax-begin-function)
- (bound-and-true-p font-lock-beginning-of-syntax-function))
- ;; We're going to modify `syntax-begin-function', so flush the cache to
- ;; avoid getting cached values that used the old value.
- (syntax-ppss-flush-cache 0))
- ;; `syntax-begin-function' may break the assumption we rely on that
- ;; `syntax-ppss' is exactly equivalent to `parse-partial-sexp' from
- ;; `point-min'. Just don't use it, the performance hit should be negligible.
- (when (boundp 'syntax-begin-function)
- (set (make-local-variable 'syntax-begin-function) nil))
- ;; Obsolete equivalent of `syntax-begin-function'.
- (when (boundp 'font-lock-beginning-of-syntax-function)
- (set (make-local-variable 'font-lock-beginning-of-syntax-function) nil)))
- (when font-lock-mode
- (if (fboundp 'font-lock-flush)
- (font-lock-flush)
- (with-no-warnings (font-lock-fontify-buffer)))))
-
-;;;###autoload
-(defun rainbow-delimiters-mode-enable ()
- "Enable `rainbow-delimiters-mode'."
- (rainbow-delimiters-mode 1))
-
-;;;###autoload
-(defun rainbow-delimiters-mode-disable ()
- "Disable `rainbow-delimiters-mode'."
- (rainbow-delimiters-mode 0))
-
-(provide 'rainbow-delimiters)
-;;; rainbow-delimiters.el ends here
diff --git a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.elc b/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.elc
deleted file mode 100644
index 2bc2a7b..0000000
Binary files a/emacs/.emacs.d/elpa/rainbow-delimiters-20170929.432/rainbow-delimiters.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/rainbow-mode-0.13.signed b/emacs/.emacs.d/elpa/rainbow-mode-0.13.signed
deleted file mode 100644
index 1ba862c..0000000
--- a/emacs/.emacs.d/elpa/rainbow-mode-0.13.signed
+++ /dev/null
@@ -1 +0,0 @@
-Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent (trust undefined) created at 2017-05-29T23:05:03+0200 using DSA
\ No newline at end of file
diff --git a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-autoloads.el b/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-autoloads.el
deleted file mode 100644
index b586428..0000000
--- a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-autoloads.el
+++ /dev/null
@@ -1,23 +0,0 @@
-;;; rainbow-mode-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "rainbow-mode" "rainbow-mode.el" (23124 14382
-;;;;;; 115575 75000))
-;;; Generated autoloads from rainbow-mode.el
-
-(autoload 'rainbow-mode "rainbow-mode" "\
-Colorize strings that represent colors.
-This will fontify with colors the string like \"#aabbcc\" or \"blue\".
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; rainbow-mode-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-pkg.el b/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-pkg.el
deleted file mode 100644
index 17527c9..0000000
--- a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "rainbow-mode" "0.13" "Colorize color names in buffers" 'nil :url "http://elpa.gnu.org/packages/rainbow-mode.html" :keywords '("faces"))
diff --git a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.el b/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.el
deleted file mode 100644
index fd2f46b..0000000
--- a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.el
+++ /dev/null
@@ -1,1258 +0,0 @@
-;;; rainbow-mode.el --- Colorize color names in buffers
-
-;; Copyright (C) 2010-2017 Free Software Foundation, Inc
-
-;; Author: Julien Danjou
-;; Keywords: faces
-;; Version: 0.13
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs. If not, see .
-
-;;; Commentary:
-;;
-;; This minor mode sets background color to strings that match color
-;; names, e.g. #0000ff is displayed in white with a blue background.
-;;
-
-;;; Code:
-
-(eval-when-compile
- (require 'cl))
-
-(require 'regexp-opt)
-(require 'faces)
-(require 'color)
-
-(unless (require 'xterm-color nil t)
- (require 'ansi-color))
-
-(defgroup rainbow nil
- "Show color strings with a background color."
- :tag "Rainbow"
- :group 'help)
-
-;; Hexadecimal colors
-(defvar rainbow-hexadecimal-colors-font-lock-keywords
- '(("[^&]\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
- (1 (rainbow-colorize-itself 1)))
- ("^\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
- (0 (rainbow-colorize-itself)))
- ("[Rr][Gg][Bb]:[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}"
- (0 (rainbow-colorize-itself)))
- ("[Rr][Gg][Bb][Ii]:[0-9.]+/[0-9.]+/[0-9.]+"
- (0 (rainbow-colorize-itself)))
- ("\\(?:[Cc][Ii][Ee]\\(?:[Xx][Yy][Zz]\\|[Uu][Vv][Yy]\\|[Xx][Yy][Yy]\\|[Ll][Aa][Bb]\\|[Ll][Uu][Vv]\\)\\|[Tt][Ee][Kk][Hh][Vv][Cc]\\):[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?"
- (0 (rainbow-colorize-itself))))
- "Font-lock keywords to add for hexadecimal colors.")
-
-;; rgb() colors
-(defvar rainbow-html-rgb-colors-font-lock-keywords
- '(("rgb(\s*\\([0-9]\\{1,3\\}\\(?:\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*)"
- (0 (rainbow-colorize-rgb)))
- ("rgba(\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)"
- (0 (rainbow-colorize-rgb)))
- ("hsl(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*)"
- (0 (rainbow-colorize-hsl)))
- ("hsla(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)"
- (0 (rainbow-colorize-hsl))))
- "Font-lock keywords to add for RGB colors.")
-
-;; HTML colors name
-(defvar rainbow-html-colors-font-lock-keywords nil
- "Font-lock keywords to add for HTML colors.")
-(make-variable-buffer-local 'rainbow-html-colors-font-lock-keywords)
-
-(defcustom rainbow-html-colors-alist
- '(("AliceBlue" . "#F0F8FF")
- ("AntiqueWhite" . "#FAEBD7")
- ("Aqua" . "#00FFFF")
- ("Aquamarine" . "#7FFFD4")
- ("Azure" . "#F0FFFF")
- ("Beige" . "#F5F5DC")
- ("Bisque" . "#FFE4C4")
- ("Black" . "#000000")
- ("BlanchedAlmond" . "#FFEBCD")
- ("Blue" . "#0000FF")
- ("BlueViolet" . "#8A2BE2")
- ("Brown" . "#A52A2A")
- ("BurlyWood" . "#DEB887")
- ("CadetBlue" . "#5F9EA0")
- ("Chartreuse" . "#7FFF00")
- ("Chocolate" . "#D2691E")
- ("Coral" . "#FF7F50")
- ("CornflowerBlue" . "#6495ED")
- ("Cornsilk" . "#FFF8DC")
- ("Crimson" . "#DC143C")
- ("Cyan" . "#00FFFF")
- ("DarkBlue" . "#00008B")
- ("DarkCyan" . "#008B8B")
- ("DarkGoldenRod" . "#B8860B")
- ("DarkGray" . "#A9A9A9")
- ("DarkGrey" . "#A9A9A9")
- ("DarkGreen" . "#006400")
- ("DarkKhaki" . "#BDB76B")
- ("DarkMagenta" . "#8B008B")
- ("DarkOliveGreen" . "#556B2F")
- ("Darkorange" . "#FF8C00")
- ("DarkOrchid" . "#9932CC")
- ("DarkRed" . "#8B0000")
- ("DarkSalmon" . "#E9967A")
- ("DarkSeaGreen" . "#8FBC8F")
- ("DarkSlateBlue" . "#483D8B")
- ("DarkSlateGray" . "#2F4F4F")
- ("DarkSlateGrey" . "#2F4F4F")
- ("DarkTurquoise" . "#00CED1")
- ("DarkViolet" . "#9400D3")
- ("DeepPink" . "#FF1493")
- ("DeepSkyBlue" . "#00BFFF")
- ("DimGray" . "#696969")
- ("DimGrey" . "#696969")
- ("DodgerBlue" . "#1E90FF")
- ("FireBrick" . "#B22222")
- ("FloralWhite" . "#FFFAF0")
- ("ForestGreen" . "#228B22")
- ("Fuchsia" . "#FF00FF")
- ("Gainsboro" . "#DCDCDC")
- ("GhostWhite" . "#F8F8FF")
- ("Gold" . "#FFD700")
- ("GoldenRod" . "#DAA520")
- ("Gray" . "#808080")
- ("Grey" . "#808080")
- ("Green" . "#008000")
- ("GreenYellow" . "#ADFF2F")
- ("HoneyDew" . "#F0FFF0")
- ("HotPink" . "#FF69B4")
- ("IndianRed" . "#CD5C5C")
- ("Indigo" . "#4B0082")
- ("Ivory" . "#FFFFF0")
- ("Khaki" . "#F0E68C")
- ("Lavender" . "#E6E6FA")
- ("LavenderBlush" . "#FFF0F5")
- ("LawnGreen" . "#7CFC00")
- ("LemonChiffon" . "#FFFACD")
- ("LightBlue" . "#ADD8E6")
- ("LightCoral" . "#F08080")
- ("LightCyan" . "#E0FFFF")
- ("LightGoldenRodYellow" . "#FAFAD2")
- ("LightGray" . "#D3D3D3")
- ("LightGrey" . "#D3D3D3")
- ("LightGreen" . "#90EE90")
- ("LightPink" . "#FFB6C1")
- ("LightSalmon" . "#FFA07A")
- ("LightSeaGreen" . "#20B2AA")
- ("LightSkyBlue" . "#87CEFA")
- ("LightSlateGray" . "#778899")
- ("LightSlateGrey" . "#778899")
- ("LightSteelBlue" . "#B0C4DE")
- ("LightYellow" . "#FFFFE0")
- ("Lime" . "#00FF00")
- ("LimeGreen" . "#32CD32")
- ("Linen" . "#FAF0E6")
- ("Magenta" . "#FF00FF")
- ("Maroon" . "#800000")
- ("MediumAquaMarine" . "#66CDAA")
- ("MediumBlue" . "#0000CD")
- ("MediumOrchid" . "#BA55D3")
- ("MediumPurple" . "#9370D8")
- ("MediumSeaGreen" . "#3CB371")
- ("MediumSlateBlue" . "#7B68EE")
- ("MediumSpringGreen" . "#00FA9A")
- ("MediumTurquoise" . "#48D1CC")
- ("MediumVioletRed" . "#C71585")
- ("MidnightBlue" . "#191970")
- ("MintCream" . "#F5FFFA")
- ("MistyRose" . "#FFE4E1")
- ("Moccasin" . "#FFE4B5")
- ("NavajoWhite" . "#FFDEAD")
- ("Navy" . "#000080")
- ("OldLace" . "#FDF5E6")
- ("Olive" . "#808000")
- ("OliveDrab" . "#6B8E23")
- ("Orange" . "#FFA500")
- ("OrangeRed" . "#FF4500")
- ("Orchid" . "#DA70D6")
- ("PaleGoldenRod" . "#EEE8AA")
- ("PaleGreen" . "#98FB98")
- ("PaleTurquoise" . "#AFEEEE")
- ("PaleVioletRed" . "#D87093")
- ("PapayaWhip" . "#FFEFD5")
- ("PeachPuff" . "#FFDAB9")
- ("Peru" . "#CD853F")
- ("Pink" . "#FFC0CB")
- ("Plum" . "#DDA0DD")
- ("PowderBlue" . "#B0E0E6")
- ("Purple" . "#800080")
- ("Red" . "#FF0000")
- ("RosyBrown" . "#BC8F8F")
- ("RoyalBlue" . "#4169E1")
- ("SaddleBrown" . "#8B4513")
- ("Salmon" . "#FA8072")
- ("SandyBrown" . "#F4A460")
- ("SeaGreen" . "#2E8B57")
- ("SeaShell" . "#FFF5EE")
- ("Sienna" . "#A0522D")
- ("Silver" . "#C0C0C0")
- ("SkyBlue" . "#87CEEB")
- ("SlateBlue" . "#6A5ACD")
- ("SlateGray" . "#708090")
- ("SlateGrey" . "#708090")
- ("Snow" . "#FFFAFA")
- ("SpringGreen" . "#00FF7F")
- ("SteelBlue" . "#4682B4")
- ("Tan" . "#D2B48C")
- ("Teal" . "#008080")
- ("Thistle" . "#D8BFD8")
- ("Tomato" . "#FF6347")
- ("Turquoise" . "#40E0D0")
- ("Violet" . "#EE82EE")
- ("Wheat" . "#F5DEB3")
- ("White" . "#FFFFFF")
- ("WhiteSmoke" . "#F5F5F5")
- ("Yellow" . "#FFFF00")
- ("YellowGreen" . "#9ACD32"))
- "Alist of HTML colors.
-Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR)."
- :group 'rainbow)
-
-(defcustom rainbow-html-colors-major-mode-list
- '(html-mode css-mode php-mode nxml-mode xml-mode)
- "List of major mode where HTML colors are enabled when
-`rainbow-html-colors' is set to auto."
- :group 'rainbow)
-
-(defcustom rainbow-html-colors 'auto
- "When to enable HTML colors.
-If set to t, the HTML colors will be enabled. If set to nil, the
-HTML colors will not be enabled. If set to auto, the HTML colors
-will be enabled if a major mode has been detected from the
-`rainbow-html-colors-major-mode-list'."
- :group 'rainbow)
-
-;; X colors
-(defvar rainbow-x-colors-font-lock-keywords
- `((,(regexp-opt (x-defined-colors) 'words)
- (0 (rainbow-colorize-itself))))
- "Font-lock keywords to add for X colors.")
-
-(defcustom rainbow-x-colors-major-mode-list
- '(emacs-lisp-mode lisp-interaction-mode c-mode c++-mode java-mode)
- "List of major mode where X colors are enabled when
-`rainbow-x-colors' is set to auto."
- :group 'rainbow)
-
-(defcustom rainbow-x-colors 'auto
- "When to enable X colors.
-If set to t, the X colors will be enabled. If set to nil, the
-X colors will not be enabled. If set to auto, the X colors
-will be enabled if a major mode has been detected from the
-`rainbow-x-colors-major-mode-list'."
- :group 'rainbow)
-
-;; LaTeX colors
-(defvar rainbow-latex-rgb-colors-font-lock-keywords
- '(("{rgb}{\\([0-9.]+\\),\s*\\([0-9.]+\\),\s*\\([0-9.]+\\)}"
- (0 (rainbow-colorize-rgb-float)))
- ("{RGB}{\\([0-9]\\{1,3\\}\\),\s*\\([0-9]\\{1,3\\}\\),\s*\\([0-9]\\{1,3\\}\\)}"
- (0 (rainbow-colorize-rgb)))
- ("{HTML}{\\([0-9A-Fa-f]\\{6\\}\\)}"
- (0 (rainbow-colorize-hexadecimal-without-sharp))))
- "Font-lock keywords to add for LaTeX colors.")
-
-(defcustom rainbow-latex-colors-major-mode-list
- '(latex-mode)
- "List of major mode where LaTeX colors are enabled when
-`rainbow-x-colors' is set to auto."
- :group 'rainbow)
-
-(defcustom rainbow-latex-colors 'auto
- "When to enable LaTeX colors.
-If set to t, the LaTeX colors will be enabled. If set to nil, the
-LaTeX colors will not be enabled. If set to auto, the LaTeX colors
-will be enabled if a major mode has been detected from the
-`rainbow-latex-colors-major-mode-list'."
- :group 'rainbow)
-
-;; Shell colors
-(defvar rainbow-ansi-colors-font-lock-keywords
- '(("\\(\\\\[eE]\\|\\\\033\\|\\\\x1[bB]\\|\033\\)\\[\\([0-9;]*m\\)"
- (0 (rainbow-colorize-ansi))))
- "Font-lock keywords to add for ANSI colors.")
-
-(defcustom rainbow-ansi-colors-major-mode-list
- '(sh-mode c-mode c++-mode)
- "List of major mode where ANSI colors are enabled when
-`rainbow-ansi-colors' is set to auto."
- :group 'rainbow)
-
-(defcustom rainbow-ansi-colors 'auto
- "When to enable ANSI colors.
-If set to t, the ANSI colors will be enabled. If set to nil, the
-ANSI colors will not be enabled. If set to auto, the ANSI colors
-will be enabled if a major mode has been detected from the
-`rainbow-ansi-colors-major-mode-list'."
- :group 'rainbow)
-
-;; R colors
-
-;; R colors name
-(defvar rainbow-r-colors-font-lock-keywords nil
- "Font-lock keywords to add for R colors.")
-(make-variable-buffer-local 'rainbow-r-colors-font-lock-keywords)
-
-;; use the following code to generate the list in R
-;; output_colors <- function(colors) {for(color in colors) {col <- col2rgb(color); cat(sprintf("(\"%s\" . \"#%02X%02X%02X\")\n",color,col[1],col[2],col[3]));}}
-;; output_colors(colors())
-(defcustom rainbow-r-colors-alist
- '(("white" . "#FFFFFF")
- ("aliceblue" . "#F0F8FF")
- ("antiquewhite" . "#FAEBD7")
- ("antiquewhite1" . "#FFEFDB")
- ("antiquewhite2" . "#EEDFCC")
- ("antiquewhite3" . "#CDC0B0")
- ("antiquewhite4" . "#8B8378")
- ("aquamarine" . "#7FFFD4")
- ("aquamarine1" . "#7FFFD4")
- ("aquamarine2" . "#76EEC6")
- ("aquamarine3" . "#66CDAA")
- ("aquamarine4" . "#458B74")
- ("azure" . "#F0FFFF")
- ("azure1" . "#F0FFFF")
- ("azure2" . "#E0EEEE")
- ("azure3" . "#C1CDCD")
- ("azure4" . "#838B8B")
- ("beige" . "#F5F5DC")
- ("bisque" . "#FFE4C4")
- ("bisque1" . "#FFE4C4")
- ("bisque2" . "#EED5B7")
- ("bisque3" . "#CDB79E")
- ("bisque4" . "#8B7D6B")
- ("black" . "#000000")
- ("blanchedalmond" . "#FFEBCD")
- ("blue" . "#0000FF")
- ("blue1" . "#0000FF")
- ("blue2" . "#0000EE")
- ("blue3" . "#0000CD")
- ("blue4" . "#00008B")
- ("blueviolet" . "#8A2BE2")
- ("brown" . "#A52A2A")
- ("brown1" . "#FF4040")
- ("brown2" . "#EE3B3B")
- ("brown3" . "#CD3333")
- ("brown4" . "#8B2323")
- ("burlywood" . "#DEB887")
- ("burlywood1" . "#FFD39B")
- ("burlywood2" . "#EEC591")
- ("burlywood3" . "#CDAA7D")
- ("burlywood4" . "#8B7355")
- ("cadetblue" . "#5F9EA0")
- ("cadetblue1" . "#98F5FF")
- ("cadetblue2" . "#8EE5EE")
- ("cadetblue3" . "#7AC5CD")
- ("cadetblue4" . "#53868B")
- ("chartreuse" . "#7FFF00")
- ("chartreuse1" . "#7FFF00")
- ("chartreuse2" . "#76EE00")
- ("chartreuse3" . "#66CD00")
- ("chartreuse4" . "#458B00")
- ("chocolate" . "#D2691E")
- ("chocolate1" . "#FF7F24")
- ("chocolate2" . "#EE7621")
- ("chocolate3" . "#CD661D")
- ("chocolate4" . "#8B4513")
- ("coral" . "#FF7F50")
- ("coral1" . "#FF7256")
- ("coral2" . "#EE6A50")
- ("coral3" . "#CD5B45")
- ("coral4" . "#8B3E2F")
- ("cornflowerblue" . "#6495ED")
- ("cornsilk" . "#FFF8DC")
- ("cornsilk1" . "#FFF8DC")
- ("cornsilk2" . "#EEE8CD")
- ("cornsilk3" . "#CDC8B1")
- ("cornsilk4" . "#8B8878")
- ("cyan" . "#00FFFF")
- ("cyan1" . "#00FFFF")
- ("cyan2" . "#00EEEE")
- ("cyan3" . "#00CDCD")
- ("cyan4" . "#008B8B")
- ("darkblue" . "#00008B")
- ("darkcyan" . "#008B8B")
- ("darkgoldenrod" . "#B8860B")
- ("darkgoldenrod1" . "#FFB90F")
- ("darkgoldenrod2" . "#EEAD0E")
- ("darkgoldenrod3" . "#CD950C")
- ("darkgoldenrod4" . "#8B6508")
- ("darkgray" . "#A9A9A9")
- ("darkgreen" . "#006400")
- ("darkgrey" . "#A9A9A9")
- ("darkkhaki" . "#BDB76B")
- ("darkmagenta" . "#8B008B")
- ("darkolivegreen" . "#556B2F")
- ("darkolivegreen1" . "#CAFF70")
- ("darkolivegreen2" . "#BCEE68")
- ("darkolivegreen3" . "#A2CD5A")
- ("darkolivegreen4" . "#6E8B3D")
- ("darkorange" . "#FF8C00")
- ("darkorange1" . "#FF7F00")
- ("darkorange2" . "#EE7600")
- ("darkorange3" . "#CD6600")
- ("darkorange4" . "#8B4500")
- ("darkorchid" . "#9932CC")
- ("darkorchid1" . "#BF3EFF")
- ("darkorchid2" . "#B23AEE")
- ("darkorchid3" . "#9A32CD")
- ("darkorchid4" . "#68228B")
- ("darkred" . "#8B0000")
- ("darksalmon" . "#E9967A")
- ("darkseagreen" . "#8FBC8F")
- ("darkseagreen1" . "#C1FFC1")
- ("darkseagreen2" . "#B4EEB4")
- ("darkseagreen3" . "#9BCD9B")
- ("darkseagreen4" . "#698B69")
- ("darkslateblue" . "#483D8B")
- ("darkslategray" . "#2F4F4F")
- ("darkslategray1" . "#97FFFF")
- ("darkslategray2" . "#8DEEEE")
- ("darkslategray3" . "#79CDCD")
- ("darkslategray4" . "#528B8B")
- ("darkslategrey" . "#2F4F4F")
- ("darkturquoise" . "#00CED1")
- ("darkviolet" . "#9400D3")
- ("deeppink" . "#FF1493")
- ("deeppink1" . "#FF1493")
- ("deeppink2" . "#EE1289")
- ("deeppink3" . "#CD1076")
- ("deeppink4" . "#8B0A50")
- ("deepskyblue" . "#00BFFF")
- ("deepskyblue1" . "#00BFFF")
- ("deepskyblue2" . "#00B2EE")
- ("deepskyblue3" . "#009ACD")
- ("deepskyblue4" . "#00688B")
- ("dimgray" . "#696969")
- ("dimgrey" . "#696969")
- ("dodgerblue" . "#1E90FF")
- ("dodgerblue1" . "#1E90FF")
- ("dodgerblue2" . "#1C86EE")
- ("dodgerblue3" . "#1874CD")
- ("dodgerblue4" . "#104E8B")
- ("firebrick" . "#B22222")
- ("firebrick1" . "#FF3030")
- ("firebrick2" . "#EE2C2C")
- ("firebrick3" . "#CD2626")
- ("firebrick4" . "#8B1A1A")
- ("floralwhite" . "#FFFAF0")
- ("forestgreen" . "#228B22")
- ("gainsboro" . "#DCDCDC")
- ("ghostwhite" . "#F8F8FF")
- ("gold" . "#FFD700")
- ("gold1" . "#FFD700")
- ("gold2" . "#EEC900")
- ("gold3" . "#CDAD00")
- ("gold4" . "#8B7500")
- ("goldenrod" . "#DAA520")
- ("goldenrod1" . "#FFC125")
- ("goldenrod2" . "#EEB422")
- ("goldenrod3" . "#CD9B1D")
- ("goldenrod4" . "#8B6914")
- ("gray" . "#BEBEBE")
- ("gray0" . "#000000")
- ("gray1" . "#030303")
- ("gray2" . "#050505")
- ("gray3" . "#080808")
- ("gray4" . "#0A0A0A")
- ("gray5" . "#0D0D0D")
- ("gray6" . "#0F0F0F")
- ("gray7" . "#121212")
- ("gray8" . "#141414")
- ("gray9" . "#171717")
- ("gray10" . "#1A1A1A")
- ("gray11" . "#1C1C1C")
- ("gray12" . "#1F1F1F")
- ("gray13" . "#212121")
- ("gray14" . "#242424")
- ("gray15" . "#262626")
- ("gray16" . "#292929")
- ("gray17" . "#2B2B2B")
- ("gray18" . "#2E2E2E")
- ("gray19" . "#303030")
- ("gray20" . "#333333")
- ("gray21" . "#363636")
- ("gray22" . "#383838")
- ("gray23" . "#3B3B3B")
- ("gray24" . "#3D3D3D")
- ("gray25" . "#404040")
- ("gray26" . "#424242")
- ("gray27" . "#454545")
- ("gray28" . "#474747")
- ("gray29" . "#4A4A4A")
- ("gray30" . "#4D4D4D")
- ("gray31" . "#4F4F4F")
- ("gray32" . "#525252")
- ("gray33" . "#545454")
- ("gray34" . "#575757")
- ("gray35" . "#595959")
- ("gray36" . "#5C5C5C")
- ("gray37" . "#5E5E5E")
- ("gray38" . "#616161")
- ("gray39" . "#636363")
- ("gray40" . "#666666")
- ("gray41" . "#696969")
- ("gray42" . "#6B6B6B")
- ("gray43" . "#6E6E6E")
- ("gray44" . "#707070")
- ("gray45" . "#737373")
- ("gray46" . "#757575")
- ("gray47" . "#787878")
- ("gray48" . "#7A7A7A")
- ("gray49" . "#7D7D7D")
- ("gray50" . "#7F7F7F")
- ("gray51" . "#828282")
- ("gray52" . "#858585")
- ("gray53" . "#878787")
- ("gray54" . "#8A8A8A")
- ("gray55" . "#8C8C8C")
- ("gray56" . "#8F8F8F")
- ("gray57" . "#919191")
- ("gray58" . "#949494")
- ("gray59" . "#969696")
- ("gray60" . "#999999")
- ("gray61" . "#9C9C9C")
- ("gray62" . "#9E9E9E")
- ("gray63" . "#A1A1A1")
- ("gray64" . "#A3A3A3")
- ("gray65" . "#A6A6A6")
- ("gray66" . "#A8A8A8")
- ("gray67" . "#ABABAB")
- ("gray68" . "#ADADAD")
- ("gray69" . "#B0B0B0")
- ("gray70" . "#B3B3B3")
- ("gray71" . "#B5B5B5")
- ("gray72" . "#B8B8B8")
- ("gray73" . "#BABABA")
- ("gray74" . "#BDBDBD")
- ("gray75" . "#BFBFBF")
- ("gray76" . "#C2C2C2")
- ("gray77" . "#C4C4C4")
- ("gray78" . "#C7C7C7")
- ("gray79" . "#C9C9C9")
- ("gray80" . "#CCCCCC")
- ("gray81" . "#CFCFCF")
- ("gray82" . "#D1D1D1")
- ("gray83" . "#D4D4D4")
- ("gray84" . "#D6D6D6")
- ("gray85" . "#D9D9D9")
- ("gray86" . "#DBDBDB")
- ("gray87" . "#DEDEDE")
- ("gray88" . "#E0E0E0")
- ("gray89" . "#E3E3E3")
- ("gray90" . "#E5E5E5")
- ("gray91" . "#E8E8E8")
- ("gray92" . "#EBEBEB")
- ("gray93" . "#EDEDED")
- ("gray94" . "#F0F0F0")
- ("gray95" . "#F2F2F2")
- ("gray96" . "#F5F5F5")
- ("gray97" . "#F7F7F7")
- ("gray98" . "#FAFAFA")
- ("gray99" . "#FCFCFC")
- ("gray100" . "#FFFFFF")
- ("green" . "#00FF00")
- ("green1" . "#00FF00")
- ("green2" . "#00EE00")
- ("green3" . "#00CD00")
- ("green4" . "#008B00")
- ("greenyellow" . "#ADFF2F")
- ("grey" . "#BEBEBE")
- ("grey0" . "#000000")
- ("grey1" . "#030303")
- ("grey2" . "#050505")
- ("grey3" . "#080808")
- ("grey4" . "#0A0A0A")
- ("grey5" . "#0D0D0D")
- ("grey6" . "#0F0F0F")
- ("grey7" . "#121212")
- ("grey8" . "#141414")
- ("grey9" . "#171717")
- ("grey10" . "#1A1A1A")
- ("grey11" . "#1C1C1C")
- ("grey12" . "#1F1F1F")
- ("grey13" . "#212121")
- ("grey14" . "#242424")
- ("grey15" . "#262626")
- ("grey16" . "#292929")
- ("grey17" . "#2B2B2B")
- ("grey18" . "#2E2E2E")
- ("grey19" . "#303030")
- ("grey20" . "#333333")
- ("grey21" . "#363636")
- ("grey22" . "#383838")
- ("grey23" . "#3B3B3B")
- ("grey24" . "#3D3D3D")
- ("grey25" . "#404040")
- ("grey26" . "#424242")
- ("grey27" . "#454545")
- ("grey28" . "#474747")
- ("grey29" . "#4A4A4A")
- ("grey30" . "#4D4D4D")
- ("grey31" . "#4F4F4F")
- ("grey32" . "#525252")
- ("grey33" . "#545454")
- ("grey34" . "#575757")
- ("grey35" . "#595959")
- ("grey36" . "#5C5C5C")
- ("grey37" . "#5E5E5E")
- ("grey38" . "#616161")
- ("grey39" . "#636363")
- ("grey40" . "#666666")
- ("grey41" . "#696969")
- ("grey42" . "#6B6B6B")
- ("grey43" . "#6E6E6E")
- ("grey44" . "#707070")
- ("grey45" . "#737373")
- ("grey46" . "#757575")
- ("grey47" . "#787878")
- ("grey48" . "#7A7A7A")
- ("grey49" . "#7D7D7D")
- ("grey50" . "#7F7F7F")
- ("grey51" . "#828282")
- ("grey52" . "#858585")
- ("grey53" . "#878787")
- ("grey54" . "#8A8A8A")
- ("grey55" . "#8C8C8C")
- ("grey56" . "#8F8F8F")
- ("grey57" . "#919191")
- ("grey58" . "#949494")
- ("grey59" . "#969696")
- ("grey60" . "#999999")
- ("grey61" . "#9C9C9C")
- ("grey62" . "#9E9E9E")
- ("grey63" . "#A1A1A1")
- ("grey64" . "#A3A3A3")
- ("grey65" . "#A6A6A6")
- ("grey66" . "#A8A8A8")
- ("grey67" . "#ABABAB")
- ("grey68" . "#ADADAD")
- ("grey69" . "#B0B0B0")
- ("grey70" . "#B3B3B3")
- ("grey71" . "#B5B5B5")
- ("grey72" . "#B8B8B8")
- ("grey73" . "#BABABA")
- ("grey74" . "#BDBDBD")
- ("grey75" . "#BFBFBF")
- ("grey76" . "#C2C2C2")
- ("grey77" . "#C4C4C4")
- ("grey78" . "#C7C7C7")
- ("grey79" . "#C9C9C9")
- ("grey80" . "#CCCCCC")
- ("grey81" . "#CFCFCF")
- ("grey82" . "#D1D1D1")
- ("grey83" . "#D4D4D4")
- ("grey84" . "#D6D6D6")
- ("grey85" . "#D9D9D9")
- ("grey86" . "#DBDBDB")
- ("grey87" . "#DEDEDE")
- ("grey88" . "#E0E0E0")
- ("grey89" . "#E3E3E3")
- ("grey90" . "#E5E5E5")
- ("grey91" . "#E8E8E8")
- ("grey92" . "#EBEBEB")
- ("grey93" . "#EDEDED")
- ("grey94" . "#F0F0F0")
- ("grey95" . "#F2F2F2")
- ("grey96" . "#F5F5F5")
- ("grey97" . "#F7F7F7")
- ("grey98" . "#FAFAFA")
- ("grey99" . "#FCFCFC")
- ("grey100" . "#FFFFFF")
- ("honeydew" . "#F0FFF0")
- ("honeydew1" . "#F0FFF0")
- ("honeydew2" . "#E0EEE0")
- ("honeydew3" . "#C1CDC1")
- ("honeydew4" . "#838B83")
- ("hotpink" . "#FF69B4")
- ("hotpink1" . "#FF6EB4")
- ("hotpink2" . "#EE6AA7")
- ("hotpink3" . "#CD6090")
- ("hotpink4" . "#8B3A62")
- ("indianred" . "#CD5C5C")
- ("indianred1" . "#FF6A6A")
- ("indianred2" . "#EE6363")
- ("indianred3" . "#CD5555")
- ("indianred4" . "#8B3A3A")
- ("ivory" . "#FFFFF0")
- ("ivory1" . "#FFFFF0")
- ("ivory2" . "#EEEEE0")
- ("ivory3" . "#CDCDC1")
- ("ivory4" . "#8B8B83")
- ("khaki" . "#F0E68C")
- ("khaki1" . "#FFF68F")
- ("khaki2" . "#EEE685")
- ("khaki3" . "#CDC673")
- ("khaki4" . "#8B864E")
- ("lavender" . "#E6E6FA")
- ("lavenderblush" . "#FFF0F5")
- ("lavenderblush1" . "#FFF0F5")
- ("lavenderblush2" . "#EEE0E5")
- ("lavenderblush3" . "#CDC1C5")
- ("lavenderblush4" . "#8B8386")
- ("lawngreen" . "#7CFC00")
- ("lemonchiffon" . "#FFFACD")
- ("lemonchiffon1" . "#FFFACD")
- ("lemonchiffon2" . "#EEE9BF")
- ("lemonchiffon3" . "#CDC9A5")
- ("lemonchiffon4" . "#8B8970")
- ("lightblue" . "#ADD8E6")
- ("lightblue1" . "#BFEFFF")
- ("lightblue2" . "#B2DFEE")
- ("lightblue3" . "#9AC0CD")
- ("lightblue4" . "#68838B")
- ("lightcoral" . "#F08080")
- ("lightcyan" . "#E0FFFF")
- ("lightcyan1" . "#E0FFFF")
- ("lightcyan2" . "#D1EEEE")
- ("lightcyan3" . "#B4CDCD")
- ("lightcyan4" . "#7A8B8B")
- ("lightgoldenrod" . "#EEDD82")
- ("lightgoldenrod1" . "#FFEC8B")
- ("lightgoldenrod2" . "#EEDC82")
- ("lightgoldenrod3" . "#CDBE70")
- ("lightgoldenrod4" . "#8B814C")
- ("lightgoldenrodyellow" . "#FAFAD2")
- ("lightgray" . "#D3D3D3")
- ("lightgreen" . "#90EE90")
- ("lightgrey" . "#D3D3D3")
- ("lightpink" . "#FFB6C1")
- ("lightpink1" . "#FFAEB9")
- ("lightpink2" . "#EEA2AD")
- ("lightpink3" . "#CD8C95")
- ("lightpink4" . "#8B5F65")
- ("lightsalmon" . "#FFA07A")
- ("lightsalmon1" . "#FFA07A")
- ("lightsalmon2" . "#EE9572")
- ("lightsalmon3" . "#CD8162")
- ("lightsalmon4" . "#8B5742")
- ("lightseagreen" . "#20B2AA")
- ("lightskyblue" . "#87CEFA")
- ("lightskyblue1" . "#B0E2FF")
- ("lightskyblue2" . "#A4D3EE")
- ("lightskyblue3" . "#8DB6CD")
- ("lightskyblue4" . "#607B8B")
- ("lightslateblue" . "#8470FF")
- ("lightslategray" . "#778899")
- ("lightslategrey" . "#778899")
- ("lightsteelblue" . "#B0C4DE")
- ("lightsteelblue1" . "#CAE1FF")
- ("lightsteelblue2" . "#BCD2EE")
- ("lightsteelblue3" . "#A2B5CD")
- ("lightsteelblue4" . "#6E7B8B")
- ("lightyellow" . "#FFFFE0")
- ("lightyellow1" . "#FFFFE0")
- ("lightyellow2" . "#EEEED1")
- ("lightyellow3" . "#CDCDB4")
- ("lightyellow4" . "#8B8B7A")
- ("limegreen" . "#32CD32")
- ("linen" . "#FAF0E6")
- ("magenta" . "#FF00FF")
- ("magenta1" . "#FF00FF")
- ("magenta2" . "#EE00EE")
- ("magenta3" . "#CD00CD")
- ("magenta4" . "#8B008B")
- ("maroon" . "#B03060")
- ("maroon1" . "#FF34B3")
- ("maroon2" . "#EE30A7")
- ("maroon3" . "#CD2990")
- ("maroon4" . "#8B1C62")
- ("mediumaquamarine" . "#66CDAA")
- ("mediumblue" . "#0000CD")
- ("mediumorchid" . "#BA55D3")
- ("mediumorchid1" . "#E066FF")
- ("mediumorchid2" . "#D15FEE")
- ("mediumorchid3" . "#B452CD")
- ("mediumorchid4" . "#7A378B")
- ("mediumpurple" . "#9370DB")
- ("mediumpurple1" . "#AB82FF")
- ("mediumpurple2" . "#9F79EE")
- ("mediumpurple3" . "#8968CD")
- ("mediumpurple4" . "#5D478B")
- ("mediumseagreen" . "#3CB371")
- ("mediumslateblue" . "#7B68EE")
- ("mediumspringgreen" . "#00FA9A")
- ("mediumturquoise" . "#48D1CC")
- ("mediumvioletred" . "#C71585")
- ("midnightblue" . "#191970")
- ("mintcream" . "#F5FFFA")
- ("mistyrose" . "#FFE4E1")
- ("mistyrose1" . "#FFE4E1")
- ("mistyrose2" . "#EED5D2")
- ("mistyrose3" . "#CDB7B5")
- ("mistyrose4" . "#8B7D7B")
- ("moccasin" . "#FFE4B5")
- ("navajowhite" . "#FFDEAD")
- ("navajowhite1" . "#FFDEAD")
- ("navajowhite2" . "#EECFA1")
- ("navajowhite3" . "#CDB38B")
- ("navajowhite4" . "#8B795E")
- ("navy" . "#000080")
- ("navyblue" . "#000080")
- ("oldlace" . "#FDF5E6")
- ("olivedrab" . "#6B8E23")
- ("olivedrab1" . "#C0FF3E")
- ("olivedrab2" . "#B3EE3A")
- ("olivedrab3" . "#9ACD32")
- ("olivedrab4" . "#698B22")
- ("orange" . "#FFA500")
- ("orange1" . "#FFA500")
- ("orange2" . "#EE9A00")
- ("orange3" . "#CD8500")
- ("orange4" . "#8B5A00")
- ("orangered" . "#FF4500")
- ("orangered1" . "#FF4500")
- ("orangered2" . "#EE4000")
- ("orangered3" . "#CD3700")
- ("orangered4" . "#8B2500")
- ("orchid" . "#DA70D6")
- ("orchid1" . "#FF83FA")
- ("orchid2" . "#EE7AE9")
- ("orchid3" . "#CD69C9")
- ("orchid4" . "#8B4789")
- ("palegoldenrod" . "#EEE8AA")
- ("palegreen" . "#98FB98")
- ("palegreen1" . "#9AFF9A")
- ("palegreen2" . "#90EE90")
- ("palegreen3" . "#7CCD7C")
- ("palegreen4" . "#548B54")
- ("paleturquoise" . "#AFEEEE")
- ("paleturquoise1" . "#BBFFFF")
- ("paleturquoise2" . "#AEEEEE")
- ("paleturquoise3" . "#96CDCD")
- ("paleturquoise4" . "#668B8B")
- ("palevioletred" . "#DB7093")
- ("palevioletred1" . "#FF82AB")
- ("palevioletred2" . "#EE799F")
- ("palevioletred3" . "#CD6889")
- ("palevioletred4" . "#8B475D")
- ("papayawhip" . "#FFEFD5")
- ("peachpuff" . "#FFDAB9")
- ("peachpuff1" . "#FFDAB9")
- ("peachpuff2" . "#EECBAD")
- ("peachpuff3" . "#CDAF95")
- ("peachpuff4" . "#8B7765")
- ("peru" . "#CD853F")
- ("pink" . "#FFC0CB")
- ("pink1" . "#FFB5C5")
- ("pink2" . "#EEA9B8")
- ("pink3" . "#CD919E")
- ("pink4" . "#8B636C")
- ("plum" . "#DDA0DD")
- ("plum1" . "#FFBBFF")
- ("plum2" . "#EEAEEE")
- ("plum3" . "#CD96CD")
- ("plum4" . "#8B668B")
- ("powderblue" . "#B0E0E6")
- ("purple" . "#A020F0")
- ("purple1" . "#9B30FF")
- ("purple2" . "#912CEE")
- ("purple3" . "#7D26CD")
- ("purple4" . "#551A8B")
- ("red" . "#FF0000")
- ("red1" . "#FF0000")
- ("red2" . "#EE0000")
- ("red3" . "#CD0000")
- ("red4" . "#8B0000")
- ("rosybrown" . "#BC8F8F")
- ("rosybrown1" . "#FFC1C1")
- ("rosybrown2" . "#EEB4B4")
- ("rosybrown3" . "#CD9B9B")
- ("rosybrown4" . "#8B6969")
- ("royalblue" . "#4169E1")
- ("royalblue1" . "#4876FF")
- ("royalblue2" . "#436EEE")
- ("royalblue3" . "#3A5FCD")
- ("royalblue4" . "#27408B")
- ("saddlebrown" . "#8B4513")
- ("salmon" . "#FA8072")
- ("salmon1" . "#FF8C69")
- ("salmon2" . "#EE8262")
- ("salmon3" . "#CD7054")
- ("salmon4" . "#8B4C39")
- ("sandybrown" . "#F4A460")
- ("seagreen" . "#2E8B57")
- ("seagreen1" . "#54FF9F")
- ("seagreen2" . "#4EEE94")
- ("seagreen3" . "#43CD80")
- ("seagreen4" . "#2E8B57")
- ("seashell" . "#FFF5EE")
- ("seashell1" . "#FFF5EE")
- ("seashell2" . "#EEE5DE")
- ("seashell3" . "#CDC5BF")
- ("seashell4" . "#8B8682")
- ("sienna" . "#A0522D")
- ("sienna1" . "#FF8247")
- ("sienna2" . "#EE7942")
- ("sienna3" . "#CD6839")
- ("sienna4" . "#8B4726")
- ("skyblue" . "#87CEEB")
- ("skyblue1" . "#87CEFF")
- ("skyblue2" . "#7EC0EE")
- ("skyblue3" . "#6CA6CD")
- ("skyblue4" . "#4A708B")
- ("slateblue" . "#6A5ACD")
- ("slateblue1" . "#836FFF")
- ("slateblue2" . "#7A67EE")
- ("slateblue3" . "#6959CD")
- ("slateblue4" . "#473C8B")
- ("slategray" . "#708090")
- ("slategray1" . "#C6E2FF")
- ("slategray2" . "#B9D3EE")
- ("slategray3" . "#9FB6CD")
- ("slategray4" . "#6C7B8B")
- ("slategrey" . "#708090")
- ("snow" . "#FFFAFA")
- ("snow1" . "#FFFAFA")
- ("snow2" . "#EEE9E9")
- ("snow3" . "#CDC9C9")
- ("snow4" . "#8B8989")
- ("springgreen" . "#00FF7F")
- ("springgreen1" . "#00FF7F")
- ("springgreen2" . "#00EE76")
- ("springgreen3" . "#00CD66")
- ("springgreen4" . "#008B45")
- ("steelblue" . "#4682B4")
- ("steelblue1" . "#63B8FF")
- ("steelblue2" . "#5CACEE")
- ("steelblue3" . "#4F94CD")
- ("steelblue4" . "#36648B")
- ("tan" . "#D2B48C")
- ("tan1" . "#FFA54F")
- ("tan2" . "#EE9A49")
- ("tan3" . "#CD853F")
- ("tan4" . "#8B5A2B")
- ("thistle" . "#D8BFD8")
- ("thistle1" . "#FFE1FF")
- ("thistle2" . "#EED2EE")
- ("thistle3" . "#CDB5CD")
- ("thistle4" . "#8B7B8B")
- ("tomato" . "#FF6347")
- ("tomato1" . "#FF6347")
- ("tomato2" . "#EE5C42")
- ("tomato3" . "#CD4F39")
- ("tomato4" . "#8B3626")
- ("turquoise" . "#40E0D0")
- ("turquoise1" . "#00F5FF")
- ("turquoise2" . "#00E5EE")
- ("turquoise3" . "#00C5CD")
- ("turquoise4" . "#00868B")
- ("violet" . "#EE82EE")
- ("violetred" . "#D02090")
- ("violetred1" . "#FF3E96")
- ("violetred2" . "#EE3A8C")
- ("violetred3" . "#CD3278")
- ("violetred4" . "#8B2252")
- ("wheat" . "#F5DEB3")
- ("wheat1" . "#FFE7BA")
- ("wheat2" . "#EED8AE")
- ("wheat3" . "#CDBA96")
- ("wheat4" . "#8B7E66")
- ("whitesmoke" . "#F5F5F5")
- ("yellow" . "#FFFF00")
- ("yellow1" . "#FFFF00")
- ("yellow2" . "#EEEE00")
- ("yellow3" . "#CDCD00")
- ("yellow4" . "#8B8B00")
- ("yellowgreen" . "#9ACD32"))
- "Alist of R colors.
-Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR)."
- :group 'rainbow)
-(defcustom rainbow-r-colors-major-mode-list
- '(ess-mode)
- "List of major mode where R colors are enabled when
-`rainbow-r-colors' is set to auto."
- :group 'rainbow)
-
-(defcustom rainbow-r-colors 'auto
- "When to enable R colors.
-If set to t, the R colors will be enabled. If set to nil, the
-R colors will not be enabled. If set to auto, the R colors
-will be enabled if a major mode has been detected from the
-`rainbow-r-colors-major-mode-list'."
- :group 'rainbow)
-
-
-;; Functions
-(defun rainbow-colorize-match (color &optional match)
- "Return a matched string propertized with a face whose
-background is COLOR. The foreground is computed using
-`rainbow-color-luminance', and is either white or black."
- (let ((match (or match 0)))
- (put-text-property
- (match-beginning match) (match-end match)
- 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color))
- "white" "black"))
- (:background ,color)))))
-
-(defun rainbow-colorize-itself (&optional match)
- "Colorize a match with itself."
- (rainbow-colorize-match (match-string-no-properties (or match 0)) match))
-
-(defun rainbow-colorize-hexadecimal-without-sharp ()
- "Colorize an hexadecimal colors and prepend # to it."
- (rainbow-colorize-match (concat "#" (match-string-no-properties 1))))
-
-(defun rainbow-colorize-by-assoc (assoc-list)
- "Colorize a match with its association from ASSOC-LIST."
- (rainbow-colorize-match (cdr (assoc-string (match-string-no-properties 0)
- assoc-list t))))
-
-(defun rainbow-rgb-relative-to-absolute (number)
- "Convert a relative NUMBER to absolute. If NUMBER is absolute, return NUMBER.
-This will convert \"80 %\" to 204, \"100 %\" to 255 but \"123\" to \"123\".
-If the percentage value is above 100, it's converted to 100."
- (let ((string-length (- (length number) 1)))
- ;; Is this a number with %?
- (if (eq (elt number string-length) ?%)
- (/ (* (min (string-to-number (substring number 0 string-length)) 100) 255) 100)
- (string-to-number number))))
-
-(defun rainbow-colorize-hsl ()
- "Colorize a match with itself."
- (let ((h (/ (string-to-number (match-string-no-properties 1)) 360.0))
- (s (/ (string-to-number (match-string-no-properties 2)) 100.0))
- (l (/ (string-to-number (match-string-no-properties 3)) 100.0)))
- (rainbow-colorize-match
- (multiple-value-bind (r g b)
- (color-hsl-to-rgb h s l)
- (format "#%02X%02X%02X" (* r 255) (* g 255) (* b 255))))))
-
-(defun rainbow-colorize-rgb ()
- "Colorize a match with itself."
- (let ((r (rainbow-rgb-relative-to-absolute (match-string-no-properties 1)))
- (g (rainbow-rgb-relative-to-absolute (match-string-no-properties 2)))
- (b (rainbow-rgb-relative-to-absolute (match-string-no-properties 3))))
- (rainbow-colorize-match (format "#%02X%02X%02X" r g b))))
-
-(defun rainbow-colorize-rgb-float ()
- "Colorize a match with itself, with relative value."
- (let ((r (* (string-to-number (match-string-no-properties 1)) 255.0))
- (g (* (string-to-number (match-string-no-properties 2)) 255.0))
- (b (* (string-to-number (match-string-no-properties 3)) 255.0)))
- (rainbow-colorize-match (format "#%02X%02X%02X" r g b))))
-
-(defvar ansi-color-context)
-(defvar xterm-color-current)
-
-(defun rainbow-colorize-ansi ()
- "Return a matched string propertized with ansi color face."
- (let ((xterm-color? (featurep 'xterm-color))
- (string (match-string-no-properties 0))
- color)
- (save-match-data
- (let* ((replaced (concat
- (replace-regexp-in-string
- "^\\(\\\\[eE]\\|\\\\033\\|\\\\x1[bB]\\)"
- "\033" string) "x"))
- xterm-color-current
- ansi-color-context
- (applied (funcall (if xterm-color?
- 'xterm-color-filter
- 'ansi-color-apply)
- replaced))
- (face-property (get-text-property
- 0
- (if xterm-color? 'face 'font-lock-face)
- applied)))
- (unless (listp (car face-property))
- (setq face-property (list face-property)))
- (setq color (funcall (if xterm-color? 'cadr 'cdr)
- (or (assq (if xterm-color?
- :foreground
- 'foreground-color)
- face-property)
- (assq (if xterm-color?
- :background
- 'background-color)
- face-property))))))
- (when color
- (rainbow-colorize-match color))))
-
-(defun rainbow-color-luminance (red green blue)
- "Calculate the luminance of color composed of RED, GREEN and BLUE.
-Return a value between 0 and 1."
- (/ (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 256))
-
-(defun rainbow-x-color-luminance (color)
- "Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\").
-Return a value between 0 and 1."
- (let* ((values (x-color-values color))
- (r (/ (car values) 256.0))
- (g (/ (cadr values) 256.0))
- (b (/ (caddr values) 256.0)))
- (rainbow-color-luminance r g b)))
-
-(defun rainbow-turn-on ()
- "Turn on raibow-mode."
- (font-lock-add-keywords nil
- rainbow-hexadecimal-colors-font-lock-keywords
- t)
- ;; Activate X colors?
- (when (or (eq rainbow-x-colors t)
- (and (eq rainbow-x-colors 'auto)
- (memq major-mode rainbow-x-colors-major-mode-list)))
- (font-lock-add-keywords nil
- rainbow-x-colors-font-lock-keywords
- t))
- ;; Activate LaTeX colors?
- (when (or (eq rainbow-latex-colors t)
- (and (eq rainbow-latex-colors 'auto)
- (memq major-mode rainbow-latex-colors-major-mode-list)))
- (font-lock-add-keywords nil
- rainbow-latex-rgb-colors-font-lock-keywords
- t))
- ;; Activate ANSI colors?
- (when (or (eq rainbow-ansi-colors t)
- (and (eq rainbow-ansi-colors 'auto)
- (memq major-mode rainbow-ansi-colors-major-mode-list)))
- (font-lock-add-keywords nil
- rainbow-ansi-colors-font-lock-keywords
- t))
- ;; Activate HTML colors?
- (when (or (eq rainbow-html-colors t)
- (and (eq rainbow-html-colors 'auto)
- (memq major-mode rainbow-html-colors-major-mode-list)))
- (setq rainbow-html-colors-font-lock-keywords
- `((,(regexp-opt (mapcar 'car rainbow-html-colors-alist) 'words)
- (0 (rainbow-colorize-by-assoc rainbow-html-colors-alist)))))
- (font-lock-add-keywords nil
- `(,@rainbow-html-colors-font-lock-keywords
- ,@rainbow-html-rgb-colors-font-lock-keywords)
- t))
- ;; Activate R colors?
- (when (or (eq rainbow-r-colors t)
- (and (eq rainbow-r-colors 'auto)
- (memq major-mode rainbow-r-colors-major-mode-list)))
- (setq rainbow-r-colors-font-lock-keywords
- `((,(regexp-opt (mapcar 'car rainbow-r-colors-alist) 'words)
- (0 (rainbow-colorize-by-assoc rainbow-r-colors-alist)))))
- (font-lock-add-keywords nil
- rainbow-r-colors-font-lock-keywords
- t)))
-
-(defun rainbow-turn-off ()
- "Turn off rainbow-mode."
- (font-lock-remove-keywords
- nil
- `(,@rainbow-hexadecimal-colors-font-lock-keywords
- ,@rainbow-x-colors-font-lock-keywords
- ,@rainbow-latex-rgb-colors-font-lock-keywords
- ,@rainbow-r-colors-font-lock-keywords
- ,@rainbow-html-colors-font-lock-keywords
- ,@rainbow-html-rgb-colors-font-lock-keywords)))
-
-;;;###autoload
-(define-minor-mode rainbow-mode
- "Colorize strings that represent colors.
-This will fontify with colors the string like \"#aabbcc\" or \"blue\"."
- :lighter " Rbow"
- (progn
- (if rainbow-mode
- (rainbow-turn-on)
- (rainbow-turn-off))
- ;; Call font-lock-mode to refresh the buffer when used e.g. interactively
- (font-lock-mode 1)))
-
-;;;; ChangeLog:
-
-;; 2017-05-29 Julien Danjou
-;;
-;; Fix `rainbow-color-luminance' docstring
-;;
-;; 2015-10-12 Julien Danjou
-;;
-;; rainbow: add font-lock at the end
-;;
-;; See https://github.com/fxbois/web-mode/issues/612
-;;
-;; 2015-03-06 Julien Danjou
-;;
-;; rainbow: fix font-lock-mode refresh
-;;
-;; 2014-10-15 Stefan Monnier
-;;
-;; * packages/rainbow-mode/rainbow-mode.el (ansi-color-context)
-;; (xterm-color-current): Declare.
-;;
-;; 2014-09-07 Julien Danjou
-;;
-;; rainbow-mode: support float in CSS and limit to 100%
-;;
-;; 2013-08-05 Julien Danjou
-;;
-;; rainbow-mode: 0.9, allow spaces in LaTeX colors
-;;
-;; 2013-05-03 Julien Danjou
-;;
-;; rainbow-mode: add support for R, bump version to 0.8
-;;
-;; Signed-off-by: Julien Danjou
-;;
-;; 2013-02-26 Julien Danjou
-;;
-;; rainbow-mode: version 0.7
-;;
-;; * rainbow-mode.el: don't activate font-lock-mode
-;;
-;; 2012-12-11 Julien Danjou
-;;
-;; * rainbow-mode: update to 0.6, add support for ANSI coloring
-;;
-;; 2012-11-26 Julien Danjou
-;;
-;; rainbow-mode: fix some LaTex docstrings
-;;
-;; 2012-11-14 Julien Danjou
-;;
-;; rainbow-mode: version 0.5
-;;
-;; * rainbow-mode.el: fix syntax error on
-;; `rainbow-hexadecimal-colors-font-lock-keywords'.
-;;
-;; 2012-11-09 Julien Danjou
-;;
-;; rainbow-mode: version 0.4
-;;
-;; * rainbow-mode.el: Use functions from color package to colorize HSL
-;; rather
-;; than our own copy.
-;;
-;; 2012-11-09 Julien Danjou
-;;
-;; rainbow-mode 0.3
-;;
-;; * rainbow-mode.el: avoid colorizing HTML entities
-;;
-;; 2011-09-23 Julien Danjou
-;;
-;; Update rainbow-mode to version 0.2
-;;
-;; 2011-07-01 Chong Yidong
-;;
-;; Give every package its own directory in packages/ including single-file
-;; packages.
-;;
-
-
-(provide 'rainbow-mode)
-
-;;; rainbow-mode.el ends here
diff --git a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.elc b/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.elc
deleted file mode 100644
index 5f97b70..0000000
Binary files a/emacs/.emacs.d/elpa/rainbow-mode-0.13/rainbow-mode.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-autoloads.el b/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-autoloads.el
deleted file mode 100644
index 3079bd5..0000000
--- a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-autoloads.el
+++ /dev/null
@@ -1,41 +0,0 @@
-;;; rich-minority-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "rich-minority" "rich-minority.el" (23124 14368
-;;;;;; 638843 805000))
-;;; Generated autoloads from rich-minority.el
-
-(autoload 'rm--mode-list-as-string-list "rich-minority" "\
-Return `minor-mode-list' as a simple list of strings.
-
-\(fn)" nil nil)
-
-(defvar rich-minority-mode nil "\
-Non-nil if Rich minority mode is enabled.
-See the `rich-minority-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 `rich-minority-mode'.")
-
-(custom-autoload 'rich-minority-mode "rich-minority" nil)
-
-(autoload 'rich-minority-mode "rich-minority" "\
-Toggle Rich minority mode on or off.
-With a prefix argument ARG, enable Rich minority mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
-\\{rich-minority-mode-map}
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; rich-minority-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-pkg.el b/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-pkg.el
deleted file mode 100644
index 612ac3b..0000000
--- a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "rich-minority" "20170813.622" "Clean-up and Beautify the list of minor-modes." '((cl-lib "0.5")) :commit "3201f6e1769beb9f6cbbda392bef99fce337acf4" :url "https://github.com/Malabarba/rich-minority" :keywords '("mode-line" "faces"))
diff --git a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.el b/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.el
deleted file mode 100644
index 7430978..0000000
--- a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.el
+++ /dev/null
@@ -1,300 +0,0 @@
-;;; rich-minority.el --- Clean-up and Beautify the list of minor-modes.
-
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
-
-;; Author: Artur Malabarba
-;; URL: https://github.com/Malabarba/rich-minority
-;; Package-Version: 20170813.622
-;; Package-Requires: ((cl-lib "0.5"))
-;; Version: 1.0.1
-;; License: GNU General Public License v3 or newer
-;; Keywords: mode-line faces
-
-;;; Commentary:
-;;
-;; Emacs package for hiding and/or highlighting the list of minor-modes
-;; in the mode-line.
-;;
-;;
-;; Usage
-;; ─────
-;;
-;; To activate the enrichment of your minor-modes list, call `M-x
-;; rich-minority-mode', or add this to your init file:
-;;
-;; ┌────
-;; │ (rich-minority-mode 1)
-;; └────
-;;
-;; By default, this has a couple of small effects (provided as examples)
-;; it is up to you to customize it to your liking with the following
-;; three variables:
-;;
-;; `rm-blacklist': List of minor mode names that will be hidden from the
-;; minor-modes list. Use this to hide *only* a few modes
-;; that are always active and don’t really contribute
-;; information.
-;; `rm-whitelist': List of minor mode names that are allowed on the
-;; minor-modes list. Use this to hide *all but* a few
-;; modes.
-;; `rm-text-properties': List text properties to apply to each minor-mode
-;; lighter. For instance, by default we highlight
-;; `Ovwrt' with a red face, so you always know if
-;; you’re in `overwrite-mode'.
-;;
-;;
-;; Comparison to Diminish
-;; ──────────────────────
-;;
-;; Diminish is an established player in the mode-line world, who also
-;; handles the minor-modes list. What can rich-minority /offer in
-;; contrast/?
-;;
-;; • rich-minority is more versatile:
-;; 1. It accepts *regexps*, instead of having to specify each
-;; minor-mode individually;
-;; 2. It also offers a *whitelist* behaviour, in addition to the
-;; blacklist;
-;; 3. It supports *highlighting* specific minor-modes with completely
-;; arbitrary text properties.
-;; • rich-minority takes a cleaner, functional approach. It doesn’t hack
-;; into the `minor-mode-alist' variable.
-;;
-;; What is rich-minority /missing/?
-;;
-;; 1. It doesn’t have a quick and simple replacement functionality yet.
-;; Although you can set the `display' property of a minor-mode to
-;; whatever string you want and that will function as a replacement.
-;; 2. Its source comments lack [Will Mengarini’s poetry]. :-)
-;;
-;;
-;; [Will Mengarini’s poetry] http://www.eskimo.com/~seldon/diminish.el
-;;
-;;
-;; Installation
-;; ────────────
-;;
-;; This package is available fom Melpa, you may install it by calling
-;; `M-x package-install'.
-
-
-;;; Code:
-(require 'cl-lib)
-
-(declare-function lm-version "lisp-mnt")
-(defun rm-bug-report ()
- "Opens github issues page in a web browser. Please send any bugs you find.
-Please include your Emacs and rich-minority versions."
- (interactive)
- (require 'lisp-mnt)
- (message "Your rm-version is: %s, and your emacs version is: %s.\nPlease include this in your report!"
- (lm-version "rich-minority.el") emacs-version)
- (browse-url "https://github.com/Malabarba/rich-minority/issues/new"))
-(defun rm-customize ()
- "Open the customization menu in the `rich-minority' group."
- (interactive)
- (customize-group 'rich-minority t))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Customization variables.
-(defcustom rm-blacklist '(" hl-p")
- "List of minor modes you want to hide from the mode-line.
-
-Has three possible values:
-
-- nil: All minor modes are shown in the mode-line (but see also
- `rm-whitelist').
-
-- List of strings: Represents a list of minor mode names that
- will be hidden from the minor-modes list.
-
-- A string: If this variable is set to a single string, this
- string must be a regexp. This regexp will be compared to each
- minor-mode lighter, and those which match are hidden from the
- minor-mode list.
-
-If you'd like to use a list of regexps, simply use something like the following:
- (setq rm-blacklist (mapconcat 'identity list-of-regexps \"\\\\|\"))
-
-Don't forget to start each string with a blank space, as most
-minor-mode lighters start with a space."
- :type '(choice (repeat string)
- (regexp :tag "Regular expression."))
- :group 'rich-minority
- :package-version '(rich-minority . "0.1.1"))
-(define-obsolete-variable-alias 'rm-excluded-modes 'rm-blacklist "0.1.1")
-(define-obsolete-variable-alias 'rm-hidden-modes 'rm-blacklist "0.1.1")
-
-(defcustom rm-whitelist nil
- "List of minor modes you want to include in the mode-line.
-
-- nil: All minor modes are shown in the mode-line (but see also
- `rm-blacklist').
-
-- List of strings: Represents a list of minor mode names that are
- allowed on the minor-modes list. Any minor-mode whose lighter
- is not in this list will NOT be displayed.
-
-- A string: If this variable is set to a single string, this
- string must be a regexp. This regexp will be compared to each
- minor-mode lighter, and only those which match are displayed on
- the minor-mode list.
-
-If you'd like to use a list of regexps, simply use something like the following:
- (setq rm-whitelist (mapconcat 'identity list-of-regexps \"\\\\|\"))
-
-Don't forget to start each string with a blank space, as most
-minor-mode lighters start with a space."
- :type '(choice (repeat string)
- (regexp :tag "Regular expression."))
- :group 'rich-minority
- :package-version '(rich-minority . "0.1.1"))
-(define-obsolete-variable-alias 'rm-included-modes 'rm-whitelist "0.1.1")
-
-(defcustom rm-text-properties
- '(("\\` Ovwrt\\'" 'face 'font-lock-warning-face))
- "Alist of text properties to be applied to minor-mode lighters.
-The car of each element must be a regexp, and the cdr must be a
-list of text properties.
-
- (REGEXP PROPERTY-NAME PROPERTY-VALUE ...)
-
-If the regexp matches a minor mode lighter, the text properties
-are applied to it. They are tested in order, and search stops at
-the first match.
-
-These properties take priority over those defined in
-`rm-base-text-properties'."
- :type '(repeat (cons regexp (repeat sexp)))
- :group 'rich-minority
- :package-version '(rich-minority . "0.1"))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Functions and Defvars
-(defconst rm--help-echo-bottom
- "Mouse-1: Mode Menu.\nMouse-2: Mode Help.\nMouse-3: Toggle Minor Modes.")
-
-(defvar-local rm--help-echo nil
- "Used to set the help-echo string dynamically.")
-
-(defun rm-format-mode-line-entry (entry)
- "Format an ENTRY of `minor-mode-alist'.
-Return a cons of the mode line string and the mode name, or nil
-if the mode line string is empty."
- (let ((mode-symbol (car entry))
- (mode-string (format-mode-line entry)))
- (unless (string= mode-string "")
- (cons mode-string mode-symbol))))
-
-;;;###autoload
-(defun rm--mode-list-as-string-list ()
- "Return `minor-mode-list' as a simple list of strings."
- (let ((full-list (delq nil (mapcar #'rm-format-mode-line-entry
- minor-mode-alist)))
- (spacer (propertize " " 'display '(space :align-to 15))))
- (setq rm--help-echo
- (format "Full list:\n%s\n\n%s"
- (mapconcat (lambda (pair)
- (format " %s%s(%S)"
- (car pair) spacer (cdr pair)))
- full-list "\n")
- rm--help-echo-bottom))
- (mapcar #'rm--propertize
- (rm--remove-hidden-modes
- (mapcar #'car full-list)))))
-
-(defcustom rm-base-text-properties
- '('help-echo 'rm--help-echo
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-minor-mode-keymap)
- "List of text propeties to apply to every minor mode."
- :type '(repeat sexp)
- :group 'rich-minority
- :package-version '(rich-minority . "0.1"))
-
-(defun rm--propertize (mode)
- "Propertize the string MODE according to `rm-text-properties'."
- (if (null (stringp mode))
- `(:propertize ,mode ,@rm-base-text-properties)
- (let ((al rm-text-properties)
- done prop)
- (while (and (null done) al)
- (setq done (pop al))
- (if (string-match (car done) mode)
- (setq prop (cdr done))
- (setq done nil)))
- (eval `(propertize ,mode ,@prop ,@rm-base-text-properties)))))
-
-(defun rm--remove-hidden-modes (li)
- "Remove from LI elements that match `rm-blacklist' or don't match `rm-whitelist'."
- (let ((pred (if (listp rm-blacklist) #'member #'rm--string-match))
- (out li))
- (when rm-blacklist
- (setq out
- (remove nil
- (mapcar
- (lambda (x) (unless (and (stringp x)
- (funcall pred x rm-blacklist))
- x))
- out))))
- (when rm-whitelist
- (setq pred (if (listp rm-whitelist) #'member #'rm--string-match))
- (setq out
- (remove nil
- (mapcar
- (lambda (x) (unless (and (stringp x)
- (null (funcall pred x rm-whitelist)))
- x))
- out))))
- out))
-
-(defun rm--string-match (string regexp)
- "Like `string-match', but arg STRING comes before REGEXP."
- (string-match regexp string))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; minor-mode
-(defvar rm--mode-line-construct
- '(:eval (rm--mode-list-as-string-list))
- "Construct used to replace `minor-mode-alist'.")
-
-(defvar rm--warning-absent-element
- "Couldn't find %S inside `mode-line-modes'. If you didn't change it yourself, please file a bug report with M-x rm-bug-report"
- "Warning message used when something wasn't found.")
-
-(defvar rm--backup-construct nil
- "Construct containing `minor-mode-alist' which we removed from the mode-line.")
-
-;;;###autoload
-(define-minor-mode rich-minority-mode nil nil " $"
- :global t
- (if rich-minority-mode
- (let ((place (or (member 'minor-mode-alist mode-line-modes)
- (cl-member-if
- (lambda (x) (and (listp x)
- (equal (car x) :propertize)
- (equal (cadr x) '("" minor-mode-alist))))
- mode-line-modes))))
- (if place
- (progn
- (setq rm--backup-construct (car place))
- (setcar place rm--mode-line-construct))
- (setq rich-minority-mode nil)
- (if (member 'sml/pos-id-separator mode-line-format)
- (message "You don't need to activate rich-minority-mode if you're using smart-mode-line")
- (warn rm--warning-absent-element 'minor-mode-alist))))
- (let ((place (member rm--mode-line-construct mode-line-modes)))
- (if place
- (setcar place rm--backup-construct)
- (warn rm--warning-absent-element rm--mode-line-construct)))))
-
-(provide 'rich-minority)
-
-;;; rich-minority.el ends here
-
-;; Local Variables:
-;; nameless-current-name: "rm"
-;; End:
diff --git a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.elc b/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.elc
deleted file mode 100644
index 4b9536e..0000000
Binary files a/emacs/.emacs.d/elpa/rich-minority-20170813.622/rich-minority.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/s-20171102.227/s-autoloads.el b/emacs/.emacs.d/elpa/s-20171102.227/s-autoloads.el
deleted file mode 100644
index 0282173..0000000
--- a/emacs/.emacs.d/elpa/s-20171102.227/s-autoloads.el
+++ /dev/null
@@ -1,15 +0,0 @@
-;;; s-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil nil ("s.el") (23124 14355 652115 935000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; s-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/s-20171102.227/s-pkg.el b/emacs/.emacs.d/elpa/s-20171102.227/s-pkg.el
deleted file mode 100644
index debacde..0000000
--- a/emacs/.emacs.d/elpa/s-20171102.227/s-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "s" "20171102.227" "The long lost Emacs string manipulation library." 'nil :commit "5e9a6857d42015c67681616aa3519f599f97b8d8" :keywords '("strings"))
diff --git a/emacs/.emacs.d/elpa/s-20171102.227/s.el b/emacs/.emacs.d/elpa/s-20171102.227/s.el
deleted file mode 100644
index 417c04f..0000000
--- a/emacs/.emacs.d/elpa/s-20171102.227/s.el
+++ /dev/null
@@ -1,709 +0,0 @@
-;;; s.el --- The long lost Emacs string manipulation library.
-
-;; Copyright (C) 2012-2015 Magnar Sveen
-
-;; Author: Magnar Sveen
-;; Version: 1.12.0
-;; Package-Version: 20171102.227
-;; Keywords: strings
-
-;; 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 .
-
-;;; Commentary:
-
-;; The long lost Emacs string manipulation library.
-;;
-;; See documentation on https://github.com/magnars/s.el#functions
-
-;;; Code:
-
-;; Silence byte-compiler
-(defvar ucs-normalize-combining-chars) ; Defined in `ucs-normalize'
-(autoload 'slot-value "eieio")
-
-(defun s-trim-left (s)
- "Remove whitespace at the beginning of S."
- (declare (pure t) (side-effect-free t))
- (save-match-data
- (if (string-match "\\`[ \t\n\r]+" s)
- (replace-match "" t t s)
- s)))
-
-(defun s-trim-right (s)
- "Remove whitespace at the end of S."
- (save-match-data
- (declare (pure t) (side-effect-free t))
- (if (string-match "[ \t\n\r]+\\'" s)
- (replace-match "" t t s)
- s)))
-
-(defun s-trim (s)
- "Remove whitespace at the beginning and end of S."
- (declare (pure t) (side-effect-free t))
- (s-trim-left (s-trim-right s)))
-
-(defun s-collapse-whitespace (s)
- "Convert all adjacent whitespace characters to a single space."
- (declare (pure t) (side-effect-free t))
- (replace-regexp-in-string "[ \t\n\r]+" " " s))
-
-(defun s-split (separator s &optional omit-nulls)
- "Split S into substrings bounded by matches for regexp SEPARATOR.
-If OMIT-NULLS is non-nil, zero-length substrings are omitted.
-
-This is a simple wrapper around the built-in `split-string'."
- (declare (side-effect-free t))
- (save-match-data
- (split-string s separator omit-nulls)))
-
-(defun s-split-up-to (separator s n &optional omit-nulls)
- "Split S up to N times into substrings bounded by matches for regexp SEPARATOR.
-
-If OMIT-NULLS is non-nil, zero-length substrings are omitted.
-
-See also `s-split'."
- (declare (side-effect-free t))
- (save-match-data
- (let ((op 0)
- (r nil))
- (with-temp-buffer
- (insert s)
- (setq op (goto-char (point-min)))
- (while (and (re-search-forward separator nil t)
- (< 0 n))
- (let ((sub (buffer-substring op (match-beginning 0))))
- (unless (and omit-nulls
- (equal sub ""))
- (push sub r)))
- (setq op (goto-char (match-end 0)))
- (setq n (1- n)))
- (let ((sub (buffer-substring op (point-max))))
- (unless (and omit-nulls
- (equal sub ""))
- (push sub r))))
- (nreverse r))))
-
-(defun s-lines (s)
- "Splits S into a list of strings on newline characters."
- (declare (pure t) (side-effect-free t))
- (s-split "\\(\r\n\\|[\n\r]\\)" s))
-
-(defun s-join (separator strings)
- "Join all the strings in STRINGS with SEPARATOR in between."
- (declare (pure t) (side-effect-free t))
- (mapconcat 'identity strings separator))
-
-(defun s-concat (&rest strings)
- "Join all the string arguments into one string."
- (declare (pure t) (side-effect-free t))
- (apply 'concat strings))
-
-(defun s-prepend (prefix s)
- "Concatenate PREFIX and S."
- (declare (pure t) (side-effect-free t))
- (concat prefix s))
-
-(defun s-append (suffix s)
- "Concatenate S and SUFFIX."
- (declare (pure t) (side-effect-free t))
- (concat s suffix))
-
-(defun s-repeat (num s)
- "Make a string of S repeated NUM times."
- (declare (pure t) (side-effect-free t))
- (let (ss)
- (while (> num 0)
- (setq ss (cons s ss))
- (setq num (1- num)))
- (apply 'concat ss)))
-
-(defun s-chop-suffix (suffix s)
- "Remove SUFFIX if it is at end of S."
- (declare (pure t) (side-effect-free t))
- (let ((pos (- (length suffix))))
- (if (and (>= (length s) (length suffix))
- (string= suffix (substring s pos)))
- (substring s 0 pos)
- s)))
-
-(defun s-chop-suffixes (suffixes s)
- "Remove SUFFIXES one by one in order, if they are at the end of S."
- (declare (pure t) (side-effect-free t))
- (while suffixes
- (setq s (s-chop-suffix (car suffixes) s))
- (setq suffixes (cdr suffixes)))
- s)
-
-(defun s-chop-prefix (prefix s)
- "Remove PREFIX if it is at the start of S."
- (declare (pure t) (side-effect-free t))
- (let ((pos (length prefix)))
- (if (and (>= (length s) (length prefix))
- (string= prefix (substring s 0 pos)))
- (substring s pos)
- s)))
-
-(defun s-chop-prefixes (prefixes s)
- "Remove PREFIXES one by one in order, if they are at the start of S."
- (declare (pure t) (side-effect-free t))
- (while prefixes
- (setq s (s-chop-prefix (car prefixes) s))
- (setq prefixes (cdr prefixes)))
- s)
-
-(defun s-shared-start (s1 s2)
- "Returns the longest prefix S1 and S2 have in common."
- (declare (pure t) (side-effect-free t))
- (let ((search-length (min (length s1) (length s2)))
- (i 0))
- (while (and (< i search-length)
- (= (aref s1 i) (aref s2 i)))
- (setq i (1+ i)))
- (substring s1 0 i)))
-
-(defun s-shared-end (s1 s2)
- "Returns the longest suffix S1 and S2 have in common."
- (declare (pure t) (side-effect-free t))
- (let* ((l1 (length s1))
- (l2 (length s2))
- (search-length (min l1 l2))
- (i 0))
- (while (and (< i search-length)
- (= (aref s1 (- l1 i 1)) (aref s2 (- l2 i 1))))
- (setq i (1+ i)))
- ;; If I is 0, then it means that there's no common suffix between
- ;; S1 and S2.
- ;;
- ;; However, since (substring s (- 0)) will return the whole
- ;; string, `s-shared-end' should simply return the empty string
- ;; when I is 0.
- (if (zerop i)
- ""
- (substring s1 (- i)))))
-
-(defun s-chomp (s)
- "Remove one trailing `\\n`, `\\r` or `\\r\\n` from S."
- (declare (pure t) (side-effect-free t))
- (s-chop-suffixes '("\n" "\r") s))
-
-(defun s-truncate (len s)
- "If S is longer than LEN, cut it down to LEN - 3 and add ... at the end."
- (declare (pure t) (side-effect-free t))
- (if (> (length s) len)
- (format "%s..." (substring s 0 (- len 3)))
- s))
-
-(defun s-word-wrap (len s)
- "If S is longer than LEN, wrap the words with newlines."
- (declare (side-effect-free t))
- (save-match-data
- (with-temp-buffer
- (insert s)
- (let ((fill-column len))
- (fill-region (point-min) (point-max)))
- (buffer-substring (point-min) (point-max)))))
-
-(defun s-center (len s)
- "If S is shorter than LEN, pad it with spaces so it is centered."
- (declare (pure t) (side-effect-free t))
- (let ((extra (max 0 (- len (length s)))))
- (concat
- (make-string (ceiling extra 2) ? )
- s
- (make-string (floor extra 2) ? ))))
-
-(defun s-pad-left (len padding s)
- "If S is shorter than LEN, pad it with PADDING on the left."
- (declare (pure t) (side-effect-free t))
- (let ((extra (max 0 (- len (length s)))))
- (concat (make-string extra (string-to-char padding))
- s)))
-
-(defun s-pad-right (len padding s)
- "If S is shorter than LEN, pad it with PADDING on the right."
- (declare (pure t) (side-effect-free t))
- (let ((extra (max 0 (- len (length s)))))
- (concat s
- (make-string extra (string-to-char padding)))))
-
-(defun s-left (len s)
- "Returns up to the LEN first chars of S."
- (declare (pure t) (side-effect-free t))
- (if (> (length s) len)
- (substring s 0 len)
- s))
-
-(defun s-right (len s)
- "Returns up to the LEN last chars of S."
- (declare (pure t) (side-effect-free t))
- (let ((l (length s)))
- (if (> l len)
- (substring s (- l len) l)
- s)))
-
-(defun s-ends-with? (suffix s &optional ignore-case)
- "Does S end with SUFFIX?
-
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences.
-
-Alias: `s-suffix?'"
- (declare (pure t) (side-effect-free t))
- (let ((start-pos (- (length s) (length suffix))))
- (and (>= start-pos 0)
- (eq t (compare-strings suffix nil nil
- s start-pos nil ignore-case)))))
-
-(defun s-starts-with? (prefix s &optional ignore-case)
- "Does S start with PREFIX?
-
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences.
-
-Alias: `s-prefix?'. This is a simple wrapper around the built-in
-`string-prefix-p'."
- (declare (pure t) (side-effect-free t))
- (string-prefix-p prefix s ignore-case))
-
-(defun s--truthy? (val)
- (declare (pure t) (side-effect-free t))
- (not (null val)))
-
-(defun s-contains? (needle s &optional ignore-case)
- "Does S contain NEEDLE?
-
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences."
- (declare (pure t) (side-effect-free t))
- (let ((case-fold-search ignore-case))
- (s--truthy? (string-match-p (regexp-quote needle) s))))
-
-(defun s-equals? (s1 s2)
- "Is S1 equal to S2?
-
-This is a simple wrapper around the built-in `string-equal'."
- (declare (pure t) (side-effect-free t))
- (string-equal s1 s2))
-
-(defun s-less? (s1 s2)
- "Is S1 less than S2?
-
-This is a simple wrapper around the built-in `string-lessp'."
- (declare (pure t) (side-effect-free t))
- (string-lessp s1 s2))
-
-(defun s-matches? (regexp s &optional start)
- "Does REGEXP match S?
-If START is non-nil the search starts at that index.
-
-This is a simple wrapper around the built-in `string-match-p'."
- (declare (side-effect-free t))
- (s--truthy? (string-match-p regexp s start)))
-
-(defun s-blank? (s)
- "Is S nil or the empty string?"
- (declare (pure t) (side-effect-free t))
- (or (null s) (string= "" s)))
-
-(defun s-blank-str? (s)
- "Is S nil or the empty string or string only contains whitespace?"
- (declare (pure t) (side-effect-free t))
- (or (s-blank? s) (s-blank? (s-trim s))))
-
-(defun s-present? (s)
- "Is S anything but nil or the empty string?"
- (declare (pure t) (side-effect-free t))
- (not (s-blank? s)))
-
-(defun s-presence (s)
- "Return S if it's `s-present?', otherwise return nil."
- (declare (pure t) (side-effect-free t))
- (and (s-present? s) s))
-
-(defun s-lowercase? (s)
- "Are all the letters in S in lower case?"
- (declare (side-effect-free t))
- (let ((case-fold-search nil))
- (not (string-match-p "[[:upper:]]" s))))
-
-(defun s-uppercase? (s)
- "Are all the letters in S in upper case?"
- (declare (side-effect-free t))
- (let ((case-fold-search nil))
- (not (string-match-p "[[:lower:]]" s))))
-
-(defun s-mixedcase? (s)
- "Are there both lower case and upper case letters in S?"
- (let ((case-fold-search nil))
- (s--truthy?
- (and (string-match-p "[[:lower:]]" s)
- (string-match-p "[[:upper:]]" s)))))
-
-(defun s-capitalized? (s)
- "In S, is the first letter upper case, and all other letters lower case?"
- (declare (side-effect-free t))
- (let ((case-fold-search nil))
- (s--truthy?
- (string-match-p "^[[:upper:]][^[:upper:]]*$" s))))
-
-(defun s-numeric? (s)
- "Is S a number?"
- (declare (pure t) (side-effect-free t))
- (s--truthy?
- (string-match-p "^[0-9]+$" s)))
-
-(defun s-replace (old new s)
- "Replaces OLD with NEW in S."
- (declare (pure t) (side-effect-free t))
- (replace-regexp-in-string (regexp-quote old) new s t t))
-
-(defalias 's-replace-regexp 'replace-regexp-in-string)
-
-(defun s--aget (alist key)
- (declare (pure t) (side-effect-free t))
- (cdr (assoc-string key alist)))
-
-(defun s-replace-all (replacements s)
- "REPLACEMENTS is a list of cons-cells. Each `car` is replaced with `cdr` in S."
- (declare (pure t) (side-effect-free t))
- (replace-regexp-in-string (regexp-opt (mapcar 'car replacements))
- (lambda (it) (s--aget replacements it))
- s t t))
-
-(defun s-downcase (s)
- "Convert S to lower case.
-
-This is a simple wrapper around the built-in `downcase'."
- (declare (side-effect-free t))
- (downcase s))
-
-(defun s-upcase (s)
- "Convert S to upper case.
-
-This is a simple wrapper around the built-in `upcase'."
- (declare (side-effect-free t))
- (upcase s))
-
-(defun s-capitalize (s)
- "Convert the first word's first character to upper case and the rest to lower case in S."
- (declare (side-effect-free t))
- (concat (upcase (substring s 0 1)) (downcase (substring s 1))))
-
-(defun s-titleize (s)
- "Convert each word's first character to upper case and the rest to lower case in S.
-
-This is a simple wrapper around the built-in `capitalize'."
- (declare (side-effect-free t))
- (capitalize s))
-
-(defmacro s-with (s form &rest more)
- "Threads S through the forms. Inserts S as the last item
-in the first form, making a list of it if it is not a list
-already. If there are more forms, inserts the first form as the
-last item in second form, etc."
- (declare (debug (form &rest [&or (function &rest form) fboundp])))
- (if (null more)
- (if (listp form)
- `(,(car form) ,@(cdr form) ,s)
- (list form s))
- `(s-with (s-with ,s ,form) ,@more)))
-
-(put 's-with 'lisp-indent-function 1)
-
-(defun s-index-of (needle s &optional ignore-case)
- "Returns first index of NEEDLE in S, or nil.
-
-If IGNORE-CASE is non-nil, the comparison is done without paying
-attention to case differences."
- (declare (pure t) (side-effect-free t))
- (let ((case-fold-search ignore-case))
- (string-match-p (regexp-quote needle) s)))
-
-(defun s-reverse (s)
- "Return the reverse of S."
- (declare (pure t) (side-effect-free t))
- (save-match-data
- (if (multibyte-string-p s)
- (let ((input (string-to-list s))
- output)
- (require 'ucs-normalize)
- (while input
- ;; Handle entire grapheme cluster as a single unit
- (let ((grapheme (list (pop input))))
- (while (memql (car input) ucs-normalize-combining-chars)
- (push (pop input) grapheme))
- (setq output (nconc (nreverse grapheme) output))))
- (concat output))
- (concat (nreverse (string-to-list s))))))
-
-(defun s-match-strings-all (regex string)
- "Return a list of matches for REGEX in STRING.
-
-Each element itself is a list of matches, as per
-`match-string'. Multiple matches at the same position will be
-ignored after the first."
- (declare (side-effect-free t))
- (save-match-data
- (let ((all-strings ())
- (i 0))
- (while (and (< i (length string))
- (string-match regex string i))
- (setq i (1+ (match-beginning 0)))
- (let (strings
- (num-matches (/ (length (match-data)) 2))
- (match 0))
- (while (/= match num-matches)
- (push (match-string match string) strings)
- (setq match (1+ match)))
- (push (nreverse strings) all-strings)))
- (nreverse all-strings))))
-
-(defun s-matched-positions-all (regexp string &optional subexp-depth)
- "Return a list of matched positions for REGEXP in STRING.
-SUBEXP-DEPTH is 0 by default."
- (declare (side-effect-free t))
- (if (null subexp-depth)
- (setq subexp-depth 0))
- (save-match-data
- (let ((pos 0) result)
- (while (and (string-match regexp string pos)
- (< pos (length string)))
- (let ((m (match-end subexp-depth)))
- (push (cons (match-beginning subexp-depth) (match-end subexp-depth)) result)
- (setq pos (match-end 0))))
- (nreverse result))))
-
-(defun s-match (regexp s &optional start)
- "When the given expression matches the string, this function returns a list
-of the whole matching string and a string for each matched subexpressions.
-If it did not match the returned value is an empty list (nil).
-
-When START is non-nil the search will start at that index."
- (declare (side-effect-free t))
- (save-match-data
- (if (string-match regexp s start)
- (let ((match-data-list (match-data))
- result)
- (while match-data-list
- (let* ((beg (car match-data-list))
- (end (cadr match-data-list))
- (subs (if (and beg end) (substring s beg end) nil)))
- (setq result (cons subs result))
- (setq match-data-list
- (cddr match-data-list))))
- (nreverse result)))))
-
-(defun s-slice-at (regexp s)
- "Slices S up at every index matching REGEXP."
- (declare (side-effect-free t))
- (if (= 0 (length s)) (list "")
- (save-match-data
- (let (i)
- (setq i (string-match regexp s 1))
- (if i
- (cons (substring s 0 i)
- (s-slice-at regexp (substring s i)))
- (list s))))))
-
-(defun s-split-words (s)
- "Split S into list of words."
- (declare (side-effect-free t))
- (s-split
- "[^[:word:]0-9]+"
- (let ((case-fold-search nil))
- (replace-regexp-in-string
- "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2"
- (replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" "\\1 \\2" s)))
- t))
-
-(defun s--mapcar-head (fn-head fn-rest list)
- "Like MAPCAR, but applies a different function to the first element."
- (if list
- (cons (funcall fn-head (car list)) (mapcar fn-rest (cdr list)))))
-
-(defun s-lower-camel-case (s)
- "Convert S to lowerCamelCase."
- (declare (side-effect-free t))
- (s-join "" (s--mapcar-head 'downcase 'capitalize (s-split-words s))))
-
-(defun s-upper-camel-case (s)
- "Convert S to UpperCamelCase."
- (declare (side-effect-free t))
- (s-join "" (mapcar 'capitalize (s-split-words s))))
-
-(defun s-snake-case (s)
- "Convert S to snake_case."
- (declare (side-effect-free t))
- (s-join "_" (mapcar 'downcase (s-split-words s))))
-
-(defun s-dashed-words (s)
- "Convert S to dashed-words."
- (declare (side-effect-free t))
- (s-join "-" (mapcar 'downcase (s-split-words s))))
-
-(defun s-capitalized-words (s)
- "Convert S to Capitalized words."
- (declare (side-effect-free t))
- (let ((words (s-split-words s)))
- (s-join " " (cons (capitalize (car words)) (mapcar 'downcase (cdr words))))))
-
-(defun s-titleized-words (s)
- "Convert S to Titleized Words."
- (declare (side-effect-free t))
- (s-join " " (mapcar 's-titleize (s-split-words s))))
-
-(defun s-word-initials (s)
- "Convert S to its initials."
- (declare (side-effect-free t))
- (s-join "" (mapcar (lambda (ss) (substring ss 0 1))
- (s-split-words s))))
-
-;; Errors for s-format
-(progn
- (put 's-format-resolve
- 'error-conditions
- '(error s-format s-format-resolve))
- (put 's-format-resolve
- 'error-message
- "Cannot resolve a template to values"))
-
-(defun s-format (template replacer &optional extra)
- "Format TEMPLATE with the function REPLACER.
-
-REPLACER takes an argument of the format variable and optionally
-an extra argument which is the EXTRA value from the call to
-`s-format'.
-
-Several standard `s-format' helper functions are recognized and
-adapted for this:
-
- (s-format \"${name}\" 'gethash hash-table)
- (s-format \"${name}\" 'aget alist)
- (s-format \"$0\" 'elt sequence)
-
-The REPLACER function may be used to do any other kind of
-transformation."
- (let ((saved-match-data (match-data)))
- (unwind-protect
- (replace-regexp-in-string
- "\\$\\({\\([^}]+\\)}\\|[0-9]+\\)"
- (lambda (md)
- (let ((var
- (let ((m (match-string 2 md)))
- (if m m
- (string-to-number (match-string 1 md)))))
- (replacer-match-data (match-data)))
- (unwind-protect
- (let ((v
- (cond
- ((eq replacer 'gethash)
- (funcall replacer var extra))
- ((eq replacer 'aget)
- (funcall 's--aget extra var))
- ((eq replacer 'elt)
- (funcall replacer extra var))
- ((eq replacer 'oref)
- (funcall #'slot-value extra (intern var)))
- (t
- (set-match-data saved-match-data)
- (if extra
- (funcall replacer var extra)
- (funcall replacer var))))))
- (if v (format "%s" v) (signal 's-format-resolve md)))
- (set-match-data replacer-match-data)))) template
- ;; Need literal to make sure it works
- t t)
- (set-match-data saved-match-data))))
-
-(defvar s-lex-value-as-lisp nil
- "If `t' interpolate lisp values as lisp.
-
-`s-lex-format' inserts values with (format \"%S\").")
-
-(defun s-lex-fmt|expand (fmt)
- "Expand FMT into lisp."
- (declare (side-effect-free t))
- (list 's-format fmt (quote 'aget)
- (append '(list)
- (mapcar
- (lambda (matches)
- (list
- 'cons
- (cadr matches)
- `(format
- (if s-lex-value-as-lisp "%S" "%s")
- ,(intern (cadr matches)))))
- (s-match-strings-all "${\\([^}]+\\)}" fmt)))))
-
-(defmacro s-lex-format (format-str)
- "`s-format` with the current environment.
-
-FORMAT-STR may use the `s-format' variable reference to refer to
-any variable:
-
- (let ((x 1))
- (s-lex-format \"x is: ${x}\"))
-
-The values of the variables are interpolated with \"%s\" unless
-the variable `s-lex-value-as-lisp' is `t' and then they are
-interpolated with \"%S\"."
- (declare (debug (form)))
- (s-lex-fmt|expand format-str))
-
-(defun s-count-matches (regexp s &optional start end)
- "Count occurrences of `regexp' in `s'.
-
-`start', inclusive, and `end', exclusive, delimit the part of `s'
-to match. "
- (declare (side-effect-free t))
- (save-match-data
- (with-temp-buffer
- (insert s)
- (goto-char (point-min))
- (count-matches regexp (or start 1) (or end (point-max))))))
-
-(defun s-wrap (s prefix &optional suffix)
- "Wrap string S with PREFIX and optionally SUFFIX.
-
-Return string S with PREFIX prepended. If SUFFIX is present, it
-is appended, otherwise PREFIX is used as both prefix and
-suffix."
- (declare (pure t) (side-effect-free t))
- (concat prefix s (or suffix prefix)))
-
-
-;;; Aliases
-
-(defalias 's-blank-p 's-blank?)
-(defalias 's-blank-str-p 's-blank-str?)
-(defalias 's-capitalized-p 's-capitalized?)
-(defalias 's-contains-p 's-contains?)
-(defalias 's-ends-with-p 's-ends-with?)
-(defalias 's-equals-p 's-equals?)
-(defalias 's-less-p 's-less?)
-(defalias 's-lowercase-p 's-lowercase?)
-(defalias 's-matches-p 's-matches?)
-(defalias 's-mixedcase-p 's-mixedcase?)
-(defalias 's-numeric-p 's-numeric?)
-(defalias 's-prefix-p 's-starts-with?)
-(defalias 's-prefix? 's-starts-with?)
-(defalias 's-present-p 's-present?)
-(defalias 's-starts-with-p 's-starts-with?)
-(defalias 's-suffix-p 's-ends-with?)
-(defalias 's-suffix? 's-ends-with?)
-(defalias 's-uppercase-p 's-uppercase?)
-
-
-(provide 's)
-;;; s.el ends here
diff --git a/emacs/.emacs.d/elpa/s-20171102.227/s.elc b/emacs/.emacs.d/elpa/s-20171102.227/s.elc
deleted file mode 100644
index c4a25c4..0000000
Binary files a/emacs/.emacs.d/elpa/s-20171102.227/s.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/seq-2.20.signed b/emacs/.emacs.d/elpa/seq-2.20.signed
deleted file mode 100644
index bfca90a..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20.signed
+++ /dev/null
@@ -1 +0,0 @@
-Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent (trust undefined) created at 2017-05-04T23:05:02+0200 using DSA
\ No newline at end of file
diff --git a/emacs/.emacs.d/elpa/seq-2.20/ChangeLog b/emacs/.emacs.d/elpa/seq-2.20/ChangeLog
deleted file mode 100644
index 07f4988..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/ChangeLog
+++ /dev/null
@@ -1,195 +0,0 @@
-2017-05-04 Nicolas Petton
-
- Update seq.el to 2.20
-
-2016-12-16 Nicolas Petton
-
- Backport the latest changes to seq.el from Emacs master
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-into): Do not convert the sequence if not
- needed.
- * packages/seq/tests/seq-tests.el: Add a regression test.
-
-2016-12-15 Nicolas Petton
-
- Backport seq-mapn fix from Emacs master
-
- * packages/seq/seq-24.el (seq-mapn):
- * packages/seq/seq-25.el (seq-mapn): Fix for circular lists.
- * packages/seq/tests/seq-tests.el: Add a regression test.
-
-2016-11-16 Nicolas Petton
-
- Do not use map.el in seq-tests.el
-
- * packages/seq/tests/seq-tests.el: Do not use map.el. map.el was
- introduced in Emacs 25.1, but seq.el is also available in GNU ELPA for
- Emacs 24.5.
-
-2016-10-25 Nicolas Petton
-
- Fix seq-random-elt docstring
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-random-elt): Fix the docstring.
-
-2016-10-25 Nicolas Petton
-
- Backport seq.el changes from Emacs master
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el (seq-random-elt): New function.
- * packages/seq/seq.el: Bump version to 2.19.
- * packages/seq/tests/seq-tests.el: Add tests for seq-random-elt.
-
-2016-09-02 Clément Pit--Claudel
-
- ; Fix documentation of seq-subseq
-
-2016-08-28 Nicolas Petton
-
- * packages/seq/seq-24.el: Rename seq-p to seqp
-
-2016-06-12 Nicolas Petton
-
- Update seq.el to 2.16
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el: Better implementation of seq-drop for lists.
- * packages/seq/seq.el: Bump version number.
-
-2016-04-22 Stefan Monnier
-
- * seq-24.el (seq-concatenate,seq-into,seq--make-bindings): Use _
-
- rather than t as catch-all for pcase.
-
-2016-03-31 Nicolas Petton
-
- Update seq to version 2.15
-
- * packages/seq/seq-25.el: Require cl-lib.
- * packages/seq/seq.el: Bump version number.
-
-2016-03-29 Nicolas Petton
-
- Update seq.el to version 2.14
-
- * packages/seq/seq.el: Bump version number.
- * packages/seq/seq-24.el (seq-sort-by): New function.
- * packages/seq/seq-25.el (seq-sort-by): New function.
- * packages/seq/tests/seq-tests.el: Add a test for seq-sort-by.
-
-2016-03-25 Nicolas Petton
-
- * packages/seq/seq-25.el: Better declarations for seq--when-emacs-25-p
-
-2016-03-25 Nicolas Petton
-
- Split seq.el into separate files for different versions of Emacs
-
- All functions in seq-25.el are wrapped in a `seq--when-emacs-25-p' to
- make sure that the byte compiler won't emit warnings or errors when the
- file is byte compiled in Emacs < 25.
-
- * packages/seq/seq-24.el:
- * packages/seq/seq-25.el: New files.
- * packages/seq/seq.el: Load seq-VERSION.el based on the version of
- Emacs.
- * packages/seq/test/seq.el-test.el: Backport a test from seq.el in Emacs
- master.
-
-2015-11-30 Stefan Monnier
-
- * packages/seq: Don't define it as a :core package
-
- Revert the removal of packages/seq/seq.el since it's different from the
- one in lisp/emacs-lisp.
- * .gitignore: Remove packages/seq.
- * externals-list: Remove "seq" entry.
-
-2015-11-29 Stefan Monnier
-
- * externals-list: Add seq and python as :core packages
-
- * .gitignore: Add packages/{seq,python}.
- * packages/seq: Remove.
-
-2015-10-20 Nicolas Petton
-
- Update seq.el to version 1.11
-
- * packages/seq/seq.el:
- * packages/seq/tests/seq-tests.el: Update.
-
-2015-09-18 Nicolas Petton
-
- Update seq.el to version 1.9
-
- * packages/seq/seq.el: Update to version 1.9.
- * packages/seq/tests/seq-tests.el: Update to version 1.9.
-
-2015-07-09 Nicolas Petton
-
- Update seq.el to version 1.8
-
- * packages/seq/seq.el: Update to version 1.8.
- * packages/seq/tests/seq-tests.el: Update to version 1.8.
-
-2015-05-15 Nicolas Petton
-
- Update seq.el to version 1.7
-
- * packages/seq/seq.el: Update to version 1.7.
- * packages/seq/tests/seq-tests.el: Update to version 1.7.
-
-2015-04-27 Nicolas Petton
-
- * packages/seq/seq.el: Update seq.el to version 1.5.
-
-2015-04-15 Nicolas Petton
-
- seq.el update
-
- * packages/seq/seq.el: Update seq.el to version 1.4
- * packages/seq/tests/seq-tests.el: Update seq.el to version 1.4
-
-2015-03-25 Nicolas Petton
-
- Rephrases a comment in seq.el about the order of the arguments
-
- * packages/seq/seq.el: Better comment about the order of the arguments
-
-2015-03-09 Nicolas Petton
-
- Update seq.el to version 1.3
-
- * packages/seq/seq.el: update to version 1.3
- * packages/seq/tests/seq-tests.el: update to version 1.3
-
-2015-02-11 Nicolas Petton
-
- Update seq.el to version 1.2
-
- * package/seq/seq.el: Update to version 1.2
- * packages/seq/tests/seq-tests.el: Update to version 1.2
-
-2015-02-09 Nicolas Petton
-
- Update seq.el to version 1.1.1
-
- * package/seq/seq.el: Update to version 1.1.1
- * packages/seq/tests/seq-tests.el: Update to version 1.1.1
-
-2015-02-06 Nicolas Petton
-
- Update seq.el to version 1.1
-
- * packages/seq/seq.el: Update to version 1.1
- * packages/seq/tests/seq-tests.el: Update to version 1.1
-
-2015-01-14 Nicolas Petton
-
- packages/seq: New package
-
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-24.el b/emacs/.emacs.d/elpa/seq-2.20/seq-24.el
deleted file mode 100644
index d7ea729..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/seq-24.el
+++ /dev/null
@@ -1,496 +0,0 @@
-;;; seq-24.el --- seq.el implementation for Emacs 24.x -*- lexical-binding: t -*-
-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
-
-;; Author: Nicolas Petton
-;; Keywords: sequences
-
-;; Maintainer: emacs-devel@gnu.org
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs. If not, see .
-
-;;; Commentary:
-
-;; Sequence-manipulation functions that complement basic functions
-;; provided by subr.el.
-;;
-;; All functions are prefixed with "seq-".
-;;
-;; All provided functions work on lists, strings and vectors.
-;;
-;; Functions taking a predicate or iterating over a sequence using a
-;; function as argument take the function as their first argument and
-;; the sequence as their second argument. All other functions take
-;; the sequence as their first argument.
-
-;;; Code:
-
-(defmacro seq-doseq (spec &rest body)
- "Loop over a sequence.
-Similar to `dolist' but can be applied to lists, strings, and vectors.
-
-Evaluate BODY with VAR bound to each element of SEQ, in turn.
-
-\(fn (VAR SEQ) BODY...)"
- (declare (indent 1) (debug ((symbolp form &optional form) body)))
- (let ((length (make-symbol "length"))
- (seq (make-symbol "seq"))
- (index (make-symbol "index")))
- `(let* ((,seq ,(cadr spec))
- (,length (if (listp ,seq) nil (seq-length ,seq)))
- (,index (if ,length 0 ,seq)))
- (while (if ,length
- (< ,index ,length)
- (consp ,index))
- (let ((,(car spec) (if ,length
- (prog1 (seq-elt ,seq ,index)
- (setq ,index (+ ,index 1)))
- (pop ,index))))
- ,@body)))))
-
-;; Implementation of `seq-let' compatible with Emacs<25.1.
-(defmacro seq-let (args sequence &rest body)
- "Bind the variables in ARGS to the elements of SEQUENCE then evaluate BODY.
-
-ARGS can also include the `&rest' marker followed by a variable
-name to be bound to the rest of SEQUENCE."
- (declare (indent 2) (debug t))
- (let ((seq-var (make-symbol "seq")))
- `(let* ((,seq-var ,sequence)
- ,@(seq--make-bindings args seq-var))
- ,@body)))
-
-(defun seq-drop (sequence n)
- "Return a subsequence of SEQUENCE without its first N elements.
-The result is a sequence of the same type as SEQUENCE.
-
-If N is a negative integer or zero, SEQUENCE is returned."
- (if (<= n 0)
- sequence
- (if (listp sequence)
- (seq--drop-list sequence n)
- (let ((length (seq-length sequence)))
- (seq-subseq sequence (min n length) length)))))
-
-(defun seq-take (sequence n)
- "Return a subsequence of SEQUENCE with its first N elements.
-The result is a sequence of the same type as SEQUENCE.
-
-If N is a negative integer or zero, an empty sequence is
-returned."
- (if (listp sequence)
- (seq--take-list sequence n)
- (seq-subseq sequence 0 (min (max n 0) (seq-length sequence)))))
-
-(defun seq-drop-while (predicate sequence)
- "Return a sequence from the first element for which (PREDICATE element) is nil in SEQUENCE.
-The result is a sequence of the same type as SEQUENCE."
- (if (listp sequence)
- (seq--drop-while-list predicate sequence)
- (seq-drop sequence (seq--count-successive predicate sequence))))
-
-(defun seq-take-while (predicate sequence)
- "Return the successive elements for which (PREDICATE element) is non-nil in SEQUENCE.
-The result is a sequence of the same type as SEQUENCE."
- (if (listp sequence)
- (seq--take-while-list predicate sequence)
- (seq-take sequence (seq--count-successive predicate sequence))))
-
-(defun seq-filter (predicate sequence)
- "Return a list of all the elements for which (PREDICATE element) is non-nil in SEQUENCE."
- (let ((exclude (make-symbol "exclude")))
- (delq exclude (seq-map (lambda (elt)
- (if (funcall predicate elt)
- elt
- exclude))
- sequence))))
-
-(defun seq-map-indexed (function sequence)
- "Return the result of applying FUNCTION to each element of SEQUENCE.
-Unlike `seq-map', FUNCTION takes two arguments: the element of
-the sequence, and its index within the sequence."
- (let ((index 0))
- (seq-map (lambda (elt)
- (prog1
- (funcall function elt index)
- (setq index (1+ index))))
- sequence)))
-
-(defun seq-remove (predicate sequence)
- "Return a list of all the elements for which (PREDICATE element) is nil in SEQUENCE."
- (seq-filter (lambda (elt) (not (funcall predicate elt)))
- sequence))
-
-(defun seq-reduce (function sequence initial-value)
- "Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
-
-Return the result of calling FUNCTION with INITIAL-VALUE and the
-first element of SEQUENCE, then calling FUNCTION with that result and
-the second element of SEQUENCE, then with that result and the third
-element of SEQUENCE, etc.
-
-If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
- (if (seq-empty-p sequence)
- initial-value
- (let ((acc initial-value))
- (seq-doseq (elt sequence)
- (setq acc (funcall function acc elt)))
- acc)))
-
-(defun seq-some (predicate sequence)
- "Return the first value for which if (PREDICATE element) is non-nil for in SEQUENCE."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (let ((result (funcall predicate elt)))
- (when result
- (throw 'seq--break result))))
- nil))
-
-(defun seq-find (predicate sequence &optional default)
- "Return the first element for which (PREDICATE element) is non-nil in SEQUENCE.
-If no element is found, return DEFAULT.
-
-Note that `seq-find' has an ambiguity if the found element is
-identical to DEFAULT, as it cannot be known if an element was
-found or not."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (when (funcall predicate elt)
- (throw 'seq--break elt)))
- default))
-
-(defun seq-every-p (predicate sequence)
- "Return non-nil if (PREDICATE element) is non-nil for all elements of the sequence SEQUENCE."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (or (funcall predicate elt)
- (throw 'seq--break nil)))
- t))
-
-(defun seq-count (predicate sequence)
- "Return the number of elements for which (PREDICATE element) is non-nil in SEQUENCE."
- (let ((count 0))
- (seq-doseq (elt sequence)
- (when (funcall predicate elt)
- (setq count (+ 1 count))))
- count))
-
-(defun seq-empty-p (sequence)
- "Return non-nil if the sequence SEQUENCE is empty, nil otherwise."
- (if (listp sequence)
- (null sequence)
- (= 0 (seq-length sequence))))
-
-(defun seq-sort (predicate sequence)
- "Return a sorted sequence comparing using PREDICATE the elements of SEQUENCE.
-The result is a sequence of the same type as SEQUENCE."
- (if (listp sequence)
- (sort (seq-copy sequence) predicate)
- (let ((result (seq-sort predicate (append sequence nil))))
- (seq-into result (type-of sequence)))))
-
-(defun seq-sort-by (function pred sequence)
- "Sort SEQUENCE using PRED as a comparison function.
-Elements of SEQUENCE are transformed by FUNCTION before being
-sorted. FUNCTION must be a function of one argument."
- (seq-sort (lambda (a b)
- (funcall pred
- (funcall function a)
- (funcall function b)))
- sequence))
-
-(defun seq-contains (sequence elt &optional testfn)
- "Return the first element in SEQUENCE that equals to ELT.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-some (lambda (e)
- (funcall (or testfn #'equal) elt e))
- sequence))
-
-(defun seq-set-equal-p (sequence1 sequence2 &optional testfn)
- "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements, regardless of order.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (and (seq-every-p (lambda (item1) (seq-contains sequence2 item1 testfn)) sequence1)
- (seq-every-p (lambda (item2) (seq-contains sequence1 item2 testfn)) sequence2)))
-
-(defun seq-position (sequence elt &optional testfn)
- "Return the index of the first element in SEQUENCE that is equal to ELT.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (let ((index 0))
- (catch 'seq--break
- (seq-doseq (e sequence)
- (when (funcall (or testfn #'equal) e elt)
- (throw 'seq--break index))
- (setq index (1+ index)))
- nil)))
-
-(defun seq-uniq (sequence &optional testfn)
- "Return a list of the elements of SEQUENCE with duplicates removed.
-TESTFN is used to compare elements, or `equal' if TESTFN is nil."
- (let ((result '()))
- (seq-doseq (elt sequence)
- (unless (seq-contains result elt testfn)
- (setq result (cons elt result))))
- (nreverse result)))
-
-(defun seq-subseq (sequence start &optional end)
- "Return the subsequence of SEQUENCE from START to END.
-If END is omitted, it defaults to the length of the sequence.
-If START or END is negative, it counts from the end."
- (cond ((or (stringp sequence) (vectorp sequence)) (substring sequence start end))
- ((listp sequence)
- (let (len (errtext (format "Bad bounding indices: %s, %s" start end)))
- (and end (< end 0) (setq end (+ end (setq len (seq-length sequence)))))
- (if (< start 0) (setq start (+ start (or len (setq len (seq-length sequence))))))
- (when (> start 0)
- (setq sequence (nthcdr (1- start) sequence))
- (or sequence (error "%s" errtext))
- (setq sequence (cdr sequence)))
- (if end
- (let ((res nil))
- (while (and (>= (setq end (1- end)) start) sequence)
- (push (pop sequence) res))
- (or (= (1+ end) start) (error "%s" errtext))
- (nreverse res))
- (seq-copy sequence))))
- (t (error "Unsupported sequence: %s" sequence))))
-
-(defun seq-concatenate (type &rest seqs)
- "Concatenate, into a sequence of type TYPE, the sequences SEQS.
-TYPE must be one of following symbols: vector, string or list.
-
-\n(fn TYPE SEQUENCE...)"
- (pcase type
- (`vector (apply #'vconcat seqs))
- (`string (apply #'concat seqs))
- (`list (apply #'append (append seqs '(nil))))
- (_ (error "Not a sequence type name: %S" type))))
-
-(defun seq-mapcat (function sequence &optional type)
- "Concatenate the result of applying FUNCTION to each element of SEQUENCE.
-The result is a sequence of type TYPE, or a list if TYPE is nil."
- (apply #'seq-concatenate (or type 'list)
- (seq-map function sequence)))
-
-(defun seq-mapn (function sequence &rest seqs)
- "Like `seq-map' but FUNCTION is mapped over all SEQS.
-The arity of FUNCTION must match the number of SEQS, and the
-mapping stops on the shortest sequence.
-Return a list of the results.
-
-\(fn FUNCTION SEQS...)"
- (let ((result nil)
- (seqs (seq-map (lambda (s)
- (seq-into s 'list))
- (cons sequence seqs))))
- (while (not (memq nil seqs))
- (push (apply function (seq-map #'car seqs)) result)
- (setq seqs (seq-map #'cdr seqs)))
- (nreverse result)))
-
-(defun seq-partition (sequence n)
- "Return a list of the elements of SEQUENCE grouped into sub-sequences of length N.
-The last sequence may contain less than N elements. If N is a
-negative integer or 0, nil is returned."
- (unless (< n 1)
- (let ((result '()))
- (while (not (seq-empty-p sequence))
- (push (seq-take sequence n) result)
- (setq sequence (seq-drop sequence n)))
- (nreverse result))))
-
-(defun seq-intersection (seq1 seq2 &optional testfn)
- "Return a list of the elements that appear in both SEQ1 and SEQ2.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-reduce (lambda (acc elt)
- (if (seq-contains seq2 elt testfn)
- (cons elt acc)
- acc))
- (seq-reverse seq1)
- '()))
-
-(defun seq-difference (seq1 seq2 &optional testfn)
- "Return a list of the elements that appear in SEQ1 but not in SEQ2.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-reduce (lambda (acc elt)
- (if (not (seq-contains seq2 elt testfn))
- (cons elt acc)
- acc))
- (seq-reverse seq1)
- '()))
-
-(defun seq-group-by (function sequence)
- "Apply FUNCTION to each element of SEQUENCE.
-Separate the elements of SEQUENCE into an alist using the results as
-keys. Keys are compared using `equal'."
- (seq-reduce
- (lambda (acc elt)
- (let* ((key (funcall function elt))
- (cell (assoc key acc)))
- (if cell
- (setcdr cell (push elt (cdr cell)))
- (push (list key elt) acc))
- acc))
- (seq-reverse sequence)
- nil))
-
-(defalias 'seq-reverse
- (if (ignore-errors (reverse [1 2]))
- #'reverse
- (lambda (sequence)
- "Return the reversed copy of list, vector, or string SEQUENCE.
-See also the function `nreverse', which is used more often."
- (let ((result '()))
- (seq-map (lambda (elt) (push elt result))
- sequence)
- (if (listp sequence)
- result
- (seq-into result (type-of sequence)))))))
-
-(defun seq-into (sequence type)
- "Convert the sequence SEQUENCE into a sequence of type TYPE.
-TYPE can be one of the following symbols: vector, string or list."
- (pcase type
- (`vector (seq--into-vector sequence))
- (`string (seq--into-string sequence))
- (`list (seq--into-list sequence))
- (_ (error "Not a sequence type name: %S" type))))
-
-(defun seq-min (sequence)
- "Return the smallest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
- (apply #'min (seq-into sequence 'list)))
-
-(defun seq-max (sequence)
- "Return the largest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
- (apply #'max (seq-into sequence 'list)))
-
-(defun seq-random-elt (sequence)
- "Return a random element from SEQUENCE.
-Signal an error if SEQUENCE is empty."
- (if (seq-empty-p sequence)
- (error "Sequence cannot be empty")
- (seq-elt sequence (random (seq-length sequence)))))
-
-(defun seq--drop-list (list n)
- "Return a list from LIST without its first N elements.
-This is an optimization for lists in `seq-drop'."
- (nthcdr n list))
-
-(defun seq--take-list (list n)
- "Return a list from LIST made of its first N elements.
-This is an optimization for lists in `seq-take'."
- (let ((result '()))
- (while (and list (> n 0))
- (setq n (1- n))
- (push (pop list) result))
- (nreverse result)))
-
-(defun seq--drop-while-list (predicate list)
- "Return a list from the first element for which (PREDICATE element) is nil in LIST.
-This is an optimization for lists in `seq-drop-while'."
- (while (and list (funcall predicate (car list)))
- (setq list (cdr list)))
- list)
-
-(defun seq--take-while-list (predicate list)
- "Return the successive elements for which (PREDICATE element) is non-nil in LIST.
-This is an optimization for lists in `seq-take-while'."
- (let ((result '()))
- (while (and list (funcall predicate (car list)))
- (push (pop list) result))
- (nreverse result)))
-
-(defun seq--count-successive (predicate sequence)
- "Return the number of successive elements for which (PREDICATE element) is non-nil in SEQUENCE."
- (let ((n 0)
- (len (seq-length sequence)))
- (while (and (< n len)
- (funcall predicate (seq-elt sequence n)))
- (setq n (+ 1 n)))
- n))
-
-;; Helper function for the Backward-compatible version of `seq-let'
-;; for Emacs<25.1.
-(defun seq--make-bindings (args sequence &optional bindings)
- "Return a list of bindings of the variables in ARGS to the elements of a sequence.
-if BINDINGS is non-nil, append new bindings to it, and return
-BINDINGS."
- (let ((index 0)
- (rest-marker nil))
- (seq-doseq (name args)
- (unless rest-marker
- (pcase name
- ((pred seqp)
- (setq bindings (seq--make-bindings (seq--elt-safe args index)
- `(seq--elt-safe ,sequence ,index)
- bindings)))
- (`&rest
- (progn (push `(,(seq--elt-safe args (1+ index))
- (seq-drop ,sequence ,index))
- bindings)
- (setq rest-marker t)))
- (_
- (push `(,name (seq--elt-safe ,sequence ,index)) bindings))))
- (setq index (1+ index)))
- bindings))
-
-(defun seq--elt-safe (sequence n)
- "Return element of SEQUENCE at the index N.
-If no element is found, return nil."
- (when (or (listp sequence)
- (and (sequencep sequence)
- (> (seq-length sequence) n)))
- (seq-elt sequence n)))
-
-(defun seq--activate-font-lock-keywords ()
- "Activate font-lock keywords for some symbols defined in seq."
- (font-lock-add-keywords 'emacs-lisp-mode
- '("\\" "\\")))
-
-(defalias 'seq-copy #'copy-sequence)
-(defalias 'seq-elt #'elt)
-(defalias 'seq-length #'length)
-(defalias 'seq-do #'mapc)
-(defalias 'seq-each #'seq-do)
-(defalias 'seq-map #'mapcar)
-(defalias 'seqp #'sequencep)
-
-(defun seq--into-list (sequence)
- "Concatenate the elements of SEQUENCE into a list."
- (if (listp sequence)
- sequence
- (append sequence nil)))
-
-(defun seq--into-vector (sequence)
- "Concatenate the elements of SEQUENCE into a vector."
- (if (vectorp sequence)
- sequence
- (vconcat sequence)))
-
-(defun seq--into-string (sequence)
- "Concatenate the elements of SEQUENCE into a string."
- (if (stringp sequence)
- sequence
- (concat sequence)))
-
-(unless (fboundp 'elisp--font-lock-flush-elisp-buffers)
- ;; In Emacs≥25, (via elisp--font-lock-flush-elisp-buffers and a few others)
- ;; we automatically highlight macros.
- (add-hook 'emacs-lisp-mode-hook #'seq--activate-font-lock-keywords))
-
-(provide 'seq-24)
-;;; seq-24.el ends here
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-24.elc b/emacs/.emacs.d/elpa/seq-2.20/seq-24.elc
deleted file mode 100644
index e81a167..0000000
Binary files a/emacs/.emacs.d/elpa/seq-2.20/seq-24.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-25.el b/emacs/.emacs.d/elpa/seq-2.20/seq-25.el
deleted file mode 100644
index d26bde6..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/seq-25.el
+++ /dev/null
@@ -1,530 +0,0 @@
-;;; seq-25.el --- seq.el implementation for Emacs 25.x -*- lexical-binding: t -*-
-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
-
-;; Author: Nicolas Petton
-;; Keywords: sequences
-
-;; Maintainer: emacs-devel@gnu.org
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs. If not, see .
-
-;;; Commentary:
-
-;; Sequence-manipulation functions that complement basic functions
-;; provided by subr.el.
-;;
-;; All functions are prefixed with "seq-".
-;;
-;; All provided functions work on lists, strings and vectors.
-;;
-;; Functions taking a predicate or iterating over a sequence using a
-;; function as argument take the function as their first argument and
-;; the sequence as their second argument. All other functions take
-;; the sequence as their first argument.
-;;
-;; seq.el can be extended to support new type of sequences. Here are
-;; the generic functions that must be implemented by new seq types:
-;; - `seq-elt'
-;; - `seq-length'
-;; - `seq-do'
-;; - `seqp'
-;; - `seq-subseq'
-;; - `seq-into-sequence'
-;; - `seq-copy'
-;; - `seq-into'
-
-;;; Code:
-
-;; When loading seq.el in Emacs 24.x, this file gets byte-compiled, even if
-;; never used. This takes care of byte-compilation warnings is emitted, by
-;; emitting nil in the macro expansion in Emacs 24.x.
-(defmacro seq--when-emacs-25-p (&rest body)
- "Execute BODY if in Emacs>=25.x."
- (declare (indent (lambda (&rest x) 0)) (debug t))
- (when (version<= "25" emacs-version)
- `(progn ,@body)))
-
-(seq--when-emacs-25-p
-
-(require 'cl-generic)
-(require 'cl-lib) ;; for cl-subseq
-
-(defmacro seq-doseq (spec &rest body)
- "Loop over a sequence.
-Evaluate BODY with VAR bound to each element of SEQUENCE, in turn.
-
-Similar to `dolist' but can be applied to lists, strings, and vectors.
-
-\(fn (VAR SEQUENCE) BODY...)"
- (declare (indent 1) (debug ((symbolp form &optional form) body)))
- `(seq-do (lambda (,(car spec))
- ,@body)
- ,(cadr spec)))
-
-(pcase-defmacro seq (&rest patterns)
- "Build a `pcase' pattern that matches elements of SEQUENCE.
-
-The `pcase' pattern will match each element of PATTERNS against the
-corresponding element of SEQUENCE.
-
-Extra elements of the sequence are ignored if fewer PATTERNS are
-given, and the match does not fail."
- `(and (pred seqp)
- ,@(seq--make-pcase-bindings patterns)))
-
-(defmacro seq-let (args sequence &rest body)
- "Bind the variables in ARGS to the elements of SEQUENCE, then evaluate BODY.
-
-ARGS can also include the `&rest' marker followed by a variable
-name to be bound to the rest of SEQUENCE."
- (declare (indent 2) (debug (sexp form body)))
- `(pcase-let ((,(seq--make-pcase-patterns args) ,sequence))
- ,@body))
-
-
-;;; Basic seq functions that have to be implemented by new sequence types
-(cl-defgeneric seq-elt (sequence n)
- "Return Nth element of SEQUENCE."
- (elt sequence n))
-
-;; Default gv setters for `seq-elt'.
-;; It can be a good idea for new sequence implementations to provide a
-;; "gv-setter" for `seq-elt'.
-(cl-defmethod (setf seq-elt) (store (sequence array) n)
- (aset sequence n store))
-
-(cl-defmethod (setf seq-elt) (store (sequence cons) n)
- (setcar (nthcdr n sequence) store))
-
-(cl-defgeneric seq-length (sequence)
- "Return the number of elements of SEQUENCE."
- (length sequence))
-
-(cl-defgeneric seq-do (function sequence)
- "Apply FUNCTION to each element of SEQUENCE, presumably for side effects.
-Return SEQUENCE."
- (mapc function sequence))
-
-(defalias 'seq-each #'seq-do)
-
-(cl-defgeneric seqp (sequence)
- "Return non-nil if SEQUENCE is a sequence, nil otherwise."
- (sequencep sequence))
-
-(cl-defgeneric seq-copy (sequence)
- "Return a shallow copy of SEQUENCE."
- (copy-sequence sequence))
-
-(cl-defgeneric seq-subseq (sequence start &optional end)
- "Return the sequence of elements of SEQUENCE from START to END.
-END is exclusive.
-
-If END is omitted, it defaults to the length of the sequence. If
-START or END is negative, it counts from the end. Signal an
-error if START or END are outside of the sequence (i.e too large
-if positive or too small if negative)."
- (cl-subseq sequence start end))
-
-
-(cl-defgeneric seq-map (function sequence)
- "Return the result of applying FUNCTION to each element of SEQUENCE."
- (let (result)
- (seq-do (lambda (elt)
- (push (funcall function elt) result))
- sequence)
- (nreverse result)))
-
-(defun seq-map-indexed (function sequence)
- "Return the result of applying FUNCTION to each element of SEQUENCE.
-Unlike `seq-map', FUNCTION takes two arguments: the element of
-the sequence, and its index within the sequence."
- (let ((index 0))
- (seq-map (lambda (elt)
- (prog1
- (funcall function elt index)
- (setq index (1+ index))))
- sequence)))
-
-;; faster implementation for sequences (sequencep)
-(cl-defmethod seq-map (function (sequence sequence))
- (mapcar function sequence))
-
-(cl-defgeneric seq-mapn (function sequence &rest sequences)
- "Like `seq-map' but FUNCTION is mapped over all SEQUENCES.
-The arity of FUNCTION must match the number of SEQUENCES, and the
-mapping stops on the shortest sequence.
-Return a list of the results.
-
-\(fn FUNCTION SEQUENCES...)"
- (let ((result nil)
- (sequences (seq-map (lambda (s)
- (seq-into s 'list))
- (cons sequence sequences))))
- (while (not (memq nil sequences))
- (push (apply function (seq-map #'car sequences)) result)
- (setq sequences (seq-map #'cdr sequences)))
- (nreverse result)))
-
-(cl-defgeneric seq-drop (sequence n)
- "Remove the first N elements of SEQUENCE and return the result.
-The result is a sequence of the same type as SEQUENCE.
-
-If N is a negative integer or zero, SEQUENCE is returned."
- (if (<= n 0)
- sequence
- (let ((length (seq-length sequence)))
- (seq-subseq sequence (min n length) length))))
-
-(cl-defgeneric seq-take (sequence n)
- "Take the first N elements of SEQUENCE and return the result.
-The result is a sequence of the same type as SEQUENCE.
-
-If N is a negative integer or zero, an empty sequence is
-returned."
- (seq-subseq sequence 0 (min (max n 0) (seq-length sequence))))
-
-(cl-defgeneric seq-drop-while (pred sequence)
- "Remove the successive elements of SEQUENCE for which PRED returns non-nil.
-PRED is a function of one argument. The result is a sequence of
-the same type as SEQUENCE."
- (seq-drop sequence (seq--count-successive pred sequence)))
-
-(cl-defgeneric seq-take-while (pred sequence)
- "Take the successive elements of SEQUENCE for which PRED returns non-nil.
-PRED is a function of one argument. The result is a sequence of
-the same type as SEQUENCE."
- (seq-take sequence (seq--count-successive pred sequence)))
-
-(cl-defgeneric seq-empty-p (sequence)
- "Return non-nil if the SEQUENCE is empty, nil otherwise."
- (= 0 (seq-length sequence)))
-
-(cl-defgeneric seq-sort (pred sequence)
- "Sort SEQUENCE using PRED as comparison function.
-The result is a sequence of the same type as SEQUENCE."
- (let ((result (seq-sort pred (append sequence nil))))
- (seq-into result (type-of sequence))))
-
-(defun seq-sort-by (function pred sequence)
- "Sort SEQUENCE using PRED as a comparison function.
-Elements of SEQUENCE are transformed by FUNCTION before being
-sorted. FUNCTION must be a function of one argument."
- (seq-sort (lambda (a b)
- (funcall pred
- (funcall function a)
- (funcall function b)))
- sequence))
-
-(cl-defmethod seq-sort (pred (list list))
- (sort (seq-copy list) pred))
-
-(cl-defgeneric seq-reverse (sequence)
- "Return a sequence with elements of SEQUENCE in reverse order."
- (let ((result '()))
- (seq-map (lambda (elt)
- (push elt result))
- sequence)
- (seq-into result (type-of sequence))))
-
-;; faster implementation for sequences (sequencep)
-(cl-defmethod seq-reverse ((sequence sequence))
- (reverse sequence))
-
-(cl-defgeneric seq-concatenate (type &rest sequences)
- "Concatenate SEQUENCES into a single sequence of type TYPE.
-TYPE must be one of following symbols: vector, string or list.
-
-\n(fn TYPE SEQUENCE...)"
- (apply #'cl-concatenate type (seq-map #'seq-into-sequence sequences)))
-
-(cl-defgeneric seq-into-sequence (sequence)
- "Convert SEQUENCE into a sequence.
-
-The default implementation is to signal an error if SEQUENCE is not a
-sequence, specific functions should be implemented for new types
-of sequence."
- (unless (sequencep sequence)
- (error "Cannot convert %S into a sequence" sequence))
- sequence)
-
-(cl-defgeneric seq-into (sequence type)
- "Concatenate the elements of SEQUENCE into a sequence of type TYPE.
-TYPE can be one of the following symbols: vector, string or
-list."
- (pcase type
- (`vector (seq--into-vector sequence))
- (`string (seq--into-string sequence))
- (`list (seq--into-list sequence))
- (_ (error "Not a sequence type name: %S" type))))
-
-(cl-defgeneric seq-filter (pred sequence)
- "Return a list of all the elements for which (PRED element) is non-nil in SEQUENCE."
- (let ((exclude (make-symbol "exclude")))
- (delq exclude (seq-map (lambda (elt)
- (if (funcall pred elt)
- elt
- exclude))
- sequence))))
-
-(cl-defgeneric seq-remove (pred sequence)
- "Return a list of all the elements for which (PRED element) is nil in SEQUENCE."
- (seq-filter (lambda (elt) (not (funcall pred elt)))
- sequence))
-
-(cl-defgeneric seq-reduce (function sequence initial-value)
- "Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
-
-Return the result of calling FUNCTION with INITIAL-VALUE and the
-first element of SEQUENCE, then calling FUNCTION with that result and
-the second element of SEQUENCE, then with that result and the third
-element of SEQUENCE, etc.
-
-If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
- (if (seq-empty-p sequence)
- initial-value
- (let ((acc initial-value))
- (seq-doseq (elt sequence)
- (setq acc (funcall function acc elt)))
- acc)))
-
-(cl-defgeneric seq-every-p (pred sequence)
- "Return non-nil if (PRED element) is non-nil for all elements of SEQUENCE."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (or (funcall pred elt)
- (throw 'seq--break nil)))
- t))
-
-(cl-defgeneric seq-some (pred sequence)
- "Return the first value for which if (PRED element) is non-nil for in SEQUENCE."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (let ((result (funcall pred elt)))
- (when result
- (throw 'seq--break result))))
- nil))
-
-(cl-defgeneric seq-find (pred sequence &optional default)
- "Return the first element for which (PRED element) is non-nil in SEQUENCE.
-If no element is found, return DEFAULT.
-
-Note that `seq-find' has an ambiguity if the found element is
-identical to DEFAULT, as it cannot be known if an element was
-found or not."
- (catch 'seq--break
- (seq-doseq (elt sequence)
- (when (funcall pred elt)
- (throw 'seq--break elt)))
- default))
-
-(cl-defgeneric seq-count (pred sequence)
- "Return the number of elements for which (PRED element) is non-nil in SEQUENCE."
- (let ((count 0))
- (seq-doseq (elt sequence)
- (when (funcall pred elt)
- (setq count (+ 1 count))))
- count))
-
-(cl-defgeneric seq-contains (sequence elt &optional testfn)
- "Return the first element in SEQUENCE that is equal to ELT.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-some (lambda (e)
- (funcall (or testfn #'equal) elt e))
- sequence))
-
-(cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn)
- "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements, regardless of order.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (and (seq-every-p (lambda (item1) (seq-contains sequence2 item1 testfn)) sequence1)
- (seq-every-p (lambda (item2) (seq-contains sequence1 item2 testfn)) sequence2)))
-
-(cl-defgeneric seq-position (sequence elt &optional testfn)
- "Return the index of the first element in SEQUENCE that is equal to ELT.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (let ((index 0))
- (catch 'seq--break
- (seq-doseq (e sequence)
- (when (funcall (or testfn #'equal) e elt)
- (throw 'seq--break index))
- (setq index (1+ index)))
- nil)))
-
-(cl-defgeneric seq-uniq (sequence &optional testfn)
- "Return a list of the elements of SEQUENCE with duplicates removed.
-TESTFN is used to compare elements, or `equal' if TESTFN is nil."
- (let ((result '()))
- (seq-doseq (elt sequence)
- (unless (seq-contains result elt testfn)
- (setq result (cons elt result))))
- (nreverse result)))
-
-(cl-defgeneric seq-mapcat (function sequence &optional type)
- "Concatenate the result of applying FUNCTION to each element of SEQUENCE.
-The result is a sequence of type TYPE, or a list if TYPE is nil."
- (apply #'seq-concatenate (or type 'list)
- (seq-map function sequence)))
-
-(cl-defgeneric seq-partition (sequence n)
- "Return a list of the elements of SEQUENCE grouped into sub-sequences of length N.
-The last sequence may contain less than N elements. If N is a
-negative integer or 0, nil is returned."
- (unless (< n 1)
- (let ((result '()))
- (while (not (seq-empty-p sequence))
- (push (seq-take sequence n) result)
- (setq sequence (seq-drop sequence n)))
- (nreverse result))))
-
-(cl-defgeneric seq-intersection (sequence1 sequence2 &optional testfn)
- "Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-reduce (lambda (acc elt)
- (if (seq-contains sequence2 elt testfn)
- (cons elt acc)
- acc))
- (seq-reverse sequence1)
- '()))
-
-(cl-defgeneric seq-difference (sequence1 sequence2 &optional testfn)
- "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2.
-Equality is defined by TESTFN if non-nil or by `equal' if nil."
- (seq-reduce (lambda (acc elt)
- (if (not (seq-contains sequence2 elt testfn))
- (cons elt acc)
- acc))
- (seq-reverse sequence1)
- '()))
-
-(cl-defgeneric seq-group-by (function sequence)
- "Apply FUNCTION to each element of SEQUENCE.
-Separate the elements of SEQUENCE into an alist using the results as
-keys. Keys are compared using `equal'."
- (seq-reduce
- (lambda (acc elt)
- (let* ((key (funcall function elt))
- (cell (assoc key acc)))
- (if cell
- (setcdr cell (push elt (cdr cell)))
- (push (list key elt) acc))
- acc))
- (seq-reverse sequence)
- nil))
-
-(cl-defgeneric seq-min (sequence)
- "Return the smallest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
- (apply #'min (seq-into sequence 'list)))
-
-(cl-defgeneric seq-max (sequence)
- "Return the largest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
- (apply #'max (seq-into sequence 'list)))
-
-(defun seq--count-successive (pred sequence)
- "Return the number of successive elements for which (PRED element) is non-nil in SEQUENCE."
- (let ((n 0)
- (len (seq-length sequence)))
- (while (and (< n len)
- (funcall pred (seq-elt sequence n)))
- (setq n (+ 1 n)))
- n))
-
-;;; Optimized implementations for lists
-
-(cl-defmethod seq-drop ((list list) n)
- "Optimized implementation of `seq-drop' for lists."
- (nthcdr n list))
-
-(cl-defmethod seq-take ((list list) n)
- "Optimized implementation of `seq-take' for lists."
- (let ((result '()))
- (while (and list (> n 0))
- (setq n (1- n))
- (push (pop list) result))
- (nreverse result)))
-
-(cl-defmethod seq-drop-while (pred (list list))
- "Optimized implementation of `seq-drop-while' for lists."
- (while (and list (funcall pred (car list)))
- (setq list (cdr list)))
- list)
-
-(cl-defmethod seq-empty-p ((list list))
- "Optimized implementation of `seq-empty-p' for lists."
- (null list))
-
-
-(defun seq--into-list (sequence)
- "Concatenate the elements of SEQUENCE into a list."
- (if (listp sequence)
- sequence
- (append sequence nil)))
-
-(defun seq--into-vector (sequence)
- "Concatenate the elements of SEQUENCE into a vector."
- (if (vectorp sequence)
- sequence
- (vconcat sequence)))
-
-(defun seq--into-string (sequence)
- "Concatenate the elements of SEQUENCE into a string."
- (if (stringp sequence)
- sequence
- (concat sequence)))
-
-(defun seq--make-pcase-bindings (args)
- "Return a list of bindings of the variables in ARGS to the elements of a sequence."
- (let ((bindings '())
- (index 0)
- (rest-marker nil))
- (seq-doseq (name args)
- (unless rest-marker
- (pcase name
- (`&rest
- (progn (push `(app (pcase--flip seq-drop ,index)
- ,(seq--elt-safe args (1+ index)))
- bindings)
- (setq rest-marker t)))
- (_
- (push `(app (pcase--flip seq--elt-safe ,index) ,name) bindings))))
- (setq index (1+ index)))
- bindings))
-
-(defun seq--make-pcase-patterns (args)
- "Return a list of `(seq ...)' pcase patterns from the argument list ARGS."
- (cons 'seq
- (seq-map (lambda (elt)
- (if (seqp elt)
- (seq--make-pcase-patterns elt)
- elt))
- args)))
-
-;; TODO: make public?
-(defun seq--elt-safe (sequence n)
- "Return element of SEQUENCE at the index N.
-If no element is found, return nil."
- (ignore-errors (seq-elt sequence n))))
-
-(cl-defgeneric seq-random-elt (sequence)
- "Return a random element from SEQUENCE.
-Signal an error if SEQUENCE is empty."
- (if (seq-empty-p sequence)
- (error "Sequence cannot be empty")
- (seq-elt sequence (random (seq-length sequence)))))
-
-(provide 'seq-25)
-;;; seq-25.el ends here
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-25.elc b/emacs/.emacs.d/elpa/seq-2.20/seq-25.elc
deleted file mode 100644
index 375e7f9..0000000
Binary files a/emacs/.emacs.d/elpa/seq-2.20/seq-25.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-autoloads.el b/emacs/.emacs.d/elpa/seq-2.20/seq-autoloads.el
deleted file mode 100644
index 56948a0..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/seq-autoloads.el
+++ /dev/null
@@ -1,16 +0,0 @@
-;;; seq-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil nil ("seq-24.el" "seq-25.el" "seq-pkg.el" "seq.el")
-;;;;;; (23124 14343 578725 703000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; seq-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.el b/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.el
deleted file mode 100644
index 0ce3587..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;; Generated package description from seq.el
-(define-package "seq" "2.20" "Sequence manipulation functions" 'nil :url "http://elpa.gnu.org/packages/seq.html" :keywords '("sequences"))
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.elc b/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.elc
deleted file mode 100644
index 1297641..0000000
Binary files a/emacs/.emacs.d/elpa/seq-2.20/seq-pkg.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq.el b/emacs/.emacs.d/elpa/seq-2.20/seq.el
deleted file mode 100644
index 83d4392..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/seq.el
+++ /dev/null
@@ -1,48 +0,0 @@
-;;; seq.el --- Sequence manipulation functions -*- lexical-binding: t -*-
-
-;; Copyright (C) 2014-2016 Free Software Foundation, Inc.
-
-;; Author: Nicolas Petton
-;; Keywords: sequences
-;; Version: 2.20
-;; Package: seq
-
-;; Maintainer: emacs-devel@gnu.org
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs. If not, see .
-
-;;; Commentary:
-
-;; Sequence-manipulation functions that complement basic functions
-;; provided by subr.el.
-;;
-;; All functions are prefixed with "seq-".
-;;
-;; All provided functions work on lists, strings and vectors.
-;;
-;; Functions taking a predicate or iterating over a sequence using a
-;; function as argument take the function as their first argument and
-;; the sequence as their second argument. All other functions take
-;; the sequence as their first argument.
-
-;;; Code:
-
-(if (version< emacs-version "25")
- (require 'seq-24)
- (require 'seq-25))
-
-(provide 'seq)
-;;; seq.el ends here
diff --git a/emacs/.emacs.d/elpa/seq-2.20/seq.elc b/emacs/.emacs.d/elpa/seq-2.20/seq.elc
deleted file mode 100644
index f729935..0000000
Binary files a/emacs/.emacs.d/elpa/seq-2.20/seq.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.el b/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.el
deleted file mode 100644
index d53fa36..0000000
--- a/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.el
+++ /dev/null
@@ -1,382 +0,0 @@
-;;; seq-tests.el --- Tests for sequences.el
-
-;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
-
-;; Author: Nicolas Petton
-;; Maintainer: emacs-devel@gnu.org
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs 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.
-
-;; GNU Emacs 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 GNU Emacs. If not, see .
-
-;;; Commentary:
-
-;; Tests for seq.el
-
-;;; Code:
-
-(require 'ert)
-(require 'seq)
-
-(defmacro with-test-sequences (spec &rest body)
- "Successively bind VAR to a list, vector, and string built from SEQ.
-Evaluate BODY for each created sequence.
-
-\(fn (var seq) body)"
- (declare (indent 1) (debug ((symbolp form) body)))
- (let ((initial-seq (make-symbol "initial-seq")))
- `(let ((,initial-seq ,(cadr spec)))
- ,@(mapcar (lambda (s)
- `(let ((,(car spec) (apply (function ,s) ,initial-seq)))
- ,@body))
- '(list vector string)))))
-
-(defun same-contents-p (seq1 seq2)
- "Return t if SEQ1 and SEQ2 have the same contents, nil otherwise."
- (equal (append seq1 '()) (append seq2 '())))
-
-(defun test-sequences-evenp (integer)
- "Return t if INTEGER is even."
- (eq (logand integer 1) 0))
-
-(defun test-sequences-oddp (integer)
- "Return t if INTEGER is odd."
- (not (test-sequences-evenp integer)))
-
-(ert-deftest test-seq-drop ()
- (with-test-sequences (seq '(1 2 3 4))
- (should (equal (seq-drop seq 0) seq))
- (should (equal (seq-drop seq 1) (seq-subseq seq 1)))
- (should (equal (seq-drop seq 2) (seq-subseq seq 2)))
- (should (seq-empty-p (seq-drop seq 4)))
- (should (seq-empty-p (seq-drop seq 10))))
- (with-test-sequences (seq '())
- (should (seq-empty-p (seq-drop seq 0)))
- (should (seq-empty-p (seq-drop seq 1)))))
-
-(ert-deftest test-seq-take ()
- (with-test-sequences (seq '(2 3 4 5))
- (should (seq-empty-p (seq-take seq 0)))
- (should (= (seq-length (seq-take seq 1)) 1))
- (should (= (seq-elt (seq-take seq 1) 0) 2))
- (should (same-contents-p (seq-take seq 3) '(2 3 4)))
- (should (equal (seq-take seq 10) seq))))
-
-(ert-deftest test-seq-drop-while ()
- (with-test-sequences (seq '(1 3 2 4))
- (should (equal (seq-drop-while #'test-sequences-oddp seq)
- (seq-drop seq 2)))
- (should (equal (seq-drop-while #'test-sequences-evenp seq)
- seq))
- (should (seq-empty-p (seq-drop-while #'numberp seq))))
- (with-test-sequences (seq '())
- (should (seq-empty-p (seq-drop-while #'test-sequences-oddp seq)))))
-
-(ert-deftest test-seq-take-while ()
- (with-test-sequences (seq '(1 3 2 4))
- (should (equal (seq-take-while #'test-sequences-oddp seq)
- (seq-take seq 2)))
- (should (seq-empty-p (seq-take-while #'test-sequences-evenp seq)))
- (should (equal (seq-take-while #'numberp seq) seq)))
- (with-test-sequences (seq '())
- (should (seq-empty-p (seq-take-while #'test-sequences-oddp seq)))))
-
-(ert-deftest test-seq-map-indexed ()
- (should (equal (seq-map-indexed (lambda (elt i)
- (list elt i))
- nil)
- nil))
- (should (equal (seq-map-indexed (lambda (elt i)
- (list elt i))
- '(a b c d))
- '((a 0) (b 1) (c 2) (d 3)))))
-
-(ert-deftest test-seq-filter ()
- (with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-filter #'test-sequences-evenp seq) '(6 8 10)))
- (should (equal (seq-filter #'test-sequences-oddp seq) '(7 9)))
- (should (equal (seq-filter (lambda (elt) nil) seq) '())))
- (with-test-sequences (seq '())
- (should (equal (seq-filter #'test-sequences-evenp seq) '()))))
-
-(ert-deftest test-seq-remove ()
- (with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-remove #'test-sequences-evenp seq) '(7 9)))
- (should (equal (seq-remove #'test-sequences-oddp seq) '(6 8 10)))
- (should (same-contents-p (seq-remove (lambda (elt) nil) seq) seq)))
- (with-test-sequences (seq '())
- (should (equal (seq-remove #'test-sequences-evenp seq) '()))))
-
-(ert-deftest test-seq-count ()
- (with-test-sequences (seq '(6 7 8 9 10))
- (should (equal (seq-count #'test-sequences-evenp seq) 3))
- (should (equal (seq-count #'test-sequences-oddp seq) 2))
- (should (equal (seq-count (lambda (elt) nil) seq) 0)))
- (with-test-sequences (seq '())
- (should (equal (seq-count #'test-sequences-evenp seq) 0))))
-
-(ert-deftest test-seq-reduce ()
- (with-test-sequences (seq '(1 2 3 4))
- (should (= (seq-reduce #'+ seq 0) 10))
- (should (= (seq-reduce #'+ seq 5) 15)))
- (with-test-sequences (seq '())
- (should (eq (seq-reduce #'+ seq 0) 0))
- (should (eq (seq-reduce #'+ seq 7) 7))))
-
-(ert-deftest test-seq-some ()
- (with-test-sequences (seq '(4 3 2 1))
- (should (seq-some #'test-sequences-evenp seq))
- (should (seq-some #'test-sequences-oddp seq))
- (should-not (seq-some (lambda (elt) (> elt 10)) seq)))
- (with-test-sequences (seq '())
- (should-not (seq-some #'test-sequences-oddp seq)))
- (should (seq-some #'null '(1 nil 2))))
-
-(ert-deftest test-seq-find ()
- (with-test-sequences (seq '(4 3 2 1))
- (should (= 4 (seq-find #'test-sequences-evenp seq)))
- (should (= 3 (seq-find #'test-sequences-oddp seq)))
- (should-not (seq-find (lambda (elt) (> elt 10)) seq)))
- (should-not (seq-find #'null '(1 nil 2)))
- (should-not (seq-find #'null '(1 nil 2) t))
- (should-not (seq-find #'null '(1 2 3)))
- (should (seq-find #'null '(1 2 3) 'sentinel)))
-
-(ert-deftest test-seq-contains ()
- (with-test-sequences (seq '(3 4 5 6))
- (should (seq-contains seq 3))
- (should-not (seq-contains seq 7)))
- (with-test-sequences (seq '())
- (should-not (seq-contains seq 3))
- (should-not (seq-contains seq nil))))
-
-(ert-deftest test-seq-every-p ()
- (with-test-sequences (seq '(43 54 22 1))
- (should (seq-every-p (lambda (elt) t) seq))
- (should-not (seq-every-p #'test-sequences-oddp seq))
- (should-not (seq-every-p #'test-sequences-evenp seq)))
- (with-test-sequences (seq '(42 54 22 2))
- (should (seq-every-p #'test-sequences-evenp seq))
- (should-not (seq-every-p #'test-sequences-oddp seq)))
- (with-test-sequences (seq '())
- (should (seq-every-p #'identity seq))
- (should (seq-every-p #'test-sequences-evenp seq))))
-
-(ert-deftest test-seq-empty-p ()
- (with-test-sequences (seq '(0))
- (should-not (seq-empty-p seq)))
- (with-test-sequences (seq '(0 1 2))
- (should-not (seq-empty-p seq)))
- (with-test-sequences (seq '())
- (should (seq-empty-p seq))))
-
-(ert-deftest test-seq-sort ()
- (should (equal (seq-sort #'< "cbaf") "abcf"))
- (should (equal (seq-sort #'< '(2 1 9 4)) '(1 2 4 9)))
- (should (equal (seq-sort #'< [2 1 9 4]) [1 2 4 9]))
- (should (equal (seq-sort #'< "") "")))
-
-(ert-deftest test-seq-uniq ()
- (with-test-sequences (seq '(2 4 6 8 6 4 3))
- (should (equal (seq-uniq seq) '(2 4 6 8 3))))
- (with-test-sequences (seq '(3 3 3 3 3))
- (should (equal (seq-uniq seq) '(3))))
- (with-test-sequences (seq '())
- (should (equal (seq-uniq seq) '()))))
-
-(ert-deftest test-seq-subseq ()
- (with-test-sequences (seq '(2 3 4 5))
- (should (equal (seq-subseq seq 0 4) seq))
- (should (same-contents-p (seq-subseq seq 2 4) '(4 5)))
- (should (same-contents-p (seq-subseq seq 1 3) '(3 4)))
- (should (same-contents-p (seq-subseq seq 1 -1) '(3 4))))
- (should (vectorp (seq-subseq [2 3 4 5] 2)))
- (should (stringp (seq-subseq "foo" 2 3)))
- (should (listp (seq-subseq '(2 3 4 4) 2 3)))
- (should-error (seq-subseq '(1 2 3) 4))
- (should-not (seq-subseq '(1 2 3) 3))
- (should (seq-subseq '(1 2 3) -3))
- (should-error (seq-subseq '(1 2 3) 1 4))
- (should (seq-subseq '(1 2 3) 1 3)))
-
-(ert-deftest test-seq-concatenate ()
- (with-test-sequences (seq '(2 4 6))
- (should (equal (seq-concatenate 'string seq [8]) (string 2 4 6 8)))
- (should (equal (seq-concatenate 'list seq '(8 10)) '(2 4 6 8 10)))
- (should (equal (seq-concatenate 'vector seq '(8 10)) [2 4 6 8 10]))
- (should (equal (seq-concatenate 'vector nil '(8 10)) [8 10]))
- (should (equal (seq-concatenate 'vector seq nil) [2 4 6]))))
-
-(ert-deftest test-seq-mapcat ()
- (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)))
- '(1 2 3 4 5 6)))
- (should (equal (seq-mapcat #'seq-reverse '[(3 2 1) (6 5 4)])
- '(1 2 3 4 5 6)))
- (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector)
- '[1 2 3 4 5 6])))
-
-(ert-deftest test-seq-partition ()
- (should (same-contents-p (seq-partition '(0 1 2 3 4 5 6 7) 3)
- '((0 1 2) (3 4 5) (6 7))))
- (should (same-contents-p (seq-partition '[0 1 2 3 4 5 6 7] 3)
- '([0 1 2] [3 4 5] [6 7])))
- (should (same-contents-p (seq-partition "Hello world" 2)
- '("He" "ll" "o " "wo" "rl" "d")))
- (should (equal (seq-partition '() 2) '()))
- (should (equal (seq-partition '(1 2 3) -1) '())))
-
-(ert-deftest test-seq-group-by ()
- (with-test-sequences (seq '(1 2 3 4))
- (should (equal (seq-group-by #'test-sequences-oddp seq)
- '((t 1 3) (nil 2 4)))))
- (should (equal (seq-group-by #'car '((a 1) (b 3) (c 4) (a 2)))
- '((b (b 3)) (c (c 4)) (a (a 1) (a 2))))))
-
-(ert-deftest test-seq-reverse ()
- (with-test-sequences (seq '(1 2 3 4))
- (should (same-contents-p (seq-reverse seq) '(4 3 2 1)))
- (should (equal (type-of (seq-reverse seq))
- (type-of seq)))))
-
-(ert-deftest test-seq-into ()
- (let* ((vector [1 2 3])
- (list (seq-into vector 'list)))
- (should (same-contents-p vector list))
- (should (listp list)))
- (let* ((list '(hello world))
- (vector (seq-into list 'vector)))
- (should (same-contents-p vector list))
- (should (vectorp vector)))
- (let* ((string "hello")
- (list (seq-into string 'list)))
- (should (same-contents-p string list))
- (should (stringp string)))
- (let* ((string "hello")
- (vector (seq-into string 'vector)))
- (should (same-contents-p string vector))
- (should (stringp string)))
- (let* ((list nil)
- (vector (seq-into list 'vector)))
- (should (same-contents-p list vector))
- (should (vectorp vector))))
-
-(ert-deftest test-seq-intersection ()
- (let ((v1 [2 3 4 5])
- (v2 [1 3 5 6 7]))
- (should (same-contents-p (seq-intersection v1 v2)
- '(3 5))))
- (let ((l1 '(2 3 4 5))
- (l2 '(1 3 5 6 7)))
- (should (same-contents-p (seq-intersection l1 l2)
- '(3 5))))
- (let ((v1 [2 4 6])
- (v2 [1 3 5]))
- (should (seq-empty-p (seq-intersection v1 v2)))))
-
-(ert-deftest test-seq-difference ()
- (let ((v1 [2 3 4 5])
- (v2 [1 3 5 6 7]))
- (should (same-contents-p (seq-difference v1 v2)
- '(2 4))))
- (let ((l1 '(2 3 4 5))
- (l2 '(1 3 5 6 7)))
- (should (same-contents-p (seq-difference l1 l2)
- '(2 4))))
- (let ((v1 [2 4 6])
- (v2 [2 4 6]))
- (should (seq-empty-p (seq-difference v1 v2)))))
-
-(ert-deftest test-seq-let ()
- (with-test-sequences (seq '(1 2 3 4))
- (seq-let (a b c d e) seq
- (should (= a 1))
- (should (= b 2))
- (should (= c 3))
- (should (= d 4))
- (should (null e)))
- (seq-let (a b &rest others) seq
- (should (= a 1))
- (should (= b 2))
- (should (same-contents-p others (seq-drop seq 2)))))
- (let ((seq '(1 (2 (3 (4))))))
- (seq-let (_ (_ (_ (a)))) seq
- (should (= a 4))))
- (let (seq)
- (seq-let (a b c) seq
- (should (null a))
- (should (null b))
- (should (null c)))))
-
-(ert-deftest test-seq-min-max ()
- (with-test-sequences (seq '(4 5 3 2 0 4))
- (should (= (seq-min seq) 0))
- (should (= (seq-max seq) 5))))
-
-(ert-deftest test-seq-position ()
- (with-test-sequences (seq '(2 4 6))
- (should (null (seq-position seq 1)))
- (should (= (seq-position seq 4) 1)))
- (let ((seq '(a b c)))
- (should (null (seq-position seq 'd #'eq)))
- (should (= (seq-position seq 'a #'eq) 0))
- (should (null (seq-position seq (make-symbol "a") #'eq)))))
-
-(ert-deftest test-seq-mapn ()
- (should-error (seq-mapn #'identity))
- (with-test-sequences (seq '(1 2 3 4 5 6 7))
- (should (equal (append seq nil)
- (seq-mapn #'identity seq)))
- (should (equal (seq-mapn #'1+ seq)
- (seq-map #'1+ seq)))
-
- (with-test-sequences (seq-2 '(10 20 30 40 50))
- (should (equal (seq-mapn #'+ seq seq-2)
- '(11 22 33 44 55)))
- (should (equal (seq-mapn #'+ seq seq-2 nil) nil)))))
-
-(ert-deftest test-seq-sort-by ()
- (let ((seq ["x" "xx" "xxx"]))
- (should (equal (seq-sort-by #'seq-length #'> seq)
- ["xxx" "xx" "x"]))))
-
-(ert-deftest test-seq-random-elt-take-all ()
- (let ((seq '(a b c d e))
- (elts '()))
- (should (= 0 (length elts)))
- (dotimes (_ 1000)
- (let ((random-elt (seq-random-elt seq)))
- (add-to-list 'elts
- random-elt)))
- (should (= 5 (length elts)))))
-
-(ert-deftest test-seq-random-elt-signal-on-empty ()
- (should-error (seq-random-elt nil))
- (should-error (seq-random-elt []))
- (should-error (seq-random-elt "")))
-
-(ert-deftest test-seq-mapn-circular-lists ()
- (let ((l1 '#1=(1 . #1#)))
- (should (equal (seq-mapn #'+ '(3 4 5 7) l1)
- '(4 5 6 8)))))
-
-(ert-deftest test-seq-into-and-identity ()
- (let ((lst '(1 2 3))
- (vec [1 2 3])
- (str "foo bar"))
- (should (eq (seq-into lst 'list) lst))
- (should (eq (seq-into vec 'vector) vec))
- (should (eq (seq-into str 'string) str))))
-
-(provide 'seq-tests)
-;;; seq-tests.el ends here
diff --git a/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.elc b/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.elc
deleted file mode 100644
index 1d8b9c2..0000000
Binary files a/emacs/.emacs.d/elpa/seq-2.20/tests/seq-tests.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-autoloads.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-autoloads.el
deleted file mode 100644
index a6dbd83..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-autoloads.el
+++ /dev/null
@@ -1,58 +0,0 @@
-;;; smart-mode-line-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "smart-mode-line" "smart-mode-line.el" (23124
-;;;;;; 14369 65512 482000))
-;;; Generated autoloads from smart-mode-line.el
-
-(when load-file-name (let ((dir (file-name-as-directory (file-name-directory load-file-name)))) (add-to-list 'custom-theme-load-path dir) (when (file-directory-p (file-name-as-directory (concat dir "themes"))) (add-to-list 'custom-theme-load-path (file-name-as-directory (concat dir "themes"))))))
-
-(autoload 'sml/setup "smart-mode-line" "\
-Setup the mode-line to be smart and sexy.
-
-ARG is ignored. Just call this function in your init file, and
-the mode-line will be setup.
-
-\(fn &optional ARG)" t nil)
-
-(defalias 'smart-mode-line-enable #'sml/setup)
-
-;;;***
-
-;;;### (autoloads nil "smart-mode-line-dark-theme" "smart-mode-line-dark-theme.el"
-;;;;;; (23124 14369 82179 227000))
-;;; Generated autoloads from smart-mode-line-dark-theme.el
-
-(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
-
-;;;***
-
-;;;### (autoloads nil "smart-mode-line-light-theme" "smart-mode-line-light-theme.el"
-;;;;;; (23124 14369 58845 784000))
-;;; Generated autoloads from smart-mode-line-light-theme.el
-
-(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
-
-;;;***
-
-;;;### (autoloads nil "smart-mode-line-respectful-theme" "smart-mode-line-respectful-theme.el"
-;;;;;; (23124 14369 52179 86000))
-;;; Generated autoloads from smart-mode-line-respectful-theme.el
-
-(when load-file-name (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
-
-;;;***
-
-;;;### (autoloads nil nil ("smart-mode-line-pkg.el") (23124 14369
-;;;;;; 75512 529000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; smart-mode-line-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.el
deleted file mode 100644
index ce97ea3..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.el
+++ /dev/null
@@ -1,49 +0,0 @@
-;;; smart-mode-line-dark-theme.el --- Dark theme for smart-mode-line
-
-;; Copyright (C) 2014 Artur Malabarba
-
-;; Author: Artur Malabarba
-;; URL: http://github.com/Bruce-Connor/smart-mode-line
-;; Separator: -
-
-;;; License:
-;;
-;; 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 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.
-;;
-
-;;; Change Log:
-;; 0.1a - 2014/05/14 - Created File.
-;;; Code:
-
-(deftheme smart-mode-line-dark "Dark theme for smart-mode-line.")
-
-(custom-theme-set-faces
- 'smart-mode-line-dark
- '(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil)))
- '(mode-line-inactive ((t :foreground "gray60" :background "#404045" :inverse-video nil)))
- '(mode-line ((t :foreground "gray60" :background "black" :inverse-video nil)))
- '(sml/global ((t :foreground "gray50" :inverse-video nil)))
- '(sml/modes ((t :inherit sml/global :foreground "White")))
- '(sml/filename ((t :inherit sml/global :foreground "#eab700" :weight bold)))
- '(sml/prefix ((t :inherit sml/global :foreground "#bf6000")))
- '(sml/read-only ((t :inherit sml/not-modified :foreground "DeepSkyBlue")))
- '(persp-selected-face ((t :foreground "ForestGreen" :inherit sml/filename)))
- '(helm-candidate-number ((t :foreground nil :background nil :inherit sml/filename))))
-
-;;;###autoload
-(when load-file-name
- (add-to-list 'custom-theme-load-path
- (file-name-as-directory (file-name-directory load-file-name))))
-
-(provide-theme 'smart-mode-line-dark)
-;;; smart-mode-line-dark-theme.el ends here.
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.elc b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.elc
deleted file mode 100644
index 499dd99..0000000
Binary files a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-dark-theme.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.el
deleted file mode 100644
index 0629a29..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.el
+++ /dev/null
@@ -1,47 +0,0 @@
-;;; smart-mode-line-light-theme.el --- Light theme for smart-mode-line
-
-;; Copyright (C) 2014 Artur Malabarba
-
-;; Author: Artur Malabarba
-;; URL: http://github.com/Bruce-Connor/smart-mode-line
-;; Separator: -
-
-;;; License:
-;;
-;; 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 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.
-;;
-
-;;; Change Log:
-;; 0.1a - 2014/05/14 - Created File.
-;;; Code:
-
-(deftheme smart-mode-line-light "Light theme for smart-mode-line.")
-
-(custom-theme-set-faces
- 'smart-mode-line-light
- '(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil)))
- '(mode-line-inactive ((t :foreground "grey20" :background "#fdf6e3" :inverse-video nil)))
- '(mode-line ((t :foreground "black" :background "grey85" :inverse-video nil)))
- '(sml/global ((t :foreground "gray20" :inverse-video nil)))
- '(sml/modes ((t :inherit sml/global :foreground "Black")))
- '(sml/filename ((t :inherit sml/global :foreground "Blue" :weight bold)))
- '(sml/prefix ((t :inherit sml/global :foreground "#5b2507" :weight bold)))
- '(sml/read-only ((t :inherit sml/not-modified :foreground "DarkGreen" :weight bold))))
-
-;;;###autoload
-(when load-file-name
- (add-to-list 'custom-theme-load-path
- (file-name-as-directory (file-name-directory load-file-name))))
-
-(provide-theme 'smart-mode-line-light)
-;;; smart-mode-line-light-theme.el ends here.
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.elc b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.elc
deleted file mode 100644
index d45d30b..0000000
Binary files a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-light-theme.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-pkg.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-pkg.el
deleted file mode 100644
index 4e19fc0..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-pkg.el
+++ /dev/null
@@ -1,8 +0,0 @@
-(define-package "smart-mode-line" "20171013.849" "A color coded smart mode-line."
- '((emacs "24.3")
- (rich-minority "0.1.1"))
- :url "http://github.com/Malabarba/smart-mode-line" :keywords
- '("mode-line" "faces" "themes"))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.el
deleted file mode 100644
index cd1ae86..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.el
+++ /dev/null
@@ -1,49 +0,0 @@
-;;; smart-mode-line-respectful-theme.el --- Respectful theme for smart-mode-line
-
-;; Copyright (C) 2014 Artur Malabarba
-
-;; Author: Artur Malabarba
-;; URL: http://github.com/Bruce-Connor/smart-mode-line
-;; Separator: -
-
-;;; License:
-;;
-;; 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 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.
-;;
-
-;;; Change Log:
-;; 0.1a - 2014/05/14 - Created File.
-;;; Code:
-
-(deftheme smart-mode-line-respectful
- "Respectful theme for smart-mode-line.
-Tries to respect the colors chosen by your global theme.
-Results may vary.")
-
-(custom-theme-set-faces
- 'smart-mode-line-respectful
- '(mode-line-inactive ((t :inverse-video nil)))
- '(mode-line ((t :inverse-video nil)))
- '(sml/global ((t :inherit font-lock-preprocessor-face)))
- '(sml/filename ((t :inherit mode-line-buffer-id)))
- '(sml/prefix ((t :inherit (font-lock-variable-name-face sml/global))))
- '(sml/read-only ((t :inherit (font-lock-type-face sml/not-modified))))
- '(sml/modes ((t :foreground nil :inherit sml/filename :weight normal))))
-
-;;;###autoload
-(when load-file-name
- (add-to-list 'custom-theme-load-path
- (file-name-as-directory (file-name-directory load-file-name))))
-
-(provide-theme 'smart-mode-line-respectful)
-;;; smart-mode-line-respectful-theme.el ends here.
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.elc b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.elc
deleted file mode 100644
index 1f388e0..0000000
Binary files a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line-respectful-theme.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.el b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.el
deleted file mode 100644
index 682e0e7..0000000
--- a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.el
+++ /dev/null
@@ -1,1746 +0,0 @@
-;;; smart-mode-line.el --- A color coded smart mode-line.
-
-;; Copyright (C) 2012 Artur Malabarba
-
-;; Author: Artur Malabarba
-;; URL: http://github.com/Malabarba/smart-mode-line
-;; Version: 2.10
-;; Package-Requires: ((emacs "24.3") (rich-minority "0.1.1"))
-;; Keywords: mode-line faces themes
-;; Prefix: sml
-;; Separator: /
-
-;;; Commentary:
-;;
-;; Smart Mode Line is a sexy mode-line for Emacs. It aims to be easy to
-;; read from small to large monitors by using *colors*, a *prefix feature*, and
-;; *smart truncation*.
-;;
-;; New in v2.5
-;; ===========
-;; - Emacs 24.4 compatible.
-;; - Integration with [Projectile](https://github.com/bbatsov/projectile)!
-;; - Display `current-directory' in Shell and eshell.
-;; - New value for `sml/theme': `automatic' (highly recommended).
-;; - `sml/apply-theme' is interactive and has completion.
-;; - Smart-mode-line themes are now regular themes.
-;;
-;; Installation
-;; ===
-;; **smart-mode-line** is available on Melpa, and that's the recommended
-;; way of installing it. If you do that, you can simply activate it with:
-;;
-;; (sml/setup)
-;;
-;; To set the color theme, do one of the following BEFORE `sml/setup`:
-;;
-;; (setq sml/theme 'dark)
-;; (setq sml/theme 'light)
-;; (setq sml/theme 'respectful)
-;;
-;; Features
-;; ===
-;; Its main features include:
-;;
-;; 1. **Color coded**:
-;; Highlights the most important information for you
-;; (buffer name, modified state, line number). Don't
-;; like the colors? See item *5.*!
-;;
-;; 2. **Fixed width** (if you want):
-;; Lets you set a maxium width for the path name and mode names, and
-;; truncates them intelligently (truncates the directory, not the
-;; buffer name). Also let's you **right indent** strings in the
-;; mode-line (see `sml/mode-width').
-;;
-;; 3. **Directory as Prefixes**:
-;; Prefix feature saves a LOT of space. e.g. *"~/.emacs.d/"*
-;; is translated to *":ED:"* in the path (open a file inside
-;; this folder to see it in action). Long path names you
-;; are commonly working on are displayed as short
-;; abbreviations. Set your own prefixes to make best use
-;; of it (by configuring `sml/replacer-regexp-list'). Mousing
-;; over the abbreviated path will show you the full
-;; path. See below for examples.
-;;
-;; 4. **Hide or Highlight minor-modes**:
-;; The [rich-minority](https://github.com/Malabarba/rich-minority)
-;; package saves even more space. Select which minor modes you don't
-;; want to see listed by adding them to the variable
-;; `rm-excluded-modes', or even highlight the modes that are more
-;; important with the variable `rm-text-properties'. This will filter
-;; out the modes you don't care about and unclutter the modes list
-;; (mousing over the modes list still shows the full list).
-;;
-;; 4. **Hide minor-modes**:
-;; Hidden-modes feature saves even more space. Select
-;; which minor modes you don't want to see listed by
-;; customizing the `rm-blacklist' variable. This will
-;; filter out the modes you don't care about and unclutter
-;; the modes list (mousing over the modes list still shows
-;; the full list).
-;;
-;; 5. **Very easy to configure**:
-;; All colors and variables are customizable. You can change the
-;; whole theme with `sml/apply-theme', or just customize anything
-;; manually with `sml/customize' and `sml/customize-faces'. There are
-;; *DOZENS* of variables to customize your mode-line, just pop over
-;; there and have a look!
-;;
-;; 6. **Compatible with absolutely anything**:
-;; I'm serious. Versions 2.0 and above should be compatible with
-;; **any** other packages that display information in the mode-line
-;; (evil, nyan-mode, elscreen, display-battery-mode, etc). If you
-;; find *ANYTHING* that does not appear as it should, file a bug report
-;; and I'll get to it.
-;;
-;; Important Variables:
-;; ===
-;; All variables can be edited by running `sml/customize', and the
-;; documentations are mostly self explanatory, I list here only the
-;; most important ones.
-;;
-;; 1. `sml/theme'
-;; Choose what theme you want to use for the mode-line colors. For now
-;; there are 3 different themes: `dark', `light', and `respectful'.
-;;
-;; 1. `sml/shorten-directory' and `sml/shorten-modes'
-;; Setting both of these to `t' guarantees a fixed width mode-line
-;; (directory name and minor-modes list will be truncated to fit). To
-;; actually define the width, see below.
-;;
-;; 2. `sml/name-width' and `sml/mode-width'
-;; Customize these according to the width of your Emacs frame. I set
-;; them to `40' and `full' respectively, and the mode-line fits
-;; perfectly when the frame is split in two even on my laptop's small
-;; 17" monitor. `full' means everything after the minor-modes will be
-;; right-indented.
-;;
-;; 3. `sml/replacer-regexp-list'
-;; This variable is a list of (REGEXP REPLACEMENT) that is used
-;; to parse the path. The replacements are applied
-;; sequentially. This allows you to greatly abbreviate the path
-;; that's shown in the mode-line. If this abbreviation is of
-;; the form *":SOMETHING:"*, it is considered a prefix and get's
-;; a different color (you can change what's considered a prefix
-;; by customizing `sml/prefix-regexp').
-;; For example, if you do a lot of work on a folder called
-;; *"~/Dropbox/Projects/In-Development/"* almost half the
-;; mode-line would be occupied just by the folder name, which
-;; is much less important than the buffer name. But, you can't
-;; just hide the folder name, since editing a file in
-;; *"~/Dropbox/Projects/In-Development/Source"* is VERY different
-;; from editting a file in *"~/Dropbox/Projects/Source"*. By
-;; setting up a prefix for your commonly used folders, you get
-;; all that information without wasting all that space. In this
-;; example you could set the replacement to *":ProjDev:"* or just
-;; *":InDev:"*, so the path shown in the mode-line will be
-;; *":ProjDev:Source/"* (saves a lot of space without hiding
-;; information).
-;;
-;; Here go some more useful examples:
-;;
-;; (add-to-list 'sml/replacer-regexp-list '("^~/Dropbox/Projects/In-Development/" ":ProjDev:") t)
-;; (add-to-list 'sml/replacer-regexp-list '("^~/Documents/Work/" ":Work:") t)
-;;
-;; ;; Added in the right order, they even work sequentially:
-;; (add-to-list 'sml/replacer-regexp-list '("^~/Dropbox/" ":DB:") t)
-;; (add-to-list 'sml/replacer-regexp-list '("^:DB:Documents" ":DDocs:") t)
-;; (add-to-list 'sml/replacer-regexp-list '("^~/Git-Projects/" ":Git:") t)
-;; (add-to-list 'sml/replacer-regexp-list '("^:Git:\\(.*\\)/src/main/java/" ":G/\\1/SMJ:") t)
-
-;;; License:
-;;
-;; 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 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.
-;;
-
-;;; Change Log:
-;; 2.6 - 2014/08/15 - Allow for sml/name-width to have different mininum and maximum values.
-;; 2.6 - 2014/08/15 - Delegated minor-mode filtering to rich-minority package.
-;; 2.5.3 - 2014/06/18 - Fix custom-theme-load-path for manual installations.
-;; 2.5.2 - 2014/06/16 - sml/no-confirm-load-theme variable to skip theme confirmation.
-;; 2.5.1 - 2014/06/16 - sml/apply-theme no-confirm in daemon mode.
-;; 2.5 - 2014/05/15 - sml/theme: New possible values: 'automatic (highly recommended) or nil.
-;; 2.5 - 2014/05/14 - sml/mode-width: New possible value: 'right.
-;; 2.5 - 2014/05/14 - Themes engine completely redone.
-;; 2.5 - 2014/05/14 - sml/apply-theme is interactive.
-;; 2.4.5 - 2014/04/24 - Changed default value of sml/mode-width back to 'full.
-;; 2.4.3 - 2014/03/25 - sml/mode-line-buffer-identification fix for ggtags.
-;; 2.4.2 - 2014/03/13 - Perspective support simplified to sml/apply-theme.
-;; 2.4.2 - 2014/03/13 - Projectile integration only applies after the user replacements (to change, see sml/use-projectile-p).
-;; 2.4.1 - 2014/03/11 - Small fix to dired-mode with uniquify.
-;; 2.4 - 2014/03/10 - Projectile integration! To disable it, set sml/use-projectile-p.
-;; 2.4 - 2014/03/10 - Change the order of line/column numbers with sml/order-of-line-and-column.
-;; 2.4 - 2014/03/10 - Take over dired's buffer-identification. We will undo this if dired ever does anything special with this variable.
-;; 2.4 - 2014/03/10 - Show current-directory in Shell and eshell.
-;; 2.4 - 2014/03/10 - Tested against 24.4.
-;; 2.4 - 2014/03/10 - Ditch total number of lines count.
-;; 2.3.13 - 2014/03/05 - sml/apply-theme forces our foreground/background colors.
-;; 2.3.12 - 2014/03/05 - Use sml/show-remote to hide/show the "@" symbol. .
-;; 2.3.12 - 2014/03/05 - Support showing tramp state (remote buffer).
-;; 2.3.12 - 2014/02/27 - sml/apply-theme avoids nesting.
-;; 2.3.11 - 2014/02/15 - Silent sml/apply-theme.
-;; 2.3.10 - 2014/02/15 - Fix sml/setup ignoring sml/theme.
-;; 2.3.9 - 2014/02/10 - sml/hidden-modes allows regexps.
-;; 2.3.8 - 2014/02/07 - Buffer identification width auto-updates when sml/name-width changes.
-;; 2.3.8 - 2014/02/07 - sml/apply-theme customizes helm-candidate-number.
-;; 2.3.7 - 2014/01/21 - Adapt sml/generate-buffer-identification.
-;; 2.3.6 - 2013/12/16 - sml/replacer follows symlinks.
-;; 2.3.6 - 2013/12/16 - Fix filling and name on the very first update of non-file buffers.
-;; 2.3.5 - 2013/12/14 - sml/generate-position-help runs less often now.
-;; 2.3.4 - 2013/12/14 - Remove lag-inducing advice.
-;; 2.3.3 - 2013/12/09 - Fix sml/get-directory for files attached to mails - Thanks tsdh.
-;; 2.3.2 - 2013/12/07 - Fix for themes which set :inverse-video t in the mode-line.
-;; 2.3.1 - 2013/12/04 - sml/show-frame-identification now always defaults to nil.
-;; 2.3.1 - 2013/12/04 - Fix for sml/show-client not working.
-;; 2.3 - 2013/12/04 - sml/show-frame-identification only t for terminals.
-;; 2.3 - 2013/12/03 - Mark boolean's as safe-local-variables.
-;; 2.2.3 - 2013/12/03 - Fix possible recursion in sml/apply-theme.
-;; 2.2.2 - 2013/11/27 - Fix sml/apply-theme to consider saved faces.
-;; 2.2.1 - 2013/11/27 - Fix doc for sml/show-frame-identification.
-;; 2.2 - 2013/11/26 - Better minor list and some fixes.
-;; 2.0.5 - 2013/11/24 - sml/revert no longer available.
-;; 2.0.4 - 2013/11/24 - Improved faces a little.
-;; 2.0.3.4 - 2013/11/15 - Workaround to prevent core dump.
-;; 2.0.3.3 - 2013/11/13 - Small fix on sml/generate-buffer-identification for man pages.
-;; 2.0.3.2 - 2013/11/12 - sml/filter-mode-line-list now uses remove nil.
-;; 2.0.3.1 - 2013/11/08 - Quick fix sml/get-directory.
-;; 2.0.3 - 2013/11/07 - sml/show-frame-identification.
-;; 2.0.3 - 2013/11/07 - Improvements to sml/parse-mode-line-elements.
-;; 2.0.3 - 2013/11/07 - sml/compile-position-construct.
-;; 2.0.3 - 2013/11/07 - Line-number removed from sml/generate-position-help.
-;; 2.0.3 - 2013/11/07 - Position optimization with sml/position-construct.
-;; 2.0.3 - 2013/11/07 - Performance optimization thanks to sml/buffer-identification.
-;; 2.0.2 - 2013/11/05 - better sml/replacer-regexp-list.
-;; 2.0.2 - 2013/11/05 - sml/mule-info also hides input system.
-;; 2.0.2 - 2013/11/05 - show-encoding is now alias for sml/mule-info.
-;; 2.0.2 - 2013/11/05 - Removed anchors.
-;; 2.0.1 - 2013/11/04 - Slight fix on sml/apply-theme
-;; 2.0 - 2013/11/04 - Remove unnecessary functions.
-;; 2.0 - 2013/11/04 - Many other internal improvements.
-;; 2.0 - 2013/11/02 - Remove sml/mode-line-format
-;; 2.0 - 2013/11/02 - Reduce huge spaces in mode-line-format
-;; 2.0 - 2013/11/02 - Redesign the format to use mode-line-mule-info.
-;; 2.0 - 2013/11/02 - Redesign the format to use mode-line-client.
-;; 2.0 - 2013/11/02 - Redesign the format to use mode-line-modified.
-;; 2.0 - 2013/11/02 - Redesign the format to use mode-line-remote.
-;; 2.0 - 2013/11/02 - Manually edits mode-line-front-space.
-;; 2.0 - 2013/11/02 - Manually edits mode-line-frame-identification.
-;; 2.0 - 2013/11/02 - Manually edits mode-line-buffer-identification.
-;; 2.0 - 2013/11/02 - Manually edits mode-line-end-spaces.
-;; 2.0 - 2013/11/02 - Redesign the format to use mode-line-modes.
-;; 2.0 - 2013/11/01 - Redesign the format to use mode-line-position.
-;; 1.30.1 - 2013/10/21 - eval-when-compile cl
-;; 1.30 - 2013/10/13 - Click mode list to toggle minor-mode hiding.
-;; 1.29.2 - 2013/10/02 - Different default position-percentage face.
-;; 1.29.1 - 2013/08/22 - Fix hang introduced with last update.
-;; 1.29 - 2013/08/11 - Fixed lag with remote files.
-;; 1.28.1 - 2013/08/11 - Fix for the erc fix.
-;; 1.28 - 2013/08/11 - Fixing erc notifications.
-;; 1.27 - 2013/08/10 - Changed default value of sml/mode-width to a number. 'full didn't work for everyone.
-;; 1.27 - 2013/08/10 - Doc bug.
-;; 1.26 - 2013/07/18 - Fix for % in the process string.
-;; 1.25 - 2013/07/16 - sml/override-theme also tries to set good colors for the text (not just the background).
-;; 1.24 - 2013/07/16 - sml/mule-info face changed to be less important.
-;; 1.23.2 - 2013/07/15 - Changed doc of sml/replacer-regexp-list.
-;; 1.23.1 - 2013/07/15 - moved perspective variable to eval-after-load.
-;; 1.23 - 2013/07/15 - added an icon to mew-format.
-;; 1.23 - 2013/07/15 - obsolete sml/show-time.
-;; 1.23 - 2013/07/15 - fixed a bug which required emacs restart for changes to take effect.
-;; 1.22 - 2013/07/15 - sml/vc-mode-show-backend implemented.
-;; 1.22 - 2013/07/15 - move mew-support variable.
-;; 1.22 - 2013/07/15 - Changed default value of sml/replacer-regexp-list.
-;; 1.21 - 2013/07/14 - Encoding description.
-;; 1.21 - 2013/07/14 - Reestructured some of the present functions.
-;; 1.21 - 2013/07/14 - New position indicator.
-;; 1.20 - 2013/07/14 - vc-mode support.
-;; 1.19 - 2013/07/14 - Reorganized groups.
-;; 1.18 - 2013/07/12 - mew variables only get created if mew is loaded.
-;; 1.18 - 2013/07/12 - Reformulated the simplified mode-line.
-;; 1.18 - 2013/07/12 - Added number of lines to mouse tooltip of position.
-;; 1.17 - 2013/07/10 - Fallback 'modified' string.
-;; 1.16 - 2013/07/08 - Changed implementation of battery display.
-;; 1.16 - 2013/07/08 - Fixed battery-display.
-;; 1.15 - 2013/07/06 - Implemented sml-modeline support.
-;; 1.14 - 2013/06/25 - Slightly reduced the default value of extra-filler.
-;; 1.13 - 2013/06/10 - removed 'cl requirement.
-;; 1.13 - 2013/06/10 - Advice to mew-biff-clear.
-;; 1.12 - 2013/06/06 - Gigantic typo fix. Sorry about that.
-;; 1.11 - 2013/06/05 - Added biff support.
-;; 1.10 - 2013/05/24 - Fix for buffer name with '%'.
-;; 1.9 - 2013/05/13 - Now uses file name instead of buffer-name by default, controled by `sml/show-file-name'.
-;; 1.9 - 2013/05/13 - When showing buffer name, can strip the part by setting `sml/show-trailing-N'.
-;; 1.8.3 - 2013/04/21 - Fixed first line of docs.
-;; 1.8.2 - 2013/04/18 - added empty anchors throughout the mode-line.
-;; 1.8.2 - 2013/04/18 - evil-mode support.
-;; 1.8.1 - 2013/04/17 - sml/bug-report function.
-;; 1.8.1 - 2013/04/17 - sml/override-theme variable.
-;; 1.8.1 - 2013/04/17 - Changed install instruction to override theme settings.
-;; 1.8 - 2013/04/14 - sml/mode-width can now be 'full.
-;; 1.7.1 - 2012/11/17 - Perspective support.
-;; 1.7 - 2012/11/14 - Fixed some modes not showing in the minor mode list - Thanks Constantin.
-;; 1.7 - 2012/11/14 - Fixed infinite loop. - Thanks Constantin.
-;; 1.7 - 2012/11/14 - Fixed for dired-mode.
-;; 1.7 - 2012/11/14 - Added parent customize groups.
-;; 1.6.2 - 2012/07/13 - Fixed mode shortenning.
-;; 1.6.1 - 2012/07/12 - NEW FEATURE: Modes list now fully supports clicking.
-;; 1.6.1 - 2012/07/12 - NEW FEATURE: `sml/version' constant.
-;; 1.6.1 - 2012/07/12 - `sml/hidden-modes' is now a list of strings (not regexps).
-;; 1.6 - 2012/07/09 - NEW FEATURE: Customizable faces for the prefix, see `sml/prefix-face-list'.
-;; 1.5.4 - 2012/06/28 - Optimized regexp-replacer.
-;; 1.5.3 - 2012/06/20 - Remove prefix and folder for non-files. Color the :Git prefix.
-;; 1.5.2 - 2012/06/14 - Saner default widths and mode-name fix for Term.
-;; 1.5.1 - 2012/06/12 - Fixed battery font for corner cases.
-;; 1.5 - 2012/06/11 - Added support for display-battery-mode. See the description for more.
-
-;;; Code:
-
-(require 'cl-lib)
-(require 'custom)
-(require 'cus-face)
-(require 'rich-minority)
-
-(defconst sml/version "2.10" "Version of the smart-mode-line.el package.")
-(defun sml/bug-report ()
- "Opens github issues page in a web browser. Please send me any bugs you find, and please include your Emacs and sml versions."
- (interactive)
- (browse-url "https://github.com/Malabarba/smart-mode-line/issues/new")
- (message "Your sml/version is: %s, and your emacs version is: %s.\nPlease include this in your report!" sml/version emacs-version))
-(defun sml/customize ()
- "Open the customization group for the `smart-mode-line' package."
- (interactive)
- (customize-group 'smart-mode-line t))
-(defun sml/customize-faces ()
- "Open the customization group for faces used by the `smart-mode-line' package."
- (interactive)
- (customize-group 'smart-mode-line-faces t))
-
-(defgroup smart-mode-line '()
- "Customization group for the `smart-mode-line' package."
- :group 'convenience
- :prefix 'sml)
-(defgroup smart-mode-line-position '()
- "Showing the point position in the smart mode line."
- :group 'smart-mode-line
- :prefix 'sml)
-(defgroup smart-mode-line-path-and-prefix '()
- "Showing the path, buffer-name, and prefix in the smart mode line."
- :group 'smart-mode-line
- :prefix 'sml)
-(defgroup smart-mode-line-mode-list '()
- "Showing major/minor modes in the smart mode line."
- :group 'smart-mode-line
- :prefix 'sml)
-(defgroup smart-mode-line-others '()
- "Showing other data in the smart mode line."
- :group 'smart-mode-line
- :prefix 'sml)
-
-(defgroup smart-mode-line-faces '()
- "Font (face) colors for the `smart-mode-line.el' package.
-
-You can fully customize any of the fonts to match the color you
-want. You can also set properties like bold with ':weight bold'.
-
-Note that, by default, smart-mode-line overrides your theme's
-settings for the background and foreground color of the modeline
-face. We need to override, otherwise some elements become
-unreadable on lighter themes. If you'd rather configure these
-unreadable colors yourself and keep your theme's settings, just
-set `sml/override-theme' to nil."
- :prefix 'sml
- :group 'smart-mode-line
- :group 'faces)
-
-
-;;; Actual Code
-(defvar erc-track-position-in-mode-line)
-(defvar sml/simplified nil
- "Temporary dynamic variable. Used for filling.")
-(defvar sml/active-background-color)
-
-(defvar sml/-debug nil
- "Whether debugging information should be printed.")
-
-(defmacro sml/-debug (fmt &rest r)
- "If variable `sml/-debug' is non-nil, describe FMT.
-If FMT is a string, this is essentially the same as `message'.
-If FMT is anything else, this is essentially:
- (message \"%s is: %s\" 'FMT FMT)"
- (when (and (boundp 'sml/-debug) sml/-debug)
- (if (stringp fmt)
- `(apply #'message (concat "[sml/debug] " ,fmt) ,r)
- `(message "[sml/debug] %s is: %s" ',fmt ,fmt))))
-
-(defvar sml/shortener-func 'sml/do-shorten-directory
- "Function used to shorten the directory name.
-
-Value is a funcallable symbol that takes two arguments: the
-string to be shortened and the maximum size. This is set
-automatically when `sml/shorten-directory' is changed via the
-customization menu or via the `sml/toggle-shorten-directory'
-function (which are the only ways you should change it).")
-
-(defun sml/set-shortener-func (sym val)
- "Configure `sml/shortener-func' according to `sml/shorten-directory'.
-Set SYM to VAL."
- (set-default sym val)
- (if val (setq sml/shortener-func 'sml/do-shorten-directory)
- (setq sml/shortener-func 'sml/not-shorten-directory)))
-
-(define-obsolete-variable-alias 'sml/time-format 'display-time-format)
-(define-obsolete-variable-alias 'sml/show-time 'display-time-mode)
-(define-obsolete-variable-alias 'sml/override-theme 'sml/theme)
-
-(defcustom sml/theme 'automatic
- "Defines which theme `smart-mode-line' should use.
-
-This is usually one of the symbols:
-'automatic, 'respectful, 'dark, 'light or nil;
-but it can be something else if there are other smart-mode-line
-themes defined.
-
-Setting this to 'light and 'dark will apply some predefined
-colors to the mode-line, which are designed to be easy to read.
-
-Setting this to nil will apply almost no colors. Use this if your
-global color theme already customizes sml faces (flatui-theme is
-an example).
-
-Setting this to 'automatic will let sml decide between 'light or
-'dark or nil, to best match the global theme that is active when
-`sml/setup' is called.
-
-Setting it to 'respectful will try to use the colors defined by
-your current Emacs theme (emphasis on the \"try\"). Use this if
-you color theme does NOT customize sml faces, AND if you're not
-happy with 'light or 'dark.
-This option will make the mode-line colors more consistent with
-buffer colors (when compared to 'light or 'dark, which have fixed
-colors) , but it's a bit of a shot in the dark. The result will
-vary for each color theme, and you may get colors that don't read
-well.
-
-But don't forget, ALL COLORS ARE CUSTOMIZABLE!
-`sml/customize-faces'
-Any color you change manually won't get affected by this
-variable.
-
-Setting this variable via `setq' only has effect BEFORE calling
-`sml/setup'. If smart-mode-line is already loaded, use
- `sml/apply-theme' instead (or the customization interface)."
- :type '(choice (const :tag "Automatically choose between 'light, 'dark, or nil during setup. (Default and Recommended)" automatic)
- (const :tag "Don't use a theme." nil)
- (const :tag "Use a dark color-theme." dark)
- (const :tag "Use a light color-theme." light)
- (const :tag "Respect the color-theme's colors." respectful)
- (symbol :tag "Other smart-mode-line theme you installed."))
- :set 'sml/apply-theme
- :initialize 'custom-initialize-default
- :group 'smart-mode-line-faces :group 'smart-mode-line)
-
-(defcustom sml/position-percentage-format "%p"
- "Format used to display position in the buffer.
-
-Set it to nil to hide the number."
- :type 'string
- :group 'smart-mode-line-position
- :package-version '(smart-mode-line . "2.0"))
-(put 'sml/position-percentage-format 'risky-local-variable t)
-
-(defcustom sml/line-number-format "%3l"
- "Format used to display line number.
-
-Empty it or disable `line-number-mode' to hide the number."
- :type 'string
- :group 'smart-mode-line-position
- :set 'sml/compile-position-construct
- :initialize 'custom-initialize-default)
-(put 'sml/line-number-format 'risky-local-variable t)
-
-(defcustom sml/size-indication-format "%I "
- "Format to display buffer size when `size-indication-mode' is on."
- :type 'string
- :group 'smart-mode-line-position
- :package-version '(smart-mode-line . "2.0")
- :set 'sml/compile-position-construct
- :initialize 'custom-initialize-default)
-(put 'sml/size-indication-format 'risky-local-variable t)
-
-(defcustom sml/col-number-format "%2c"
- "Format used to display column number.
-
-Empty it or disable `column-number-mode' to hide the number."
- :type 'string
- :group 'smart-mode-line-position
- :set 'sml/compile-position-construct
- :initialize 'custom-initialize-default)
-(put 'sml/col-number-format 'risky-local-variable t)
-
-(defcustom sml/numbers-separator ":"
- "Separator between line and column number.
-
-Since we use different faces for line and column number, you can
-just set this to \"\" to save an extra char of space."
- :type 'string
- :group 'smart-mode-line-position)
-
-(defcustom sml/show-remote t
- "Whether to display an \"@\" for remote buffers.
-If the buffer is local, an \"-\" is displayed instead.
-If this variable is nil, nothing is displayed."
- :type 'boolean
- :group 'smart-mode-line-others)
-(put 'sml/show-remote 'safe-local-variable 'booleanp)
-
-(defcustom sml/show-client nil
- "Whether to show an \"@\" for emacsclient frames."
- :type 'boolean
- :group 'smart-mode-line-others)
-(put 'sml/show-client 'safe-local-variable 'booleanp)
-
-(defcustom sml/modified-char (char-to-string (if (char-displayable-p ?×) ?× ?*))
- "String that indicates if buffer is modified. Should be one SINGLE char."
- :type 'string
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "1.16"))
-
-(defcustom sml/show-trailing-N t
- "Whether the \"\" suffix in buffer names should be displayed in the mode-line."
- :type 'boolean
- :group 'smart-mode-line-path-and-prefix)
-(put 'sml/show-trailing-N 'safe-local-variable 'booleanp)
-
-(defcustom sml/show-file-name t
- "Unless nil: show file name instead of buffer name on the mode-line."
- :type 'boolean
- :group 'smart-mode-line-path-and-prefix)
-(put 'sml/show-file-name 'safe-local-variable 'booleanp)
-
-(defcustom sml/fill-char ?\s
- "The char to be used for filling."
- :type 'char
- :group 'smart-mode-line-path-and-prefix)
-
-(defcustom sml/replacer-regexp-list
- `((,(concat "^" (if (boundp 'org-directory) (regexp-quote org-directory) "~/org/")) ":Org:")
- ("^~/\\.emacs\\.d/elpa/" ":ELPA:")
- ("^~/\\.emacs\\.d/" ":ED:")
- ("^/sudo:.*:" ":SU:")
- ("^~/Documents/" ":Doc:")
- ("^~/Dropbox/" ":DB:")
- ("^:\\([^:]*\\):Documento?s/" ":\\1/Doc:")
- ("^~/[Gg]it/" ":Git:")
- ("^~/[Gg]it[Hh]ub/" ":Git:")
- ("^~/[Gg]it\\([Hh]ub\\|\\)-?[Pp]rojects/" ":Git:"))
- "List of pairs of strings used (by `sml/replacer') to create prefixes.
-
-The first string of each pair is a regular expression, the second
-is a replacement. These pairs are sequentially applied on the
-file path to replace portions of it, turning them into prefixes.
-For instance, \"~/.emacs.d/\" is replaced by \":ED:\", which is
-shorter but easily identified.
-
-The replacement strings can really be anything, but to be colored
-as a prefix a string must start and end with \":\" (see the
-default as an example, as an exception \"~/\" is also a prefix).
-
-Replacement doesn't stop on first match, so you can have stacking replacements:
-
- (add-to-list 'sml/replacer-regexp-list '(\"^:DB:Org/\" \":Org:\") t)
-
-Remember that `add-to-list' adds items to the FRONT, and you'll
-usually want to add them to the back (thus the t at the end).
-
-You can also set custom colors (faces) for these prefixes, just
-set `sml/prefix-face-list' accordingly."
- :type '(repeat (list regexp string))
- :group 'smart-mode-line-path-and-prefix
- :package-version '(smart-mode-line . "1.22"))
-
-(defcustom sml/prefix-regexp '(":\\(.*:\\)" "~/")
- "List of Regexps used to identify prefixes.
-
-A prefix is anything at the beginning of a line that matches any
-of these regexps. Don't start these regexps with \"^\", the
-parser applies that for you."
- :type '(repeat regexp)
- :group 'smart-mode-line-path-and-prefix)
-
-(defcustom sml/prefix-face-list '((":SU:" sml/sudo)
- (":G" sml/git)
- ("" sml/prefix))
- "List of (STRING FACE) pairs used by `sml/propertize-prefix'.
-
-After the file path is constructed, the prefix contained in it is
-colored according to this list. The elements are checked one by
-one and, if the prefix contains the STRING part of the pair, then
-FACE is applied to it (and checking stops there)."
- :type '(repeat (list string face))
- :group 'smart-mode-line-path-and-prefix)
-
-(defcustom sml/name-width 44
- "Minimum and maximum size of the file name in the mode-line.
-
-If `sml/shorten-directory' is nil, this is the minimum width.
-Otherwise, this is both the minimum and maximum width.
-
-Alternatively, you can set the minimum and maximum widths
-separately, by setting this variable to a cons cell of integers:
- (MIN-WIDTH . MAX-WIDTH)
-"
- :type '(choice integer (cons (integer :tag "Minimum width")
- (integer :tag "Maximum width")))
- :group 'smart-mode-line-path-and-prefix)
-
-(defcustom sml/shorten-directory t
- "Should directory name be shortened to fit width?
-
-When the buffer+directory name is longer than
-`sml/name-width':
- if nil the rest of the mode-line is pushed right;
- otherwise the directory name is shortened to fit."
- :type 'boolean
- :group 'smart-mode-line-path-and-prefix
- :set 'sml/set-shortener-func)
-(put 'sml/shorten-directory 'safe-local-variable 'booleanp)
-
-(defcustom sml/full-mode-string " +"
- "String that's appended to the minor-mode list when it's full."
- :type 'string
- :group 'smart-mode-line-mode-list)
-
-(defcustom sml/shorten-mode-string " -"
- "String that's appended to the minor-mode list when all modes are displayed."
- :type 'string
- :group 'smart-mode-line-mode-list)
-
-(defcustom sml/shorten-modes t
- "Should modes list be shortened to fit width?
-
-When the modes list is longer than `sml/mode-width':
- if nil the rest of the mode-line is pushed right;
- otherwise the list is shortened to fit."
- :type 'boolean
- :group 'smart-mode-line-mode-list)
-(put 'sml/shorten-modes 'safe-local-variable 'booleanp)
-
-(defun sml/toggle-shorten-directory (&rest val)
- "Toggle the variable `sml/shorten-directory'.
-
-If given an argument VAL, the variable is set to the argument,
-otherwise it is toggled. This can be used as an alternative to
-customizing the variable with `customize-group'. Setting the
-variable with `setq' will NOT work and should be avoided."
- (interactive)
- (sml/set-shortener-func 'sml/shorten-directory
- (if val (car-safe val)
- (not sml/shorten-directory))))
-
-(defun sml/toggle-shorten-modes (&rest val)
- "Toggle the variable `sml/shorten-modes'.
-
-If given an argument VAL, the variable is set to the argument,
-otherwise it is toggled. This can be used as an alternative to
-customizing the variable with `customize-group'. Equivalent to
-setting the variable with `setq'."
- (interactive)
- (setq sml/shorten-modes (if val (car val)
- (not sml/shorten-modes)))
- (force-mode-line-update))
-
-(defcustom sml/mode-width 'full
- "Maximum and/or minimum size of the modes list in the mode-line.
-
-If it is an integer, then the modes list width is that many
-characters.
-
-If it is the symbol `full', then the mode-list fills all the
-empty space is available in the mode-line (this has the effect of
-indenting right anything after the mode-list).
-
-If it is the symbol `right', then it behaves like `full', but the
-minor-modes list is moved all the way to the right.
-
-If `sml/shorten-modes' is nil, this is the minimum width.
-Otherwise, this is both the minimum and maximum width."
- :type '(choice integer symbol)
- :group 'smart-mode-line-mode-list
- :package-version '(smart-mode-line . "2.4.5"))
-
-(defcustom sml/battery-format " %p"
- "Format used to display the battery in the mode-line.
-
-Only relevant if using `display-battery-mode'. See that function
-for the syntax."
- :type 'string
- :group 'smart-mode-line-others)
-
-(defcustom sml/modified-time-string "Modified on %T %Y-%m-%d."
- "String format used for displaying the modified time.
-
-This is shown in the tooltip when hovering over the \"modified
-file\" character (which is usually a * right before the file
-name."
- :type 'string
- :group 'smart-mode-line-others)
-
-(defcustom sml/extra-filler 0
- "The number of extra filling chars to use.
-It comes into play when `sml/mode-width' is set to 'full.
-
-This is necessary because the mode-line width (which we need but
-don't have access to) is larger than `window-total-width' (which
-we have access to).
-
-Decrease this if right indentation seems to be going too far (or
-if you just want to fine-tune it)."
- :type 'integer
- :group 'smart-mode-line-mode-list)
-
-;; Face definitions
-(defface sml/global '((t :inverse-video nil)) "" :group 'smart-mode-line-faces)
-(defface sml/modes '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/minor-modes '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/filename '((t :inherit sml/global :weight bold)) "" :group 'smart-mode-line-faces)
-(defface sml/prefix '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/read-only '((t :inherit sml/not-modified)) "" :group 'smart-mode-line-faces)
-(defface sml/modified '((t :inherit sml/not-modified :foreground "Red" :weight bold))
- "" :group 'smart-mode-line-faces)
-(defface sml/outside-modified '((t :inherit sml/not-modified :foreground "#ffffff" :background "#c82829"))
- "" :group 'smart-mode-line-faces)
-
-(defface sml/line-number '((t :inherit sml/modes :weight bold)) "" :group 'smart-mode-line-faces)
-(defface sml/remote '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/name-filling '((t :inherit sml/position-percentage)) "" :group 'smart-mode-line-faces)
-(defface sml/position-percentage '((t :inherit sml/prefix :weight normal)) "" :group 'smart-mode-line-faces)
-(defface sml/col-number '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/numbers-separator '((t :inherit sml/col-number)) "" :group 'smart-mode-line-faces)
-(defface sml/client '((t :inherit sml/prefix)) "" :group 'smart-mode-line-faces)
-(defface sml/not-modified '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/mule-info '((t :inherit sml/global)) "" :group 'smart-mode-line-faces)
-(defface sml/sudo '((t :inherit sml/outside-modified)) "" :group 'smart-mode-line-faces)
-(defface sml/git '((t :inherit (sml/read-only sml/prefix))) "" :group 'smart-mode-line-faces)
-(defface sml/folder '((t :inherit sml/global :weight normal)) "" :group 'smart-mode-line-faces)
-(defface sml/process '((t :inherit sml/prefix)) "" :group 'smart-mode-line-faces)
-(defface sml/vc '((t :inherit sml/git)) "" :group 'smart-mode-line-faces)
-(defface sml/vc-edited '((t :inherit sml/prefix)) "" :group 'smart-mode-line-faces)
-(defface sml/charging '((t :inherit sml/global :foreground "ForestGreen")) "" :group 'smart-mode-line-faces)
-(defface sml/discharging '((t :inherit sml/global :foreground "Red")) "" :group 'smart-mode-line-faces)
-(defface sml/time '((t :inherit sml/modes)) "" :group 'smart-mode-line-faces)
-
-(defvar sml/-apply-theme-is-running nil "Avoid nesting in `sml/apply-theme'.")
-
-(defcustom sml/no-confirm-load-theme nil
- "If non-nil, `sml/apply-theme' will pass the NO-CONFIRM flag to `load-theme'.
-If you're having problems with Emacs always asking for permission
-to load a theme (and not remembering your choice), you can set
-this to t to workaround the problem. But it's recommended that
-you try the problem instead."
- :type 'boolean
- :group 'smart-mode-line-faces
- :package-version '(smart-mode-line . "2.5.2"))
-
-;;;###autoload
-(when load-file-name
- (let ((dir (file-name-as-directory (file-name-directory load-file-name))))
- (add-to-list 'custom-theme-load-path dir)
- (when (file-directory-p (file-name-as-directory (concat dir "themes")))
- (add-to-list 'custom-theme-load-path
- (file-name-as-directory (concat dir "themes"))))))
-
-(defun sml/apply-theme (theme &optional value silent)
- "Apply the theme called smart-mode-line-THEME.
-
-THEME is usually one of the symbols: respectful, dark, or light;
-but it can be something else if there are other smart-mode-line
-themes defined.
-See the `sml/theme' variable for the meaning of each symbol.
-
-This function will call `disable-theme' on any enabled themes
-whose name starts with \"smart-mode-line-\", then it will call
-`load-theme' on the theme called \"smart-mode-line-THEME\".
-
-This also sets the `sml/theme' variable, see its documentation
-for more information on each value.
-
-The second argument (VALUE) is for internal use only, DON'T USE IT.
-
-Third argument SILENT prevents messages."
- (interactive
- (list
- (intern
- (completing-read
- "Load smart-mode-line theme: "
- (cons
- 'automatic
- (mapcar
- (lambda (x) (replace-regexp-in-string "\\`smart-mode-line-" "" (symbol-name x)))
- (cl-remove-if-not #'sml/theme-p (custom-available-themes))))))
- nil nil))
- (sml/-debug "Entering apply-theme")
- (when (eq theme (intern "")) (setq theme nil))
- (sml/-debug theme)
- (sml/-debug sml/theme)
- (unless silent (message "[sml] %s set to %s" 'sml/theme (or value theme)))
- (sml/-debug sml/-apply-theme-is-running)
- (unless sml/-apply-theme-is-running
- (let ((sml/-apply-theme-is-running t)) ;Avoid nesting.
- ;; Set the variable
- (setq-default sml/theme (or value theme))
- (sml/-debug sml/theme)
-
- ;; Disable any previous smart-mode-line themes.
- (sml/-debug custom-enabled-themes)
- (mapc (lambda (x) (when (sml/theme-p x) (disable-theme x)))
- custom-enabled-themes)
- (sml/-debug custom-enabled-themes)
-
- ;; Load the theme requested.
- (sml/-debug sml/theme)
- (when (eq sml/theme 'automatic)
- (setq sml/theme (sml/-automatically-decide-theme)))
- (sml/-debug sml/theme)
- (when sml/theme
- (let ((theme-name
- (if (sml/theme-p sml/theme) sml/theme
- (intern (format "smart-mode-line-%s" sml/theme)))))
- (sml/-debug theme-name)
- (load-theme theme-name sml/no-confirm-load-theme))))))
-
-(defadvice enable-theme (after sml/after-enable-theme-advice (theme) activate)
- "Make sure smart-mode-line themes take priority over global themes that don't customize sml faces."
- (unless (or (eq theme 'user) (sml/faces-from-theme theme))
- (mapc #'enable-theme
- (reverse (cl-remove-if-not #'sml/theme-p custom-enabled-themes)))))
-
-(defun sml/theme-p (theme)
- "Return non-nil if theme named THEME is a smart-mode-line theme.
-Takes symbols and strings."
- (string-match "\\`smart-mode-line-" (if (symbolp theme) (symbol-name theme) theme)))
-
-(defvaralias 'sml/show-encoding 'sml/mule-info)
-
-(defcustom sml/show-eol nil
- "Whether to display the buffer EOL in the mode-line."
- :type 'boolean
- :group 'smart-mode-line-others)
-(put 'sml/show-eol 'safe-local-variable 'booleanp)
-
-(defcustom sml/outside-modified-char "M"
- "Char to display if buffer needs to be reverted."
- :type 'string
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "1.20"))
-
-(defvaralias 'sml/encoding-format 'sml/mule-info)
-(defcustom sml/mule-info "%z"
- "Format for multilingual information. Set this to nil to hide buffer encoding."
- :type '(choice string (const :tag "Don't display." nil))
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "2.0"))
-
-(defcustom sml/read-only-char "R"
- "Displayed when buffer is readonly."
- :type 'string
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "1.20"))
-
-(defcustom sml/show-frame-identification nil
- "Whether to show frame identification or not.
-
-In some systems this doesn't even display anything. It's most useful
-on terminals, but you might want to disable it anyway.
-
-Just set this to nil, and frame identification won't be displayed."
- :type 'boolean
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "2.0.3"))
-(put 'sml/show-frame-identification 'safe-local-variable 'booleanp)
-
-(defcustom sml/vc-mode-show-backend nil
- "Whether to show or not the backend in vc-mode's mode-line description.
-
-I think most people only use one backend, so this defaults to nil.
-If you want it to show the backend, just set it to t."
- :type 'boolean
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "1.22"))
-(put 'sml/vc-mode-show-backend 'safe-local-variable 'booleanp)
-
-
-(defvar sml/position-construct nil "Used for recycling position information.")
-(put 'sml/position-construct 'risky-local-variable t)
-
-(defvar sml/position-help-text nil "Help-text for position information.")
-(make-variable-buffer-local 'sml/position-help-text)
-
-;;; Buffer Identification
-(defvar sml/buffer-identification-filling nil
- "Filling generated by `sml/fill-for-buffer-identification'.")
-(make-variable-buffer-local 'sml/buffer-identification-filling)
-(put 'sml/buffer-identification-filling 'risky-local-variable t)
-
-(defvar sml/buffer-identification nil
- "Used for recycling buffer identification without having to recompute it.")
-(make-variable-buffer-local 'sml/buffer-identification)
-(put 'sml/buffer-identification 'risky-local-variable t)
-
-(defadvice rename-buffer (after sml/after-rename-buffer-advice ())
- "Regenerate buffer-identification after `rename-buffer'."
- (sml/generate-buffer-identification))
-(defadvice set-visited-file-name (after sml/after-set-visited-file-name-advice ())
- "Regenerate buffer-identification after `set-visited-file-name'."
- (sml/generate-buffer-identification))
-
-(defvar sml/name-width-old nil "Used for recalculating buffer identification filling only when necessary.")
-(make-variable-buffer-local 'sml/name-width-old)
-(defvar sml/shorten-directory-old nil "Used for recalculating buffer identification filling only when necessary.")
-(make-variable-buffer-local 'sml/shorten-directory-old)
-(defun sml/generate-buffer-identification-if-necessary ()
- "Call `sml/generate-buffer-identification' only if `sml/name-width' has changed."
- (unless (and (equal sml/name-width-old sml/name-width)
- (equal sml/shorten-directory-old sml/shorten-directory))
- (setq sml/name-width-old sml/name-width)
- (setq sml/shorten-directory-old sml/shorten-directory)
- (sml/generate-buffer-identification))
- nil)
-
-(defvar sml/mode-line-client
- `(sml/show-client
- (:eval (if (frame-parameter nil 'client)
- ,(propertize "@" 'face 'sml/client 'help-echo (purecopy "emacsclient frame"))
- " ")))
- "Construct that replaces `mode-line-client'.")
-
-(defvar sml/mode-line-buffer-identification
- '("" (sml/buffer-identification
- sml/buffer-identification
- (:eval (sml/generate-buffer-identification))))
- "Replace the default `mode-line-buffer-identification' with our own.")
-
-(defvar sml/projectile-replacement-format)
-(defvar sml/use-projectile-p)
-(defvar sml/projectile-loaded-p nil "Non-nil if projectile has been loaded.")
-
-(defcustom sml/pos-id-separator " "
- "Miscellaneous mode-line construct."
- :type 'string)
-(put 'sml/pos-id-separator 'risky-local-variable t)
-(defcustom sml/pre-modes-separator " "
- "Miscellaneous mode-line construct."
- :type 'string)
-(put 'sml/pre-modes-separator 'risky-local-variable t)
-(defcustom sml/pre-id-separator ""
- "Miscellaneous mode-line construct."
- :type 'string)
-(put 'sml/pre-id-separator 'risky-local-variable t)
-(defcustom sml/pre-minor-modes-separator ""
- "Miscellaneous mode-line construct."
- :type 'string)
-(put 'sml/pre-minor-modes-separator 'risky-local-variable t)
-(defcustom sml/pos-minor-modes-separator ""
- "Miscellaneous mode-line construct."
- :type 'string)
-(put 'sml/pos-minor-modes-separator 'risky-local-variable t)
-
-(defun sml/-automatically-decide-theme ()
- "Return the most appropriate sml theme, based on global theme."
- (sml/-debug "Entering -automatically-decide-theme")
- (sml/-debug (sml/global-theme-support-sml-p))
- (unless (sml/global-theme-support-sml-p)
- (sml/-debug (face-background 'mode-line nil t))
- (sml/-debug (face-background 'default nil t))
- (let ((bg (ignore-errors
- (or (face-background 'mode-line nil t)
- (face-background 'default nil t)))))
- (if (ignore-errors
- (and (stringp bg)
- (> (color-distance "white" bg)
- (color-distance "black" bg))))
- 'dark 'light))))
-
-(defun sml/-setup-theme ()
- "Decide what theme to use and apply it.
-Used during initialization."
- (sml/-debug "Entering -setup-theme")
- (sml/-debug sml/theme)
- (when sml/theme
- (when (eq sml/theme 'automatic)
- (setq sml/theme (sml/-automatically-decide-theme)))
- (sml/-debug "chosen theme:")
- (sml/-debug sml/theme)
- (sml/apply-theme sml/theme nil :silent)))
-
-(defvar battery-mode-line-format)
-
-
-;;;###autoload
-(defun sml/setup (&optional arg)
- "Setup the mode-line to be smart and sexy.
-
-ARG is ignored. Just call this function in your init file, and
-the mode-line will be setup."
- (interactive)
- (sml/-debug "Entering setup")
- (sml/-debug custom-enabled-themes)
-
- ;; Just a couple of useful variables
- (setq sml/simplified nil)
- (setq battery-mode-line-format sml/battery-format)
-
- ;; Activate rich-minority, and configure it for us.
- (setq rm-base-text-properties
- (append rm-base-text-properties '('face 'sml/minor-modes)))
-
- ;; Set the theme the user requested.
- (sml/-setup-theme)
-
- ;;;; And this is where the magic happens.
- ;; Remove elements we implement separately, and improve the ones not removed.
- (sml/filter-mode-line-list 'mode-line-mule-info)
- (setq-default mode-line-client sml/mode-line-client)
- (sml/filter-mode-line-list 'mode-line-modified)
- (sml/filter-mode-line-list 'mode-line-remote)
- (setq-default mode-line-frame-identification
- '("" (sml/show-frame-identification "%F")
- sml/pre-id-separator))
-
- ;; (setq-default mode-line-buffer-identification '("%b"))
-
- (setq-default mode-line-buffer-identification
- sml/mode-line-buffer-identification)
- (sml/filter-mode-line-list 'mode-line-position)
- (sml/filter-mode-line-list 'mode-line-modes)
- (setq-default mode-line-end-spaces nil)
-
- ;; Add position descriptions on the left (they were already removed
- ;; from the middle). Since this is the very first symbol to be
- ;; evaluated, we also use it for calculating variables that need to
- ;; be updated
- (setq-default mode-line-front-space '((:eval (sml/generate-buffer-identification-if-necessary))
- (sml/position-help-text
- nil
- (:eval (let ((sml/-this-buffer-changed-p t))
- (sml/generate-position-help))))
- (sml/position-construct
- sml/position-construct
- (:eval (sml/compile-position-construct)))))
-
- (add-hook 'after-save-hook 'sml/generate-buffer-identification)
- (ad-activate 'rename-buffer)
- (ad-activate 'set-visited-file-name)
- (add-hook 'clone-indirect-buffer-hook 'sml/generate-buffer-identification)
- ;; (ad-activate 'set-buffer-modified-p)
- (add-hook 'after-change-functions 'sml/-this-buffer-changed)
- (add-hook 'post-command-hook 'sml/generate-position-help)
-
- ;; This is to ensure fixed name width. The reason we do this manually
- ;; is that some major-modes change `mode-line-buffer-identification'
- ;; (so we can't fill inside the variable), and we want this
- ;; symbol to be an element in `mode-line-format' for compatibility
- ;; with other packages which hack into the mode-line.
-
- (add-to-list 'mode-line-position
- '(sml/buffer-identification-filling
- sml/buffer-identification-filling
- (:eval (setq sml/buffer-identification-filling
- (sml/fill-for-buffer-identification)))))
-
- ;; Remove some annoying big spaces
- (setq-default mode-line-format
- (mapcar
- (lambda (x) (cond
- ;; ((eq x 'mode-line-buffer-identification)
- ;; '(:propertize mode-line-buffer-identification face sml/id))
- ((and (stringp x) (string= x " "))
- 'sml/pos-id-separator)
- ((and (stringp x) (string= x " "))
- 'sml/pre-modes-separator)
- (t x)))
- mode-line-format))
-
- ;;;; And here comes support for a bunch of extra stuff. Some of
- ;;;; these are just needed for coloring.
-
- ;; Shell and eshell support
- (add-hook 'comint-output-filter-functions 'sml/generate-buffer-identification)
- (add-hook 'eshell-directory-change-hook 'sml/generate-buffer-identification)
-
- ;; Term support
- (defadvice term-command-hook (after sml/term-advice-1 activate)
- (sml/generate-buffer-identification))
-
- (defadvice term-handle-ansi-terminal-messages (after sml/term-advice-2 activate)
- (sml/generate-buffer-identification))
-
- ;; Dired overrides the buffer-identification (which we would
- ;; normally respect) but doesn't actually do anything useful with
- ;; it, so we overoverride back.
- (add-hook 'dired-mode-hook 'sml/set-buffer-identification)
-
- ;; Display time
- (add-hook 'display-time-hook 'sml/propertize-time-string)
-
- ;; Battery support
- (eval-after-load 'battery
- '(defadvice battery-update (after sml/after-battery-update-advice () activate)
- "Change battery color."
- (when battery-mode-line-string
- (setq battery-mode-line-string
- (propertize battery-mode-line-string
- 'face 'sml/battery)))))
-
- ;; Projectile support
- (eval-after-load "projectile"
- '(progn
- (setq sml/projectile-loaded-p t)
- (defcustom sml/projectile-replacement-format "[%s]"
- "Format used for replacements derived from projectile."
- :type 'string
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "2.4"))
- (defcustom sml/use-projectile-p 'after-prefixes
- "Whether we should use projectile to guess path prefixes.
-
-If this is non-nil, and if current buffer is inside a project (as
-defined by projectile), we use the project's name as a
-prefix (with the `sml/projectile-replacement-format' variable).
-
-If this is 'after-prefix, then this replacement will only be used
-if no other prefixes (defined in `sml/replacer-regexp-list') were
-found to match the current file path."
- :type '(choice (const :tag "Use projectile only if current path doesn't match any prefixes." after-prefixes)
- (const :tag "Use projectile before checking prefixes." before-prefixes)
- (const :tag "Don't use projectile." nil))
- :group 'smart-mode-line-others
- :package-version '(smart-mode-line . "2.4.1"))
- (defface sml/projectile '((t :inherit sml/git)) "" :group 'smart-mode-line-faces)
- (add-to-list 'sml/prefix-regexp (format (regexp-quote sml/projectile-replacement-format) ".*"))
- (add-to-list 'sml/prefix-face-list
- (list (format (regexp-quote sml/projectile-replacement-format) ".*")
- 'sml/projectile))))
-
- ;; vc-mode
- (eval-after-load "vc-hooks"
- '(defadvice vc-mode-line (after sml/after-vc-mode-line-advice () activate)
- "Color `vc-mode'."
- (when (stringp vc-mode)
- (let ((noback (replace-regexp-in-string (format "^ %s" (vc-backend buffer-file-name)) " " vc-mode)))
- (setq vc-mode
- (propertize (if sml/vc-mode-show-backend vc-mode noback)
- 'face (cond ((string-match "^ -" noback) 'sml/vc)
- ((string-match "^ [:@]" noback) 'sml/vc-edited)
- ((string-match "^ [!\\?]" noback) 'sml/modified))))))))
-
- ;; Mew support
- (eval-after-load "mew-net"
- '(progn
- (defgroup smart-mode-line-mew '() "Group for editing the mew-support variables." :group 'smart-mode-line)
- (defcustom sml/mew-support t
- "Whether to flash the mode-line when mew detects new mail."
- :type 'boolean :group 'smart-mode-line-mew
- :package-version '(smart-mode-line . "1.11"))
- (defcustom sml/new-mail-background-color "#110000"
- "When new mail arrives, mode-line background will be tinted this color.
-
-Only works with mew-biff. Right now it stays colored until you
-read the mail, so this color should probably be something sutil.
-Might implement a quick flash eventually."
- :type 'color :group 'smart-mode-line-mew
- :package-version '(smart-mode-line . "1.11"))
- (defcustom sml/mew-biff-format (concat "%2d" (if (char-displayable-p ?✉) "✉" "M"))
- "Format used for new-mail notifications if you use mew with biff."
- :type 'string :group 'smart-mode-line-mew
- :package-version '(smart-mode-line . "1.11"))
- (defadvice mew-biff-clear (around sml/mew-biff-clear-advice activate)
- "Advice used to customize mew-biff-bark to fit sml's style."
- ad-do-it
- (when sml/mew-support
- ;; Remove the color
- (set-face-attribute 'mode-line nil :background sml/active-background-color)))
- (defadvice mew-biff-bark (around sml/mew-biff-bark-advice (n) activate)
- "Advice used to customize mew-biff-bark to fit sml's style."
- ad-do-it
- (when sml/mew-support
- ;; Remove the color if mail has been read.
- (if (= n 0) (set-face-attribute 'mode-line nil :background sml/active-background-color)
- ;; Apply color if there's mail. (mew-biff-bark 100)
- (set-face-attribute 'mode-line nil :background sml/new-mail-background-color)
- (setq mew-biff-string (format sml/mew-biff-format n)))))))
-
- (unless (and (boundp 'erc-track-position-in-mode-line)
- (null erc-track-position-in-mode-line))
- (setq erc-track-position-in-mode-line t))
-
- (run-hooks 'sml/after-setup-hook))
-
-;;;###autoload
-(defalias 'smart-mode-line-enable #'sml/setup)
-
-(defun sml/global-theme-support-sml-p ()
- "Non-nil if any of the enabled themes supports smart-mode-line."
- (cl-remove-if
- #'sml/theme-p
- (cl-remove-if-not #'sml/faces-from-theme custom-enabled-themes)))
-
-(defun sml/faces-from-theme (theme)
- "Return the sml faces that THEME customizes."
- (cl-remove-if-not
- (lambda (it) (string-match "\\`sml/" (symbol-name it)))
- (mapcar #'cadr (get theme 'theme-settings))))
-
-(defun sml/set-buffer-identification (&rest ignored)
- "Setq the buffer-identification of this buffer back to ours.
-
-Currently, we only this for dired. For other modes (like info) we
-respect their changes.
-
-Argument IGNORED is obsolete."
- (setq mode-line-buffer-identification sml/mode-line-buffer-identification))
-
-(defvar sml/-this-buffer-changed-p nil
- "t if buffer was changed since last help-text update.")
-(make-variable-buffer-local 'sml/-this-buffer-changed-p)
-
-(defun sml/-this-buffer-changed (&rest ignored)
- "Set variable `sml/-this-buffer-changed-p' to t.
-Argument IGNORED is ignored."
- (setq sml/-this-buffer-changed-p t) nil)
-
-(defun sml/generate-position-help (&rest ignored)
- "Set the string describing various buffer content information.
-Argument IGNORED is ignored."
- (when (and sml/-this-buffer-changed-p
- (get-buffer-window (current-buffer)))
- (setq sml/-this-buffer-changed-p nil)
- (setq sml/position-help-text
- (format-mode-line
- (concat "Buffer size:\n\t%IB\n"
- ;; ;; This is way too slow, unfortunately.
- ;; "Number of Lines:\n\t"
- ;; (int-to-string (line-number-at-pos (point-max)))
- "\nmouse-1: Display Line and Column Mode Menu")))
- nil))
-
-(defcustom sml/order-of-line-and-column nil
- "Decide the order of line-number and column-number display.
-
-When both `line-number-mode' and `column-number-mode' are
-enabled, this variable decides which gets displayed on the left,
-and which gets displayed on the right. If either one of the modes
-is not enabled, this variable has no effect (obviously).
-
-It can only be t or nil.
- t means column-number:line-number
- nil means line-number:column-number"
- :type '(choice (const :tag "column-number:line-number" t)
- (const :tag "line-number:column-number" nil))
- :group 'smart-mode-line-position
- :package-version '(smart-mode-line . "2.4"))
-
-(defun sml/compile-position-construct (&optional symbol value)
- "Recompile the `sml/position-construct' after one of the formats was edited.
-Also sets SYMBOL to VALUE."
- (when (and symbol value) (set symbol value))
- (sml/generate-position-help)
- (setq sml/position-construct
- `((size-indication-mode
- ,(propertize sml/size-indication-format
- 'face 'sml/col-number
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map))
- (sml/order-of-line-and-column
- (column-number-mode
- ,(propertize sml/col-number-format
- 'face 'sml/col-number
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map))
- (line-number-mode
- ,(propertize sml/line-number-format
- 'face 'sml/line-number
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map)))
- (column-number-mode
- (line-number-mode
- ,(propertize sml/numbers-separator
- 'face 'sml/numbers-separator
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map)))
- (sml/order-of-line-and-column
- (line-number-mode
- ,(propertize sml/line-number-format
- 'face 'sml/line-number
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map))
- (column-number-mode
- ,(propertize sml/col-number-format
- 'face 'sml/col-number
- 'help-echo 'sml/position-help-text
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map))))))
-
-(defun sml/generate-modified-status ()
- "Return a string describing the modified status of the buffer."
- (cond
- ((not (or (and (buffer-file-name) (file-remote-p buffer-file-name))
- (verify-visited-file-modtime (current-buffer))))
- (propertize sml/outside-modified-char 'face 'sml/outside-modified
- 'help-echo "Modified outside Emacs!\nRevert first!"))
- ((buffer-modified-p)
- (propertize (if buffer-read-only
- sml/read-only-char
- sml/modified-char)
- 'face 'sml/modified
- 'help-echo (if (and (buffer-file-name) (not (file-remote-p buffer-file-name)))
- (format-time-string
- sml/modified-time-string
- (nth 5 (file-attributes (buffer-file-name))))
- "Buffer Modified")
- 'local-map '(keymap (mode-line keymap (mouse-1 . save-buffer)))))
- (buffer-read-only (propertize sml/read-only-char
- 'face 'sml/read-only
- 'help-echo "Read-Only Buffer"))
- (t (propertize " " 'face 'sml/not-modified))))
-
-(defmacro sml/propertize-position (s face help)
- "Propertize string S as a line/column number, using FACE and help-echo HELP."
- `(propertize ,s
- 'face ,face
- 'help-echo ,help
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-column-line-number-mode-map))
-
-(defun sml/propertize-time-string ()
- "Function to be added to `display-time-hook' to propertize the string."
- (when (and (boundp 'display-time-string) (stringp display-time-string))
- (setq display-time-string
- (propertize display-time-string
- 'face 'sml/time))))
-
-(defun sml/filter-mode-line-list (l)
- "Filter some elements of L and propertize the ones not filtered.
-
-L must be a symbol! We assign right back to it"
- (if (and (symbolp l) (listp (eval l)))
- (set-default l
- (remove nil (mapcar 'sml/parse-mode-line-elements (eval l))))
- (error "l must be a symbol to a list!")))
-
-(defun sml/fill-for-buffer-identification ()
- "Return a string such that `mode-line-buffer-identification' is fixed-width.
-In buffers where `mode-line-buffer-identification' is nil, we
-don't do any filling. That's because the given mode probably
-doesn't want any buffer-id."
- (if mode-line-buffer-identification
- (propertize
- (make-string (max (- (or (car-safe sml/name-width) sml/name-width)
- (string-width (format-mode-line mode-line-buffer-identification)))
- 0)
- sml/fill-char)
- 'face 'sml/name-filling)
- ""))
-
-(defun sml/generate-buffer-identification (&rest ignored)
- "Return fully propertized prefix+path+buffername.
-Argument IGNORED is ignored."
- (setq sml/name-width-old sml/name-width)
- (setq sml/buffer-identification-filling nil)
- (when (or ;; Only calculate all this if it will actually be used
- (equal sml/mode-line-buffer-identification mode-line-buffer-identification)
- (member (cadr sml/mode-line-buffer-identification) mode-line-buffer-identification)
- (member sml/mode-line-buffer-identification mode-line-buffer-identification))
- (setq sml/buffer-identification
- (let* ((dir (sml/replacer (abbreviate-file-name (sml/get-directory))))
- (sml/use-projectile-p (unless (or (not sml/projectile-loaded-p)
- (and (buffer-file-name)
- (file-remote-p (buffer-file-name))))
- sml/use-projectile-p))
- (prefix (sml/get-prefix dir))
- (bufname (sml/buffer-name))
- (dirsize (max 0 (- (abs (or (cdr-safe sml/name-width) sml/name-width))
- (string-width prefix) (string-width bufname))))
- (dirstring (funcall sml/shortener-func dir dirsize)))
-
- (propertize (concat (sml/propertize-prefix (replace-regexp-in-string "%" "%%" prefix))
- (propertize (replace-regexp-in-string "%" "%%" dirstring) 'face 'sml/folder)
- (propertize (replace-regexp-in-string "%" "%%" bufname) 'face 'sml/filename))
- 'help-echo (format "%s\n\nmouse-1: Previous buffer\nmouse-3: Next buffer"
- (or (buffer-file-name) (buffer-name)))
- 'mouse-face 'mode-line-highlight
- 'local-map mode-line-buffer-identification-keymap)))))
-
-(defun sml/parse-mode-line-elements (el)
- "Propertize or delete EL.
-
-To be used in mapcar and accumulate results."
- (cond
- ;; These are implemented separately
- ((member el '("%[" "%]" "%1+" "(" ")" (t erc-modified-channels-object)
- (:eval (if (display-graphic-p) " " "-"))
- (:eval (unless (display-graphic-p) "-%-"))
- (:eval (mode-line-frame-control))))
- nil)
- ((member (car-safe el) '(line-number-mode column-number-mode size-indication-mode current-input-method)) nil)
- ;; mode-line-remote
- ((and (stringp el) (string= el "%1@"))
- `(sml/show-remote
- (:propertize ,el face sml/remote)))
- ;; mode-line-client
- ((equal el '("" (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
- help-echo "emacsclient frame")))
- `(sml/show-client
- (:eval (if (frame-parameter nil 'client)
- ,(propertize "@" 'face 'sml/client 'help-echo (purecopy "emacsclient frame"))
- " "))))
-
- ;; mode-line-modified
- ((and (stringp el) (string-match "%[0-9-]*\\*" el))
- '(:eval (sml/generate-modified-status)))
-
- ;;;; mode-line-position
- ;; Color the position percentage
- ((sml/is-%p-p el)
- `(sml/position-percentage-format
- (-3 (:propertize (:eval sml/position-percentage-format)
- local-map ,mode-line-column-line-number-mode-map
- mouse-face mode-line-highlight
- face sml/position-percentage
- help-echo "Buffer Relative Position\n\
-mouse-1: Display Line and Column Mode Menu"))))
-
- ;;;; mode-line-mule-info
- ;; Partially hide some MULE info
- ((and (stringp el) (string-match "\\s-*%[-0-9]*z" el))
- `(sml/mule-info ((1 (:propertize
- (current-input-method
- ("" current-input-method-title)
- " ")
- face sml/mule-info
- help-echo (concat
- ,(purecopy "Current input method: ")
- current-input-method
- ,(purecopy "\n\
-mouse-2: Disable input method\n\
-mouse-3: Describe current input method"))
- local-map ,mode-line-input-method-map
- mouse-face mode-line-highlight))
- (:propertize (:eval sml/mule-info)
- face sml/mule-info
- help-echo mode-line-mule-info-help-echo
- mouse-face mode-line-highlight
- local-map ,mode-line-coding-system-map))))
- ;; Make EOL optional
- ((equal el '(:eval (mode-line-eol-desc)))
- '(sml/show-eol (:eval (mode-line-eol-desc))))
-
- ;;;; mode-line-modes
- ;; Color the mode line process
- ((or (equal el '("" mode-line-process))
- (equal (car (cdr-safe el)) '("" mode-line-process)))
- `(:propertize ("" mode-line-process) face sml/process))
- ;; Color the mode name, without changing other properties
- ((and (listp el)
- (equal (car el) :propertize)
- (equal (cadr el) '("" mode-name)))
- (setf (cadr el) '("" "%[" mode-name "%]"))
- (append el '(face sml/modes)))
- ;; Completely replace the minor modes (so we can truncate)
- ((and (listp el)
- (equal (car el) :propertize)
- (equal (cadr el) '("" minor-mode-alist)))
- '(:eval (sml/generate-minor-modes)))
-
- ;; ;;; Propertize misc-info
- ;; ((memq (car-safe el) '(which-func-mode global-mode-string))
- ;; `(:eval (add-text-properties (format-mode-line ',el))))
-
- ;; If it's something we don't recognize, just leave it as-is.
- (t el)))
-
-(defun sml/is-%p-p (x)
- "Non-nil if X matches \"%p\" in a very subjective sense."
- (or (and (listp x)
- (cl-remove-if-not
- (lambda (y) (string-match ".*%p.*" y))
- (cl-remove-if-not #'stringp x)))
- (and (stringp x)
- (string-match ".*%p.*" x))))
-
-(defun sml/buffer-name ()
- "Return either buffer name or file name to be shown on the mode-line.
-Uses `sml/show-file-name' to decide between the two.
-
-Unless `sml/show-trailing-N' is nil, prevents the \"\" (used in
-duplicated buffer names) from being displayed."
- (cond ((buffer-base-buffer)
- (buffer-name))
- ((and sml/show-file-name (buffer-file-name))
- (file-name-nondirectory (buffer-file-name)))
- ((derived-mode-p 'dired-mode)
- (file-name-nondirectory (directory-file-name default-directory)))
- (sml/show-trailing-N
- (buffer-name))
- (t (replace-regexp-in-string "<[0-9]+>$" "" (buffer-name)))))
-
-(defun sml/fill-width-available ()
- "Return the size available for filling."
- (max 0
- (+ sml/extra-filler
- (- (window-total-width)
- (let ((sml/simplified t))
- (string-width (format-mode-line mode-line-format)))))))
-
-(defconst sml/propertized-shorten-mode-string
- '(:propertize sml/shorten-mode-string
- face sml/minor-modes
- help-echo "mouse-1: Shorten minor modes"
- local-map (keymap (mode-line keymap (mouse-1 . sml/toggle-shorten-modes)))
- mouse-face mode-line-highlight))
-(defconst sml/propertized-full-mode-string
- '(:propertize sml/full-mode-string
- face sml/minor-modes
- help-echo "mouse-1: Show all modes"
- local-map (keymap (mode-line keymap (mouse-1 . sml/toggle-shorten-modes)))
- mouse-face mode-line-highlight))
-
-(defun sml/count-occurrences-starting-at (regex string start)
- "Count occurrences of REGEX in STRING starting at index START."
- (if (string-match regex string start)
- (+ 1 (sml/count-occurrences-starting-at regex string (match-end 0)))
- 0))
-
-;;; Patch, in case the user is using the wrong variable.
-(when (boundp 'sml/hidden-modes)
- (message "[smart-mode-line] Warning: `sml/hidden-modes' is obsolete, use `rm-blacklist' instead")
- (setq rm-blacklist sml/hidden-modes))
-(define-obsolete-variable-alias 'sml/hidden-modes 'rm-blacklist)
-
-(defun sml/generate-minor-modes ()
- "Extracts all rich strings necessary for the minor mode list."
- (if sml/simplified
- ""
- (let* (;; The minor-mode-alist
- (nameList (rm--mode-list-as-string-list))
- ;; The size available
- (size (max 0
- (- (if (member sml/mode-width '(full right))
- ;; Calculate how much width is available
- (sml/fill-width-available)
- ;; or use what the user requested.
- sml/mode-width)
- (string-width (format-mode-line
- 'sml/pre-minor-modes-separator))
- (string-width (format-mode-line
- 'sml/pos-minor-modes-separator)))))
- ;; Used for counting size.
- (finalNameList (mapconcat 'identity nameList ""))
- needs-removing filling)
-
- ;; Calculate whether truncation is necessary.
- (when (and sml/shorten-modes (> (string-width finalNameList) size))
- ;; We need to remove 1+ "the number of spaces found".
- (setq needs-removing
- (1+
- (sml/count-occurrences-starting-at
- " " finalNameList
- (- size (string-width sml/full-mode-string))))))
- ;; Add truncation string if necessary
- (when needs-removing
- (setcdr (last nameList (1+ needs-removing))
- (list t sml/propertized-full-mode-string)))
- ;; If we're not shortenning, add " -" at the end.
- (unless sml/shorten-modes
- (add-to-list 'nameList sml/propertized-shorten-mode-string t))
-
- ;; Padding
- (setq filling (- size (string-width (format-mode-line nameList))))
- (setq filling (make-string (max 0 filling) sml/fill-char))
-
- (if (eq sml/mode-width 'right)
- (list (propertize filling 'face 'sml/modes)
- 'sml/pre-minor-modes-separator nameList
- 'sml/pos-minor-modes-separator)
- (list "" 'sml/pre-minor-modes-separator nameList
- 'sml/pos-minor-modes-separator filling)))))
-
-(defun sml/propertize-prefix (prefix)
- "Set the color of PREFIX according to its contents."
- (cl-loop for pair in sml/prefix-face-list
- if (string-match (car pair) prefix)
- return (propertize prefix 'face (car (cdr pair)))))
-
-(defun sml/get-directory ()
- "Decide if we want directory shown. If so, return it."
- (abbreviate-file-name
- (cond
- ;; In email attachments, buffer-file-name is non-nil, but
- ;; file-name-directory returns nil
- ((buffer-file-name) (or (file-name-directory (buffer-file-name)) ""))
- ((eq major-mode 'dired-mode)
- (replace-regexp-in-string "/[^/]*/$" "/" default-directory))
- ((and (symbolp major-mode)
- (member major-mode '(shell-mode eshell-mode term-mode)))
- default-directory)
- ;; In indirect buffers, buffer-file-name is nil. The correct value is
- ;; retrieved from the base buffer.
- ((buffer-base-buffer)
- (with-current-buffer (buffer-base-buffer) (sml/get-directory)))
- (t ""))))
-
-(defun sml/set-battery-font ()
- "Set `sml/battery' face depending on battery state."
- (let ((data (and (boundp 'battery-status-function)
- battery-status-function
- (funcall battery-status-function))))
- (if (string-equal "AC" (cdr (assoc 76 data)))
- (copy-face 'sml/charging 'sml/battery)
- (copy-face 'sml/discharging 'sml/battery))))
-
-(defadvice battery-update (before sml/set-battery-font activate)
- "Fontify the battery display."
- (sml/set-battery-font))
-
-(defun sml/replacer (in)
- "Run on string IN the replacements from `sml/replacer-regexp-list'.
-Runs first on the given path, and if that doesn't have any affect,
-runs them again on a version of the given path with all symlinks
-expanded via `file-truename'. If neither run succeeds in making
-any replacements, returns the path originally given.
-
-Used by `sml/strip-prefix' and `sml/get-prefix'."
- ;; First try replacing on the original path
- (if (string= in "")
- in
- (sml/replacer-raw in)))
-
-(defun sml/replacer-raw (in)
- "Run on the string IN the replacements from `sml/replacer-regexp-list'.
-
-If projectile is loaded, also performs replacements specified by
-project name first."
- (let ((out in)
- proj)
- ;; Maybe try projectile
- (when (and sml/projectile-loaded-p
- (eq sml/use-projectile-p 'before-prefixes))
- (setq out (sml/perform-projectile-replacement out)))
- ;; Try regular replacements
- (when (string= out in)
- (dolist (cur sml/replacer-regexp-list)
- (setq out (replace-regexp-in-string (car cur) (car (cdr cur)) out))))
- ;; Try truename replacements
- (when (string= out in)
- (let* ((true-in (abbreviate-file-name (file-truename in)))
- (true-out true-in))
- (dolist (cur sml/replacer-regexp-list)
- (setq true-out (replace-regexp-in-string
- (car cur) (car (cdr cur)) true-out)))
- (unless (string= true-in true-out)
- (setq out true-out))))
- ;; Maybe try projectile later
- (when (and sml/projectile-loaded-p
- (eq sml/use-projectile-p 'after-prefixes)
- (string= out in))
- (setq out (sml/perform-projectile-replacement out)))
- out))
-
-(declare-function projectile-project-p "projectile")
-(declare-function projectile-project-name "projectile")
-(defun sml/perform-projectile-replacement (in)
- "If path IN is inside a project, use its name as a prefix."
- (let ((proj (projectile-project-p)))
- (if (stringp proj)
- (let* ((replacement
- (format sml/projectile-replacement-format
- (projectile-project-name)))
- (short (replace-regexp-in-string
- (concat "^" (regexp-quote (abbreviate-file-name proj)))
- replacement
- in)))
- (if (string= short in)
- (let* ((true-in (abbreviate-file-name (file-truename in)))
- (true-short
- (replace-regexp-in-string
- (concat "^" (regexp-quote (abbreviate-file-name (file-truename proj))))
- replacement true-in)))
- (if (string= true-in true-short) in true-short))
- short))
- in)))
-
-(defun sml/regexp-composer (getter)
- "Prepare the actual regexp using `sml/prefix-regexp'.
-If GETTER is non-nil, result regexp also accepts empty match."
- (let ((left "^\\(")
- (right (if getter "\\|\\).*" "\\)")))
- (if (stringp sml/prefix-regexp)
- (if (string-match "\\(" sml/prefix-regexp)
- sml/prefix-regexp
- (concat left sml/prefix-regexp right))
- (concat left (mapconcat 'identity sml/prefix-regexp "\\|") right))))
-
-(defun sml/strip-prefix (path)
- "Remove prefix from string PATH.
-
-A prefix is anything at the beginning of the line that matches a
-regexp in `sml/prefix-regexp'."
- (replace-regexp-in-string (sml/regexp-composer nil) "" path))
-
-(defun sml/get-prefix (path)
- "Get prefix from string PATH.
-
-A prefix is anything at the beginning of the line that matches a
-regexp in `sml/prefix-regexp'."
- (replace-regexp-in-string (sml/regexp-composer t) "\\1" path))
-
-(defun sml/not-shorten-directory (dir ml)
- "Return DIR, abbreviated and prefixed.
-ML isn't used."
- (sml/strip-prefix dir))
-
-(defcustom sml/directory-truncation-string (if (char-displayable-p ?…) "…/" ".../")
- "String used when truncating part of the file path.
-Set this to nil or an empty string if you don't want any
-indication of a truncated path."
- :type 'string
- :group 'smart-mode-line
- :package-version '(smart-mode-line . "2.10"))
-
-(defun sml/do-shorten-directory (dir max-length)
- "Show up to MAX-LENGTH characters of a directory name DIR."
- (let ((longname (sml/strip-prefix dir)))
- ;; If it fits, return the string.
- (if (<= (string-width longname) max-length) longname
- ;; If it doesn't, shorten it
- (let ((path (reverse (split-string longname "/")))
- (output ""))
- (when (and path (equal "" (car path)))
- (setq path (cdr path)))
- (let ((max (- max-length (string-width sml/directory-truncation-string))))
- ;; Concat as many levels as possible, leaving 4 chars for safety.
- (while (and path (<= (string-width (concat (car path) "/" output))
- max))
- (setq output (concat (car path) "/" output))
- (setq path (cdr path))))
- ;; If we had to shorten, prepend .../
- (when path
- (setq output (concat sml/directory-truncation-string output)))
- output))))
-
-(provide 'smart-mode-line)
-;;; smart-mode-line.el ends here
diff --git a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.elc b/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.elc
deleted file mode 100644
index cab24a9..0000000
Binary files a/emacs/.emacs.d/elpa/smart-mode-line-20171013.849/smart-mode-line.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-autoloads.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-autoloads.el
deleted file mode 100644
index 5c8f012..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-autoloads.el
+++ /dev/null
@@ -1,202 +0,0 @@
-;;; smartparens-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "smartparens" "smartparens.el" (23124 14370
-;;;;;; 2183 563000))
-;;; Generated autoloads from smartparens.el
-
-(autoload 'sp-cheat-sheet "smartparens" "\
-Generate a cheat sheet of all the smartparens interactive functions.
-
-Without a prefix argument, print only the short documentation and examples.
-
-With non-nil prefix argument ARG, show the full documentation for each function.
-
-You can follow the links to the function or variable help page.
-To get back to the full list, use \\[help-go-back].
-
-You can use `beginning-of-defun' and `end-of-defun' to jump to
-the previous/next entry.
-
-Examples are fontified using the `font-lock-string-face' for
-better orientation.
-
-\(fn &optional ARG)" t nil)
-
-(defvar smartparens-mode-map (make-sparse-keymap) "\
-Keymap used for `smartparens-mode'.")
-
-(autoload 'sp-use-paredit-bindings "smartparens" "\
-Initiate `smartparens-mode-map' with `sp-paredit-bindings'.
-
-\(fn)" t nil)
-
-(autoload 'sp-use-smartparens-bindings "smartparens" "\
-Initiate `smartparens-mode-map' with `sp-smartparens-bindings'.
-
-\(fn)" t nil)
-
-(autoload 'smartparens-mode "smartparens" "\
-Toggle smartparens mode.
-
-You can enable pre-set bindings by customizing
-`sp-base-key-bindings' variable. The current content of
-`smartparens-mode-map' is:
-
- \\{smartparens-mode-map}
-
-\(fn &optional ARG)" t nil)
-
-(autoload 'smartparens-strict-mode "smartparens" "\
-Toggle the strict smartparens mode.
-
-When strict mode is active, `delete-char', `kill-word' and their
-backward variants will skip over the pair delimiters in order to
-keep the structure always valid (the same way as `paredit-mode'
-does). This is accomplished by remapping them to
-`sp-delete-char' and `sp-kill-word'. There is also function
-`sp-kill-symbol' that deletes symbols instead of words, otherwise
-working exactly the same (it is not bound to any key by default).
-
-When strict mode is active, this is indicated with \"/s\"
-after the smartparens indicator in the mode list.
-
-\(fn &optional ARG)" t nil)
-
-(defvar smartparens-global-strict-mode nil "\
-Non-nil if Smartparens-Global-Strict mode is enabled.
-See the `smartparens-global-strict-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 `smartparens-global-strict-mode'.")
-
-(custom-autoload 'smartparens-global-strict-mode "smartparens" nil)
-
-(autoload 'smartparens-global-strict-mode "smartparens" "\
-Toggle Smartparens-Strict mode in all buffers.
-With prefix ARG, enable Smartparens-Global-Strict mode if ARG is positive;
-otherwise, disable it. If called from Lisp, enable the mode if
-ARG is omitted or nil.
-
-Smartparens-Strict mode is enabled in all buffers where
-`turn-on-smartparens-strict-mode' would do it.
-See `smartparens-strict-mode' for more information on Smartparens-Strict mode.
-
-\(fn &optional ARG)" t nil)
-
-(autoload 'turn-on-smartparens-strict-mode "smartparens" "\
-Turn on `smartparens-strict-mode'.
-
-\(fn)" t nil)
-
-(autoload 'turn-off-smartparens-strict-mode "smartparens" "\
-Turn off `smartparens-strict-mode'.
-
-\(fn)" t nil)
-
-(defvar smartparens-global-mode nil "\
-Non-nil if Smartparens-Global mode is enabled.
-See the `smartparens-global-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 `smartparens-global-mode'.")
-
-(custom-autoload 'smartparens-global-mode "smartparens" nil)
-
-(autoload 'smartparens-global-mode "smartparens" "\
-Toggle Smartparens mode in all buffers.
-With prefix ARG, enable Smartparens-Global mode if ARG is positive;
-otherwise, disable it. If called from Lisp, enable the mode if
-ARG is omitted or nil.
-
-Smartparens mode is enabled in all buffers where
-`turn-on-smartparens-mode' would do it.
-See `smartparens-mode' for more information on Smartparens mode.
-
-\(fn &optional ARG)" t nil)
-
-(autoload 'turn-on-smartparens-mode "smartparens" "\
-Turn on `smartparens-mode'.
-
-This function is used to turn on `smartparens-global-mode'.
-
-By default `smartparens-global-mode' ignores buffers with
-`mode-class' set to special, but only if they are also not comint
-buffers.
-
-Additionally, buffers on `sp-ignore-modes-list' are ignored.
-
-You can still turn on smartparens in these mode manually (or
-in mode's startup-hook etc.) by calling `smartparens-mode'.
-
-\(fn)" t nil)
-
-(autoload 'turn-off-smartparens-mode "smartparens" "\
-Turn off `smartparens-mode'.
-
-\(fn)" t nil)
-
-(autoload 'show-smartparens-mode "smartparens" "\
-Toggle visualization of matching pairs. When enabled, any
-matching pair is highlighted after `sp-show-pair-delay' seconds
-of Emacs idle time if the point is immediately in front or after
-a pair. This mode works similarly to `show-paren-mode', but
-support custom pairs.
-
-\(fn &optional ARG)" t nil)
-
-(defvar show-smartparens-global-mode nil "\
-Non-nil if Show-Smartparens-Global mode is enabled.
-See the `show-smartparens-global-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 `show-smartparens-global-mode'.")
-
-(custom-autoload 'show-smartparens-global-mode "smartparens" nil)
-
-(autoload 'show-smartparens-global-mode "smartparens" "\
-Toggle Show-Smartparens mode in all buffers.
-With prefix ARG, enable Show-Smartparens-Global mode if ARG is positive;
-otherwise, disable it. If called from Lisp, enable the mode if
-ARG is omitted or nil.
-
-Show-Smartparens mode is enabled in all buffers where
-`turn-on-show-smartparens-mode' would do it.
-See `show-smartparens-mode' for more information on Show-Smartparens mode.
-
-\(fn &optional ARG)" t nil)
-
-(autoload 'turn-on-show-smartparens-mode "smartparens" "\
-Turn on `show-smartparens-mode'.
-
-\(fn)" t nil)
-
-(autoload 'turn-off-show-smartparens-mode "smartparens" "\
-Turn off `show-smartparens-mode'.
-
-\(fn)" t nil)
-
-;;;***
-
-;;;### (autoloads nil nil ("smartparens-clojure.el" "smartparens-config.el"
-;;;;;; "smartparens-elixir.el" "smartparens-ess.el" "smartparens-haskell.el"
-;;;;;; "smartparens-html.el" "smartparens-javascript.el" "smartparens-latex.el"
-;;;;;; "smartparens-lua.el" "smartparens-markdown.el" "smartparens-ml.el"
-;;;;;; "smartparens-org.el" "smartparens-pkg.el" "smartparens-python.el"
-;;;;;; "smartparens-racket.el" "smartparens-ruby.el" "smartparens-rust.el"
-;;;;;; "smartparens-scala.el" "smartparens-text.el") (23124 14370
-;;;;;; 55517 153000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; smartparens-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.el
deleted file mode 100644
index d33ad90..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.el
+++ /dev/null
@@ -1,56 +0,0 @@
-;;; smartparens-clojure.el --- Additional configuration for Clojure mode.
-;;
-;; Author: Vitalie Spinu
-;; Maintainer: Matus Goljer
-;; Created: 14 July 2016
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-;;
-;; This file is not part of GNU Emacs.
-;;
-;;; License:
-;;
-;; This file is part of Smartparens.
-;;
-;; Smartparens 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.
-;;
-;; Smartparens 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 Smartparens. If not, see .
-;;
-;;; Commentary:
-;;
-;; This file provides some additional configuration for Clojure mode. To use
-;; it, simply add:
-;;
-;; (require 'smartparens-clojure)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;;; Code:
-
-(require 'smartparens)
-
-(defvar sp-clojure-prefix "\\(?:[@`'#~,_?^]+\\)"
- "Prefix used in `sp-sepx-prefix' for clojure modes.")
-
-(dolist (mode '(clojure-mode clojurescript-mode clojurec-mode cider-repl-mode))
- (add-to-list 'sp-sexp-prefix `(,mode regexp ,sp-clojure-prefix)))
-
-;; Match "`" with "`" in strings and comments
-(sp-with-modes sp-clojure-modes
- (sp-local-pair "`" "`"
- :when '(sp-in-string-p
- sp-in-comment-p)
- :unless '(sp-lisp-invalid-hyperlink-p)))
-
-(provide 'smartparens-clojure)
-;;; smartparens-clojure.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.elc
deleted file mode 100644
index 360c927..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-clojure.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.el
deleted file mode 100644
index 954f285..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.el
+++ /dev/null
@@ -1,129 +0,0 @@
-;;; smartparens-config.el --- Default configuration for smartparens package
-
-;; Copyright (C) 2013-2016 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 30 Jan 2013
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This is a default configuration for smartparens package. If you
-;; wish to set up everything by yourself, you can instead require
-;; smartparens directly.
-
-;; However, some configuration is always loaded by default, most
-;; notably the built-in list of supported pairs. If you want to erase
-;; this list, simply use (setq sp-pairs nil) and then add your own
-;; pairs.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-lisp-invalid-hyperlink-p (id action context)
- "Test if there is an invalid hyperlink in a Lisp docstring.
-ID, ACTION, CONTEXT."
- (when (eq action 'navigate)
- ;; Ignore errors due to us being at the start or end of the
- ;; buffer.
- (ignore-errors
- (or (and (looking-at "\\sw\\|\\s_")
- (save-excursion
- (backward-char 2)
- (looking-at "\\sw\\|\\s_")))
- (and (save-excursion
- (backward-char 1)
- (looking-at "\\sw\\|\\s_"))
- (save-excursion
- (forward-char 1)
- (looking-at "\\sw\\|\\s_")))))))
-
-;; emacs is lisp hacking enviroment, so we set up some most common
-;; lisp modes too
-(sp-with-modes sp-lisp-modes
- ;; disable ', it's the quote character!
- (sp-local-pair "'" nil :actions nil))
-
-(sp-with-modes (-difference sp-lisp-modes sp-clojure-modes)
- ;; also only use the pseudo-quote inside strings where it serve as
- ;; hyperlink.
- (sp-local-pair "`" "'"
- :when '(sp-in-string-p
- sp-in-comment-p)
- :unless '(sp-lisp-invalid-hyperlink-p)
- :skip-match (lambda (ms mb me)
- (cond
- ((equal ms "'")
- (or (sp-lisp-invalid-hyperlink-p "`" 'navigate '_)
- (not (sp-point-in-string-or-comment))))
- (t (not (sp-point-in-string-or-comment)))))))
-
-;; Unfortunately emacs devs in their glorious wisdom decided to
-;; make @ no longer have prefix syntax, it is now a symbol... because
-;; apparently its use in symbols is so frequent. Anyway, since we
-;; can't really change that, let's use a regexp based solution
-(add-to-list 'sp-sexp-prefix (list 'emacs-lisp-mode 'regexp "\\(?:['`]*,@?\\|[',`]\\)"))
-
-;; TODO: this should only be active in docstring, otherwise we want
-;; the regexp completion \\{\\}. To handle this feature, we must
-;; allow multiple pairs on same opening (therefore, the unique ID must
-;; become the opening and closing pair)
-(sp-local-pair 'emacs-lisp-mode "\\\\{" "}" :when '(sp-in-docstring-p))
-
-;; NOTE: Normally, `sp-local-pair' accepts list of modes (or a single
-;; mode) as a first argument. The macro `sp-with-modes' adds this
-;; automatically. If you want to call sp-local-pair outside this
-;; macro, you MUST supply the major mode argument.
-
-(eval-after-load 'clojure-mode '(require 'smartparens-clojure))
-(eval-after-load 'elixir-mode '(require 'smartparens-elixir))
-(eval-after-load 'enh-ruby-mode '(require 'smartparens-ruby))
-(eval-after-load 'ess '(require 'smartparens-ess))
-(eval-after-load 'haskell-interactive-mode '(require 'smartparens-haskell))
-(eval-after-load 'haskell-mode '(require 'smartparens-haskell))
-(--each sp--html-modes
- (eval-after-load it '(require 'smartparens-html)))
-(eval-after-load 'latex '(require 'smartparens-latex))
-(eval-after-load 'lua-mode '(require 'smartparens-lua))
-(eval-after-load 'markdown-mode '(require 'smartparens-markdown))
-(--each '(python-mode python)
- (eval-after-load it '(require 'smartparens-python)))
-(eval-after-load 'org '(require 'smartparens-org))
-(eval-after-load 'racket-mode '(require 'smartparens-racket))
-(eval-after-load 'ruby-mode '(require 'smartparens-ruby))
-(eval-after-load 'rust-mode '(require 'smartparens-rust))
-(eval-after-load 'scala-mode '(require 'smartparens-scala))
-(eval-after-load 'tex-mode '(require 'smartparens-latex))
-(eval-after-load 'text-mode '(require 'smartparens-text))
-(eval-after-load 'tuareg '(require 'smartparens-ml))
-(eval-after-load 'fsharp-mode '(require 'smartparens-ml))
-(--each '(js js2-mode)
- (eval-after-load it '(require 'smartparens-javascript)))
-(provide 'smartparens-config)
-
-;;; smartparens-config.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.elc
deleted file mode 100644
index f24caaf..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-config.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.el
deleted file mode 100644
index 637dd22..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.el
+++ /dev/null
@@ -1,134 +0,0 @@
-;;; smartparens-elixir.el --- Configuration for Elixir.
-
-;; Copyright (C) 2017 Matúš Goljer
-
-;; Author: Matúš Goljer
-;; Maintainer: Matúš Goljer
-;; Version: 0.0.1
-;; Created: 15th January 2017
-;; Keywords: languages
-
-;; 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 .
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'smartparens)
-
-(--each '(elixir-mode)
- (add-to-list 'sp-sexp-suffix (list it 'regexp "")))
-
-(defun sp-elixir-def-p (id)
- "Return non-nil if the \"do\" keyword is part of definition.
-
-ID is the opening delimiter.
-
-Definitions are the constructions of the form defmodule-do-end,
-def-do-end and similar pairs."
- (save-excursion
- (when (equal "do" id)
- (back-to-indentation)
- (looking-at (regexp-opt '(
- "defmodule"
- "defmacro"
- "defmacrop"
- "quote"
- "def"
- "defp"
- "if"
- "unless"
- "case"
- "cond"
- "with"
- "for"
- "receive"
- "try"
- ))))))
-
-(defun sp-elixir-skip-def-p (ms mb me)
- "Test if \"do\" is part of definition.
-MS, MB, ME."
- (sp-elixir-def-p ms))
-
-(defun sp-elixir-do-block-post-handler (id action context)
- "Insert \"do\" keyword and indent the new block.
-ID, ACTION, CONTEXT."
- (when (eq action 'insert)
- (let ((m (make-marker)))
- (save-excursion
- (forward-word) ;; over the "end"
- (move-marker m (point)))
- (save-excursion (newline))
- (save-excursion (insert " do"))
- (indent-region (line-beginning-position) m)
- (move-marker m nil nil))))
-
-(defun sp-elixir-empty-do-block-post-handler (id action context)
- "Insert empty \"do\" keyword and indent the new block.
-
-This is used for receive-do-end expression.
-ID, ACTION, CONTEXT."
- (when (eq action 'insert)
- (let ((m (make-marker)))
- (save-excursion
- (forward-word) ;; over the "end"
- (move-marker m (point)))
- (save-excursion
- (forward-line -1)
- (end-of-line)
- (insert " do"))
- (save-excursion (newline))
- (indent-region (line-beginning-position) m)
- (indent-according-to-mode)
- (move-marker m nil nil))))
-
-(sp-with-modes 'elixir-mode
- (sp-local-pair "do" "end"
- :when '(("SPC" "RET" ""))
- :skip-match 'sp-elixir-skip-def-p)
- (sp-local-pair "def" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "defp" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "defmodule" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "fn" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '("| "))
- (sp-local-pair "if" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "unless" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "case" "end"
- :when '(("SPC" "RET" ""))
- :post-handlers '(sp-elixir-do-block-post-handler)
- :unless '(sp-in-comment-p))
- (sp-local-pair "receive" "end"
- :when '(("RET" ""))
- :post-handlers '(sp-elixir-empty-do-block-post-handler))
- )
-
-(provide 'smartparens-elixir)
-;;; smartparens-elixir.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.elc
deleted file mode 100644
index 4e63d91..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-elixir.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.el
deleted file mode 100644
index 61f9d28..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.el
+++ /dev/null
@@ -1,224 +0,0 @@
-;;; smartparens-ess.el --- Smartparens Extension for Emacs Speaks Statistics
-
-;; Copyright (c) 2015-2016 Bernhard Pröll
-
-;; Author: Bernhard Pröll
-;; Maintainer: Bernhard Pröll
-;; URL: https://github.com/Fuco1/smartparens
-;; Created: 2015-02-26
-;; Version: 0.2
-;; Keywords: abbrev convenience editing
-
-;; 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 .
-
-;;; Commentary:
-;;
-;; This file provides some additional configuration for ESS. To use
-;; it, simply add:
-;;
-;; (require 'smartparens-ess)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;;; Code:
-
-(require 'smartparens)
-(require 'rx)
-
-
-;; avoid traveling commas when slurping
-;; (|a, b), c ---> (|a, b, c)
-(dolist (mode '(ess-mode inferior-ess-mode))
- (add-to-list 'sp-sexp-suffix (list mode 'regexp "")))
-
-;; `sp-sexp-prefix' for ESS
-(add-to-list 'sp-sexp-prefix
- (list 'ess-mode 'regexp
- (rx (zero-or-more (or word (syntax symbol))))))
-
-;; slurping follows Google's R style guide
-;; see https://google.github.io/styleguide/Rguide.xml
-(defun sp-ess-pre-handler (id action context)
- "Remove spaces before opening parenthesis in a function call.
-Remove redundant space around commas.
-ID, ACTION, CONTEXT."
- (when (equal action 'slurp-forward)
- (let ((sxp (sp-get-thing 'back)))
- (save-excursion
- (goto-char (sp-get sxp :beg-prf))
- ;; (|) x ---> (x)
- (when (looking-back (rx (syntax open-parenthesis)
- (one-or-more space)))
- (cycle-spacing 0 nil 'single-shot))
- (cond
- ;; (|)if(cond) ---> (|if (cond))
- ((member (sp-get sxp :prefix) '("if" "for" "while"))
- (goto-char (sp-get sxp :beg))
- (cycle-spacing 1 nil 'single-shot))
- ;; (|)v [,2] <- if(x > 1) ---> (v[,2] <- if (x > 1))
- ((and
- (member (sp-get sxp :op) '("[" "("))
- (equal (sp-get sxp :prefix) "")
- (looking-back
- (rx (and (not-char "%" ",")
- (not (syntax close-parenthesis)))
- (one-or-more space)))
- (not (member
- (save-excursion
- (sp-backward-sexp)
- (thing-at-point 'word 'noprop))
- '("if" "for" "while"))))
- (cycle-spacing 0 nil 'single-shot))
- ;; (|[...])%in% ---> ([...] %in%|)
- ((or (looking-at "%") (looking-back "%"))
- (just-one-space))
- ;; (|)a , b, c ---> (|a, b, c)
- ((looking-back
- (rx (zero-or-more space) "," (zero-or-more space))
- (line-beginning-position) 'greedy)
- (replace-match ", "))))))
- (when (equal action 'slurp-backward)
- (let ((sxp (sp-get-thing)))
- (save-excursion
- (goto-char (sp-get sxp :end))
- ;; x (|) ---> (x)
- (when (looking-at (rx (one-or-more space)
- (syntax close-parenthesis)))
- (cycle-spacing 0 nil 'single-shot))
- ;; if(cond){} (|) ---> (if (cond) {}|)
- (cond ((member (sp-get sxp :prefix) '("if" "for" "while"))
- (goto-char (sp-get sxp :beg))
- (cycle-spacing 1 nil 'single-shot))
- ;; for style reasons there should be a space before curly
- ;; brackets and binary operators
- ((and (member (sp-get sxp :op) '("{" "%"))
- (not (looking-at (rx (syntax close-parenthesis)))))
- (cycle-spacing 1 nil 'single-shot))
- ;; v[2](|) ---> (v[2]|)
- ((and
- (not (member (thing-at-point 'word 'noprop)
- '("if" "for" "while")))
- (looking-at
- (rx (and (zero-or-more space)
- (not-char "{")
- (or (syntax close-parenthesis)
- (char "(")
- (char "["))))))
- (cycle-spacing 0 nil 'single-shot))
- ;; 1 , 2 (|) ---> (1, 2)
- ((looking-at
- (rx (zero-or-more space) "," (zero-or-more space)))
- (replace-match ", ")))))))
-
-;; function(x) {|} ---> function(x) {\n|\n}
-;; ##' \tabular{rrr}{|} --->
-;; ##' \tabular{rrr}{
-;; ##' |
-;; ##' }
-(defun sp-ess-open-sexp-indent (&rest args)
- "Open new brace or bracket with indentation.
-ARGS."
- (if (and (fboundp 'ess-roxy-entry-p) (ess-roxy-entry-p))
- (progn
- (save-excursion (ess-roxy-indent-on-newline))
- (when (looking-back ess-roxy-str nil)
- (cycle-spacing 3 nil t)))
- (newline)
- (indent-according-to-mode)
- (forward-line -1)
- (indent-according-to-mode)))
-
-(defun sp-ess-roxy-str-p (id action context)
- "Test if looking back at `ess-roxy-re'.
-ID, ACTION, CONTEXT."
- (when (and (boundp 'ess-roxy-re) (eq action 'insert))
- (sp--looking-back-p ess-roxy-re)))
-
-(sp-with-modes 'ess-mode
- (sp-local-pair "{" nil
- :pre-handlers '(sp-ess-pre-handler)
- ;; the more reasonable C-j interferes with default binding for
- ;; `ess-eval-line'
- :post-handlers '((sp-ess-open-sexp-indent "M-j")))
- (sp-local-pair "(" nil
- :pre-handlers '(sp-ess-pre-handler)
- :post-handlers '((sp-ess-open-sexp-indent "M-j")))
- (sp-local-pair "[" nil
- :pre-handlers '(sp-ess-pre-handler)
- :post-handlers '((sp-ess-open-sexp-indent "M-j")))
- (sp-local-pair "'" nil
- :unless '(sp-ess-roxy-str-p sp-in-comment-p sp-in-string-quotes-p)))
-
-;;; roxygen2 markup
-;; see https://cran.r-project.org/web/packages/roxygen2/vignettes/formatting.html
-(sp-with-modes 'ess-mode
- (sp-local-pair "\\strong{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\strong")
- (sp-local-pair "\\emph{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\emph")
- (sp-local-pair "\\code{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\code")
- (sp-local-pair "\\url{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\url")
- (sp-local-pair "\\link{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\link")
- (sp-local-pair "\\href{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\href"
- :suffix "{[^}]*}")
- (sp-local-pair "\\email{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\email")
- (sp-local-pair "\\pkg{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\pkg")
- (sp-local-pair "\\item{" "}"
- :when '(sp-in-comment-p)
- :post-handlers '((sp-ess-open-sexp-indent "M-j"))
- :trigger "\\item{")
- (sp-local-pair "\\enumerate{" "}"
- :when '(sp-in-comment-p)
- :post-handlers '((sp-ess-open-sexp-indent "M-j"))
- :trigger "\\enumerate")
- (sp-local-pair "\\itemize{" "}"
- :when '(sp-in-comment-p)
- :post-handlers '((sp-ess-open-sexp-indent "M-j"))
- :trigger "\\itemize")
- (sp-local-pair "\\describe{" "}"
- :when '(sp-in-comment-p)
- :post-handlers '((sp-ess-open-sexp-indent "M-j"))
- :trigger "\\describe")
- (sp-local-pair "\\eqn{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\eqn")
- (sp-local-pair "\\deqn{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\deqn")
- (sp-local-pair "\\tabular{" "}"
- :when '(sp-in-comment-p)
- :trigger "\\tabular"
- :post-handlers '((sp-ess-open-sexp-indent "M-j"))
- :suffix "{[^}]*}"))
-
-
-(provide 'smartparens-ess)
-;;; smartparens-ess ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.elc
deleted file mode 100644
index 0c4230c..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ess.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.el
deleted file mode 100644
index 4952cc9..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.el
+++ /dev/null
@@ -1,113 +0,0 @@
-;;; smartparens-haskell.el --- Additional configuration for Haskell based modes.
-
-;; Copyright (C) 2015 Michael Xavier
-
-;; Author: Michael Xavier
-;; Maintainer: Michael Xavier
-;; Created: 29 Apr 2016
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Haskell based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-haskell)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-(require 'smartparens)
-
-(defun sp-haskell-skip-apostrophe (ms mb me)
- (save-excursion
- ;; We test the syntax class because haskell mode overrides
- ;; the class for ' on the fly when it run the syntax pass of
- ;; font-lock... so that if '' is a valid string (char) it
- ;; gets an override via 'syntax-table property. In which
- ;; case we just agree with haskell mode and let it be used as
- ;; a pair.
- (not (eq (syntax-class (syntax-after mb)) 7))))
-
-(defun sp-haskell-strict-ignore-apostrophe-after-word (_id action _context)
- "Ignore trailing ' when navigating.
-
-Because ' in haskell is symbol class it gets picked up as part of
-a words such as myFunction', and then strict mode won't allow us
-to delete it. Also show-smartparens-mode incorrectly highlights
-it as missing an opener.
-
-So we ignore that pair when at the end of word."
- (when (eq action 'navigate)
- (sp--looking-back-p (concat "\\(\\sw\\|\\s_\\)'+"))))
-
-(sp-with-modes '(haskell-mode haskell-interactive-mode)
- (sp-local-pair "{-" "-}")
- (sp-local-pair "{-#" "#-}")
- (sp-local-pair "{-@" "@-}")
- (sp-local-pair "'" nil
- :unless '(sp-point-after-word-p
- sp-haskell-strict-ignore-apostrophe-after-word)
- :skip-match 'sp-haskell-skip-apostrophe)
- (sp-local-pair "\\(" nil :actions nil))
-
-(defun sp--inferior-haskell-mode-backward-bound-fn ()
- "Limit the backward search to the prompt if point is on prompt."
- (-when-let (limit (cond ((bound-and-true-p comint-last-prompt)
- (marker-position (cdr comint-last-prompt)))
- ((bound-and-true-p comint-last-prompt-overlay)
- (overlay-end comint-last-prompt-overlay))
- (t nil)))
- (and (> (point) limit) limit)))
-
-(defun sp--inferior-haskell-mode-forward-bound-fn ()
- "Limit the forward search to exclude the prompt if point is before prompt."
- (-when-let (limit (cond ((bound-and-true-p comint-last-prompt)
- (marker-position (car comint-last-prompt)))
- ((bound-and-true-p comint-last-prompt-overlay)
- (overlay-start comint-last-prompt-overlay))
- (t nil)))
- (and (< (point) limit) limit)))
-
-(defun sp--setup-inferior-haskell-mode-search-bounds ()
- "Setup the search bound.
-
-If the point is after the last prompt, limit the backward search
-only for the propmt.
-
-If the point is before the last prompt, limit the forward search up until the prompt start."
- (setq sp-forward-bound-fn 'sp--inferior-haskell-mode-forward-bound-fn)
- (setq sp-backward-bound-fn 'sp--inferior-haskell-mode-backward-bound-fn))
-
-(add-hook 'inferior-haskell-mode-hook 'sp--setup-inferior-haskell-mode-search-bounds)
-
-(provide 'smartparens-haskell)
-
-;;; smartparens-haskell.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.elc
deleted file mode 100644
index ffe5397..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-haskell.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.el
deleted file mode 100644
index 70e143a..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.el
+++ /dev/null
@@ -1,170 +0,0 @@
-;;; smartparens-html.el --- Additional configuration for HTML based modes.
-
-;; Copyright (C) 2013-2014 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 14 Sep 2013
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for HTML based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-html)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-
-;; This file provides these interactive functions:
-
-;; `sp-html-next-tag' - Recommended binding: C-c C-f
-;; `sp-html-previous-tag' - Recommended binding: C-c C-b
-;;
-;; (These two bindings are used for navigation by tags forward or
-;; backward, but `sp-forward-sexp' already does that.)
-
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-html-next-tag (arg)
- "Move point to the beginning of next SGML tag.
-
-With ARG positive N > 1, move N tags forward.
-
-With ARG raw prefix argument \\[universal-argument] move out of
-the current tag and to the beginning of enclosing tag.
-
-Note: this function is based on `sp-beginning-of-sexp' but
-specialized to only work with SGML tags and to always move
-forward."
- (interactive "P")
- (let ((sp-prefix-tag-object t))
- (if (sp--raw-argument-p arg)
- (sp-beginning-of-sexp arg)
- (sp-beginning-of-sexp (1+ (prefix-numeric-value arg))))))
-
-(defun sp-html-previous-tag (arg)
- "Move point to the beginning of previous SGML tag.
-
-With ARG positive N > 1, move N tags backward.
-
-With ARG raw prefix argument \\[universal-argument] move out of
-the current tag and to the beginning of enclosing tag.
-
-Note: this function is based on `sp-beginning-of-sexp' but
-specialized to only work with SGML tags and to always move
-backward."
- (interactive "P")
- (let ((sp-prefix-tag-object t))
- (if (sp--raw-argument-p arg)
- (sp-beginning-of-sexp arg)
- (sp-beginning-of-sexp (1- (- (prefix-numeric-value arg)))))))
-
-(defun sp-html-post-handler (&optional id action context)
- "Post-action hooks for `html-mode'.
-
-ID is the tag being processed, ACTION is the action and CONTEXT
-specifies if we are inside a string or code."
- (cl-case action
- (slurp-forward
- (save-excursion
- (let ((sp-prefix-pair-object t))
- (sp-backward-sexp))
- (-when-let (enc (sp-get-enclosing-sexp))
- (sp-get enc
- (goto-char :beg-in)
- (when (looking-at-p "[ \t]*$")
- (goto-char :end-in)
- (save-excursion
- (sp-backward-sexp)
- (forward-line -1)
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (1+ (line-end-position)))))
- (newline-and-indent))))))
- (slurp-backward
- (save-excursion
- (-when-let (enc (sp-get-enclosing-sexp))
- (sp-get enc
- (goto-char :end-in)
- (when (sp--looking-back-p "^[ \t]*")
- (save-excursion
- (goto-char :beg-in)
- (newline-and-indent)
- (sp-forward-sexp)
- (forward-line)
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (1+ (line-end-position))))))))))
- (barf-forward
- (save-excursion
- (let ((sp-prefix-pair-object t))
- (sp-backward-sexp))
- (-when-let (enc (sp-get-enclosing-sexp))
- (sp-get enc
- (goto-char :beg-in)
- (when (looking-at-p "[ \t]*$")
- (goto-char :end-in)
- (newline-and-indent)))))
- (save-excursion
- (sp-forward-sexp)
- (forward-line)
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (1+ (line-end-position))))))
- (barf-backward
- (save-excursion
- (-when-let (enc (sp-get-enclosing-sexp))
- (sp-get enc
- (goto-char :end-in)
- (when (sp--looking-back-p "^[ \t]*")
- (goto-char :beg-in)
- (newline-and-indent)
- (sp-backward-up-sexp)
- (sp-backward-sexp)
- (forward-line -1)
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (1+ (line-end-position)))))))))
- (beginning-of-sexp
- (when (looking-at-p "[ \t]*$")
- (sp-next-sexp)))
- (end-of-sexp
- (when (sp--looking-back-p "^[ \t]*" nil t)
- (sp-previous-sexp)))))
-
-(sp-with-modes sp--html-modes
- (sp-local-pair "<" ">")
- (sp-local-tag "<" "<_>" "" :transform 'sp-match-sgml-tags :post-handlers '(sp-html-post-handler)))
-
-(--each sp--html-modes
- (add-to-list 'sp-navigate-consider-sgml-tags it))
-
-(provide 'smartparens-html)
-
-;;; smartparens-html.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.elc
deleted file mode 100644
index fd16651..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-html.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.el
deleted file mode 100644
index 1b6462e..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.el
+++ /dev/null
@@ -1,55 +0,0 @@
-;;; smartparens-javascript.el --- Additional configuration for JavaScript based modes.
-
-;; Copyright (c) 2017 Marinin Tim
-;; Author: Tim Marinin
-;; Maintainer: Tim Marinin
-;; Created: 2017-03-03
-;; Keywords: abbrev convenience editing javascript
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for JavaScript based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-javascript)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-;; (|sys).path.append---the dot should not travel with the closing
-;; paren
-(--each '(js-mode javascript-mode js2-mode typescript-mode)
- (add-to-list 'sp-sexp-suffix (list it 'regexp "")))
-
-(provide 'smartparens-javascript)
-;;; smartparens-javasript.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.elc
deleted file mode 100644
index 8c1fa7e..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-javascript.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.el
deleted file mode 100644
index 65eaa96..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.el
+++ /dev/null
@@ -1,185 +0,0 @@
-;;; smartparens-latex.el --- Additional configuration for (La)TeX based modes.
-
-;; Copyright (C) 2013-2016 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 14 Feb 2013
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for (La)TeX based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-latex)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-latex-insert-spaces-inside-pair (id action context)
- "ID, ACTION, CONTEXT."
- (when (eq action 'insert)
- (insert " ")
- (backward-char 1))
- (when (and (eq action 'wrap)
- (save-excursion
- (goto-char (sp-get sp-last-wrapped-region :beg-in))
- (not (sp--looking-back-p "[[{(]"))))
- (save-excursion
- (goto-char (sp-get sp-last-wrapped-region :end-in))
- (insert " ")
- (goto-char (sp-get sp-last-wrapped-region :beg-in))
- (insert " "))))
-
-(defun sp-latex-skip-match-apostrophe (ms mb me)
- "MS, MB, ME."
- (when (equal ms "'")
- (save-excursion
- (goto-char me)
- (looking-at-p "\\sw"))))
-
-(defun sp-latex-skip-double-quote (id action context)
- "ID, ACTION, CONTEXT."
- (when (eq action 'insert)
- (when (looking-at-p "''''")
- (delete-char -2)
- (delete-char 2)
- (forward-char 2))))
-
-(defun sp-latex-point-after-backslash (id action context)
- "Return t if point follows a backslash, nil otherwise.
-This predicate is only tested on \"insert\" action.
-ID, ACTION, CONTEXT."
- (when (eq action 'insert)
- (let ((trigger (sp-get-pair id :trigger)))
- (looking-back (concat "\\\\" (regexp-quote (if trigger trigger id)))))))
-
-(add-to-list 'sp-navigate-skip-match
- '((tex-mode plain-tex-mode latex-mode) . sp--backslash-skip-match))
-
-(sp-with-modes '(
- tex-mode
- plain-tex-mode
- latex-mode
- LaTeX-mode
- )
- (sp-local-pair "`" "'"
- :actions '(:rem autoskip)
- :skip-match 'sp-latex-skip-match-apostrophe
- :unless '(sp-latex-point-after-backslash))
- ;; math modes, yay. The :actions are provided automatically if
- ;; these pairs do not have global definitions.
- (sp-local-pair "$" "$")
- (sp-local-pair "\\[" "\\]"
- :unless '(sp-latex-point-after-backslash))
-
- ;; disable useless pairs. Maybe also remove " ' and \"?
- (sp-local-pair "/*" nil :actions nil)
- (sp-local-pair "\\\\(" nil :actions nil)
- (sp-local-pair "'" nil :actions nil)
- (sp-local-pair "\\\"" nil :actions nil)
-
- ;; quote should insert ``'' instead of double quotes. If we ever
- ;; need to insert ", C-q is our friend.
- (sp-local-pair "``" "''"
- :trigger "\""
- :unless '(sp-latex-point-after-backslash)
- :post-handlers '(sp-latex-skip-double-quote))
-
- ;; add the prefix function sticking to {} pair
- (sp-local-pair "{" nil :prefix "\\\\\\(\\sw\\|\\s_\\)*")
-
- ;; do not add more space when slurping
- (sp-local-pair "{" "}")
- (sp-local-pair "(" ")")
- (sp-local-pair "[" "]")
-
- ;; pairs for big brackets. Needs more research on what pairs are
- ;; useful to add here. Post suggestions if you know some.
- (sp-local-pair "\\left(" "\\right)"
- :trigger "\\l("
- :when '(sp-in-math-p)
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\left[" "\\right]"
- :trigger "\\l["
- :when '(sp-in-math-p)
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\left\\{" "\\right\\}"
- :trigger "\\l{"
- :when '(sp-in-math-p)
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\left|" "\\right|"
- :trigger "\\l|"
- :when '(sp-in-math-p)
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\bigl(" "\\bigr)"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\biggl(" "\\biggr)"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Bigl(" "\\Bigr)"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Biggl(" "\\Biggr)"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\bigl[" "\\bigr]"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\biggl[" "\\biggr]"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Bigl[" "\\Bigr]"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Biggl[" "\\Biggr]"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\bigl\\{" "\\bigr\\}"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\biggl\\{" "\\biggr\\}"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Bigl\\{" "\\Bigr\\}"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\Biggl\\{" "\\Biggr\\}"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\lfloor" "\\rfloor"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\lceil" "\\rceil"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
- (sp-local-pair "\\langle" "\\rangle"
- :post-handlers '(sp-latex-insert-spaces-inside-pair))
-
- ;; some common wrappings
- (sp-local-tag "\"" "``" "''" :actions '(wrap))
- (sp-local-tag "\\b" "\\begin{_}" "\\end{_}")
- (sp-local-tag "bi" "\\begin{itemize}" "\\end{itemize}")
- (sp-local-tag "be" "\\begin{enumerate}" "\\end{enumerate}"))
-
-(provide 'smartparens-latex)
-
-;;; smartparens-latex.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.elc
deleted file mode 100644
index 34ddf3a..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-latex.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.el
deleted file mode 100644
index 7f20b66..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.el
+++ /dev/null
@@ -1,90 +0,0 @@
-;;; smartparens-lua.el --- Additional configuration for Lua based modes.
-
-;; Copyright (C) 2013-2014 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 3 August 2013
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Lua based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-lua)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-lua-post-keyword-insert (id action context)
- "ID, ACTION, CONTEXT."
- (cond
- ((eq action 'insert)
- (cond
- ((member id '("while" "for"))
- (insert " do")
- (save-excursion (newline-and-indent))
- (backward-char 3))
- ((equal id "if")
- (insert " then")
- (save-excursion (newline-and-indent))
- (backward-char 5))
- ((equal id "function")
- (save-excursion (newline-and-indent))
- (insert " "))))))
-
-;; all the pairs are expanded only if followed by "SPC" event. This
-;; will reduce false positives like 'dIFficult' to trigger.
-(sp-with-modes '(lua-mode)
- (sp-local-pair "if" "end"
- :when '(("SPC"))
- :unless '(sp-in-comment-p)
- :post-handlers '(sp-lua-post-keyword-insert))
- (sp-local-pair "function" "end"
- :when '(("SPC"))
- :unless '(sp-in-comment-p)
- :post-handlers '(sp-lua-post-keyword-insert))
- (sp-local-pair "for" "end"
- :when '(("SPC"))
- :unless '(sp-in-comment-p)
- :post-handlers '(sp-lua-post-keyword-insert))
- (sp-local-pair "while" "end"
- :when '(("SPC"))
- :unless '(sp-in-comment-p)
- :post-handlers '(sp-lua-post-keyword-insert))
- )
-
-(provide 'smartparens-lua)
-
-;;; smartparens-lua.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.elc
deleted file mode 100644
index 499b962..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-lua.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-markdown.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-markdown.el
deleted file mode 100644
index 50fe787..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-markdown.el
+++ /dev/null
@@ -1,86 +0,0 @@
-;;; smartparens-markdown.el --- Additional configuration for Markdown based modes.
-
-;; Copyright (C) 2017 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 11th May 2017
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Markdown based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-markdown)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-(require 'markdown-mode)
-
-
-(defun sp-gfm-electric-backquote-p (_id action _context)
- "Do not insert ```...``` pair if that would be handled by `markdown-electric-backquote'."
- (and (eq action 'insert)
- markdown-gfm-use-electric-backquote
- (sp--looking-back-p "^```")))
-
-(defun sp--gfm-point-after-word-p (id action context)
- "Return t if point is after a word, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-back-p (concat "\\(\\sw\\)" (regexp-quote id)))))
-
-(defun sp--gfm-skip-asterisk (ms mb me)
- "Non-nil if we should ignore this asterisk as a delimiter."
- (save-excursion
- (goto-char mb)
- (save-match-data (looking-at "^\\* "))))
-
-(sp-with-modes '(markdown-mode gfm-mode)
- (sp-local-pair "*" "*"
- :unless '(sp--gfm-point-after-word-p sp-point-at-bol-p)
- :post-handlers '(("[d1]" "SPC"))
- :skip-match 'sp--gfm-skip-asterisk)
- (sp-local-pair "**" "**")
- (sp-local-pair "_" "_" :unless '(sp-point-after-word-p)))
-
-(sp-with-modes 'markdown-mode
- (sp-local-pair "```" "```"))
-
-(sp-with-modes 'gfm-mode
- (sp-local-pair "`" "`" :unless '(:add sp-gfm-electric-backquote-p))
- (sp-local-pair "```" "```" :unless '(:add sp-gfm-electric-backquote-p)))
-
-(provide 'smartparens-markdown)
-;;; smartparens-markdown.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.el
deleted file mode 100644
index 79c1bc9..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.el
+++ /dev/null
@@ -1,57 +0,0 @@
-;;; smartparens-ml.el --- Additional configuration for ML languages
-
-;; Copyright (C) 2016-2017 Ta Quang Trung
-;; Copyright (C) 2017 Matus Goljer
-
-;; Author: Ta Quang Trung
-;; Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 14 July 2016
-;; Keywords: smartparens, ML, ocaml, reason
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for ML languages.
-;; To use it, simply add:
-;;
-;; (require 'smartparens-ml)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-;;; Local pairs for ML-family languages
-(sp-with-modes '(tuareg-mode fsharp-mode) (sp-local-pair "(*" "*)" ))
-(sp-with-modes '(reason-mode) (sp-local-pair "/*" "*/" ))
-
-(provide 'smartparens-ml)
-;;; smartparens-ml.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.elc
deleted file mode 100644
index fe13e5d..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ml.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.el
deleted file mode 100644
index 6f6a315..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.el
+++ /dev/null
@@ -1,65 +0,0 @@
-;;; smartparens-org.el --- Configuration for Org mode.
-
-;; Copyright (C) 2017 Matúš Goljer
-
-;; Author: Matúš Goljer
-;; Maintainer: Matúš Goljer
-;; Version: 0.0.1
-;; Created: 15th January 2017
-;; Keywords: languages
-
-;; 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 .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Org based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-org)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp--org-skip-asterisk (ms mb me)
- "Non-nil if the asterisk is part of the outline marker."
- (save-excursion
- (goto-char mb)
- (beginning-of-line)
- (let ((skip-distance (skip-chars-forward "*")))
- (if (= skip-distance 1)
- (not (memq (syntax-class (syntax-after (point))) '(2 3)))
- (<= me (point))))))
-
-(sp-with-modes 'org-mode
- (sp-local-pair "*" "*"
- :unless '(sp-point-after-word-p sp-point-at-bol-p)
- :skip-match 'sp--org-skip-asterisk)
- (sp-local-pair "_" "_" :unless '(sp-point-after-word-p))
- (sp-local-pair "/" "/" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
- (sp-local-pair "~" "~" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
- (sp-local-pair "=" "=" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
- (sp-local-pair "«" "»"))
-
-(provide 'smartparens-org)
-;;; smartparens-org.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.elc
deleted file mode 100644
index 08fa14a..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-org.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-pkg.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-pkg.el
deleted file mode 100644
index ab2da57..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-pkg.el
+++ /dev/null
@@ -1,6 +0,0 @@
-(define-package "smartparens" "20171201.242" "Automatic insertion, wrapping and paredit-like navigation with user defined pairs."
- '((dash "2.13.0")
- (cl-lib "0.3")))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.el
deleted file mode 100644
index d1cff0d..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.el
+++ /dev/null
@@ -1,92 +0,0 @@
-;;; smartparens-python.el --- Additional configuration for Python based modes.
-
-;; Copyright (C) 2015-2016 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 8 February 2015
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Python based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-python)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-;; Python has no sexp suffices. This fixes slurping
-;; (|sys).path.append---the dot should not travel with the closing
-;; paren
-(--each '(python-mode inferior-python-mode)
- (add-to-list 'sp-sexp-suffix (list it 'regexp "")))
-
-(sp-with-modes 'python-mode
- (sp-local-pair "'" "'" :unless '(sp-in-comment-p sp-in-string-quotes-p) :post-handlers '(:add sp-python-fix-tripple-quotes))
- (sp-local-pair "\"" "\"" :post-handlers '(:add sp-python-fix-tripple-quotes))
- (sp-local-pair "'''" "'''")
- (sp-local-pair "\\'" "\\'")
- (sp-local-pair "\"\"\"" "\"\"\""))
-
-(defun sp-python-fix-tripple-quotes (id action _context)
- "Properly rewrap tripple quote pairs.
-
-When the user rewraps a tripple quote pair to the other pair
-type (i.e. ''' to \") we check if the old pair was a
-tripple-quote pair and if so add two pairs to beg/end of the
-newly formed pair (which was a single-quote \"...\" pair)."
- (when (eq action 'rewrap-sexp)
- (let ((old (plist-get sp-handler-context :parent)))
- (when (or (and (equal old "'''") (equal id "\""))
- (and (equal old "\"\"\"") (equal id "'")))
- (save-excursion
- (sp-get sp-last-wrapped-region
- (goto-char :end-in)
- (insert (make-string 2 (aref id 0)))
- (goto-char :beg)
- (insert (make-string 2 (aref id 0)))))))))
-
-(defadvice python-indent-dedent-line-backspace
- (around sp-backward-delete-char-advice activate)
- "Fix indend."
- (if smartparens-strict-mode
- (cl-letf (((symbol-function 'delete-backward-char)
- (lambda (arg &optional killp)
- (sp-backward-delete-char arg))))
- ad-do-it)
- ad-do-it))
-
-(provide 'smartparens-python)
-;;; smartparens-python.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.elc
deleted file mode 100644
index 583415e..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-python.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.el
deleted file mode 100644
index 06a6551..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.el
+++ /dev/null
@@ -1,55 +0,0 @@
-;;; smartparens-racket.el --- Additional configuration for Racket based modes.
-
-;; Copyright (C) 2015 Vikraman Choudhury
-
-;; Author: Vikraman Choudhury
-;; Maintainer: Vikraman Choudhury
-;; Created: 26 Oct 2015
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Racket based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-racket)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(sp-with-modes '(racket-mode racket-repl-mode)
- (sp-local-pair "`" nil :actions nil)
- (sp-local-pair "#|" "|#"))
-
-(provide 'smartparens-racket)
-;;; smartparens-racket.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.elc
deleted file mode 100644
index 627dd16..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-racket.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.el
deleted file mode 100644
index 65bc079..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.el
+++ /dev/null
@@ -1,407 +0,0 @@
-;;; smartparens-ruby.el --- Additional configuration for Ruby based modes.
-
-;; Copyright (C) 2013-2014 Jean-Louis Giordano
-
-;; Author: Jean-Louis Giordano
-;; Maintainer: Matus Goljer
-;; Created: 16 June 2013
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Ruby based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-ruby)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-ruby-forward-sexp ()
- "Wrapper for `ruby-forward-sexp' based on `enh-ruby-mode'."
- (interactive)
- (if (boundp 'enh-ruby-forward-sexp)
- (enh-ruby-forward-sexp)
- (ruby-forward-sexp)))
-
-(defun sp-ruby-backward-sexp ()
- "Wrapper for `ruby-backward-sexp' based on `enh-ruby-mode'."
- (interactive)
- (if (boundp 'enh-ruby-backward-sexp)
- (enh-ruby-backward-sexp)
- (ruby-backward-sexp)))
-
-(defun sp-ruby-maybe-one-space ()
- "Turn whitespace around point to just one space."
- (while (looking-back " ") (backward-char))
- (when (or (looking-at-p " ")
- (looking-at-p "}")
- (looking-back "{")
- (and (looking-at-p "\\sw")
- (looking-back ":")))
- (save-excursion (just-one-space)))
- (when (and (not (looking-back "^.?"))
- (save-excursion
- (backward-char 2)
- (or (looking-at-p ".[^:] [.([,;]")
- (looking-at-p ".. ::")
- (looking-at-p ".[.@$] ")
- (looking-at-p ":: "))))
- (delete-char 1)))
-
-(defun sp-ruby-delete-indentation (&optional arg)
- "Better way of joining ruby lines.
-
-ARG is how many indentation to delete."
- (delete-indentation arg)
- (sp-ruby-maybe-one-space))
-
-(defun sp-ruby-block-post-handler (id action context)
- "Handler for ruby block-like insertions.
-ID, ACTION, CONTEXT."
- (when (equal action 'insert)
- (save-excursion
- (newline)
- (indent-according-to-mode))
- (indent-according-to-mode))
- (sp-ruby-post-handler id action context))
-
-(defun sp-ruby-def-post-handler (id action context)
- "Handler for ruby def-like insertions.
-ID, ACTION, CONTEXT."
- (when (equal action 'insert)
- (save-excursion
- (insert "x")
- (newline)
- (indent-according-to-mode))
- (delete-char 1))
- (sp-ruby-post-handler id action context))
-
-(defun sp-ruby-post-handler (id action context)
- "Ruby post handler.
-ID, ACTION, CONTEXT."
- (-let (((&plist :arg arg :enc enc) sp-handler-context))
- (when (equal action 'barf-backward)
- (sp-ruby-delete-indentation 1)
- (indent-according-to-mode)
- (save-excursion
- (sp-backward-sexp) ; move to begining of current sexp
- (sp-backward-sexp arg)
- (sp-ruby-maybe-one-space)))
-
- (when (equal action 'barf-forward)
- (sp-get enc
- (let ((beg-line (line-number-at-pos :beg-in))
- (end-line (line-number-at-pos :end-in)))
- (sp-forward-sexp arg)
- (sp-ruby-maybe-one-space)
- (when (not (= (line-number-at-pos) beg-line))
- (sp-ruby-delete-indentation -1))
- (indent-according-to-mode))))))
-
-(defun sp-ruby-pre-handler (id action context)
- "Handler for ruby slurp and barf.
-ID, ACTION, CONTEXT."
- (let ((enc (plist-get sp-handler-context :enc)))
- (sp-get enc
- (let ((beg-line (line-number-at-pos :beg-in))
- (end-line (line-number-at-pos :end-in)))
-
- (when (equal action 'slurp-backward)
- (save-excursion
- (sp-forward-sexp)
- (when (looking-at-p ";") (forward-char))
- (sp-ruby-maybe-one-space)
- (when (not (= (line-number-at-pos) end-line))
- (sp-ruby-delete-indentation -1)))
- (when (looking-at-p "::")
- (while (and (looking-back "\\sw")
- (--when-let (sp-get-symbol t)
- (sp-get it (goto-char :beg-prf))))))
- (while (thing-at-point-looking-at "\\.[[:blank:]\n]*")
- (sp-backward-sexp))
- (when (looking-back "[@$:&?!]")
- (backward-char)
- (when (looking-back "[@&:]")
- (backward-char)))
- (just-one-space)
- (save-excursion
- (if (= (line-number-at-pos) end-line)
- (insert " ")
- (newline))))
-
- (when (equal action 'barf-backward)
- ;; Barf whole method chains
- (while (thing-at-point-looking-at "[(.:[][\n[:blank:]]*")
- (sp-forward-sexp))
- (if (looking-at-p " *$")
- (newline)
- (save-excursion (newline))))
-
- (when (equal action 'slurp-forward)
- (save-excursion
- (sp-backward-sexp)
- (when (looking-back "\.") (backward-char))
- (sp-ruby-maybe-one-space)
- (when (not (= (line-number-at-pos) beg-line))
- (if (thing-at-point-looking-at "\\.[[:blank:]\n]*")
- (progn
- (forward-symbol -1)
- (sp-ruby-delete-indentation -1))
- (sp-ruby-delete-indentation))))
- (while (looking-at-p "::") (sp-forward-symbol))
- (when (looking-at-p "[?!;]") (forward-char))
- (if (= (line-number-at-pos) beg-line)
- (insert " ")
- (newline)))
-
- (when (equal action 'barf-forward)
- (when (looking-back "\\.") (backward-char))
- (when (looking-at-p "::")
- (while (and (looking-back "\\sw")
- (--when-let (sp-get-symbol t)
- (sp-get it (goto-char :beg-prf))))))
- (if (= (line-number-at-pos) end-line)
- (insert " ")
- (if (looking-back "^[[:blank:]]*")
- (save-excursion (newline))
- (newline))))))))
-
-(defun sp-ruby-inline-p (id)
- "Test if ID is inline."
- (save-excursion
- (when (looking-back id)
- (backward-word))
- (when (not (or (looking-back "^[[:blank:]]*")
- (looking-back "= *")))
- (or (save-excursion
- (forward-symbol -1)
- (forward-symbol 1)
- (looking-at-p (concat " *" id)))
- (save-excursion
- ;; This does not seem to make emacs snapshot happy
- (ignore-errors
- (sp-ruby-backward-sexp)
- (sp-ruby-forward-sexp)
- (looking-at-p (concat "[^[:blank:]]* *" id))))))))
-
-(defun sp-ruby-method-p (id)
- "Test if ID is a method."
- (save-excursion
- (when (looking-back id)
- (backward-word))
- (and (looking-at-p id)
- (or
- ;; fix for def_foo
- (looking-at-p (concat id "[_?!:]"))
- ;; fix for foo_def
- (looking-back "[_:@$.]")
- ;; fix for def for; end
- (looking-back "def \\|class \\|module ")
- ;; Check if multiline method call
- ;; But beware of comments!
- (and (looking-back "\\.[[:blank:]\n]*")
- (not (save-excursion
- (search-backward ".")
- (sp-point-in-comment))))))))
-
-(defun sp-ruby-skip-inline-match-p (ms mb me)
- "If non-nil, skip inline match.
-MS, MB, ME."
- (or (sp-ruby-method-p ms)
- (sp-ruby-inline-p ms)))
-
-(defun sp-ruby-skip-method-p (ms mb me)
- "If non-nil, skip method.
-MS, MB, ME."
- (sp-ruby-method-p ms))
-
-(defun sp-ruby-in-string-or-word-p (id action context)
- "Test if point is inside string or word.
-ID, ACTION, CONTEXT."
- (or (sp-in-string-p id action context)
- (and (looking-back id)
- (not (looking-back (sp--strict-regexp-quote id))))
- (sp-ruby-method-p id)))
-
-(defun sp-ruby-in-string-word-or-inline-p (id action context)
- "Test if point is inside string, word or inline.
-ID, ACTION, CONTEXT."
- (or (sp-ruby-in-string-or-word-p id action context)
- (and (looking-back id)
- (sp-ruby-inline-p id))))
-
-(defun sp-ruby-pre-pipe-handler (id action context)
- "Ruby pipe handler.
-ID, ACTION, CONTEXT."
- (when (equal action 'insert)
- (save-excursion
- (just-one-space))
- (save-excursion
- (search-backward id)
- (just-one-space))))
-
-(defun sp-ruby-should-insert-pipe-close (id action context)
- "Test whether to insert the closing pipe for a lambda-binding pipe pair.
-ID, ACTION, CONTEXT"
- (if (eq action 'insert)
- (thing-at-point-looking-at
- (rx-to-string `(and (or "do" "{") (* space) ,id)))
- t))
-
-(defun sp--ruby-skip-match (ms me mb)
- "Ruby skip match.
-MS, ME, MB."
- (when (string= ms "end")
- (or (sp-in-string-p ms me mb)
- (sp-ruby-method-p "end"))))
-
-(add-to-list 'sp-navigate-skip-match
- '((ruby-mode enh-ruby-mode motion-mode) . sp--ruby-skip-match))
-
-(dolist (mode '(ruby-mode motion-mode))
- (add-to-list 'sp-sexp-suffix `(,mode syntax "")))
-
-(sp-with-modes '(ruby-mode enh-ruby-mode motion-mode)
- (sp-local-pair "do" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-block-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "{" "}"
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-post-handler)
- :suffix "")
-
- (sp-local-pair "begin" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-block-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "def" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "class" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "module" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "case" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-method-p
- :suffix "")
-
- (sp-local-pair "for" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-or-word-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-inline-match-p)
-
- (sp-local-pair "if" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-word-or-inline-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-inline-match-p
- :suffix "")
-
- (sp-local-pair "unless" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-word-or-inline-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-inline-match-p
- :suffix "")
-
- (sp-local-pair "while" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-word-or-inline-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-inline-match-p
- :suffix "")
-
- (sp-local-pair "until" "end"
- :when '(("SPC" "RET" ""))
- :unless '(sp-ruby-in-string-word-or-inline-p sp-in-comment-p)
- :actions '(insert navigate)
- :pre-handlers '(sp-ruby-pre-handler)
- :post-handlers '(sp-ruby-def-post-handler)
- :skip-match 'sp-ruby-skip-inline-match-p
- :suffix "")
-
- (sp-local-pair "|" "|"
- :when '(sp-ruby-should-insert-pipe-close)
- :pre-handlers '(sp-ruby-pre-pipe-handler)
- :suffix ""))
-
-(provide 'smartparens-ruby)
-
-;;; smartparens-ruby.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.elc
deleted file mode 100644
index 145edae..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-ruby.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.el
deleted file mode 100644
index 1451069..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.el
+++ /dev/null
@@ -1,138 +0,0 @@
-;;; smartparens-rust.el --- Additional configuration for Rust based modes.
-
-;; Copyright (C) 2015 Wilfred Hughes
-
-;; Created: 3 November 2015
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Rust. To use
-;; it, simply add:
-;;
-;; (require 'smartparens-config)
-;;
-;; alternatively, you can explicitly load these preferences:
-;;
-;; (require 'smartparens-rust)
-;;
-;; in your configuration.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-(require 'smartparens)
-
-(defun sp-in-rust-lifetime-context (&rest args)
- "Return t if point is in a Rust context where ' represents a lifetime.
-If we return nil, ' should be used for character literals.
-ARGS."
- (or
- (condition-case nil
- ;; If point is just after a &', it's probably a &'foo.
- (save-excursion
- (backward-char 2)
- (looking-at "&"))
- ;; If we're at the beginning of the buffer, just carry on.
- (beginning-of-buffer))
- ;; If point is inside < > it's probably a parameterised function.
- (let ((paren-pos (nth 1 (syntax-ppss))))
- (and paren-pos
- (save-excursion
- (goto-char paren-pos)
- (looking-at "<"))))))
-
-(defun sp-rust-skip-match-angle-bracket (ms mb me)
- "Non-nil if we should ignore the bracket as valid delimiter."
- (save-excursion
- (goto-char me)
- (let ((on-fn-return-type
- (sp--looking-back-p (rx "->") nil))
- (on-match-branch
- (sp--looking-back-p (rx "=>") nil))
- (on-comparison
- (sp--looking-back-p (rx (or
- (seq space "<")
- (seq space ">")
- (seq space "<<")
- (seq space ">>")))
- nil)))
- (or on-comparison on-fn-return-type on-match-branch))))
-
-(defun sp-rust-filter-angle-brackets (id action context)
- "Non-nil if we should allow ID's ACTION in CONTEXT for angle brackets."
- ;; See the docstring for `sp-pair' for the possible values of ID,
- ;; ACTION and CONTEXT.
- (cond
- ;; Inside strings, don't do anything with < or >.
- ((eq context 'string)
- nil)
- ;; Don't do any smart pairing inside comments either.
- ((eq context 'comment)
- nil)
- ;; Otherwise, we're in code.
- ((eq context 'code)
- (let ((on-fn-return-type
- (looking-back (rx "->") nil))
- (on-match-branch
- (looking-back (rx "=>") nil))
- (on-comparison
- (looking-back (rx (or
- (seq space "<")
- (seq space ">")
- (seq space "<<")
- (seq space ">>")))
- nil)))
- (cond
- ;; Only insert a matching > if we're not looking at a
- ;; comparison.
- ((eq action 'insert)
- (and (not on-comparison) (not on-fn-return-type) (not on-match-branch)))
- ;; Always allow wrapping in a pair if the region is active.
- ((eq action 'wrap)
- (not on-match-branch))
- ;; When pressing >, autoskip if we're not looking at a
- ;; comparison.
- ((eq action 'autoskip)
- (and (not on-comparison) (not on-fn-return-type) (not on-match-branch)))
- ;; Allow navigation, highlighting and strictness checks if it's
- ;; not a comparison.
- ((eq action 'navigate)
- (and (not on-comparison) (not on-fn-return-type) (not on-match-branch))))))))
-
-(sp-with-modes '(rust-mode)
- (sp-local-pair "'" "'"
- :unless '(sp-in-comment-p sp-in-string-quotes-p sp-in-rust-lifetime-context)
- :post-handlers'(:rem sp-escape-quotes-after-insert))
- (sp-local-pair "<" ">"
- :when '(sp-rust-filter-angle-brackets)
- :skip-match 'sp-rust-skip-match-angle-bracket))
-
-;; Rust has no sexp suffices. This fixes slurping
-;; (|foo).bar -> (foo.bar)
-(add-to-list 'sp-sexp-suffix (list #'rust-mode 'regexp ""))
-
-(provide 'smartparens-rust)
-
-;;; smartparens-rust.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.elc
deleted file mode 100644
index 15e4312..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-rust.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.el
deleted file mode 100644
index 9e32f05..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.el
+++ /dev/null
@@ -1,80 +0,0 @@
-;;; smartparens-scala.el --- Additional configuration for Scala based modes.
-
-;; Copyright (C) 2015 Greg Nwosu
-
-;; Author: Greg Nwosu
-;; Maintainer: Greg Nwosu
-;; Created: 8 July 2015
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for Scala based
-;; modes. To use it, simply add:
-;;
-;; (require 'smartparens-scala)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-;;
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-;;
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-;; Scala has no sexp suffices. This fixes slurping
-;; import scala.mutable{|} ListBuffer, Set ---the comma should not travel with the closing
-;; paren
-(--each '(scala-mode inferior-scala-mode)
- (add-to-list 'sp-sexp-suffix (list it 'regexp "")))
-
-(defun sp-scala-wrap-with-indented-newlines (_ action _)
- "Post handler for the wrap ACTION, putting the region on indented newlines."
- (when (eq action 'wrap)
- (sp-get sp-last-wrapped-region
- (let ((beg :beg-in)
- (end :end-in))
- (save-excursion
- (goto-char end)
- (newline-and-indent))
- (save-excursion
- (goto-char beg)
- (newline))
- (indent-region beg end)))))
-
-(sp-local-pair 'scala-mode "(" nil
- :post-handlers '(("||\n[i]" "RET")
- ("| " "SPC")))
-
-(sp-local-pair 'scala-mode "{" nil
- :post-handlers '(("||\n[i]" "RET")
- ("| " "SPC")
- sp-scala-wrap-with-indented-newlines))
-
-(provide 'smartparens-scala)
-;;; smartparens-scala.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.elc
deleted file mode 100644
index 6c158a9..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-scala.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.el
deleted file mode 100644
index dc693fd..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.el
+++ /dev/null
@@ -1,65 +0,0 @@
-;;; smartparens-latex.el --- Additional configuration for text-mode.
-
-;; Copyright (C) 2017 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 16 July 2017
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; This file provides some additional configuration for `text-mode'.
-;; To use it, simply add:
-;;
-;; (require 'smartparens-text)
-;;
-;; into your configuration. You can use this in conjunction with the
-;; default config or your own configuration.
-
-;; If you have good ideas about what should be added please file an
-;; issue on the github tracker.
-
-;; For more info, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;;; Code:
-
-(require 'smartparens)
-
-(defun sp-text-mode-emoticon-p (_id action _context)
- (when (memq action '(insert navigate))
- (sp--looking-back-p ":-?[()]" 3)))
-
-(defun sp-text-mode-skip-emoticon (ms mb me)
- (when (member ms '("(" ")"))
- (save-excursion
- (goto-char mb)
- (sp--looking-back-p ":-?" 2))))
-
-(sp-local-pair 'text-mode "(" nil
- :unless '(:add sp-text-mode-emoticon-p)
- :skip-match 'sp-text-mode-skip-emoticon)
-
-(provide 'smartparens-text)
-;;; smartparens-text.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.elc
deleted file mode 100644
index d385499..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens-text.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.el b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.el
deleted file mode 100644
index eb84b52..0000000
--- a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.el
+++ /dev/null
@@ -1,9400 +0,0 @@
-;;; smartparens.el --- Automatic insertion, wrapping and paredit-like navigation with user defined pairs. -*- lexical-binding: t -*-
-
-;; Copyright (C) 2012-2016 Matus Goljer
-
-;; Author: Matus Goljer
-;; Maintainer: Matus Goljer
-;; Created: 17 Nov 2012
-;; Keywords: abbrev convenience editing
-;; URL: https://github.com/Fuco1/smartparens
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This file is part of Smartparens.
-
-;; Smartparens 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.
-
-;; Smartparens 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 Smartparens. If not, see .
-
-;;; Commentary:
-
-;; Smartparens is minor mode for Emacs that deals with parens pairs
-;; and tries to be smart about it. It started as a unification effort
-;; to combine functionality of several existing packages in a single,
-;; compatible and extensible way to deal with parentheses, delimiters,
-;; tags and the like. Some of these packages include autopair,
-;; textmate, wrap-region, electric-pair-mode, paredit and others. With
-;; the basic features found in other packages it also brings many
-;; improvements as well as completely new features.
-
-;; For a basic overview, see github readme at
-;; https://github.com/Fuco1/smartparens
-
-;; For the complete documentation visit the documentation wiki located
-;; at https://github.com/Fuco1/smartparens/wiki
-
-;; If you like this project, you can donate here:
-;; https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEYP5YVHDRX8C
-
-;;; Code:
-
-(eval-when-compile (require 'cl)) ; for `lexical-let'
-(eval-when-compile (require 'subr-x)) ; for `string-trim'
-(require 'cl-lib)
-(require 'dash)
-(require 'thingatpt)
-(require 'help-mode) ;; for help-xref-following #85
-
-(declare-function cua-replace-region "cua-base") ; FIXME: remove this when we drop support for old emacs
-(declare-function cua-delete-region "cua-base")
-(declare-function cua--fallback "cua-base")
-
-(declare-function subword-kill "subword")
-(declare-function subword-forward "subword")
-(declare-function subword-backward "subword")
-
-(declare-function hungry-delete-backward "hungry-delete")
-(declare-function hungry-delete-forward "hungry-delete")
-
-(declare-function evil-get-register "evil-common")
-(declare-function evil-set-register "evil-common")
-(defvar evil-this-register)
-
-
-;;; backport for older emacsen
-
-;; introduced in 24.3
-(unless (fboundp 'defvar-local)
- (defmacro defvar-local (var val &optional docstring)
- "Define VAR as a buffer-local variable with default value VAL.
-Like `defvar' but additionally marks the variable as being automatically
-buffer-local wherever it is set."
- (declare (debug defvar) (doc-string 3))
- ;; Can't use backquote here, it's too early in the bootstrap.
- (list 'progn (list 'defvar var val docstring)
- (list 'make-variable-buffer-local (list 'quote var)))))
-
-;;;###autoload
-(defun sp-cheat-sheet (&optional arg)
- "Generate a cheat sheet of all the smartparens interactive functions.
-
-Without a prefix argument, print only the short documentation and examples.
-
-With non-nil prefix argument ARG, show the full documentation for each function.
-
-You can follow the links to the function or variable help page.
-To get back to the full list, use \\[help-go-back].
-
-You can use `beginning-of-defun' and `end-of-defun' to jump to
-the previous/next entry.
-
-Examples are fontified using the `font-lock-string-face' for
-better orientation."
- (interactive "P")
- (setq arg (not arg))
- (let ((do-not-display '(
- smartparens-mode
- smartparens-global-mode
- turn-on-smartparens-mode
- turn-off-smartparens-mode
- sp-wrap-cancel
- sp-remove-active-pair-overlay
- sp-splice-sexp-killing-around ;; is aliased to `sp-raise-sexp'
- show-smartparens-mode
- show-smartparens-global-mode
- turn-on-show-smartparens-mode
- turn-off-show-smartparens-mode
- ))
- (do-not-display-with-arg '(
- sp-use-paredit-bindings
- sp-use-smartparens-bindings
- ))
- (commands (cl-loop for i in (cdr (assoc-string (file-truename (locate-library "smartparens")) load-history))
- if (and (consp i) (eq (car i) 'defun) (commandp (cdr i)))
- collect (cdr i))))
- (with-current-buffer (get-buffer-create "*Smartparens cheat sheet*")
- (let ((standard-output (current-buffer))
- (help-xref-following t))
- (read-only-mode -1)
- (erase-buffer)
- (help-mode)
- (smartparens-mode 1)
- (help-setup-xref (list #'sp-cheat-sheet)
- (called-interactively-p 'interactive))
- (read-only-mode -1)
- (--each (--remove (or (memq it do-not-display)
- (and arg (memq it do-not-display-with-arg)))
- commands)
- (unless (equal (symbol-name it) "advice-compilation")
- (let ((start (point)) kill-from)
- (insert (propertize (symbol-name it) 'face 'font-lock-function-name-face))
- (insert " is ")
- (describe-function-1 it)
- (save-excursion
- (when arg
- (goto-char start)
- (forward-paragraph 1)
- (forward-line 1)
- (if (looking-at "^It is bound")
- (forward-paragraph 2)
- (forward-paragraph 1))
- (setq kill-from (point))
- (when (re-search-forward "^Examples:" nil t)
- (delete-region kill-from
- (save-excursion
- (forward-line 1)
- (point))))))
- (insert (propertize (concat
- "\n\n"
- (make-string 72 ?―)
- "\n\n") 'face 'font-lock-function-name-face)))))
- (goto-char (point-min))
- (while (re-search-forward "\\(->\\|\\)" nil t)
- (let ((thing (bounds-of-thing-at-point 'line)))
- (put-text-property (car thing) (cdr thing) 'face 'font-lock-string-face)))
- (goto-char (point-min))
- (while (re-search-forward "|" nil t)
- (put-text-property (1- (point)) (point) 'face 'font-lock-warning-face))
- (goto-char (point-min))
- (while (re-search-forward "^It is bound to \\(.*?\\)\\." nil t)
- (put-text-property (match-beginning 1) (match-end 1) 'face 'font-lock-keyword-face))
- (goto-char (point-min))
- (while (re-search-forward ";;.*?$" nil t)
- (put-text-property (match-beginning 0) (match-end 0) 'face 'font-lock-comment-face))
- (help-make-xrefs)
- (goto-char (point-min))))
- (pop-to-buffer "*Smartparens cheat sheet*")))
-
-(defun sp-describe-system ()
- "Describe user's system.
-
-The output of this function can be used in bug reports."
- (interactive)
- (kill-new
- (format "- `smartparens` version: %s
-- Active major-mode: %s
-- Emacs version (`M-x emacs-version`): %s
-- Spacemacs/Evil/Other starterkit (specify which)/Vanilla: %s
-- OS: %s"
- (--if-let (cadr (assoc 'smartparens package-alist))
- (package-version-join (package-desc-version it))
- "")
- (symbol-name major-mode)
- (replace-regexp-in-string "\n" "" (emacs-version))
- ""
- (symbol-name system-type))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Variables
-
-(defvar-local sp-forward-bound-fn nil
- "Function to restrict the forward search")
-
-(defvar-local sp-backward-bound-fn nil
- "Function to restrict the backward search")
-
-(defun sp--get-forward-bound ()
- "Get the bound to limit the forward search for looking for pairs.
-
-If it returns nil, the original bound passed to the search
-function will be considered."
- (and sp-forward-bound-fn (funcall sp-forward-bound-fn)))
-
-(defun sp--get-backward-bound ()
- "Get the bound to limit the backward search for looking for pairs.
-
-If it returns nil, the original bound passed to the search
-function will be considered."
- (and sp-backward-bound-fn (funcall sp-backward-bound-fn)))
-
-
-;;;###autoload
-(defvar smartparens-mode-map (make-sparse-keymap)
- "Keymap used for `smartparens-mode'.")
-(defvaralias 'sp-keymap 'smartparens-mode-map)
-(make-obsolete-variable 'sp-keymap 'smartparens-mode-map "2015-01-01")
-
-(defvar sp-paredit-bindings '(
- ("C-M-f" . sp-forward-sexp) ;; navigation
- ("C-M-b" . sp-backward-sexp)
- ("C-M-u" . sp-backward-up-sexp)
- ("C-M-d" . sp-down-sexp)
- ("C-M-p" . sp-backward-down-sexp)
- ("C-M-n" . sp-up-sexp)
- ("M-s" . sp-splice-sexp) ;; depth-changing commands
- ("M-" . sp-splice-sexp-killing-backward)
- ("M-" . sp-splice-sexp-killing-forward)
- ("M-r" . sp-splice-sexp-killing-around)
- ("C-)" . sp-forward-slurp-sexp) ;; barf/slurp
- ("C-" . sp-forward-slurp-sexp)
- ("C-}" . sp-forward-barf-sexp)
- ("C-" . sp-forward-barf-sexp)
- ("C-(" . sp-backward-slurp-sexp)
- ("C-M-" . sp-backward-slurp-sexp)
- ("C-{" . sp-backward-barf-sexp)
- ("C-M-" . sp-backward-barf-sexp)
- ("M-S" . sp-split-sexp) ;; misc
- )
- "Paredit inspired bindings.
-
-Alist containing the default paredit bindings to corresponding
-smartparens functions.")
-
-(defun sp--populate-keymap (bindings)
- "Populates the `smartparens-mode-map' from the BINDINGS alist."
- (--each bindings
- (define-key smartparens-mode-map (read-kbd-macro (car it)) (cdr it))))
-
-;;;###autoload
-(defun sp-use-paredit-bindings ()
- "Initiate `smartparens-mode-map' with `sp-paredit-bindings'."
- (interactive)
- (sp--populate-keymap sp-paredit-bindings))
-
-(defvar sp-smartparens-bindings '(
- ("C-M-f" . sp-forward-sexp)
- ("C-M-b" . sp-backward-sexp)
- ("C-M-d" . sp-down-sexp)
- ("C-M-a" . sp-backward-down-sexp)
- ("C-S-d" . sp-beginning-of-sexp)
- ("C-S-a" . sp-end-of-sexp)
- ("C-M-e" . sp-up-sexp)
- ("C-M-u" . sp-backward-up-sexp)
- ("C-M-n" . sp-next-sexp)
- ("C-M-p" . sp-previous-sexp)
- ("C-M-k" . sp-kill-sexp)
- ("C-M-w" . sp-copy-sexp)
- ("M-" . sp-unwrap-sexp)
- ("M-" . sp-backward-unwrap-sexp)
- ("C-" . sp-forward-slurp-sexp)
- ("C-" . sp-forward-barf-sexp)
- ("C-M-" . sp-backward-slurp-sexp)
- ("C-M-" . sp-backward-barf-sexp)
- ("M-D" . sp-splice-sexp)
- ("C-M-" . sp-splice-sexp-killing-forward)
- ("C-M-" . sp-splice-sexp-killing-backward)
- ("C-S-" . sp-splice-sexp-killing-around)
- ("C-]" . sp-select-next-thing-exchange)
- ("C-M-]" . sp-select-next-thing)
- ("C-M-SPC" . sp-mark-sexp)
- ("M-F" . sp-forward-symbol)
- ("M-B" . sp-backward-symbol)
- )
- "Alist containing the default smartparens bindings.")
-
-;;;###autoload
-(defun sp-use-smartparens-bindings ()
- "Initiate `smartparens-mode-map' with `sp-smartparens-bindings'."
- (interactive)
- (sp--populate-keymap sp-smartparens-bindings))
-
-(defun sp--set-base-key-bindings (&optional symbol value)
- "Set up the default keymap based on `sp-base-key-bindings'.
-
-SYMBOL is the symbol being set, that is `sp-base-key-bindings'.
-
-VALUE is the saved value (as a symbol), can be one of:
-- sp
-- paredit
-
-This function is also used as a setter for this customize value."
- (when symbol (set-default symbol value))
- (cond
- ((eq value 'sp)
- (sp-use-smartparens-bindings))
- ((eq value 'paredit)
- (sp-use-paredit-bindings))))
-
-(defun sp--update-override-key-bindings (&optional symbol value)
- "Override the key bindings with values from `sp-override-key-bindings'.
-
-SYMBOL is `sp-override-key-bindings', VALUE is the value being set.
-
-This function is also used as a setter for this customize value."
- (when symbol (set-default symbol value))
- ;; this also needs to reload the base set, if any is present.
- (sp--set-base-key-bindings)
- (sp--populate-keymap value))
-
-(defcustom sp-base-key-bindings nil
- "A default set of key bindings for commands provided by smartparens.
-
-Paredit binding adds the bindings in `sp-paredit-bindings' to the
-corresponding smartparens commands. It does not add bindings to
-any other commands, or commands that do not have a paredit
-counterpart.
-
-Smartparens binding adds the bindings in
-`sp-smartparens-bindings' to most common smartparens commands.
-These are somewhat inspired by paredit, but in many cases differ.
-
-Note that neither \"paredit\" nor \"smartparens\" bindings add a
-binding for all the provided commands."
- :type '(radio
- (const :tag "Don't use any default set of bindings" nil)
- (const :tag "Use smartparens set of bindings" sp)
- (const :tag "Use paredit set of bindings" paredit))
- :set 'sp--set-base-key-bindings
- :group 'smartparens)
-
-(defcustom sp-override-key-bindings nil
- "An alist of bindings and commands that should override the base key set.
-
-If you wish to override a binding from the base set, set the
-value for the binding to the `kbd' recognizable string constant
-and command to the command symbol you wish to bind there.
-
-If you wish to disable a binding from the base set, set the value
-for the command to nil.
-
-Examples:
- (\"C-M-f\" . sp-forward-sexp)
- (\"C-\" . nil)
-
-See `sp-base-key-bindings'."
- :type '(alist
- :key-type string
- :value-type symbol)
- :set 'sp--update-override-key-bindings
- :group 'smartparens)
-
-(defvar sp-escape-char nil
- "Character used to escape quotes inside strings.")
-(make-variable-buffer-local 'sp-escape-char)
-
-(defvar sp-comment-char nil
- "Character used to start comments.")
-(make-variable-buffer-local 'sp-comment-char)
-
-(defvar sp-pair-list nil
- "List of pairs for autoinsertion or wrapping.
-
-Maximum length of opening or closing pair is
-`sp-max-pair-length' characters.")
-(make-variable-buffer-local 'sp-pair-list)
-
-(defvar sp-local-pairs nil
- "List of pair definitions used for current buffer.")
-(make-variable-buffer-local 'sp-local-pairs)
-
-(defvar sp-last-operation nil
- "Symbol holding the last successful operation.")
-(make-variable-buffer-local 'sp-last-operation)
-
-(cl-defstruct sp-state
- "Smartparens state for the current buffer."
- ;; A "counter" to track delayed hook. When a pair is inserted, a
- ;; cons of the form (:next . pair) is stored. On the next
- ;; (immediately after insertion) invocation of post-command-hook, it
- ;; is changed to (:this . pair). When the `car' is :this, the
- ;; post-command-hook checks the delayed hooks for `pair' and
- ;; executes them, then reset the "counter".
- delayed-hook
- ;; TODO
- delayed-insertion
- ;; The last point checked by sp--syntax-ppss and its result, used for
- ;; memoization
- last-syntax-ppss-point
- last-syntax-ppss-result
- ;; Value of `sp-pair-list' for this buffer. Note that this might
- ;; differ from `sp-pair-list' which is often changed by dynamic
- ;; binding
- pair-list
- ;; Value of `sp-local-pairs' for this buffer. Note that this might
- ;; differ from `sp-local-pairs' which is often changed by dynamic
- ;; binding
- local-pairs
- )
-
-(defvar sp-state (make-sp-state)
- "Smartparens state for the current buffer.")
-(make-variable-buffer-local 'sp-state)
-
-;; TODO: get rid of this
-(defvar sp-previous-point -1
- "Location of point before last command.
-
-This is only updated when some pair-overlay is active. Do not
-rely on the value of this variable anywhere else!")
-(make-variable-buffer-local 'sp-previous-point)
-
-;; TODO: get rid of this
-(defvar sp-wrap-point nil
- "Save the value of point before attemt to wrap a region.
-
-Used for restoring the original state if the wrapping is
-cancelled.")
-(make-variable-buffer-local 'sp-wrap-point)
-
-;; TODO: get rid of this
-(defvar sp-wrap-mark nil
- "Save the value of mark before attemt to wrap a region.
-
-Used for restoring the original state if the wrapping is
-cancelled.")
-(make-variable-buffer-local 'sp-wrap-mark)
-
-(defvar sp-last-inserted-characters ""
- "Characters typed during the wrapping selection.
-
-If wrapping is cancelled, these characters are re-inserted to the
-location of point before the wrapping.")
-(make-variable-buffer-local 'sp-last-inserted-characters)
-
-(defvar sp-last-inserted-pair nil
- "Last inserted pair.")
-(make-variable-buffer-local 'sp-last-inserted-pair)
-
-(defvar sp-delayed-pair nil
- "The pair whose insertion is being delayed.
-
-The insertion of this pair is delayed to be carried out in
-`sp--post-command-hook-handler'. The format is (opening delim
-. beg of the opening delim)")
-(make-variable-buffer-local 'sp-delayed-pair)
-
-(defvar sp-last-wrapped-region nil
- "Information about the last wrapped region.
-The format is the same as returned by `sp-get-sexp'.")
-(make-variable-buffer-local 'sp-last-wrapped-region)
-
-(defvar sp-point-inside-string nil
- "Non-nil if point is inside a string.
-
-Used to remember the state from before `self-insert-command' is
-run.")
-
-(defvar sp-buffer-modified-p nil
- "Non-nil if buffer was modified before `pre-command-hook'.")
-
-(defvar sp-pre-command-point nil
- "Position of `point' before `this-command' gets executed.")
-
-(defconst sp-max-pair-length 10
- "Maximum length of an opening or closing delimiter.
-
-Only the pairs defined by `sp-pair' are considered. Tag pairs
-can be of any length.")
-
-(defconst sp-max-prefix-length 100
- "Maximum length of a pair prefix.
-
-Because prefixes for pairs can be specified using regular
-expressions, they can potentially be of arbitrary length. This
-settings solves the problem where the parser would decide to
-backtrack the entire buffer which would lock up Emacs.")
-
-(defvar sp-pairs
- '((t
- .
- ((:open "\\\\(" :close "\\\\)" :actions (insert wrap autoskip navigate))
- (:open "\\{" :close "\\}" :actions (insert wrap autoskip navigate))
- (:open "\\(" :close "\\)" :actions (insert wrap autoskip navigate))
- (:open "\\\"" :close "\\\"" :actions (insert wrap autoskip navigate))
- (:open "\"" :close "\""
- :actions (insert wrap autoskip navigate escape)
- :unless (sp-in-string-quotes-p)
- :post-handlers (sp-escape-wrapped-region sp-escape-quotes-after-insert))
- (:open "'" :close "'"
- :actions (insert wrap autoskip navigate escape)
- :unless (sp-in-string-quotes-p sp-point-after-word-p)
- :post-handlers (sp-escape-wrapped-region sp-escape-quotes-after-insert))
- (:open "(" :close ")" :actions (insert wrap autoskip navigate))
- (:open "[" :close "]" :actions (insert wrap autoskip navigate))
- (:open "{" :close "}" :actions (insert wrap autoskip navigate))
- (:open "`" :close "`" :actions (insert wrap autoskip navigate)))))
- "List of pair definitions.
-
-Maximum length of opening or closing pair is
-`sp-max-pair-length' characters.")
-
-(defvar sp-tags nil
- "List of tag definitions. See `sp-local-tag' for more information.")
-
-(defvar sp-prefix-tag-object nil
- "If non-nil, only consider tags while searching for next thing.")
-
-(defvar sp-prefix-pair-object nil
- "If non-nil, only consider pairs while searching for next thing.
-
-Pairs are defined as expressions delimited by pairs from
-`sp-pair-list'.")
-
-(defvar sp-prefix-symbol-object nil
- "If non-nil, only consider symbols while searching for next thing.
-
-Symbol is defined as a chunk of text recognized by
-`sp-forward-symbol'.")
-
-(define-obsolete-variable-alias 'sp--lisp-modes 'sp-lisp-modes "2015-11-08")
-
-(defcustom sp-lisp-modes '(
- cider-repl-mode
- clojure-mode
- clojurec-mode
- clojurescript-mode
- clojurex-mode
- common-lisp-mode
- emacs-lisp-mode
- eshell-mode
- geiser-repl-mode
- inf-clojure-mode
- inferior-emacs-lisp-mode
- inferior-lisp-mode
- inferior-scheme-mode
- lisp-interaction-mode
- lisp-mode
- monroe-mode
- racket-mode
- racket-repl-mode
- scheme-interaction-mode
- scheme-mode
- slime-repl-mode
- stumpwm-mode
- )
- "List of Lisp-related modes."
- :type '(repeat symbol)
- :group 'smartparens)
-
-(defcustom sp-clojure-modes '(
- cider-repl-mode
- clojure-mode
- clojurec-mode
- clojurescript-mode
- clojurex-mode
- inf-clojure-mode
- )
- "List of Clojure-related modes."
- :type '(repeat symbol)
- :group 'smartparens)
-
-(defcustom sp-no-reindent-after-kill-modes '(
- python-mode
- coffee-mode
- asm-mode
- makefile-gmake-mode
- )
- "List of modes that should not reindent after kill."
- :type '(repeat symbol)
- :group 'smartparens)
-
-(defvar sp--html-modes '(
- sgml-mode
- html-mode
- rhtml-mode
- nxhtml-mode
- nxml-mode
- web-mode
- jinja2-mode
- html-erb-mode
- )
- "List of HTML modes.")
-
-(defvar sp-message-alist
- '((:unmatched-expression
- "Search failed: there is an unmatched expression somewhere or we are at the beginning/end of file"
- "Unmatched expression")
- (:unbalanced-region
- "Can not kill the region: the buffer would end up in an unbalanced state after deleting the active region"
- "Killing the region would make the buffer unbalanced"
- "Unbalanced region")
- (:delimiter-in-string
- "Ignored: opening or closing pair is inside a string or comment and matching pair is outside (or vice versa)")
- (:no-matching-tag
- "Search failed: no matching tag found"
- "No matching tag")
- (:invalid-context-prev
- "Invalid context: previous h-sexp ends after the next one"
- "Invalid context")
- (:invalid-context-cur
- "Invalid context: current h-sexp starts after the next one"
- "Invalid context")
- (:no-structure-found
- "Previous sexp starts after current h-sexp or no structure was found"
- "No valid structure found")
- (:invalid-structure
- "Ignored: this operation would result in invalid structure"
- "Ignored because of invalid structure")
- (:cant-slurp
- "Ignored: we can not slurp without breaking strictly balanced expression"
- "Can not slurp without breaking balance")
- (:cant-slurp-context
- "Ignored: we can not slurp into different context (comment -> code)"
- "Can not slurp into different context")
- (:cant-insert-closing-delimiter
- "We can not insert unbalanced closing delimiter in strict mode"
- "Can not insert unbalanced delimiter")
- (:blank-sexp
- "Point is in blank sexp, nothing to barf"
- "Point is in blank sexp")
- (:point-not-deep-enough
- "Point has to be at least two levels deep to swap the enclosing delimiters"
- "Point has to be at least two levels deep"
- "Point not deep enough")
- (:different-type
- "The expressions to be joined are of different type"
- "Expressions are of different type"))
- "List of predefined messages to be displayed by `sp-message'.
-
-Each element is a list consisting of a keyword and one or more
-strings, which are chosen based on the `sp-message-width'
-variable. If the latter is t, the first string is chosen as
-default, which should be the most verbose option available.")
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Customize & Mode definitions
-
-(defgroup smartparens ()
- "Smartparens minor mode."
- :group 'editing
- :prefix "sp-")
-
-;;;###autoload
-(define-minor-mode smartparens-mode
- "Toggle smartparens mode.
-
-You can enable pre-set bindings by customizing
-`sp-base-key-bindings' variable. The current content of
-`smartparens-mode-map' is:
-
- \\{smartparens-mode-map}"
- :init-value nil
- :lighter (" SP" (:eval (if smartparens-strict-mode "/s" "")))
- :group 'smartparens
- :keymap smartparens-mode-map
- (if smartparens-mode
- (progn
- (sp--init)
- (add-hook 'self-insert-uses-region-functions 'sp-wrap--can-wrap-p nil 'local)
- (run-hooks 'smartparens-enabled-hook))
- (remove-hook 'self-insert-uses-region-functions 'sp-wrap--can-wrap-p 'local)
- (run-hooks 'smartparens-disabled-hook)))
-
-(defvar smartparens-strict-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [remap delete-char] 'sp-delete-char)
- (define-key map [remap delete-forward-char] 'sp-delete-char)
- (define-key map [remap backward-delete-char-untabify] 'sp-backward-delete-char)
- (define-key map [remap backward-delete-char] 'sp-backward-delete-char)
- (define-key map [remap delete-backward-char] 'sp-backward-delete-char)
- (define-key map [remap kill-word] 'sp-kill-word)
- (define-key map [remap kill-line] 'sp-kill-hybrid-sexp)
- (define-key map [remap backward-kill-word] 'sp-backward-kill-word)
- (define-key map [remap kill-region] 'sp-kill-region)
- (define-key map [remap delete-region] 'sp-delete-region)
- (define-key map [remap kill-whole-line] 'sp-kill-whole-line)
- map)
- "Keymap used for `smartparens-strict-mode'.")
-
-;;;###autoload
-(define-minor-mode smartparens-strict-mode
- "Toggle the strict smartparens mode.
-
-When strict mode is active, `delete-char', `kill-word' and their
-backward variants will skip over the pair delimiters in order to
-keep the structure always valid (the same way as `paredit-mode'
-does). This is accomplished by remapping them to
-`sp-delete-char' and `sp-kill-word'. There is also function
-`sp-kill-symbol' that deletes symbols instead of words, otherwise
-working exactly the same (it is not bound to any key by default).
-
-When strict mode is active, this is indicated with \"/s\"
-after the smartparens indicator in the mode list."
- :init-value nil
- :group 'smartparens
- (if smartparens-strict-mode
- (progn
- (unless smartparens-mode
- (smartparens-mode 1))
- (unless (-find-indices (lambda (it) (eq (car it) 'smartparens-strict-mode)) minor-mode-overriding-map-alist)
- (setq minor-mode-overriding-map-alist
- (cons `(smartparens-strict-mode . ,smartparens-strict-mode-map) minor-mode-overriding-map-alist)))
- (put 'sp-backward-delete-char 'delete-selection 'sp--delete-selection-supersede-p)
- (put 'sp-delete-char 'delete-selection 'sp--delete-selection-supersede-p)
- (add-hook 'self-insert-uses-region-functions 'sp--self-insert-uses-region-strict-p nil 'local)
- (setq sp-autoskip-closing-pair 'always))
- (setq minor-mode-overriding-map-alist
- (-remove (lambda (it) (eq (car it) 'smartparens-strict-mode)) minor-mode-overriding-map-alist))
- (put 'sp-backward-delete-char 'delete-selection 'supersede)
- (put 'sp-delete-char 'delete-selection 'supersede)
- (remove-hook 'self-insert-uses-region-functions 'sp--self-insert-uses-region-strict-p 'local)
- (let ((std-val (car (plist-get (symbol-plist 'sp-autoskip-closing-pair) 'standard-value)))
- (saved-val (car (plist-get (symbol-plist 'sp-autoskip-closing-pair) 'saved-value))))
- (setq sp-autoskip-closing-pair (eval (or saved-val std-val))))))
-
-;;;###autoload
-(define-globalized-minor-mode smartparens-global-strict-mode
- smartparens-strict-mode
- turn-on-smartparens-strict-mode
- :group 'smartparens)
-
-(defcustom sp-ignore-modes-list '(
- minibuffer-inactive-mode
- )
- "Modes where smartparens mode is inactive if allowed globally."
- :type '(repeat symbol)
- :group 'smartparens)
-
-;;;###autoload
-(defun turn-on-smartparens-strict-mode ()
- "Turn on `smartparens-strict-mode'."
- (interactive)
- (unless (or (member major-mode sp-ignore-modes-list)
- (and (not (derived-mode-p 'comint-mode))
- (eq (get major-mode 'mode-class) 'special)))
- (smartparens-strict-mode 1)))
-
-;;;###autoload
-(defun turn-off-smartparens-strict-mode ()
- "Turn off `smartparens-strict-mode'."
- (interactive)
- (smartparens-strict-mode -1))
-
-(defun sp--init ()
- "Initialize the buffer local smartparens state.
-
- This includes pair bindings and other buffer local variables
-that depend on the active `major-mode'."
- (setq sp-state (make-sp-state))
- ;; setup local pair replacements
- (sp--update-local-pairs)
- ;; set the escape char
- (dotimes (char 256)
- (unless sp-escape-char
- (when (= ?\\ (char-syntax char))
- (setq sp-escape-char (string char))))
- (unless sp-comment-char
- (when (= ?< (char-syntax char))
- (setq sp-comment-char (string char))))))
-
-(defun sp--maybe-init ()
- "Initialize the buffer if it is not already initialized.
-
-See `sp--init'."
- (unless sp-pair-list
- (sp--init)))
-
-(defun sp--update-sp-pair-list ()
- "Update `sp-pair-list' according to current value of `sp-local-pairs'."
- (setq sp-pair-list
- (->> sp-local-pairs
- (--map (cons (plist-get it :open) (plist-get it :close)))
- (-sort (lambda (x y) (> (length (car x)) (length (car y))))))))
-
-(defun sp--update-local-pairs ()
- "Update local pairs after change or at mode initialization.
-
-This commands load all the parent major mode definitions and
-merges them into current buffer's `sp-local-pairs'."
- (let ((parent-modes (-fix (lambda (x)
- (--if-let (get (car x) 'derived-mode-parent)
- (cons it x)
- x))
- (list major-mode))))
- ;; Combine all the definitions from the most ancient parent to the
- ;; most recent parent
- (--each parent-modes (sp-update-local-pairs it))))
-
-(defun sp-update-local-pairs (configuration)
- "Update `sp-local-pairs' with CONFIGURATION.
-
-The pairs are only updated in current buffer not in all buffers
-with the same major mode! If you want to update all buffers of
-the specific major-modes use `sp-local-pair'.
-
-CONFIGURATION can be a symbol to be looked up in `sp-pairs' or a
-property list corresponding to the arguments of `sp-local-pair'
-or a list of such property lists."
- (setq sp-local-pairs
- (cond
- ((symbolp configuration)
- (sp--merge-pair-configurations (cdr (assq configuration sp-pairs))))
- ((plist-member configuration :open)
- (sp--merge-pair-configurations (list configuration)))
- (t
- (sp--merge-pair-configurations configuration))))
-
- ;; Keep only those which have non-nil :actions
- (setq sp-local-pairs (--filter (plist-get it :actions) sp-local-pairs))
-
- ;; update the `sp-pair-list'. This is a list only containing
- ;; (open.close) cons pairs for easier querying. We also must order
- ;; it by length of opening delimiter in descending order (first
- ;; value is the longest)
- (sp--update-sp-pair-list)
- (setf (sp-state-local-pairs sp-state) sp-local-pairs)
- (setf (sp-state-pair-list sp-state) sp-pair-list))
-
-(defun sp--update-local-pairs-everywhere (&rest modes)
- "Run `sp--update-local-pairs' in all buffers.
-
-This is necessary to update all the buffer-local definitions. If
-MODES is non-nil, only update buffers with `major-mode' equal to
-MODES."
- (setq modes (-flatten modes))
- (--each (buffer-list)
- (with-current-buffer it
- (when (and smartparens-mode
- (or (not modes)
- (--any? (derived-mode-p it) modes)))
- (sp--update-local-pairs)))))
-
-(defcustom smartparens-enabled-hook nil
- "Called after `smartparens-mode' is turned on."
- :type 'hook
- :group 'smartparens)
-
-(defcustom smartparens-disabled-hook nil
- "Called after `smartparens-mode' is turned off."
- :type 'hook
- :group 'smartparens)
-
-;;;###autoload
-(define-globalized-minor-mode smartparens-global-mode
- smartparens-mode
- turn-on-smartparens-mode)
-
-;;;###autoload
-(defun turn-on-smartparens-mode ()
- "Turn on `smartparens-mode'.
-
-This function is used to turn on `smartparens-global-mode'.
-
-By default `smartparens-global-mode' ignores buffers with
-`mode-class' set to special, but only if they are also not comint
-buffers.
-
-Additionally, buffers on `sp-ignore-modes-list' are ignored.
-
-You can still turn on smartparens in these mode manually (or
-in mode's startup-hook etc.) by calling `smartparens-mode'."
- (interactive)
- (unless (or (member major-mode sp-ignore-modes-list)
- (and (not (derived-mode-p 'comint-mode))
- (eq (get major-mode 'mode-class) 'special)))
- (smartparens-mode t)))
-
-;;;###autoload
-(defun turn-off-smartparens-mode ()
- "Turn off `smartparens-mode'."
- (interactive)
- (smartparens-mode -1))
-
-;; insert custom
-(defcustom sp-autoinsert-pair t
- "If non-nil, autoinsert pairs. See `sp-insert-pair'."
- :type 'boolean
- :group 'smartparens)
-
-;; TODO: remove this in 1.12
-(defcustom sp-autoinsert-quote-if-followed-by-closing-pair nil
- "If non-nil autoinsert quotes when the point is followed by closing delimiter.
-
-This option only changes behaviour of the insertion process if
-point is inside a string. In other words, if string is not
-closed and next character is a closing pair.
-
-For example, in a situation like this:
-
- [\"some text|]
-
-after pressing \", one would probably want to insert the closing
-quote, not a nested pair (\\\"\\\"), to close the string literal
-in the array. To enable such behaviour, set this variable to
-nil.
-
-Note: the values of this varible seem to be backward, i.e. it is
-\"enabled\" when the value is nil. This was an unfortunate
-choice of wording. It is kept this way to preserve backward
-compatibility. The intended meaning is \"insert the pair if
-followed by closing pair?\", t = yes."
- :type 'boolean
- :group 'smartparens)
-(make-obsolete-variable
- 'sp-autoinsert-quote-if-followed-by-closing-pair
- "the option was removed and no longer has any effect." "1.10")
-
-(defcustom sp-autoskip-closing-pair 'always-end
- "Determine the behaviour when skipping closing delimiters.
-
-If t, skip the following closing pair if the expression is
-active (that is right after insertion). This is controlled by
-`sp-cancel-autoskip-on-backward-movement'.
-
-If set to \"always-end\", skip the closing pair even if the
-expression is not active and point is at the end of the
-expression. This only works for expressions with
-single-character delimiters.
-
-If set to \"always\", `sp-up-sexp' is called whenever the closing
-delimiter is typed inside a sexp of the same type. This is the
-paredit-like behaviour. This setting only works for
-single-character delimiters and does not work for string-like
-delimiters.
-
-See `sp-autoskip-opening-pair' for similar setting for
-string-like delimiters.
-
-See also `sp-skip-closing-pair'."
- :type '(radio
- (const :tag "Never skip closing delimiter" nil)
- (const :tag "Skip closing delimiter in active expressions" t)
- (const :tag "Always skip closing delimiter if at the end of sexp" always-end)
- (const :tag "Always skip closing delimiter" always))
- :group 'smartparens)
-(make-variable-buffer-local 'sp-autoskip-closing-pair)
-
-(defcustom sp-autoskip-opening-pair nil
- "Determine the behaviour when skipping opening delimiters.
-
-If non-nil, skip into the following string-like expression
-instead of inserting a new pair."
- :type 'boolean
- :group 'smartparens)
-(make-variable-buffer-local 'sp-autoskip-opening-pair)
-
-;; TODO: rename to reflect what this actually does
-(defcustom sp-cancel-autoskip-on-backward-movement t
- "If non-nil, deactivate the active expression on backward movement.
-
-Note: the name of this variable is a historic coincidence and
-will change in some future release to reflect its real purpose.
-
-See also `sp-skip-closing-pair'."
- :type 'boolean
- :group 'smartparens)
-
-;; delete custom
-(defcustom sp-autodelete-pair t
- "If non-nil, auto delete pairs. See `sp-delete-pair'."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-autodelete-closing-pair t
- "If non-nil, auto delete the whole closing-pair. See `sp-delete-pair'."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-autodelete-opening-pair t
- "If non-nil, auto delete the whole opening-pair. See `sp-delete-pair'."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-undo-pairs-separately nil
- "If non-nil, put an `undo-boundary' before each inserted pair.
-
-Calling undo after smartparens complete a pair will remove only
-the pair before undoing any previous insertion.
-
-WARNING: This option is implemented by hacking the
-`buffer-undo-list'. Turning this option on might have
-irreversible consequences on the buffer's undo information and in
-some cases might remove important information. Usage of package
-`undo-tree' is recommended if you ever need to revert to a state
-unreachable by undo."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-successive-kill-preserve-whitespace 1
- "Control the behaviour of `sp-kill-sexp' on successive kills.
-
-In the description, we consider more than one space
-\"superfluous\", however, newlines are preserved."
- :type '(radio
- (const :tag "Always preserve the whitespace" 0)
- (const :tag "Remove superfluous whitespace after last kill" 1)
- (const :tag "Remove superfluous whitespace after all kills" 2))
- :group 'smartparens)
-
-;; wrap custom
-(defcustom sp-autowrap-region t
- "If non-nil, wrap the active region with pair."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-wrap-show-possible-pairs t
- "If non-nil, show possible pairs which can complete the wrapping."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-autodelete-wrap t
- "If non-nil, autodelete opening and closing pair of most recent wrapping.
-
-Deletion command must be the very first command after the
-insertion, otherwise normal behaviour is applied."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-wrap-repeat-last 1
- "Context in which smartparens repeats the last wrap.
-
-If the last operation was a wrap and we insert another pair at
-the beginning or end of the last wrapped region, repeat the
-wrap on this region with current pair."
- :type '(radio
- (const :tag "Do not repeat wrapping" 0)
- (const :tag "Only repeat if current tag is the same as the last one" 1)
- (const :tag "Always repeat if the point is after the opening/closing delimiter of last wrapped region" 2))
- :group 'smartparens)
-
-(defcustom sp-wrap-entire-symbol nil
- "If non-nil, do NOT wrap the entire symbol, only the part after point.
-
-If set to \"Enable globally\", smart symbol wrapping is active
-everywhere. This is the default option.
-
-If set to \"Disable globally\", smart symbol wrapping is disabled
-everywhere.
-
-Otherwise, a list of major modes where smart symbol wrapping is
-*disabled* can be supplied.
-
-Examples:
-
- foo-ba|r-baz -> (|foo-bar-baz) ;; if enabled
-
- foo-ba|r-baz -> foo-ba(|r-baz) ;; if disabled"
- :type '(choice
- (const :tag "Enable globally" nil)
- (const :tag "Disable globally" globally)
- (repeat :tag "Disable in these major modes" symbol))
- :group 'smartparens)
-
-(defcustom sp-wrap-from-point nil
- "If non-nil, do not wrap from the beginning of next expression but from point.
-
-However, if the point is inside a symbol/word, the entire
-symbol/word is wrapped. To customize this behaviour, see
-variable `sp-wrap-entire-symbol'."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-wrap-respect-direction nil
- "When non-nil respect the wrap direction.
-
-When non-nil, wrapping with opening pair always jumps to the
-beginning of the region and wrapping with closing pair always
-jumps to the end of the region.
-
- |fooM -> [ -> |[foo]M
- Mfoo| -> [ -> |[foo]M
- |fooM -> ] -> M[foo]|
- Mfoo| -> ] -> M[foo]|
-
-When nil, closing pair places the point at the end of the region
-and the opening pair leaves the point at its original
-position (before or after the region).
-
- |fooM -> [ -> [|fooM]
- Mfoo| -> [ -> M[foo]|
- |fooM -> ] -> M[foo]|
- Mfoo| -> ] -> M[foo]|"
- :type 'boolean
- :group 'smartparens)
-
-;; escaping custom
-(defcustom sp-escape-wrapped-region t
- "If non-nil, escape special chars inside the just wrapped region."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-escape-quotes-after-insert t
- "If non-nil, escape string quotes if typed inside string."
- :type 'boolean
- :group 'smartparens)
-
-;; navigation & manip custom
-(defcustom sp-navigate-consider-sgml-tags '(
- html-mode
- )
- "List of modes where sgml tags are considered to be sexps."
- :type '(repeat symbol)
- :group 'smartparens)
-
-
-(defcustom sp-navigate-use-textmode-stringlike-parser '((derived . text-mode))
- "List of modes where textmode stringlike parser is used.
-
-See `sp-get-textmode-stringlike-expression'.
-
-Each element of the list can either be a symbol which is then
-checked against `major-mode', or a cons (derived . PARENT-MODE),
-where PARENT-MODE is checked using `derived-mode-p'."
- :type '(repeat (choice
- (symbol :tag "Major mode")
- (cons :tag "Derived mode"
- (const derived)
- (symbol :tag "Parent major mode name"))))
- :group 'smartparens)
-
-(defcustom sp-navigate-consider-symbols t
- "If non-nil, consider symbols outside balanced expressions as such.
-
-Symbols are recognized by function `sp-forward-symbol'. This
-setting affect all the navigation and manipulation functions
-where it make sense.
-
-Also, special handling of strings is enabled, where the whole
-string delimited with \"\" is considered as one token.
-
-WARNING: This is a legacy setting and changing its value to NIL
-may break many things. It is kept only for backward
-compatibility and will be removed in the next major release."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-navigate-comments-as-sexps t
- "If non-nil, consider comments as sexps in `sp-get-enclosing-sexp'.
-
-If this option is enabled, unbalanced expressions in comments are
-never automatically closed (see `sp-navigate-close-if-unbalanced')."
- :type 'boolean
- :group 'smartparens)
-
-;; TODO: add -alist suffix
-(defcustom sp-navigate-skip-match `(
- (,sp-lisp-modes . sp--elisp-skip-match)
- )
- "Major-mode dependent specifications of skip functions.
-
-Alist where the key is a list of major-modes and the value is a
-function used to skip over matches in `sp-get-paired-expression'.
-This function takes three arguments: the currently matched
-delimiter, beginning of match and end of match. If this function
-returns true, the current match will be skipped.
-
-You can use this to skip over expressions that serve multiple
-functions, such as if/end pair or unary if in Ruby or * in
-markdown when it signifies list item instead of emphasis. If the
-exception is only relevant to one pair, you should rather
-use :skip-match option in `sp-local-pair'."
- :type '(alist
- :key-type (repeat symbol)
- :value-type symbol)
- :group 'smartparens)
-
-(defcustom sp-navigate-reindent-after-up `(
- (interactive
- ,@sp-lisp-modes
- )
- )
- "Modes where sexps should be reindented after `sp-up-sexp'.
-
-The whitespace between the closing delimiter and last \"thing\"
-inside the expression is removed. It works analogically for the
-`sp-backward-up-sexp'.
-
-Note that this also happens when `sp-skip-closing-pair' is
-invoked (usually in strict mode when the closing delimiter is
-typed) as it calls `sp-up-sexp' internally. This behaviour can
-be customized by various settings of `sp-autoskip-closing-pair'
-and `sp-autoskip-opening-pair'.
-
-If the mode is in the list \"interactive\", only reindent the sexp
-if the command was called interactively. This is recommended for
-general use.
-
-If the mode is in the list \"always\", reindend the sexp even if the
-command was called programatically."
- :type '(alist
- :options (interactive always)
- :value-type (repeat symbol))
- :group 'smartparens)
-
-(defcustom sp-navigate-reindent-after-up-in-string t
- "If non-nil, `sp-up-sexp' will reindent inside strings.
-
-If `sp-navigate-reindent-after-up' is enabled and the point is
-inside a string, this setting determines if smartparens should
-reindent the current (string) sexp or not."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-navigate-close-if-unbalanced nil
- "If non-nil, insert the closing pair of the un-matched pair on `sp-up-sexp'.
-
-The closing delimiter is inserted after the symbol at
-point (using `sp-previous-sexp')."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-navigate-interactive-always-progress-point nil
- "Make point always move in the direction of navigation.
-
-If non-nil and the function is called interactively,
-`sp-next-sexp' and `sp-previous-sexp' will always move the point
-to the end/beg of such an expression where the point would end up
-being further in the direction of travel.
-
-Note: this behaviour will become default in release 2.0 and will
-cease to be configurable."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-sexp-prefix nil
- "Alist of `major-mode' specific prefix specification.
-
-Each item is a list with three properties:
-- major mode
-- a constant symbol 'regexp or 'syntax
-- a regexp or a string containing syntax class codes.
-
-If the second argument is 'regexp, the third argument is
-interpreted as a regexp to search backward from the start of an
-expression.
-
-If the second argument is 'syntax, the third argument is
-interpreted as string containing syntax codes that will be
-skipped.
-
-You can also override this property locally for a specific pair
-by specifying its :prefix property."
- :type '(repeat
- (list symbol
- (choice
- (const :tag "Regexp" regexp)
- (const :tag "Syntax class codes" syntax))
- string))
- :group 'smartparens)
-
-(defcustom sp-sexp-suffix nil
- "Alist of `major-mode' specific suffix specification.
-
-Each item is a list with three properties:
-- major mode
-- a constant symbol 'regexp or 'syntax
-- a regexp or a string containing syntax class codes.
-
-If the second argument is 'regexp, the third argument is
-interpreted as a regexp to search forward from the end of an
-expression.
-
-If the second argument is 'syntax, the third argument is
-interpreted as string containing syntax codes that will be
-skipped.
-
-You can also override this property locally for a specific pair
-by specifying its :suffix property."
- :type '(repeat
- (list symbol
- (choice
- (const :tag "Regexp" regexp)
- (const :tag "Syntax class codes" syntax))
- string))
- :group 'smartparens)
-
-(defcustom sp-split-sexp-always-split-as-string t
- "Determine if sexp inside string is split.
-
-If the point is inside a sexp inside a string, the default
-behaviour is now to split the string, such that:
-
- \"foo (|) bar\"
-
-becomes
-
- \"foo (\"|\") bar\"
-
-instead of
-
- \"foo ()|() bar\".
-
-Note: the old default behaviour was the reverse, it would split
-the sexp, but this is hardly ever what you want.
-
-You can add a post-handler on string pair and check for
-'split-string action to add concatenation operators of the
-language you work in (in each `major-mode' you can have a separate
-hook).
-
-For example, in PHP the string concatenation operator is a
-dot (.), so you would add:
-
- (defun my-php-post-split-handler (_ action _)
- (when (eq action 'split-sexp)
- (just-one-space)
- (insert \". . \")
- (backward-char 3)))
-
- (sp-local-pair 'php-mode \"'\" nil
- :post-handlers '(my-php-post-split-handler))
-
-Then
-
- echo 'foo |baz';
-
-results in
-
- echo 'foo' . | . 'baz';"
- :type 'boolean
- :group 'smartparens)
-
-;; hybrid lines
-(defcustom sp-hybrid-kill-excessive-whitespace nil
- "Determine how `sp-kill-hybrid-sexp' kills excessive whitespace.
-
-If non-nil, `sp-kill-hybrid-sexp' will delete all whitespace
-up until next hybrid sexp if the point is at the end of line or
-on a blank line.
-
-When it is set to 'kill, whitespace will be appended to the sexp
-in kill ring."
- :type '(choice
- (const :tag "Delete" t)
- (const :tag "Kill" kill)
- (const :tag "Off" nil))
- :group 'smartparens)
-
-(defcustom sp-hybrid-kill-entire-symbol nil
- "Governs how symbols under point are treated by `sp-kill-hybrid-sexp'.
-
-If t, always kill the symbol under point.
-
-If nil, never kill the entire symbol and only kill the part after point.
-
-If a function, this should be a zero-arg predicate. When it
-returns non-nil value, we should kill from point."
- :type '(radio
- (const :tag "Always kill entire symbol" t)
- (const :tag "Always kill from point" nil)
- (const :tag "Kill from point only inside strings" sp-point-in-string)
- (function :tag "Custom predicate"))
- :group 'smartparens)
-
-(defcustom sp-comment-string nil
- "String that is inserted after calling `sp-comment'.
-
-It is an alist of list of major modes to a string.
-
-The value of `comment-start' is used if the major mode is not found."
- :type '(alist
- :key-type (repeat symbol)
- :value-type string)
- :group 'smartparens)
-
-;; ui custom
-(defcustom sp-highlight-pair-overlay t
- "If non-nil, autoinserted pairs are highlighted while point is inside the pair."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-highlight-wrap-overlay t
- "If non-nil, wrap overlays are highlighted during editing of the wrapping pair."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-highlight-wrap-tag-overlay t
- "If non-nil, wrap tag overlays are highlighted during editing of the wrapping tag pair."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-echo-match-when-invisible t
- "If non-nil, show-smartparens-mode prints the line of the
-matching paren in the echo area if not visible on screen."
- :type 'boolean
- :group 'smartparens)
-
-(defcustom sp-message-width 'frame
- "Length of information and error messages to display.
-
-If set to 'frame (the default), messages are chosen based of the
-frame width. t means chose the default (verbose) message, nil
-means mute. Integers specify the maximum width."
- :type '(choice (const :tag "Fit to frame" frame)
- (const :tag "Verbose" t)
- (const :tag "Mute" nil)
- (integer :tag "Max width"))
- :group 'smartparens)
-
-;; TODO: this should be true by default > then the behaviour is
-;; controlled by subword-mode... and this is a hard override
-(defcustom sp-use-subword nil
- "Override of `subword-mode' killing behaviour.
-
-If non-nill, `sp-kill-word' and `sp-backward-kill-word' only
-kill \"subwords\" when `subword-mode' is active."
- :type 'boolean
- :group 'smartparens)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Selection mode handling
-
-(defun sp--delete-selection-p ()
- "Return t if `delete-selection-mode' or `cua-delete-selection' is enabled."
- (or (and (boundp 'delete-selection-mode) delete-selection-mode)
- (and (boundp 'cua-delete-selection) cua-delete-selection cua-mode)))
-
-(defun sp--delete-selection-supersede-p ()
- "Decide if the current command should delete the region or not.
-
-This check is used as value of 'delete-selection property on the
-command symbol."
- (if (or (equal current-prefix-arg '(4))
- (sp-region-ok-p (region-beginning) (region-end)))
- 'supersede
- (sp-message :unbalanced-region)
- ;; Since this check runs in the pre-command-hook we can change the
- ;; command to be executed... in this case we set it to ignore
- ;; because we don't want to do anything.
- (setq this-command 'ignore)
- nil))
-
-(defun sp--self-insert-uses-region-strict-p ()
- "Decide if the current `self-insert-command' should be able to
-replace the region.
-
-This check is added to the special hook
-`self-insert-uses-region-functions' which is checked by
-`delete-selection-uses-region-p'."
- (if (or (equal current-prefix-arg '(4))
- (sp-region-ok-p (region-beginning) (region-end)))
- ;; region is OK or we are allowed to replace it, just say nil so
- ;; that delsel handles this
- nil
- ;; in case region is bad we interrupt the insertion
- (setq this-command 'ignore)
- t))
-
-;; TODO: this function was removed from Emacs, we should get rid of
-;; the advice in time.
-(defadvice cua-replace-region (around fix-sp-wrap activate)
- "Fix `sp-wrap' in `cua-selection-mode'."
- (if (sp-wrap--can-wrap-p)
- (cua--fallback)
- ad-do-it))
-
-(defadvice cua-delete-region (around fix-sp-delete-region activate)
- "If `smartparens-strict-mode' is enabled, perform a region
-check before deleting."
- (if smartparens-strict-mode
- (progn
- (unless (or current-prefix-arg
- (sp-region-ok-p (region-beginning) (region-end)))
- (user-error (sp-message :unbalanced-region :return)))
- ad-do-it)
- ad-do-it))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Misc/Utility functions
-
-(defun sp--indent-region (start end &optional column)
- "Call `indent-region' unless `aggressive-indent-mode' is enabled.
-
-START, END and COLUMN are the same as in `indent-region'."
- (unless (bound-and-true-p aggressive-indent-mode)
- ;; Don't issue "Indenting region..." message.
- (cl-letf (((symbol-function 'message) #'ignore))
- (indent-region start end column))))
-
-(defmacro sp-with-modes (arg &rest forms)
- "Add ARG as first argument to each form in FORMS.
-
-This can be used with `sp-local-pair' calls to automatically
-insert the modes."
- (declare (indent 1)
- (debug (form body)))
- (let ((modes (make-symbol "modes")))
- `(let ((,modes ,arg))
- (progn
- ,@(mapcar (lambda (form) (append (list (car form) modes) (cdr form))) forms)))))
-
-(font-lock-add-keywords 'emacs-lisp-mode `((,(concat "("
- (regexp-opt '("sp-with-modes"
- "sp-get"
- "sp-compare-sexps") t)
- "\\_>")
- (1 font-lock-keyword-face))))
-
-(defmacro sp--with-case-sensitive (&rest body)
- "Ensure that searching done within BODY is case-sensitive.
-
-Bind `case-fold-search' to nil if it is not already and avoid the
-bind if it is already. Any function that needs to use any of the
-sp--looking-* functions more than once should wrap them all in
-`sp--with-case-sensitive'."
- (declare (indent 0)
- (debug (body)))
- `(if case-fold-search
- (let ((case-fold-search nil))
- ,@body)
- ,@body))
-
-(defun sp--evil-normal-state-p ()
- "Check to see if the current `evil-state' is in normal mode."
- (and (fboundp 'evil-normal-state-p) (evil-normal-state-p)))
-
-(defun sp--evil-motion-state-p ()
- "Check to see if the current `evil-state' is in motion mode."
- (and (fboundp 'evil-motion-state-p) (evil-motion-state-p)))
-
-(defun sp--evil-visual-state-p ()
- "Check to see if the current `evil-state' is in visual mode."
- (and (fboundp 'evil-visual-state-p) (evil-visual-state-p)))
-
-(defun sp-point-in-blank-line (&optional p)
- "Return non-nil if line at point is blank (whitespace only).
-
-If optional argument P is present test this instead of point."
- (save-excursion
- (when p (goto-char p))
- (beginning-of-line)
- (looking-at "[ \t]*$")))
-
-(defun sp-point-in-blank-sexp (&optional p)
- "Return non-nil if point is inside blank (whitespace only) sexp.
-
-If optional argument P is present test this instead of point.
-
-Warning: it is only safe to call this when point is inside a
-sexp, otherwise the call may be very slow."
- (save-excursion
- (when p (goto-char p))
- (-when-let (enc (sp-get-enclosing-sexp))
- (sp-get enc (string-match-p
- "\\`[ \t\n]*\\'"
- (buffer-substring-no-properties :beg-in :end-in))))))
-
-(defun sp-char-is-escaped-p (&optional point)
- "Test if the char at POINT is escaped or not.
-
-POINT defaults to `point'."
- (setq point (or point (point)))
- (save-match-data
- (when (save-excursion
- (goto-char point)
- (looking-back (concat sp-escape-char sp-escape-char "+") nil t))
- (eq (logand (length (match-string 0)) 1) 1))))
-
-(defun sp--syntax-ppss (&optional p)
- "Memoize the last result of `syntax-ppss'.
-
-P is the point at which we run `syntax-ppss'"
- (let ((p (or p (point))))
- (if (eq p (sp-state-last-syntax-ppss-point sp-state))
- (sp-state-last-syntax-ppss-result sp-state)
- ;; Add hook to reset memoization if necessary
- (unless (sp-state-last-syntax-ppss-point sp-state)
- (add-hook 'before-change-functions 'sp--reset-memoization t t))
- (setf (sp-state-last-syntax-ppss-point sp-state) p
- (sp-state-last-syntax-ppss-result sp-state) (syntax-ppss p)))))
-
-(defun sp-point-in-string (&optional p)
- "Return non-nil if point is inside string or documentation string.
-
-This function actually returns the 3rd element of `syntax-ppss'
-which can be a number if the string is delimited by that
-character or t if the string is delimited by general string
-fences.
-
-If optional argument P is present test this instead of point."
- (ignore-errors
- (save-excursion
- (nth 3 (sp--syntax-ppss p)))))
-
-(defun sp-point-in-comment (&optional p)
- "Return non-nil if point is inside comment.
-
-If optional argument P is present test this instead off point."
- (setq p (or p (point)))
- (ignore-errors
- (save-excursion
- (or (nth 4 (sp--syntax-ppss p))
- ;; this also test opening and closing comment delimiters... we
- ;; need to chack that it is not newline, which is in "comment
- ;; ender" class in elisp-mode, but we just want it to be
- ;; treated as whitespace
- (and (< p (point-max))
- (memq (char-syntax (char-after p)) '(?< ?>))
- (not (eq (char-after p) ?\n)))
- ;; we also need to test the special syntax flag for comment
- ;; starters and enders, because `syntax-ppss' does not yet
- ;; know if we are inside a comment or not (e.g. / can be a
- ;; division or comment starter...).
- (-when-let (s (car (syntax-after p)))
- (or (and (/= 0 (logand (lsh 1 16) s))
- (nth 4 (syntax-ppss (+ p 2))))
- (and (/= 0 (logand (lsh 1 17) s))
- (nth 4 (syntax-ppss (+ p 1))))
- (and (/= 0 (logand (lsh 1 18) s))
- (nth 4 (syntax-ppss (- p 1))))
- (and (/= 0 (logand (lsh 1 19) s))
- (nth 4 (syntax-ppss (- p 2))))))))))
-
-(defun sp-point-in-string-or-comment (&optional p)
- "Return non-nil if point is inside string, documentation string or a comment.
-
-If optional argument P is present, test this instead of point."
- (or (sp-point-in-string p)
- (sp-point-in-comment p)))
-
-;; TODO: add -p suffix
-(defun sp-point-in-symbol (&optional p)
- "Return non-nil if `point' is inside symbol.
-
-If P is non-nil, interpret it as buffer position and test there.
-
-Point is inside symbol if characters on both sides of the point
-are in either word or symbol class."
- (setq p (or p (point)))
- (save-excursion
- (goto-char p)
- (and (/= 0 (following-char))
- (memq (char-syntax (following-char)) '(?w ?_))
- (memq (char-syntax (preceding-char)) '(?w ?_)))))
-
-(defun sp--single-key-description (event)
- "Return a description of the last EVENT.
-
-Replace all the function key symbols with garbage character (ň).
-
-TODO: fix this!"
- (let ((original (single-key-description event)))
- (cond
- ((string-match-p "<.*?>" original) "ň")
- ((string-match-p "SPC" original) " ")
- (t original))))
-
-;; see https://github.com/Fuco1/smartparens/issues/125#issuecomment-20356176
-(defun sp--current-indentation ()
- "Get the indentation offset of the current line."
- (save-excursion
- (back-to-indentation)
- (current-column)))
-
-(defun sp--calculate-indentation-offset (old-column old-indentation)
- "Calculate correct indentation after re-indent.
-
-OLD-COLUMN is the column before reindent.
-
-OLD-INDENTATION is the indentation depth before reindent."
- (let ((indentation (sp--current-indentation)))
- (cond
- ;; Point was in code, so move it along with the re-indented code
- ((>= old-column old-indentation)
- (+ old-column (- indentation old-indentation)))
- ;; Point was indentation, but would be in code now, so move to
- ;; the beginning of indentation
- ((<= indentation old-column) indentation)
- ;; Point was in indentation, and still is, so leave it there
- (:else old-column))))
-
-(defun sp--back-to-indentation (old-column old-indentation)
- "Set the current column to proper value.
-
-See `sp--keep-indentation'.
-
-OLD-COLUMN is the column before reindent.
-
-OLD-INDENTATION is the indentation depth before reindent."
- (let ((offset (sp--calculate-indentation-offset old-column old-indentation)))
- (move-to-column offset)))
-
-;; TODO: rename to preserve-current-column
-(defmacro sp--keep-indentation (&rest body)
- "Execute BODY and restore the column.
-
-If point was in code move it along if the line is reinvented so
-it is the same distance relative to first code column.
-
-If point was previously in the indentation region but would end
-up in code, move it to the first code column.
-
-If point was in the indentation region and is still there after
-BODY, do nothing."
- (declare (indent 0)
- (debug (body)))
- (let ((c (make-symbol "c"))
- (i (make-symbol "i")))
- `(let ((,c (current-column))
- (,i (sp--current-indentation)))
- ,@body
- (sp--back-to-indentation ,c ,i))))
-
-;; Please contribute these if you come across some!
-(defvar sp--self-insert-commands
- '(self-insert-command
- org-self-insert-command
- LaTeX-insert-left-brace)
- "List of commands that are some sort of `self-insert-command'.
-
-Many modes rebind \"self-inserting\" keys to \"smart\" versions
-which do some additional processing before delegating the
-insertion to `self-insert-command'. Smartparens needs to be able
-to distinguish these to properly handle insertion and reinsertion
-of pairs and wraps.")
-
-;; Please contribute these if you come across some!
-(defvar sp--special-self-insert-commands
- '(
- TeX-insert-dollar
- TeX-insert-quote
- quack-insert-opening-paren
- quack-insert-closing-paren
- quack-insert-opening-bracket
- quack-insert-closing-bracket
- racket-insert-closing-paren
- racket-insert-closing-bracket
- racket-insert-closing-brace
- )
- "List of commands which are handled as if they were `self-insert-command's.
-
-Some modes redefine \"self-inserting\" keys to \"smart\" versions
-which do some additional processing but do _not_ delegate the
-insertion to `self-insert-command', instead inserting via
-`insert'. Smartparens needs to be able to distinguish these to
-properly handle insertion and reinsertion of pairs and wraps.
-
-The `sp--post-self-insert-hook-handler' is called in the
-`post-command-hook' for these commands.")
-
-(defun sp--self-insert-command-p ()
- "Return non-nil if `this-command' is some sort of `self-insert-command'."
- (memq this-command sp--self-insert-commands))
-
-(defun sp--special-self-insert-command-p ()
- "Return non-nil if `this-command' is \"special\" self insert command.
-
-A special self insert command is one that inserts a character but
-does not trigger `post-self-insert-hook'."
- (memq this-command sp--special-self-insert-commands))
-
-(defun sp--signum (x)
- "Return 1 if X is positive, -1 if negative, 0 if zero."
- (cond ((> x 0) 1) ((< x 0) -1) (t 0)))
-
-(cl-eval-when (compile eval load)
- (defun sp--get-substitute (struct list)
- "Only ever call this from sp-get! This function does the
-replacement of all the keywords with actual calls to sp-get."
- (if (listp list)
- (if (eq (car list) 'sp-get)
- list
- (mapcar (lambda (x) (sp--get-substitute struct x))
- (let ((command (car list)))
- (cond
- ((eq command 'sp-do-move-op)
- (let ((argument (make-symbol "--sp-argument--")))
- `(let ((,argument ,(cadr list)))
- (if (< ,argument :beg-prf)
- (progn
- (goto-char :beg-prf)
- (delete-char (+ :op-l :prefix-l))
- (goto-char ,argument)
- (insert :prefix :op))
- (goto-char ,argument)
- (insert :prefix :op)
- (goto-char :beg-prf)
- (delete-char (+ :op-l :prefix-l))))))
- ((eq command 'sp-do-move-cl)
- (let ((argument (make-symbol "--sp-argument--")))
- `(let ((,argument ,(cadr list)))
- (if (> ,argument :end-in)
- (progn
- (goto-char ,argument)
- (insert :cl :suffix)
- (goto-char :end-in)
- (delete-char (+ :cl-l :suffix-l)))
- (goto-char :end-in)
- (delete-char (+ :cl-l :suffix-l))
- (goto-char ,argument)
- (insert :cl :suffix)))))
- ((eq command 'sp-do-del-op)
- `(progn
- (goto-char :beg-prf)
- (delete-char (+ :op-l :prefix-l))))
- ((eq command 'sp-do-del-cl)
- `(progn
- (goto-char :end-in)
- (delete-char (+ :cl-l :suffix-l))))
- ((eq command 'sp-do-put-op)
- `(progn
- (goto-char ,(cadr list))
- (insert :prefix :op)))
- ((eq command 'sp-do-put-cl)
- `(progn
- (goto-char ,(cadr list))
- (insert :cl :suffix)))
- (t list)))))
- (if (keywordp list)
- (sp--get-replace-keyword struct list)
- list)))
-
- (defun sp--get-replace-keyword (struct keyword)
- (cl-case keyword
- ;; point in buffer before the opening delimiter
- (:beg `(plist-get ,struct :beg))
- ;; point in the buffer after the closing delimiter
- (:end `(plist-get ,struct :end))
- ;; point in buffer after the opening delimiter
- (:beg-in `(+ (plist-get ,struct :beg) (length (plist-get ,struct :op))))
- ;; point in buffer before the closing delimiter
- (:end-in `(- (plist-get ,struct :end) (length (plist-get ,struct :cl))))
- ;; point in buffer before the prefix of this expression
- (:beg-prf `(- (plist-get ,struct :beg) (length (plist-get ,struct :prefix))))
- ;; point in the buffer after the suffix of this expression
- (:end-suf `(+ (plist-get ,struct :end) (length (plist-get ,struct :suffix))))
- ;; opening delimiter
- (:op `(plist-get ,struct :op))
- ;; closing delimiter
- (:cl `(plist-get ,struct :cl))
- ;; length of the opening pair
- (:op-l `(length (plist-get ,struct :op)))
- ;; length of the closing pair
- (:cl-l `(length (plist-get ,struct :cl)))
- ;; length of the entire expression, including enclosing
- ;; delimiters and the prefix and suffix
- (:len `(- (plist-get ,struct :end)
- (plist-get ,struct :beg)
- (- (length (plist-get ,struct :prefix)))
- (- (length (plist-get ,struct :suffix)))))
- ;; length of the the pair ignoring the prefix, including delimiters
- (:len-out `(- (plist-get ,struct :end) (plist-get ,struct :beg)))
- ;; length of the pair inside the delimiters
- (:len-in `(- (plist-get ,struct :end)
- (plist-get ,struct :beg)
- (length (plist-get ,struct :op))
- (length (plist-get ,struct :cl))))
- ;; expression prefix
- (:prefix `(plist-get ,struct :prefix))
- ;; expression prefix length
- (:prefix-l `(length (plist-get ,struct :prefix)))
- (:suffix `(plist-get ,struct :suffix))
- (:suffix-l `(length (plist-get ,struct :suffix)))
- ;; combined op/cl and suffix/prefix
- (:opp `(concat (plist-get ,struct :prefix)
- (plist-get ,struct :op)))
- (:opp-l `(+ (length (plist-get ,struct :prefix))
- (length (plist-get ,struct :op))))
- (:cls `(concat (plist-get ,struct :cl)
- (plist-get ,struct :suffix)))
- (:cls-l `(+ (length (plist-get ,struct :cl))
- (length (plist-get ,struct :suffix))))
- (t keyword))))
-
-;; The structure returned by sp-get-sexp is a plist with following properties:
-;;
-;; :beg - point in the buffer before the opening delimiter (ignoring prefix)
-;; :end - point in the buffer after the closing delimiter
-;; :op - opening delimiter
-;; :cl - closing delimiter
-;; :prefix - expression prefix
-;;
-;; This structure should never be accessed directly and should only be
-;; exposed by the sp-get macro. This way, we can later change the
-;; internal representation without much trouble.
-
-;; TODO: rewrite this in terms of `symbol-macrolet' ??
-(defmacro sp-get (struct &rest forms)
- "Get a property from a structure.
-
-STRUCT is a plist with the format as returned by `sp-get-sexp'.
-Which means this macro also works with `sp-get-symbol',
-`sp-get-string' and `sp-get-thing'.
-
-FORMS is an attribute we want to query. Currently supported
-attributes are:
-
-:beg - point in buffer before the opening delimiter
-:end - point in the buffer after the closing delimiter
-:beg-in - point in buffer after the opening delimiter
-:end-in - point in buffer before the closing delimiter
-:beg-prf - point in buffer before the prefix of this expression
-:end-suf - point in buffer after the suffix of this expression
-:op - opening delimiter
-:cl - closing delimiter
-:op-l - length of the opening pair
-:cl-l - length of the closing pair
-:len - length of the entire expression, including enclosing
- delimiters, the prefix and the suffix
-:len-out - length of the the pair ignoring the prefix and suffix,
- including delimiters
-:len-in - length of the pair inside the delimiters
-:prefix - expression prefix
-:prefix-l - expression prefix length
-:suffix - expression suffix
-:suffix-l - expression suffix length
-
-These special \"functions\" are expanded to do the selected
-action in the context of currently queried pair:
-
-Nullary:
-\(sp-do-del-op) - remove prefix and opening delimiter
-\(sp-do-del-cl) - remove closing delimiter and suffix
-
-Unary:
-\(sp-do-move-op p) - move prefix and opening delimiter to point p
-\(sp-do-move-cl p) - move closing delimiter and suffix to point p
-\(sp-do-put-op p) - put prefix and opening delimiter at point p
-\(sp-do-put-cl p) - put closing delimiter and suffix at point p
-
-In addition to these simple queries and commands, this macro
-understands arbitrary forms where any of the aforementioned
-attributes are used. Therefore, you can for example query for
-\"(+ :op-l :cl-l)\". This query would return the sum of lengths
-of opening and closing delimiter. A query
-\"(concat :prefix :op)\" would return the string containing
-expression prefix and the opening delimiter.
-
-Special care is taken to only evaluate the STRUCT argument once."
- (declare (indent 1)
- (debug (form body)))
- (let ((st (make-symbol "struct")))
- (sp--get-substitute st `(let ((,st ,struct)) ,@forms))))
-
-(defmacro sp-compare-sexps (a b &optional fun what-a what-b)
- "Return non-nil if the expressions A and B are equal.
-
-Two expressions are equal if their :beg property is the same.
-
-If optional argument FUN is non-nil, it is the comparison
-function.
-
-If optional argument WHAT-A is non-nil, use it as a keyword on
-which to do the comparsion (default to :beg).
-
-If optional argument WHAT-B is non-nil, use it as a keyword on
-which to do the comparsion (default to WHAT-A)."
- (declare (debug (form form &optional functionp keywordp keywordp)))
- (setq fun (or fun 'equal))
- (setq what-a (or what-a :beg))
- (setq what-b (or what-b what-a))
- `(,fun (sp-get ,a ,what-a) (sp-get ,b ,what-b)))
-
-(defun sp-message (key &optional return)
- "Display a message.
-
-KEY is either a string or list of strings, or a keyword,
-in which case the string list is looked up in
-`sp-message-alist'. The string to be displayed is chosen based on
-the `sp-message-width' variable.
-
-If RETURN is non-nil return the string instead of printing it."
- (let ((msgs (cond ((listp key) key)
- ((stringp key) (list key))
- (t (cdr (assq key sp-message-alist))))))
- (when (and msgs sp-message-width)
- (if (eq sp-message-width t)
- (if return (car msgs) (message "%s." (car msgs)))
- (let ((maxlen (if (eq sp-message-width 'frame)
- (frame-width)
- sp-message-width))
- (s nil))
- (dolist (msg msgs)
- (if (and (<= (length msg) maxlen)
- (> (length msg) (length s)))
- (setf s msg)))
- (when s
- (if return s (message "%s." s))))))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Adding/removing of pairs/bans/allows etc.
-
-(defun sp--merge-prop (prop new-pair old-pair)
- "Merge a property PROP from NEW-PAIR into OLD-PAIR.
-
-The list OLD-PAIR must not be nil."
- (let ((new-val (plist-get new-pair prop)))
- (cl-case prop
- (:close (plist-put old-pair :close new-val))
- (:prefix (plist-put old-pair :prefix new-val))
- (:suffix (plist-put old-pair :suffix new-val))
- (:skip-match (plist-put old-pair :skip-match new-val))
- (:trigger (plist-put old-pair :trigger new-val))
- (:trigger-wrap (plist-put old-pair :trigger-wrap new-val))
- ((:actions :when :unless :pre-handlers :post-handlers)
- (cl-case (car new-val)
- (:add (plist-put old-pair prop (-union (plist-get old-pair prop) (cdr new-val))))
- (:rem (plist-put old-pair prop (-difference (plist-get old-pair prop) (cdr new-val))))
- (t
- (cond
- ;; this means we have ((:add ...) (:rem ...)) argument
- ((and new-val
- (listp (car new-val))
- (memq (caar new-val) '(:add :rem)))
- (let ((a (assq :add new-val))
- (r (assq :rem new-val)))
- (plist-put old-pair prop (-union (plist-get old-pair prop) (cdr a)))
- (plist-put old-pair prop (-difference (plist-get old-pair prop) (cdr r)))))
- (t
- (plist-put old-pair prop (plist-get new-pair prop))))))))))
-
-(defun sp--merge-pairs (old-pair new-pair)
- "Merge OLD-PAIR and NEW-PAIR.
-This modifies the OLD-PAIR by side effect."
- (let ((ind 0))
- (--each new-pair
- (when (= 0 (% ind 2))
- (sp--merge-prop it new-pair old-pair))
- (setq ind (1+ ind))))
- old-pair)
-
-(defun sp--update-pair (new-pair old-pair)
- "Copy properties from NEW-PAIR to OLD-PAIR.
-
-The list OLD-PAIR must not be nil."
- (let ((ind 0))
- (--each new-pair
- (when (= 0 (% ind 2))
- (when (or (not (plist-get old-pair it))
- ;; HACK: we don't want to overwrite list properties
- ;; that aren't just :add with :add because this
- ;; would break the "idempotency".
- (not (equal '(:add) (plist-get new-pair it))))
- (plist-put old-pair it (plist-get new-pair it))))
- (setq ind (1+ ind))))
- old-pair)
-
-(defun sp--update-pair-list (pair mode)
- "Update the PAIR for major mode MODE.
-
-If this pair is not defined yet for this major mode, add it. If
-this pair is already defined, replace all the properties in the
-old definition with values from PAIR."
- ;; get the structure relevant to mode. t means global setting
- (let ((struct (--first (eq mode (car it)) sp-pairs)))
- (if (not struct)
- (!cons (cons mode (list pair)) sp-pairs)
- ;; this does NOT merge changes, only replace the values at
- ;; properties. Open delimiter works as ID as usual.
- (let ((old-pair (--first (equal (plist-get pair :open)
- (plist-get it :open))
- (cdr struct))))
- (if (not old-pair)
- (setcdr struct (cons pair (cdr struct)))
- (sp--update-pair pair old-pair)))))
- sp-pairs)
-
-(defun sp--get-pair (open list)
- "Get the pair with id OPEN from list LIST."
- (--first (equal open (plist-get it :open)) list))
-
-(defun sp--get-pair-definition (open list &optional prop)
- "Get the definition of a pair identified by OPEN from list LIST.
-
-If PROP is non-nil, return the value of that property instead."
- (let ((pair (sp--get-pair open list)))
- (if prop
- (cond
- ((eq prop :op-l)
- (length (plist-get pair :open)))
- ((eq prop :cl-l)
- (length (plist-get pair :close)))
- ((eq prop :len)
- (+ (length (plist-get pair :open)) (length (plist-get pair :close))))
- ((eq prop :post-handlers)
- (--filter (not (listp it)) (plist-get pair prop)))
- ((eq prop :post-handlers-cond)
- (--filter (listp it) (plist-get pair :post-handlers)))
- ((eq prop :when)
- (--filter (not (listp it)) (plist-get pair :when)))
- ((eq prop :when-cond)
- (-flatten (-concat (--filter (listp it) (plist-get pair :when)))))
- (t (plist-get pair prop)))
- pair)))
-
-(defun sp-get-pair-definition (open mode &optional prop)
- "Get the definition of pair identified by OPEN.
-
-OPEN is the opening delimiter, MODE is the major mode symbol or t
-for global definition.
-
-If PROP is non-nil, return the value of that property instead."
- (sp--get-pair-definition open (cdr (assq mode sp-pairs)) prop))
-
-(defun sp-get-pair (open &optional prop)
- "Return the definition of pair defined by OPEN in the current buffer.
-
-The value is fetched from `sp-local-pairs'.
-
-If PROP is non-nil, return the value of that property instead."
- (sp--get-pair-definition open sp-local-pairs prop))
-
-(defun sp--merge-pair-configurations (specific &optional current)
- "Merge SPECIFIC pair configuration to the CURRENT configuration.
-
-CURRENT defaults to `sp-local-pairs' if it is non-nil or the
-global definition from `sp-pairs' if `sp-local-pairs' is nil."
- (let* ((global (or current sp-local-pairs (cdr (assq t sp-pairs))))
- (local specific)
- (result nil))
- ;; copy the pairs on global list first. This creates new plists
- ;; so we can modify them without changing the global "template"
- ;; values.
- (dolist (old-pair global)
- (!cons (list :open (plist-get old-pair :open)) result))
-
- ;; merge the global list with result. This basically "deep copy"
- ;; global list. We use `sp--merge-pairs' because it also clones
- ;; the list properties (actions, filters etc.)
- (dolist (new-pair global)
- (let ((old-pair (sp--get-pair (plist-get new-pair :open) result)))
- (sp--merge-pairs old-pair new-pair)))
-
- ;; for each local pair, merge it into the global definition
- (dolist (new-pair local)
- (let ((old-pair (sp--get-pair (plist-get new-pair :open) result)))
- (if old-pair
- (sp--merge-pairs old-pair new-pair)
- ;; pair does not have global definition, simply copy it over
- (!cons
- ;; this "deep copy" the new-pair
- (sp--merge-pairs (list :open (plist-get new-pair :open)) new-pair)
- ;; TODO: remove the nil lists from the definitions
- result))))
- result))
-
-(defun sp-wrap-with-pair (pair)
- "Wrap the following expression with PAIR.
-
-This function is a non-interactive helper. To use this function
-interactively, bind the following lambda to a key:
-
- (lambda (&optional arg) (interactive \"P\") (sp-wrap-with-pair \"(\"))
-
-This lambda accepts the same prefix arguments as
-`sp-select-next-thing'.
-
-If region is active and `use-region-p' returns true, the region
-is wrapped instead. This is useful with selection functions in
-`evil-mode' to wrap regions with pairs."
- (let* ((arg (or current-prefix-arg 1))
- (sel (and (not (use-region-p))
- (sp-select-next-thing-exchange
- arg
- (cond
- ;; point is inside symbol and smart symbol wrapping is disabled
- ((and (sp-point-in-symbol)
- (or (eq sp-wrap-entire-symbol 'globally)
- (memq major-mode sp-wrap-entire-symbol)))
- (point))
- ;; wrap from point, not the start of the next expression
- ((and sp-wrap-from-point
- (not (sp-point-in-symbol)))
- (point))))))
- (active-pair (--first (equal (car it) pair) sp-pair-list))
- (rb (region-beginning))
- (re (region-end)))
- (goto-char re)
- (insert (cdr active-pair))
- (goto-char rb)
- (insert (car active-pair))
- (if (use-region-p)
- (sp--indent-region rb re)
- (sp-get sel (sp--indent-region :beg :end)))))
-
-(cl-defun sp-pair (open
- close
- &key
- trigger
- trigger-wrap
- (actions '(wrap insert autoskip navigate))
- when
- unless
- pre-handlers
- post-handlers
- wrap
- bind
- insert)
- "Add a pair definition.
-
-OPEN is the opening delimiter. Every pair is uniquely determined
-by this string.
-
-CLOSE is the closing delimiter. You can use nil for this
-argument if you are updating an existing definition. In this
-case, the old value is retained.
-
-TRIGGER is an optional trigger for the pair. The pair will be
-inserted if either OPEN or TRIGGER is typed. This is usually
-used as a shortcut for longer pairs or for pairs that can't be
-typed easily.
-
-TRIGGER-WRAP is the same as TRIGGER but used for wrapping.
-
-ACTIONS is a list of actions that smartparens will perform with
-this pair. Possible values are:
-
-- insert - autoinsert the closing pair when opening pair is
- typed.
-- wrap - wrap an active region with the pair defined by opening
- delimiter if this is typed while region is active.
-- autoskip - if the sexp is active or `sp-autoskip-closing-pair' is
- set to 'always, skip over the closing delimiter if user types its
- characters in order.
-- navigate - enable this pair for navigation/highlight and strictness
- checks
-- escape - allow autoescaping of this delimiter in string contexts
-
-If the ACTIONS argument has value :rem, the pair is removed.
-This can be used to remove default pairs you don't want to use.
-For example: (sp-pair \"[\" nil :actions :rem)
-
-WHEN is a list of predicates that test whether the action
-should be performed in current context. The values in the list
-should be names of the predicates (that is symbols, not
-lambdas!). They should accept three arguments: opening
-delimiter (which uniquely determines the pair), action and
-context. The context argument can have values:
-
-- string - if point is inside string.
-- comment - if point is inside comment.
-- code - if point is inside code. This context is only
- recognized in programming modes that define string semantics.
-
-If *any* filter returns t, the action WILL be performed. A number
-of filters are predefined: `sp-point-after-word-p',
-`sp-point-before-word-p', `sp-in-string-p',
-`sp-point-before-eol-p' etc.
-
-When clause also supports a special format for delayed insertion.
-The condition is a list with commands, predicates (with three
-arguments as regular when form) or strings specifying the last
-event. All three types can be combined in one list. The pair
-will be inserted *after* the next command if it matches the any
-command on the list, if the last event matches any string on the
-list or if any predicate returns true. If the pair's :when
-clause contains this special form, it will never be immediately
-inserted and will always test for delayed insertion.
-
-UNLESS is a list of predicates. The conventions are the same as
-for the WHEN list. If *any* filter on this list returns t, the
-action WILL NOT be performed. The predicates in the WHEN list
-are checked first, and if any of them succeeds, the UNLESS list
-is not checked.
-
-Note: the functions on the WHEN/UNLESS lists are also called
-\"filters\" in the documentation.
-
-All the filters are run *after* the trigger character is
-inserted.
-
-PRE-HANDLERS is a list of functions that are called before there
-has been some action caused by this pair. The arguments are the
-same as for filters. Context is relative to the point *before*
-the last inserted character. Because of the nature of the
-wrapping operation, this hook is not called if the action is
-wrapping.
-
-POST-HANDLERS is a list of functions that are called after there
-has been some action caused by this pair. The arguments are the
-same as for filters. Context is relative to current position of
-point *after* the closing pair was inserted.
-
-After a wrapping action, the point might end on either side of
-the wrapped region, depending on the original direction. You can
-use the variable `sp-last-wrapped-region' to retrieve information
-about the wrapped region and position the point to suit your
-needs.
-
-A special syntax for conditional execution of hooks is also
-supported. If the added item is a list (function command1
-command2...), where function is a 3 argument function described
-above and command(s) can be either name of a command or a string
-representing an event. If the last command or event as described
-by `single-key-description' matches any on the list, the hook
-will be executed. This means these hooks are run not after the
-insertion, but after the *next* command is executed.
-
-Example:
- ((lambda (id act con)
- (save-excursion
- (newline))) \"RET\" newline)
-
-This function will move the closing pair on its own line only if
-the next command is `newline' or is triggered by RET. Otherwise
-the pairs stay on the same line.
-
-WRAP is a key binding to which a \"wrapping\" action is bound.
-The key should be in format that is accepted by `kbd'. This
-option binds a lambda form:
-
- `(lambda (&optional arg)
- (interactive \"P\")
- (sp-wrap-with-pair ,OPEN))
-
-to the specified key sequence. The binding is added to global
-keymap. When executed, it wraps ARG (default 1) expressions with
-this pair (like `paredit-wrap-round' and friends). Additionally,
-it accepts the same prefix arguments as `sp-select-next-thing'.
-
-BIND is equivalent to WRAP. It is a legacy setting and will be
-removed soon.
-
-INSERT is a key binding to which an \"insert\" action is bound.
-The key should be in format that is accepted by `kbd'. This is
-achieved by binding a lambda form:
-
- (lambda () (interactive) (sp-insert-pair \"pair-id\"))
-
-to the supplied key, where pair-id is the open delimiter of the
-pair. The binding is added to the global map. You can also bind
-a similar lambda manually. To only bind this in specific major
-modes, use this property on `sp-local-pair' instead."
- (if (eq actions :rem)
- (let ((global-list (assq t sp-pairs)))
- (setcdr global-list (--remove (equal (plist-get it :open) open) (cdr global-list))))
- (let ((pair nil))
- (setq pair (plist-put pair :open open))
- (when close (plist-put pair :close close))
- (when trigger (plist-put pair :trigger trigger))
- (when trigger-wrap (plist-put pair :trigger-wrap trigger-wrap))
- (dolist (arg `((:actions . ,actions)
- (:when . ,when)
- (:unless . ,unless)
- (:pre-handlers . ,pre-handlers)
- (:post-handlers . ,post-handlers)))
- ;; We only consider "nil" as a proper value if the property
- ;; already exists in the pair. In that case, we will set it to
- ;; nil. This allows for removing properties in global
- ;; definitions.
- (when (or (cdr arg)
- (sp-get-pair-definition open t (car arg)))
- (plist-put pair (car arg) (cdr arg))))
- (sp--update-pair-list pair t))
- (when (or wrap bind) (global-set-key (read-kbd-macro (or wrap bind))
- `(lambda (&optional arg)
- (interactive "P")
- (sp-wrap-with-pair ,open))))
- (when insert (global-set-key (kbd insert) `(lambda () (interactive) (sp-insert-pair ,open)))))
- (sp--update-local-pairs-everywhere)
- sp-pairs)
-
-(cl-defun sp-local-pair (modes
- open
- close
- &key
- trigger
- trigger-wrap
- (actions '(:add))
- (when '(:add))
- (unless '(:add))
- (pre-handlers '(:add))
- (post-handlers '(:add))
- wrap
- bind
- insert
- prefix
- suffix
- skip-match)
- "Add a local pair definition or override a global definition.
-
-MODES can be a single mode or a list of modes where these settings
-should be applied.
-
-PREFIX is a regular expression matching an optional prefix for
-this pair in the specified major modes. If not specified, the
-characters of expression prefix syntax class are automatically
-considered instead. This can be used to attach custom prefixes
-to pairs, such as prefix \"\\function\" in \\function{arg} in
-`LaTeX-mode'.
-
-SUFFIX is a regular expression matching an optional suffix for
-this pair in the specified major modes. If not specified, the
-characters of punctuation syntax class are automatically
-considered instead.
-
-The rest of the arguments have same semantics as in `sp-pair'.
-
-If the pair is not defined globally, ACTIONS defaults to (wrap
-insert) instead of (:add) (which inherits global settings)
-
-The pairs are uniquely identified by the opening delimiter. If you
-replace the closing one with a different string in the local
-definition, this will override the global closing delimiter.
-
-The list arguments can optionally be of form starting with
-\":add\" or \":rem\" when these mean \"add to the global list\"
-and \"remove from the global list\" respectively. Otherwise,
-the global list is replaced. If you wish to both add and remove
-things with single call, use \"((:add ...) (:rem ...))\" as an
-argument. Therefore,
-
- :when '(:add my-test)
-
-would mean \"use the global settings for this pair, but also this
-additional test\". If no value is provided for list arguments,
-they default to \"(:add)\" which means they inherit the list from
-the global definition.
-
-To disable a pair in a major mode, simply set its actions set to
-nil. This will ensure the pair is not even loaded when the mode is
-activated.
-
-If WRAP is non-nil, the binding is added into major mode keymap
-called \"foo-mode-map\". If the mode does not follow this
-convention, you will need to bind the function manually (see
-`sp-pair' to how the function is named for each particular pair).
-The bindings are not added into `smartparens-mode-map' to prevent
-clashes between different modes.
-
-BIND is equivalent to WRAP. It is a legacy setting and will be
-removed soon.
-
-The binding for INSERT follows the same convention as BIND. See
-`sp-pair' for more info.
-
-You can provide a function SKIP-MATCH, that will take three
-arguments: the currently matched delimiter, beginning of match
-and end of match. If this function returns true, the
-`sp-get-paired-expression' matcher will ignore this match. You
-can use this to skip over expressions that serve multiple
-functions, such as if/end pair or unary if in Ruby or * in
-markdown when it signifies list item instead of emphasis. In
-addition, there is a global per major-mode option, see
-`sp-navigate-skip-match'."
- (if (eq actions :rem)
- (let ((remove ""))
- (dolist (m (-flatten (list modes)))
- (setq remove (concat remove
- (sp-get-pair-definition open m :open)
- (sp-get-pair-definition open m :close)))
- (let ((mode-pairs (assq m sp-pairs)))
- (setcdr mode-pairs
- (--remove (equal (plist-get it :open) open)
- (cdr mode-pairs))))))
- (dolist (m (-flatten (list modes)))
- (let* ((pair nil))
- (setq pair (plist-put pair :open open))
- (when close (plist-put pair :close close))
- (when trigger (plist-put pair :trigger trigger))
- (when trigger-wrap (plist-put pair :trigger-wrap trigger-wrap))
- (when prefix (plist-put pair :prefix prefix))
- (when suffix (plist-put pair :suffix suffix))
- (when skip-match (plist-put pair :skip-match skip-match))
- (when (and (not (sp-get-pair-definition open t))
- (equal actions '(:add)))
- (setq actions '(wrap insert autoskip navigate)))
- (plist-put pair :actions actions)
- (plist-put pair :when when)
- (plist-put pair :unless unless)
- (plist-put pair :pre-handlers pre-handlers)
- (plist-put pair :post-handlers post-handlers)
- (sp--update-pair-list pair m)
- (-when-let* ((symbol (intern (concat (symbol-name m) "-map")))
- (map (and (boundp symbol) (symbol-value symbol))))
- (when (or wrap bind) (define-key map
- (read-kbd-macro (or wrap bind))
- `(lambda (&optional arg)
- (interactive "P")
- (sp-wrap-with-pair ,open))))
- (when insert (define-key map
- (kbd insert)
- `(lambda () (interactive) (sp-insert-pair ,open))))))))
- (sp--update-local-pairs-everywhere (-flatten (list modes)))
- sp-pairs)
-
-(cl-defun sp-local-tag (modes trig open close &key
- (transform 'identity)
- (actions '(wrap insert))
- post-handlers)
- "Add a tag definition.
-
-MODES is a mode or a list of modes where this tag should
-activate. It is impossible to define global tags.
-
-TRIG is the trigger sequence. It can be a string of any length.
-If more triggers share a common prefix, the shortest trigger is
-executed.
-
-OPEN is the format of the opening tag. This is inserted before
-the active region.
-
-CLOSE is the format of the closing tag. This is inserted after
-the active region.
-
-Opening and closing tags can optionally contain the _ character.
-
-If the opening tag contains the _ character, after you type the
-trigger, the region is wrapped with \"skeleton\" tags and a
-special tag editing mode is entered. The text you now type is
-substituted for the _ character in the opening tag.
-
-If the closing tag contains the _ character, the text from the
-opening pair is mirrored to the closing pair and substituted for
-the _ character.
-
-TRANSFORM is a function name (symbol) that is called to perform a
-transformation of the opening tag text before this is inserted to
-the closing tag. For example, in html tag it might simply select
-the name of the tag and cut off the tag attributes (like
-class/style etc.). Defaults to identity.
-
-ACTIONS is a list of actions this tag should support. Currently,
-only \"wrap\" action is supported. Usually, you don't need to
-specify this argument.
-
-POST-HANDLERS is a list of functions that are called after the
-tag is inserted. If the tag does contain the _ character, these
-functions are called after the tag editing mode is exited. Each
-function on this list should accept two arguments: the trigger
-string and the action."
- (dolist (mode (-flatten (list modes)))
- (let* ((tag-list (assq mode sp-tags))
- (tag (--first (equal trig (plist-get it :trigger)) (cdr tag-list)))
- (new-tag nil))
- (setq new-tag (plist-put new-tag :trigger trig))
- (plist-put new-tag :open open)
- (plist-put new-tag :close close)
- (when transform (plist-put new-tag :transform transform))
- (when actions (plist-put new-tag :actions actions))
- (when post-handlers (plist-put new-tag :post-handlers post-handlers))
- (if tag-list
- (if (not actions)
- (setcdr tag-list (--remove (equal trig (plist-get it :trigger)) (cdr tag-list)))
- (if (not tag)
- (setcdr tag-list (cons new-tag (cdr tag-list)))
- (sp--update-pair new-tag tag)))
- ;; mode doesn't exist
- (when actions
- (!cons (cons mode (list new-tag)) sp-tags))))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Overlay management
-
-;; burlywood4
-(defface sp-pair-overlay-face
- '((t (:inherit highlight)))
- "The face used to highlight pair overlays."
- :group 'smartparens)
-
-(defface sp-wrap-overlay-face
- '((t (:inherit sp-pair-overlay-face)))
- "The face used to highlight wrap overlays.
-
-When the user wraps a region with multi-character pair a special
-insertion mode is entered. This face is used for the overlays
-where the possible wrappings are displayed.
-
-The opening and closing delimiters use
-`sp-wrap-overlay-opening-pair' and `sp-wrap-overlay-closing-pair'
-respectively."
- :group 'smartparens)
-
-(defface sp-wrap-overlay-opening-pair
- '((t (:inherit sp-wrap-overlay-face
- :foreground "green")))
- "The face used to highlight opening pairs for wrapping.
-
-See `sp-wrap-overlay-face'."
- :group 'smartparens)
-
-(defface sp-wrap-overlay-closing-pair
- '((t (:inherit sp-wrap-overlay-face
- :foreground "red")))
- "The face used to highlight closing pairs for wrapping.
-
-See `sp-wrap-overlay-face'."
- :group 'smartparens)
-
-(defface sp-wrap-tag-overlay-face
- '((t (:inherit sp-pair-overlay-face)))
- "The face used to highlight wrap tag overlays."
- :group 'smartparens)
-
-(defvar sp-pair-overlay-list '()
- "List of overlays used for tracking inserted pairs.
-
-When a pair is inserted, an overlay is created over it. When the
-user starts typing the closing pair we will not insert it again.
-If user leaves the overlay, it is canceled and the insertion
-works again as usual.")
-(make-variable-buffer-local 'sp-pair-overlay-list)
-
-(defvar sp-wrap-overlays nil
- "Cons pair of wrap overlays.")
-(make-variable-buffer-local 'sp-wrap-overlays)
-
-(defvar sp-wrap-tag-overlays nil
- "Cons pair of tag wrap overlays.")
-(make-variable-buffer-local 'sp-wrap-tag-overlays)
-
-(defvar sp-pair-overlay-keymap (make-sparse-keymap)
- "Keymap for the pair overlays.")
-(define-key sp-pair-overlay-keymap (kbd "C-g") 'sp-remove-active-pair-overlay)
-
-(defvar sp-wrap-overlay-keymap (make-sparse-keymap)
- "Keymap for the wrap overlays.")
-(define-key sp-wrap-overlay-keymap (kbd "C-g") 'sp-wrap-cancel)
-
-(defun sp--overlays-at (&optional pos)
- "Wrapper around `overlays-at' to get smartparens overlays.
-
-POS is the same as for `overlays-at'.
-
-Smartparens functions must use this function instead of
-`overlays-at' directly."
- ;; TODO: we should probably also check the returned value
- (--filter (overlay-get it 'type) (overlays-at (or pos (point)))))
-
-(defun sp--point-in-overlay-p (overlay)
- "Return t if point is in OVERLAY."
- (and (< (point) (overlay-end overlay))
- (> (point) (overlay-start overlay))))
-
-(defun sp--get-overlay-length (overlay)
- "Compute the length of OVERLAY."
- (- (overlay-end overlay) (overlay-start overlay)))
-
-(defun sp--get-active-overlay (&optional type)
- "Get active overlay.
-
-Active overlay is the shortest overlay at point. Optional
-argument TYPE restrict overlays to only those with given type."
- (let ((overlays (sp--overlays-at)))
- (when type
- (setq overlays (--filter (eq (overlay-get it 'type) type) overlays)))
- (cond
- ((not overlays) nil)
- ((not (cdr overlays)) (car overlays))
- (t
- (--reduce (if (< (sp--get-overlay-length it) (sp--get-overlay-length acc)) it acc) overlays)))))
-
-(defun sp--pair-overlay-create (start end id)
- "Create an overlay over the currently inserted pair.
-
-This overlay is used for tracking the position of the point and
-marks the active expression. START and END are the boundaries of
-the overlay, ID is the id of the pair."
- (let ((overlay (make-overlay start end)))
- ;; set priority to 99 so that yasnippet with 100 overloads the
- ;; keymap #625
- (overlay-put overlay 'priority 99)
- (overlay-put overlay 'keymap sp-pair-overlay-keymap)
- (overlay-put overlay 'pair-id id)
- (overlay-put overlay 'type 'pair)
- (!cons overlay sp-pair-overlay-list)
- (sp--pair-overlay-fix-highlight)
- (add-hook 'post-command-hook 'sp--pair-overlay-post-command-handler nil t)))
-
-(defun sp-wrap-cancel ()
- "Cancel the active wrapping."
- (interactive)
- (unwind-protect
- (-let (((obeg . oend) sp-wrap-overlays))
- (when (and (not (called-interactively-p 'any))
- (sp--delete-selection-p))
- (kill-region (overlay-end obeg) (overlay-start oend)))
- (delete-region (overlay-start oend) (overlay-end oend))
- (when (> sp-wrap-point sp-wrap-mark)
- (let ((beg (delete-and-extract-region (overlay-start obeg) (overlay-end obeg))))
- (goto-char (overlay-start oend))
- (insert beg))))
- (sp-wrap--clean-overlays)))
-
-(defun sp-wrap--clean-overlays ()
- "Delete wrap overlays."
- (-let [(obeg . oend) sp-wrap-overlays]
- (delete-overlay obeg)
- (delete-overlay oend)
- (setq sp-wrap-overlays nil)))
-
-(defun sp--pair-overlay-fix-highlight ()
- "Fix highlighting of the pair overlays.
-
-Only the active overlay should be highlighted."
- (--each (sp--overlays-at) (overlay-put it 'face nil))
- (let* ((active (sp--get-active-overlay))
- (type (and active (overlay-get active 'type))))
- (if active
- (cond
- ((eq 'wrap-tag type)
- (when sp-highlight-wrap-tag-overlay
- (overlay-put active 'face 'sp-wrap-tag-overlay-face)))
- ((eq 'pair type)
- (when sp-highlight-pair-overlay
- (overlay-put active 'face 'sp-pair-overlay-face))))
- ;; edge case where we're at the end of active overlay. If
- ;; there is a wrap-tag overlay, restore it's face
- (when sp-wrap-tag-overlays
- (overlay-put (car sp-wrap-tag-overlays) 'face 'sp-wrap-tag-overlay-face)))))
-
-(defun sp--pair-overlay-post-command-handler ()
- "Remove all invalid pair overlays.
-
-An invalid overlay is one that doesn't have point inside it or
-is of zero length.
-
-Also remove all pair overlays if point moved backwards and
-`sp-cancel-autoskip-on-backward-movement' is non-nil."
- ;; if the point moved backwards, remove all overlays
- (if (and sp-cancel-autoskip-on-backward-movement
- (< (point) sp-previous-point))
- (dolist (o sp-pair-overlay-list) (sp--remove-overlay o))
- ;; else only remove the overlays where point is outside them or
- ;; their length is zero
- (dolist (o (--remove (and (sp--point-in-overlay-p it)
- (> (sp--get-overlay-length it) 0))
- sp-pair-overlay-list))
- (sp--remove-overlay o)))
- (when sp-pair-overlay-list
- (setq sp-previous-point (point))))
-
-(defun sp--reset-memoization (&rest ignored)
- "Reset memoization as a safety precaution.
-
-IGNORED is a dummy argument used to eat up arguments passed from
-the hook where this is executed."
- (setf (sp-state-last-syntax-ppss-point sp-state) nil
- (sp-state-last-syntax-ppss-result sp-state) nil))
-
-(defun sp-remove-active-pair-overlay ()
- "Deactivate the active overlay. See `sp--get-active-overlay'."
- (interactive)
- (-when-let (active-overlay (sp--get-active-overlay 'pair))
- (sp--remove-overlay active-overlay)))
-
-(defun sp--remove-overlay (overlay)
- "Remove OVERLAY."
- ;; if it's not a pair overlay, nothing happens here anyway
- (setq sp-pair-overlay-list (--remove (equal it overlay) sp-pair-overlay-list))
- ;; if we have zero pair overlays, remove the post-command hook
- (when (not sp-pair-overlay-list)
- (remove-hook 'post-command-hook 'sp--pair-overlay-post-command-handler t)
- ;; this is only updated when sp--pair-overlay-post-command-handler
- ;; is active. Therefore, we need to reset this to 1. If not, newly
- ;; created overlay could be removed right after creation - if
- ;; sp-previous-point was greater than actual point
- (setq sp-previous-point -1))
- (delete-overlay overlay)
- (sp--pair-overlay-fix-highlight))
-
-(defun sp--replace-overlay-text (o string)
- "Replace text inside overlay O with STRING."
- (save-excursion
- (goto-char (overlay-start o))
- (insert string)
- (delete-region (point) (overlay-end o))))
-
-(defun sp--get-overlay-text (o)
- "Get text inside overlay O."
- (buffer-substring (overlay-start o) (overlay-end o)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Action predicates
-
-(defun sp-in-string-p (_id _action context)
- "Return t if point is inside string or comment, nil otherwise."
- (eq context 'string))
-
-(defun sp-in-string-quotes-p (_id action context)
- "Special string test for quotes.
-
-On insert action, test the string context one character back from
-point. Return nil at `bobp'.
-
-On escape action use the value of CONTEXT."
- (cond
- ((eq action 'insert)
- (if (bobp) nil
- (save-excursion (backward-char 1) (sp-point-in-string))))
- ((eq action 'escape)
- (eq context 'string))))
-
-(defun sp-in-docstring-p (_id _action context)
- "Return t if point is inside elisp docstring, nil otherwise."
- (and (eq context 'string)
- (save-excursion
- (--when-let (car (sp-get-quoted-string-bounds))
- (goto-char it)
- (ignore-errors (backward-sexp 3))
- (looking-at-p (regexp-opt '("defun" "defmacro"
- "cl-defun" "cl-defmacro"
- "defun*" "defmacro*"
- "lambda" "-lambda")))))))
-
-(defun sp-in-code-p (_id _action context)
- "Return t if point is inside code, nil otherwise."
- (eq context 'code))
-
-(defun sp-in-comment-p (_id _action context)
- "Return t if point is inside comment, nil otherwise."
- (eq context 'comment))
-
-(defun sp-in-math-p (_id _action _context)
- "Return t if point is inside code, nil otherwise."
- (when (functionp 'texmathp)
- (texmathp)))
-
-(defun sp-point-before-eol-p (_id action _context)
- "Return t if point is followed by optional white spaces and end of line, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-at-p "\\s-*$")))
-
-(defun sp-point-after-bol-p (id action _context)
- "Return t if point follows beginning of line and possibly white spaces, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-back-p (concat "^\\s-*" (regexp-quote id)))))
-
-(defun sp-point-at-bol-p (id action _context)
- "Return t if point is at the beginning of line, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-back-p (concat "^" (regexp-quote id)))))
-
-(defun sp-point-before-symbol-p (_id action _context)
- "Return t if point is followed by a symbol, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-at-p "\\s_")))
-
-(defun sp-point-before-word-p (_id action _context)
- "Return t if point is followed by a word, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-at-p "\\sw\\|\\s_")))
-
-(defun sp-point-after-word-p (id action _context)
- "Return t if point is after a word, nil otherwise.
-This predicate is only tested on \"insert\" action."
- ;; TODO: remove condition with sp-defpair
- (when (memq action '(insert escape))
- (sp--looking-back-p (concat "\\(\\sw\\|\\s_\\)" (regexp-quote id)))))
-
-(defun sp-point-before-same-p (id action _context)
- "Return t if point is followed by ID, nil otherwise.
-This predicate is only tested on \"insert\" action."
- (when (eq action 'insert)
- (sp--looking-at-p (regexp-quote id))))
-
-(defun sp-point-in-empty-line-p (id _action _context)
- "Return t if point is on an empty line, nil otherwise."
- (and (sp--looking-at-p "\\s-*$")
- (sp--looking-back-p (concat "^\\s-*" (regexp-quote id)))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Pair insertion/deletion/skipping
-
-(defun sp--do-action-p (id action &optional use-inside-string)
- "Return t if pair ID can perform ACTION.
-
-If ACTION is a list, return t if at least one action from the
-list can be performed.
-
-If USE-INSIDE-STRING is non-nil, use value of
-`sp-point-inside-string' instead of testing with
-`sp-point-in-string-or-comment'."
- (setq action (-flatten (list action)))
- (let* ((actions (sp-get-pair id :actions))
- (when-l (sp-get-pair id :when))
- (unless-l (sp-get-pair id :unless))
- (in-string (if use-inside-string
- sp-point-inside-string
- (sp-point-in-string)))
- (context (cond
- (in-string 'string)
- ((sp-point-in-comment) 'comment)
- (t 'code)))
- a r)
- (while (and action (not r))
- (setq a (car action))
- (setq r (when (memq a actions)
- ;;(and (when-clause) (not (unless-clause)))
- (and (or (not when-l)
- (--some (funcall it id a context) when-l))
- (or (not unless-l)
- (not (--some (funcall it id a context) unless-l))))))
- (!cdr action))
- r))
-
-(defun sp--get-handler-context (type)
- "Return the context constant. TYPE is type of the handler."
- (let ((in-string (cl-case type
- (:pre-handlers
- (save-excursion
- (unless (bobp) (backward-char 1))
- (sp-point-in-string-or-comment)))
- (:post-handlers
- (sp-point-in-string-or-comment)))))
- (if in-string 'string 'code)))
-
-(defun sp--get-context (&optional point in-string in-comment)
- "Return the context of POINT.
-
-If the optional arguments IN-STRING or IN-COMMENT non-nil, their
-value is used instead of a test."
- (save-excursion
- (goto-char (or point (point)))
- (cond
- ((or in-string (sp-point-in-string)) 'string)
- ((or in-comment (sp-point-in-comment)) 'comment)
- (t 'code))))
-
-(defun sp--parse-insertion-spec (fun)
- "Parse the insertion specification FUN and return a form to evaluate."
- (let ((spec nil)
- (after nil)
- (last 1))
- (cl-labels ((push-non-empty
- (what)
- (unless (equal (cadr what) "")
- (push what spec))))
- (with-temp-buffer
- (insert fun)
- (goto-char (point-min))
- (while (re-search-forward "\\(|\\|\\[\\)" nil t)
- (cond
- ((equal (match-string 0) "[")
- (if (save-excursion (backward-char 1) (eq (preceding-char) 92))
- (push-non-empty `(insert ,(concat (buffer-substring-no-properties last (- (point) 2)) "[")))
- (push-non-empty `(insert ,(buffer-substring-no-properties last (1- (point)))))
- (let* ((p (point))
- (fun-end (progn
- (re-search-forward "]" nil t)
- (1- (point))))
- (fun-spec (buffer-substring-no-properties p fun-end))
- (instruction (cond
- ((equal fun-spec "i")
- '(indent-according-to-mode))
- ((equal (aref fun-spec 0) ?d)
- `(delete-char ,(string-to-number (substring fun-spec 1)))))))
- (when instruction (push instruction spec)))))
- ((equal (match-string 0) "|")
- (cond
- ((save-excursion (backward-char 1) (eq (preceding-char) 92))
- (push-non-empty `(insert ,(concat (buffer-substring-no-properties last (- (point) 2)) "|"))))
- (t
- (push-non-empty `(insert ,(buffer-substring-no-properties last (1- (point)))))
- (push 'save-excursion spec)
- (when (eq (following-char) 124)
- (forward-char 1)
- (setq after '(indent-according-to-mode)))))))
- (setq last (point)))
- (push-non-empty `(insert ,(buffer-substring-no-properties last (point-max)))))
- (let* ((specr (nreverse spec))
- (specsplit (--split-with (not (eq it 'save-excursion)) specr))
- (re (-concat (car specsplit) (if (cadr specsplit) (cdr specsplit) nil))))
- (cons 'progn (if after (-snoc re after) re))))))
-
-(defun sp--run-function-or-insertion (fun id action context)
- "Run a function or insertion.
-
-If FUN is a function, call it with `funcall' with ID, ACTION and
-CONTEXT as arguments.
-
-If FUN is a string, interpret it as \"insertion specification\",
-see `sp-pair' for description."
- (cond
- ((functionp fun)
- (funcall fun id action context))
- ((stringp fun)
- (eval (sp--parse-insertion-spec fun)))))
-
-
-(defvar sp-handler-context nil
- "Special variable holding context during handler execution.")
-
-;; TODO: get rid of `sp-handler-context' and make all the handlers (we
-;; should call them hooks) take better arguments, what we pass now is
-;; useless almost always
-(defun sp--run-hook-with-args (id type action &optional context-values)
- "Run all the hooks for pair ID of type TYPE on action ACTION.
-
-CONTEXT-VALUES is a plist with arbitrary values (depending on the
-action). A dynamic varable `sp-handler-context' will be bound to
-this value during execution of the handler."
- (ignore-errors
- (let ((hook (sp-get-pair id type))
- (context (sp--get-handler-context type)))
- (if hook
- (let ((sp-handler-context context-values))
- (--each hook (sp--run-function-or-insertion it id action context)))
- ;; TODO: WHAT THE FUCK IS THIS ???11?
- (let ((tag-hook (plist-get
- (--first (string-match-p
- (replace-regexp-in-string "_" ".*?" (plist-get it :open))
- id)
- (cdr (assq 'html-mode sp-tags))) ;; REALLY?
- type)))
- (run-hook-with-args 'tag-hook id action context))))))
-
-;; TODO: add a test for a symbol property that would tell this handler
-;; not to re=set `sp-last-operation'. Useful for example in "macro
-;; functions" like `my-wrap-with-paren'.
-(defun sp--post-command-hook-handler ()
- "Handle the situation after some command has executed."
- (sp--with-case-sensitive
- (when (sp--special-self-insert-command-p)
- (sp--post-self-insert-hook-handler))
- (ignore-errors
- (when smartparens-mode
- ;; handle the wrap overlays
- (when sp-wrap-overlays
- (let* ((overlay (car sp-wrap-overlays))
- (start (overlay-start overlay))
- (end (overlay-end overlay))
- (p (point)))
- (when (or (< p sp-previous-point)
- (> p end)
- (< p start))
- (sp-wrap-cancel))))
- (when sp-wrap-overlays
- (setq sp-previous-point (point)))
-
- ;; Here we run the delayed hooks. See issue #80
- (cond
- ((eq (car-safe (sp-state-delayed-hook sp-state)) :next)
- (setf (car (sp-state-delayed-hook sp-state)) :this))
- ((eq (car-safe (sp-state-delayed-hook sp-state)) :this)
- (let* ((pair (cdr (sp-state-delayed-hook sp-state)))
- (hooks (sp-get-pair pair :post-handlers-cond)))
- (--each hooks
- (let ((fun (car it))
- (conds (cdr it)))
- (when (or (--any? (eq this-command it) conds)
- (--any? (equal (single-key-description last-command-event) it) conds))
- (sp--run-function-or-insertion
- fun pair 'insert
- (sp--get-handler-context :post-handlers)))))
- (setf (sp-state-delayed-hook sp-state) nil)
- (setq sp-last-inserted-pair nil))))
-
- ;; Here we run the delayed insertion. Some details in issue #113
- (when (and (not (eq sp-last-operation 'sp-insert-pair-delayed))
- sp-delayed-pair)
- (let* ((pair (car sp-delayed-pair))
- (beg (cdr sp-delayed-pair))
- (conds (sp-get-pair pair :when-cond))
- (open-pair pair)
- (close-pair (sp-get-pair pair :close)))
- (when (and conds
- (--any? (cond
- ((and (commandp it)
- (not (stringp it)))
- (eq this-command it))
- ((stringp it)
- (equal (single-key-description last-command-event) it))
- ((ignore-errors (funcall it pair 'insert (sp--get-handler-context :post-handlers))))) conds))
- ;; TODO: refactor this and the same code in
- ;; `sp-insert-pair' to a separate function
- (sp--run-hook-with-args open-pair :pre-handlers 'insert)
- (insert close-pair)
- (backward-char (length close-pair))
- (sp--pair-overlay-create beg
- (+ (point) (length close-pair))
- open-pair)
- ;; no auto-escape here? Should be fairly safe
- (sp--run-hook-with-args open-pair :post-handlers 'insert)
- (setq sp-last-inserted-pair open-pair)
- ;; TODO: this is probably useless
- (setq sp-last-operation 'sp-insert-pair)))
- (setq sp-delayed-pair nil))
-
- (when (eq sp-last-operation 'sp-insert-pair-delayed)
- (setq sp-last-operation nil))
-
- (unless (or (sp--self-insert-command-p)
- (sp--special-self-insert-command-p))
- ;; unless the last command was a self-insert, remove the
- ;; information about the last wrapped region. It is only used
- ;; for: 1. deleting the wrapping immediately after the wrap,
- ;; 2. re-wrapping region immediatelly after a sucessful wrap.
- ;; Therefore, the deletion should have no ill-effect. If the
- ;; necessity will arise, we can add a different flag.
- (setq sp-last-wrapped-region nil)
- (setq sp-last-operation nil))
-
- (when show-smartparens-mode
- (if (member this-command sp-show-enclosing-pair-commands)
- (sp-show--pair-enc-function)
- (when (not (eq this-command 'sp-highlight-current-sexp))
- (sp-show--pair-delete-enc-overlays))))))))
-
-(defmacro sp--setaction (action &rest forms)
- "Use ACTION as a flag to evaluating FORMS.
-
-If ACTION is nil, evaluate FORMS and set it to the value of the
-last form; otherwise do nothing."
- (declare (debug (form body)))
- `(unless ,action
- (setq ,action (progn ,@forms))))
-
-;; TODO: this introduces a regression, where doing C-4 [ inserts [[[[]
-;; figure out how to detect the argument to self-insert-command that
-;; resulted to this insertion
-(defun sp--post-self-insert-hook-handler ()
- "Handler for `post-self-insert-hook'."
- (with-demoted-errors "sp--post-self-insert-hook-handler: %S"
- (when smartparens-mode
- (sp--with-case-sensitive
- (catch 'done
- (let (action)
- (when (region-active-p)
- (condition-case err
- (sp-wrap--initialize)
- (user-error
- (message (error-message-string err))
- ;; we need to remove the undo record of the insertion
- (unless (eq buffer-undo-list t)
- ;; pop all undo info until we hit an insertion node
- (sp--undo-pop-to-last-insertion-node)
- ;; get rid of it and insert an undo boundary marker
- (pop buffer-undo-list)
- (undo-boundary))
- (restore-buffer-modified-p sp-buffer-modified-p)
- (throw 'done nil))))
- (cond
- (sp-wrap-overlays
- (sp-wrap))
- (t
- ;; TODO: this does not pick correct pair!! it uses insert and not wrapping code
- (sp--setaction
- action
- (-when-let ((_ . open-pairs) (sp--all-pairs-to-insert nil 'wrap))
- (catch 'done
- (-each open-pairs
- (-lambda ((&keys :open open :close close))
- (--when-let (sp--wrap-repeat-last (cons open close))
- (throw 'done it)))))))
- (unless overwrite-mode (sp--setaction action (sp-insert-pair)))
- (sp--setaction action (sp-skip-closing-pair))
- (unless action (sp-escape-open-delimiter))
- ;; if nothing happened, we just inserted a character, so
- ;; set the apropriate operation.
- (unless action
- (setq sp-last-operation 'sp-self-insert))))))))))
-
-;; Unfortunately, some modes rebind "inserting" keys to their own
-;; handlers but do not hand over the insertion back to
-;; `self-insert-command', rather, they insert via `insert'.
-;; Therefore, we need to call this handler in `post-command-hook' too.
-;; The list `sp--special-self-insert-commands' specifies which
-;; commands to handle specially.
-(add-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler)
-
-;; TODO: make a proper data structure for state tracking and describe
-;; why we need each of these.
-(defun sp--save-pre-command-state ()
- "Save some of the buffer state before `pre-command-hook'."
- (setq sp-point-inside-string (sp-point-in-string))
- (setq sp-pre-command-point (point))
- (setq sp-buffer-modified-p (buffer-modified-p)))
-
-(add-hook 'pre-command-hook 'sp--save-pre-command-state)
-
-(defun sp--get-pair-list ()
- "Get all non-stringlike pairs.
-
-Return all pairs that are recognized in this `major-mode' and do
-not have same opening and closing delimiter. This is used for
-navigation functions."
- (--filter (not (string= (car it) (cdr it))) sp-pair-list))
-
-(defun sp--get-stringlike-list ()
- "Get all string-like pairs.
-
-Return all pairs that are recognized in this `major-mode' that
-have same opening and closing delimiter."
- (--filter (string= (car it) (cdr it)) sp-pair-list))
-
-(defun sp--get-allowed-pair-list ()
- "Get all allowed non string-like pairs.
-
-Return all pairs that are recognized in this `major-mode', do not
-have same opening and closing delimiter and are allowed in the
-current context. See also `sp--get-pair-list'."
- (--filter (and (sp--do-action-p (car it) 'navigate)
- (not (equal (car it) (cdr it)))) sp-pair-list))
-
-(defun sp--get-allowed-stringlike-list ()
- "Get all allowed string-like pairs.
-
-Return all pairs that are recognized in this `major-mode',
-have the same opening and closing delimiter and are allowed in
-the current context."
- (--filter (and (sp--do-action-p (car it) 'navigate)
- (equal (car it) (cdr it))) sp-pair-list))
-
-(defun sp--get-pair-list-context (&optional action)
- "Return all pairs that are recognized in this `major-mode' and
-are allowed in the current context."
- (setq action (or action 'insert))
- (--filter (sp--do-action-p (car it) action) sp-pair-list))
-
-(defun sp--get-pair-list-wrap ()
- "Return the list of all pairs that can be used for wrapping."
- (--filter (sp--do-action-p (car it) 'wrap) sp-pair-list))
-
-(defun sp--wrap-regexp (string start end)
- "Wraps regexp with start and end boundary conditions to avoid
-matching symbols in symbols."
- (concat "\\(?:" (when start "\\<") string (when end "\\>") "\\)"))
-
-(defun sp--regexp-for-group (parens &rest strings)
- "Generates an optimized regexp matching all string, but with
-extra boundary conditions depending on parens."
- (let* ((start (car parens))
- (end (cadr parens)))
- (sp--wrap-regexp (regexp-opt strings) start end)))
-
-(defun sp--strict-regexp-opt (strings &optional ignored)
- "Like regexp-opt, but with extra boundary conditions to ensure
-that the strings are not matched in-symbol."
- (if strings
- (with-syntax-table
- ;; HACK: this is a terrible hack to make ' be treated as a
- ;; punctuation. Many text modes set it as word character which
- ;; messes up the regexps
- (let ((table (make-syntax-table (syntax-table))))
- (modify-syntax-entry ?' "." table)
- table)
- (--> strings
- (-group-by (lambda (string)
- (list (and (string-match-p "\\`\\<" string) t)
- (and (string-match-p "\\>\\'" string) t)))
- it)
- (mapconcat (lambda (g) (apply 'sp--regexp-for-group g)) it "\\|")
- (concat "\\(?:" it "\\)")))
- "^\\<$"))
-
-(defun sp--strict-regexp-quote (string)
- "Like regexp-quote, but make sure that the string is not
-matched in-symbol."
- (sp--wrap-regexp (regexp-quote string)
- (string-match-p "\\`\\<" string)
- (string-match-p "\\>\\'" string)))
-
-(cl-defun sp--get-opening-regexp (&optional (pair-list (sp--get-pair-list)))
- "Return regexp matching any opening pair."
- (sp--strict-regexp-opt (--map (car it) pair-list)))
-
-(cl-defun sp--get-closing-regexp (&optional (pair-list (sp--get-pair-list)))
- "Return regexp matching any closing pair."
- (sp--strict-regexp-opt (--map (cdr it) pair-list)))
-
-(cl-defun sp--get-allowed-regexp (&optional (pair-list (sp--get-allowed-pair-list)))
- "Return regexp matching any opening or closing
-delimiter for any pair allowed in current context."
- (sp--strict-regexp-opt (--mapcat (list (car it) (cdr it)) pair-list)))
-
-(cl-defun sp--get-stringlike-regexp (&optional (pair-list (sp--get-allowed-stringlike-list)))
- "Return a regexp matching any string-like delimiter.
-
-In case PAIR-LIST is empty return a regexp that never matches
-anything."
- (if (consp pair-list)
- (regexp-opt (--map (car it) pair-list))
- "^\\<$"))
-
-(defun sp--get-last-wraped-region (beg end open close)
- "Return `sp-get-sexp' style plist about the last wrapped region.
-
-Note: this function does not retrieve the actual value of
-`sp-last-wrapped-region', it merely construct the plist from the
-provided values."
- (let ((b (make-marker))
- (e (make-marker)))
- (set-marker b beg)
- (set-marker e end)
- (set-marker-insertion-type e t)
- `(:beg ,b :end ,e :op ,open :cl ,close :prefix "")))
-
-;; Wrapping is basically the same thing as insertion, only the closing
-;; pair is placed at a distance.
-
-;; However, we want to be able to insert the *closing* delimiter and
-;; go to the end of block. This will only work with delimiters which
-;; are unique wrt their opening one. For more complex wrapping, there
-;; will probably be an IDO/minibuffer interface. Openings are checked
-;; first.
-
-;; Inserting the opening delimiter should put the point wherever it
-;; was when we started insertion.
-
-(defun sp-wrap--can-wrap-p ()
- "Return non-nil if we can wrap a region.
-
-This is used in advices on various pre-command-hooks from
-\"selection deleting\" modes to intercept their actions."
- (--any? (or (string-prefix-p (sp--single-key-description last-command-event) (car it))
- (string-prefix-p (sp--single-key-description last-command-event) (cdr it)))
- (sp--get-pair-list-wrap)))
-
-(defun sp--pair-to-wrap-comparator (prop a b)
- "Comparator for wrapping pair selection.
-
-PROP specifies wrapping-end. A and B are pairs to be compared."
- (< (length (plist-get a prop)) (length (plist-get b prop))))
-
-(defun sp--pair-to-wrap (&optional prefix)
- "Return information about possible wrapping pairs.
-
-If optional PREFIX is non-nil, this is used to determine the
-possible wrapping pairs instead of the text in the wrapping
-overlay."
- (let* ((working-pairs
- ;; TODO: abstract this into a new "sp--get-..." hierarchy
- (--filter (sp--do-action-p (plist-get it :open) 'wrap) sp-local-pairs))
- (obeg (car sp-wrap-overlays))
- (prefix (or prefix (sp--get-overlay-text obeg)))
- (opening-pairs (--filter (string-prefix-p prefix (plist-get it :open)) working-pairs))
- ;; HACK: Here, we will add special "trigger pairs" to the
- ;; opening list. We set the opening delimiter to the
- ;; trigger, leave the rest alone and put the real open into
- ;; :open-real property. When we get the pair back, we will
- ;; check this property, and if present, fix the pair back to
- ;; the regular form
- (wrapper-pairs (->> (--filter (string-prefix-p prefix (or (plist-get it :trigger-wrap) "")) working-pairs)
- (-map (-lambda ((pair &as &plist :open open :trigger-wrap trigger-wrap))
- (setq pair (copy-sequence pair))
- (setq pair (plist-put pair :open trigger-wrap))
- (setq pair (plist-put pair :open-real open))
- pair))))
- (opening-pairs (-concat wrapper-pairs opening-pairs))
- (closing-pairs (--filter (string-prefix-p prefix (plist-get it :close)) working-pairs))
- (open (car (--sort (sp--pair-to-wrap-comparator :open it other) opening-pairs)))
- ;; TODO: do we need the special sorting here?
- (close (car (--sort (sp--pair-to-wrap-comparator :close it other) closing-pairs))))
- (list :open open
- :close close
- :opening opening-pairs
- :closing closing-pairs)))
-
-(defun sp-wrap--initialize ()
- "Initialize wrapping."
- (when (and sp-autowrap-region
- (sp-wrap--can-wrap-p))
- ;; This is the length of string which was inserted by the last
- ;; "self-insert" action. Typically this is 1, but sometimes a
- ;; single key inserts two or more characters, such as " in latex
- ;; where it translates into `` or ''.
- (let ((inserted-string-length (- (point) sp-pre-command-point)))
- ;; TODO: get rid of the following variables
- (setq sp-wrap-point (- (point) inserted-string-length))
- (setq sp-wrap-mark (mark))
- ;; balance check
- (with-silent-modifications
- (let ((inserted-string
- (prog1 (delete-and-extract-region sp-wrap-point (point))
- ;; HACK: in modes with string fences, the insertion
- ;; of the delimiter causes `syntax-propertize' to
- ;; fire, but the above deletion doesn't re-run it
- ;; because the cache tells it the state is OK. We
- ;; need to destroy the cache and re-run the
- ;; `syntax-propertize' on the buffer. This might be
- ;; expensive, but we only done this on wrap-init so
- ;; it's fine, I guess.
- (setq syntax-propertize--done -1)
- (syntax-propertize (point-max))))
- (point-string-context (sp-get-quoted-string-bounds sp-wrap-point))
- (mark-string-context (sp-get-quoted-string-bounds (mark))))
- ;; If point and mark are inside the same string, we don't
- ;; need to check if the region is OK. If both are outisde
- ;; strings, we have to. If one is inside and the other is
- ;; not, no matter what we would break, so we exit.
- (cond
- ;; inside the same string
- ((and point-string-context mark-string-context
- (eq (car point-string-context)
- (car mark-string-context))))
- ;; neither is inside string
- ((and (not point-string-context)
- (not mark-string-context))
- (unless (sp-region-ok-p sp-wrap-point (mark))
- (user-error "Mismatched sexp state: wrapping would break structure")))
- ;; one is in and the other isn't
- ((if point-string-context (not mark-string-context) mark-string-context)
- (user-error "Mismatched string state: point %sin string, mark %sin string"
- (if (car-safe point-string-context) "" "not ")
- (if (car-safe mark-string-context) "" "not ")))
- ;; both are in but in different strings
- (t (user-error "Mismatched string state: point and mark are inside different strings")))
- (insert inserted-string)))
- ;; if point > mark, we need to move point to mark and reinsert the
- ;; just inserted character.
- (when (> (point) (mark))
- (let ((char (delete-and-extract-region (- (point) inserted-string-length) (point))))
- (exchange-point-and-mark)
- (insert char)))
- (let* ((oleft (make-overlay (- (region-beginning) inserted-string-length)
- (region-beginning) nil nil t))
- (oright (make-overlay (region-end) (region-end) nil nil t)))
- (setq sp-wrap-overlays (cons oleft oright))
- (when sp-highlight-wrap-overlay
- (overlay-put oleft 'face 'sp-wrap-overlay-face)
- (overlay-put oright 'face 'sp-wrap-overlay-face))
- (overlay-put oleft 'priority 100)
- (overlay-put oright 'priority 100)
- (overlay-put oleft 'keymap sp-wrap-overlay-keymap)
- (overlay-put oleft 'type 'wrap)
- (setq sp-previous-point (point))
- (goto-char (1+ (overlay-start oleft)))))))
-
-(defun sp-wrap--finalize (wrapping-end open close)
- "Finalize a successful wrapping.
-
-WRAPPING-END specifies the wrapping end. If we wrapped using
-opening delimiter it is :open. If we wrapped using closing
-delimiter it is :close. Position of point after wrapping depends
-on this value---if :open, go where the wrapping was initalized,
-if :close, go after the newly-formed sexp.
-
-OPEN and CLOSE are the delimiters."
- (-let (((obeg . oend) sp-wrap-overlays))
- (sp--replace-overlay-text obeg open)
- (sp--replace-overlay-text oend close)
- (setq sp-last-operation 'sp-wrap-region)
- (setq sp-last-wrapped-region
- (sp--get-last-wraped-region
- (overlay-start obeg) (overlay-end oend)
- open close))
- (cond
- ((eq wrapping-end :open)
- (if sp-wrap-respect-direction
- (progn
- (set-mark (overlay-end oend))
- (goto-char (overlay-start obeg)))
- (when (> sp-wrap-point sp-wrap-mark)
- (set-mark (overlay-start obeg))
- (goto-char (overlay-end oend)))))
- ((eq wrapping-end :close)
- (set-mark (overlay-start obeg))
- (goto-char (overlay-end oend))))
- (sp-wrap--clean-overlays)
- (sp--run-hook-with-args open :post-handlers 'wrap)))
-
-(defun sp-wrap ()
- "Try to wrap the active region with some pair.
-
-This function is not ment to be used to wrap sexps with pairs
-programatically. Use `sp-wrap-with-pair' instead."
- (-let* (((&plist :open open :close close
- :opening opening-pairs
- :closing closing-pairs) (sp--pair-to-wrap))
- ((obeg . oend) sp-wrap-overlays))
- (cond
- (open
- (-let (((&plist :open open :close close :open-real open-real) open))
- (when sp-wrap-show-possible-pairs
- (overlay-put
- oend 'after-string
- (mapconcat (lambda (x)
- (if sp-highlight-wrap-overlay
- (concat
- (propertize
- (plist-get x :open) 'face
- 'sp-wrap-overlay-opening-pair)
- (propertize
- (plist-get x :close)
- 'face 'sp-wrap-overlay-closing-pair))
- (concat (plist-get x :open) (plist-get x :close))))
- opening-pairs " ")))
- (when (equal (sp--get-overlay-text obeg) open)
- (sp-wrap--finalize :open (or open-real open) close))))
- ((and close (= 1 (length closing-pairs)))
- (-let (((&plist :open open :close close) close))
- (when (equal (sp--get-overlay-text obeg) close)
- (sp-wrap--finalize :close open close))))
- (t
- (sp-wrap-cancel)))))
-
-(defun sp--escape-region (chars-to-escape beg end)
- "Escape instances of CHARS-TO-ESCAPE between BEG and END.
-
-Return non-nil if at least one escaping was performed."
- (save-excursion
- (goto-char beg)
- (let ((pattern (regexp-opt chars-to-escape))
- (end-marker (set-marker (make-marker) end))
- (re nil))
- (while (re-search-forward pattern end-marker t)
- (setq re t)
- (save-excursion
- (goto-char (match-beginning 0))
- (insert sp-escape-char)))
- re)))
-
-;; TODO: refactor the rewrap-sexp dependent parts out so that this
-;; function has less dependencies on the action
-;; TODO: add mode-dependent escape/unescape actions?
-(defun sp-escape-wrapped-region (id action _context)
- "Escape quotes and special chars when a region is (re)wrapped."
- (when (and sp-escape-wrapped-region
- (memq action '(wrap rewrap-sexp)))
- (sp-get sp-last-wrapped-region
- (let* ((parent-delim (save-excursion
- (goto-char :beg)
- (sp-get (sp-get-string)
- (cond
- ((and (< :beg (point))
- (< (point) :end))
- :op)
- ((eq action 'rewrap-sexp)
- (plist-get sp-handler-context :parent)))))))
- (cond
- ((equal parent-delim id)
- (sp--escape-region (list id sp-escape-char) :beg :end))
- (parent-delim
- (sp--escape-region (list id) :beg-in :end-in))
- (t
- (sp--escape-region (list id sp-escape-char) :beg-in :end-in)))))))
-
-(defun sp-escape-quotes-after-insert (id action context)
- "Escape quotes inserted via `sp-insert-pair'."
- (when (and sp-escape-quotes-after-insert
- (eq action 'insert)
- ;; we test not being inside string because if we were
- ;; before inserting the "" pair it is now split into two
- ;; -> which moves us outside the pair
- (not (eq context 'string))
- ;; the inserted character must have string syntax, otherwise no "context" flip happens
- (eq (char-syntax (aref id 0)) ?\"))
- (let ((open id)
- (close (sp-get-pair id :close)))
- (sp--escape-region (list open close)
- (- (point) (length open))
- (+ (point) (length close))))))
-
-(defun sp--buffer-is-string-balanced-p ()
- "Check if the buffer is string-balanced.
-
-A string-balanced buffer is one where where is no unclosed
-string, that is, the string state at the end of the buffer is
-\"closed\"."
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-max))
- (let ((syntax (sp--syntax-ppss)))
- (or (< (car syntax) 0)
- (nth 3 syntax))))))
-
-(defun sp-escape-open-delimiter ()
- "Escape just inserted opening pair if `sp-insert-pair' was skipped.
-
-This is useful for escaping of \" inside strings when its pairing
-is disabled. This way, we can control autoescape and closing
-delimiter insertion separately."
- (-when-let (open (plist-get (sp--pair-to-insert 'escape) :open))
- (when (and (sp--do-action-p open 'escape)
- sp-point-inside-string
- ;; do not escape if we are looking at a closing
- ;; delimiter, that means we closed an opened string,
- ;; most likely.
- (sp--buffer-is-string-balanced-p))
- (sp--escape-region (list open) (- (point) (length open)) (point)))))
-
-;; kept to not break people's config... remove later
-(defun sp-match-sgml-tags (tag)
- "Split the html tag TAG at the first space and return its name."
- (let* ((split (split-string tag " "))
- (close (car split)))
- close))
-(make-obsolete 'sp-match-sgml-tags "do not use this function as the tag system has been removed." "2015-02-07")
-
-(defun sp--is-number-cons (c)
- "Return non-nil if C is a cons cell with numbers at `car' and `cdr'."
- (and (consp c) (numberp (car c)) (numberp (cdr c))))
-
-;; TODO: more research is needed
-(defun sp--undo-pop-to-last-insertion-node ()
- "Pop all undo info until an insertion node (beg . end) is found.
-
-This can potentially remove some undo important information."
- (while (and buffer-undo-list
- (or (null (car buffer-undo-list)) ;; is nil
- ;; is not undo action we're interested in
- (not (sp--is-number-cons (car buffer-undo-list)))))
- (pop buffer-undo-list)))
-
-;; modified from: https://github.com/Fuco1/smartparens/issues/90#issuecomment-18800369
-(defun sp--split-last-insertion-undo (len)
- "Split the last insertion node in the `buffer-undo-list' to
-include separate pair node."
- (sp--undo-pop-to-last-insertion-node)
- (when buffer-undo-list
- (let* ((previous-undo-actions (cdr buffer-undo-list))
- (beg (caar buffer-undo-list))
- (end (cdar buffer-undo-list))
- first-action second-action)
- (unless (< beg (- end len))
- ;; We need to go back more than one action. Given the pairs
- ;; are limited to 10 chars now and the chunks seem to be 20
- ;; chars, we probably wouldn't need more.
- (pop buffer-undo-list)
- (sp--undo-pop-to-last-insertion-node)
- (when buffer-undo-list
- (setq beg (caar buffer-undo-list))
- (setq previous-undo-actions (cdr buffer-undo-list))))
- (setq first-action (cons beg (- end len)))
- (setq second-action (cons (- end len) end))
- (setq buffer-undo-list
- (append (list nil second-action nil first-action)
- previous-undo-actions)))))
-
-;; TODO: remove ACTION argument and make the selection process more
-;; unified (see also sp--pair-to-wrap which depends on buffer state
-;; among other things)
-(defun sp--all-pairs-to-insert (&optional looking-fn action)
- "Return all pairs that can be inserted at point.
-
-Return nil if such pair does not exist.
-
-Pairs inserted using a trigger have higher priority over pairs
-without a trigger and only one or the other list is returned.
-
-In other words, if any pair can be inserted using a trigger, only
-pairs insertable by trigger are returned.
-
-ACTION is an implementation detail. Usually it has the value
-'insert when we determine pairs to insert. On repeated wrapping
-however we pass the value 'wrap. This will be refactored away in
-the upcoming version."
- (setq looking-fn (or looking-fn 'sp--looking-back-p))
- (setq action (or action 'insert))
- (let ((working-pairs
- ;; TODO: abstract this into a new "sp--get-..." hierarchy
- (--filter (sp--do-action-p (plist-get it :open) action) sp-local-pairs)))
- (-if-let (trigs (--filter (and (plist-get it :trigger)
- (funcall looking-fn (sp--strict-regexp-quote (plist-get it :trigger))))
- working-pairs))
- (cons :trigger trigs)
- (-when-let (pairs (--filter (funcall looking-fn (sp--strict-regexp-quote (plist-get it :open))) working-pairs))
- (cons :open pairs)))))
-
-(defun sp--pair-to-insert-comparator (prop a b)
- (cond
- ;; in case of triggers shorter always wins
- ((eq prop :trigger)
- (< (length (plist-get a :trigger)) (length (plist-get b :trigger))))
- ;; Shorter wins only if the shorter's closing is a prefix of the
- ;; longer's closing. In other words, if we are looking at
- ;; shorter's closing and we are trying to nest it.
- (t
- (if (< (length (plist-get a :open)) (length (plist-get b :open)))
- (and (string-prefix-p (plist-get a :close) (plist-get b :close))
- (sp--looking-at-p (plist-get a :close)))
- (not (and (string-prefix-p (plist-get b :close) (plist-get a :close))
- (sp--looking-at-p (plist-get b :close))))))))
-
-(defun sp--pair-to-insert (&optional action)
- "Return pair that can be inserted at point.
-
-Return nil if such pair does not exist.
-
-If more triggers or opening pairs are possible select the
-shortest one."
- (-when-let ((property . pairs) (sp--all-pairs-to-insert nil action))
- (car (--sort (sp--pair-to-insert-comparator property it other) pairs))))
-
-(defun sp--longest-prefix-to-insert ()
- "Return pair with the longest :open which can be inserted at point."
- (-when-let (pairs (--filter (sp--looking-back-p (sp--strict-regexp-quote (plist-get it :open))) sp-local-pairs))
- (car (--sort (> (length (plist-get it :open)) (length (plist-get other :open))) pairs))))
-
-(defun sp--pair-to-uninsert ()
- "Return pair to uninsert.
-
-If the current to-be-inserted pair shares a prefix with
-another (shorter) pair, we must first remove the effect of
-inserting its closing pair before inserting the current one.
-
-The previously inserted pair must be the one with the longest
-common prefix excluding the current pair."
- (-when-let (lp (sp--longest-prefix-to-insert))
- (save-excursion
- (backward-char (length (plist-get lp :open)))
- (-when-let ((property . pairs) (sp--all-pairs-to-insert 'sp--looking-at-p))
- (car (--sort (> (length (plist-get it property)) (length (plist-get other property)))
- ;; remove pairs whose open is longer than the
- ;; current longest possible prefix---otherwise
- ;; they would overflow to the closing pair
- ;; TODO: this ignores the possibility when lp is
- ;; inserted by trigger. We assume triggers are
- ;; shorter than the openings and this situation,
- ;; if ever, should be very rare
- (--remove (>= (length (plist-get it :open))
- (length (plist-get lp :open))) pairs)))))))
-
-(defun sp--insert-pair-get-pair-info (active-pair)
- "Get basic info about the to-be-inserted pair."
- (let ((open-pair (plist-get active-pair :open)))
- (list
- open-pair
- (plist-get active-pair :close)
- (-if-let (tr (plist-get active-pair :trigger))
- (if (sp--looking-back-p (sp--strict-regexp-quote tr)) tr open-pair)
- open-pair))))
-
-(defun sp-insert-pair (&optional pair)
- "Automatically insert the closing pair if it is allowed in current context.
-
-If PAIR is provided, use this as pair ID instead of looking
-through the recent history of pressed keys.
-
-You can disable this feature completely for all modes and all pairs by
-setting `sp-autoinsert-pair' to nil.
-
-You can globally disable insertion of closing pair if point is
-followed by the matching opening pair. It is disabled by
-default."
- (sp--with-case-sensitive
- (catch 'done
- (-let* ((active-pair (unwind-protect
- ;; This fake insertion manufactures proper
- ;; context for the tests below... in effect
- ;; we must make it look as if the user
- ;; typed in the opening part themselves
- ;; TODO: it is duplicated in the test
- ;; below, maybe it wouldn't hurt to
- ;; restructure this function a bit
- (progn
- (when pair (insert pair))
- (sp--pair-to-insert))
- (when pair (delete-char (- (length pair))))))
- ((open-pair close-pair trig) (sp--insert-pair-get-pair-info active-pair)))
- ;; We are not looking at a closing delimiter which might mean we
- ;; are in an already existing sexp. If the to-be-inserted pair
- ;; has a prefix which is also a pair we migth be extending the
- ;; opener of a sexp with this opener. In which case we should
- ;; probably rewrap.
- (unless (sp--looking-at-p (sp--get-closing-regexp))
- (when (and open-pair
- (= 1 (- (point) sp-pre-command-point)))
- (-when-let (prefix-pair (sp-get-pair (substring open-pair 0 -1)))
- (let ((last-char-of-open-pair (substring open-pair -1)))
- (unwind-protect
- (progn
- (delete-char -1)
- (--when-let (sp-get-thing t)
- (save-excursion
- (sp-get it
- (delete-region :end-in :end)
- (goto-char :end-in)
- (insert close-pair)))
- (throw 'done t)))
- (insert last-char-of-open-pair))))))
- (if (not (unwind-protect
- (progn
- (when pair (insert pair))
- ;; TODO: all these tests must go into `sp--pair-to-insert'
- (and sp-autoinsert-pair
- active-pair
- (if (memq sp-autoskip-closing-pair '(always always-end))
- (or (not (equal open-pair close-pair))
- (not (sp-skip-closing-pair nil t)))
- t)
- (sp--do-action-p open-pair 'insert t)
- ;; was sp-autoinsert-if-followed-by-same
- (or (not (sp--get-active-overlay 'pair))
- (not (sp--looking-at (sp--strict-regexp-quote open-pair)))
- (and (equal open-pair close-pair)
- (eq sp-last-operation 'sp-insert-pair)
- (save-excursion
- (backward-char (length trig))
- (sp--looking-back (sp--strict-regexp-quote open-pair))))
- (not (equal open-pair close-pair)))))
- (when pair (delete-char (- (length pair))))))
- ;; if this pair could not be inserted, we try the procedure
- ;; again with this pair removed from sp-pair-list to give
- ;; chance to other pairs sharing a common suffix (for
- ;; example \[ and [)
- (let ((new-sp-pair-list (--remove (equal (car it) open-pair) sp-pair-list))
- (new-sp-local-pairs (--remove (equal (plist-get it :open) open-pair) sp-local-pairs)))
- (when (> (length sp-pair-list) (length new-sp-pair-list))
- (let ((sp-pair-list new-sp-pair-list)
- (sp-local-pairs new-sp-local-pairs))
- (sp-insert-pair))))
- ;; setup the delayed insertion here.
- (if (sp-get-pair open-pair :when-cond)
- (progn
- (setq sp-delayed-pair (cons open-pair (- (point) (length open-pair))))
- (setq sp-last-operation 'sp-insert-pair-delayed))
- (unless pair (delete-char (- (length trig))))
- (insert open-pair)
- (sp--run-hook-with-args open-pair :pre-handlers 'insert)
- ;; The re-binding of these dynamic variables is a hack to
- ;; combat the similar rebinding in the branch above where
- ;; we retry `sp-insert-pair' with some pairs removed.
- ;; This however causes them to be uninserted improperly,
- ;; so for this one operation we need to restore the state
- ;; to the "full" pair list. TODO: in the future we might
- ;; want to pass the state around explicitly so we have
- ;; better control.
- (--when-let (let ((sp-pair-list (sp-state-pair-list sp-state))
- (sp-local-pairs (sp-state-local-pairs sp-state)))
- (sp--pair-to-uninsert))
- (let ((cl (plist-get it :close)))
- (when (and (sp--looking-at-p (sp--strict-regexp-quote cl))
- (> (- (length close-pair) (length cl)) 0))
- (delete-char (length cl)))))
- (insert close-pair)
- (backward-char (length close-pair))
- (sp--pair-overlay-create (- (point) (length open-pair))
- (+ (point) (length close-pair))
- open-pair)
- (when sp-undo-pairs-separately
- (sp--split-last-insertion-undo (+ (length open-pair) (length close-pair)))
- ;; TODO: abc\{abc\} undo undo \{asd\} . next undo removes the
- ;; entire \{asd\} if we do not insert two nils here.
- ;; Normally, repeated nils are ignored so it shouldn't
- ;; matter. It would still be useful to inspect further.
- (push nil buffer-undo-list)
- (push nil buffer-undo-list))
- (sp--run-hook-with-args open-pair :post-handlers 'insert)
- (setq sp-last-inserted-pair open-pair)
- (setf (sp-state-delayed-hook sp-state) (cons :next open-pair))
- (setq sp-last-operation 'sp-insert-pair)))))))
-
-(defun sp--wrap-repeat-last (active-pair)
- "If the last operation was a wrap and `sp-wrap-repeat-last' is
-non-nil, repeat the wrapping with this pair around the last
-active region."
- (unless (= 0 sp-wrap-repeat-last)
- (when sp-last-wrapped-region
- (let* ((b (sp-get sp-last-wrapped-region :beg))
- (e (sp-get sp-last-wrapped-region :end))
- (op (sp-get sp-last-wrapped-region :op))
- (oplen (length op))
- (cllen (sp-get sp-last-wrapped-region :cl-l))
- (acolen (length (car active-pair))))
- (when (and
- (cond
- ((= 1 sp-wrap-repeat-last)
- (equal (car active-pair) op))
- ((= 2 sp-wrap-repeat-last)))
- (memq sp-last-operation '(sp-self-insert sp-wrap-region))
- (or (= (point) (+ b oplen acolen))
- (= (point) e)))
- (delete-char (- acolen))
- (if (< (point) e)
- (progn (goto-char (+ b oplen))
- (insert (car active-pair))
- (goto-char (- e cllen))
- (insert (cdr active-pair))
- (setq sp-last-wrapped-region
- (sp--get-last-wraped-region
- (+ b oplen) (point)
- (car active-pair) (cdr active-pair)))
- (goto-char (+ b oplen acolen)))
- (goto-char b)
- (insert (car active-pair))
- (goto-char e)
- (insert (cdr active-pair))
- (setq sp-last-wrapped-region
- (sp--get-last-wraped-region
- b e (car active-pair) (cdr active-pair))))
- (setq sp-last-operation 'sp-wrap-region)
- (sp--run-hook-with-args (car active-pair) :post-handlers 'wrap)
- sp-last-operation)))))
-
-(defun sp--char-is-part-of-stringlike (char)
- "Return non-nil if CHAR is part of a string-like delimiter of length 1."
- (->> (sp--get-stringlike-list)
- (--filter (= 1 (length (cdr it))))
- (-map 'car)
- (--any? (string-match-p (regexp-quote char) it))))
-
-(defun sp--char-is-part-of-closing (char &optional pair-list)
- "Return non-nil if CHAR is part of a pair delimiter of length 1.
-Specifically, return the pair for which CHAR is the closing
-delimiter."
- (let ((regexp (regexp-quote char)))
- (->> (or pair-list (sp--get-pair-list))
- (--filter (= 1 (length (cdr it))))
- (--find (string-match-p regexp (cdr it))))))
-
-;; TODO: this only supports single-char delimiters. Maybe it should
-;; that that way.
-(defun sp-skip-closing-pair (&optional last test-only)
- "Automatically skip the closing delimiters of pairs.
-
-If point is inside an inserted pair, and the user only moved
-forward with point (that is, only inserted text), if the closing
-pair is typed, we shouldn't insert it again but skip forward. We
-call this state \"active sexp\". The setting
-`sp-cancel-autoskip-on-backward-movement' controls when an active
-expression become inactive.
-
-For example, pressing ( is followed by inserting the pair (|). If
-we then type 'word' and follow by ), the result should be (word)|
-instead of (word)|).
-
-This behaviour can be customized by various settings of
-`sp-autoskip-closing-pair' and `sp-autoskip-opening-pair'.
-
-Additionally, this behaviour can be selectively disabled for
-specific pairs by removing their \"autoskip\" action. You can
-achieve this by using `sp-pair' or `sp-local-pair' with
-\":actions '(:rem autoskip)\"."
- (sp--with-case-sensitive
- (when (or (and (eq sp-autoskip-closing-pair t)
- sp-pair-overlay-list
- (sp--get-active-overlay 'pair))
- (memq sp-autoskip-closing-pair '(always always-end)))
- ;; TODO: ugly hack to override 'navigate with 'autoskip. Each of
- ;; these submodules should set-up their own environment somehow
- ;; and thread it through the entire computation
- (cl-letf (((symbol-function 'sp--get-allowed-stringlike-list)
- (lambda ()
- (--filter (and (sp--do-action-p (car it) 'autoskip)
- (equal (car it) (cdr it))) sp-pair-list))))
- ;; these two are pretty hackish ~_~
- (cl-labels ((get-sexp
- (last)
- (delete-char -1)
- (insert " ")
- (prog1 (sp-get-sexp)
- (delete-char -1)
- (insert last)))
- (get-enclosing-sexp
- (last)
- (delete-char -1)
- (insert " ")
- (prog1 (sp-get-enclosing-sexp)
- (delete-char -1)
- (insert last))))
- (let ((last (or last (sp--single-key-description last-command-event))))
- (-if-let (active-sexp
- (cond
- ((-when-let* ((ov (sp--get-active-overlay 'pair))
- (op (overlay-get ov 'pair-id))
- (cl (cdr (assoc op sp-pair-list))))
- ;; if the sexp is active, we are inside it.
- (when (and (= 1 (length op))
- (equal last cl))
- (list :beg (overlay-start ov)
- :end (overlay-end ov)
- :op op
- :cl cl
- :prefix ""
- :suffix ""))))
- ((sp--char-is-part-of-stringlike last)
- ;; a part of closing delimiter is typed. There are four
- ;; options now:
- ;; - we are inside the sexp, at its end
- ;; - we are inside the sexp, somewhere in the middle
- ;; - we are outside, in front of a sexp
- ;; - we are outside, somewhere between sexps
- (cond
- ((and (sp--looking-at (sp--get-stringlike-regexp))
- (not (sp--skip-match-p (match-string-no-properties 0)
- (match-beginning 0)
- (match-end 0))))
- ;; if we're looking at the delimiter, and it is valid in
- ;; current context, get the sexp.
- (get-sexp last))
- ;; here comes the feature when we're somewhere in the
- ;; middle of the sexp (or outside), if ever supported.
- ))
- ((sp--char-is-part-of-closing last)
- (cond
- ((and (sp--looking-at (sp--get-closing-regexp))
- (not (sp--skip-match-p (match-string-no-properties 0)
- (match-beginning 0)
- (match-end 0))))
- (get-sexp last))
- ((eq sp-autoskip-closing-pair 'always)
- (get-enclosing-sexp last))))))
- (if (and active-sexp
- (equal (sp-get active-sexp :cl) last)
- (sp--do-action-p (sp-get active-sexp :op) 'autoskip)
- ;; if the point is inside string and preceded
- ;; by an odd number of `sp-escape-char's, we
- ;; should not skip as that would leave the
- ;; string broken.
- (or (not (sp-point-in-string))
- (not (sp-char-is-escaped-p (1- (point))))))
- (-when-let (re (cond
- ((= (point) (sp-get active-sexp :beg))
- ;; we are in front of a string-like sexp
- (when sp-autoskip-opening-pair
- (if test-only t
- (delete-char -1)
- (forward-char)
- (setq sp-last-operation 'sp-skip-closing-pair))))
- ((= (point) (sp-get active-sexp :end-in))
- (if test-only t
- (delete-char 1)
- (setq sp-last-operation 'sp-skip-closing-pair)))
- ((sp-get active-sexp
- (and (> (point) :beg-in)
- (< (point) :end-in)))
- (if test-only t
- (delete-char -1)
- (sp-up-sexp nil t)))))
- (unless (or test-only
- sp-buffer-modified-p)
- (set-buffer-modified-p nil))
- (unless test-only
- (sp--run-hook-with-args (sp-get active-sexp :op) :post-handlers 'skip-closing-pair))
- re)
- ;; if we can't skip and are in strict mode we must not
- ;; insert anything if it is a closing character
- (sp--inhibit-insertion-of-closing-delim last))
- (sp--inhibit-insertion-of-closing-delim last))))))))
-
-(defun sp--inhibit-insertion-of-closing-delim (last)
- "Inhibit insertion of closing delimiter in `smartparens-strict-mode'.
-
-If we are not inserting inside string or a comment, and the LAST
-inserted character is closing delimiter for a pair that performs
-autoskip, and we can not jump out of its enclosing sexp (i.e. it
-does not match), we are not allowed to insert it literally
-because it would break the balance; so we delete the
-just-inserted character."
- (when (and smartparens-strict-mode
- (-when-let (pair (sp--char-is-part-of-closing
- last (sp--get-allowed-pair-list)))
- (memq 'autoskip (sp-get-pair (car pair) :actions)))
- (not (sp-point-in-string-or-comment)))
- (delete-char -1)
- (set-buffer-modified-p sp-buffer-modified-p)
- (sp-message :cant-insert-closing-delimiter)
- nil))
-
-(defun sp-delete-pair (&optional arg)
- "Automatically delete opening or closing pair, or both, depending on
-position of point.
-
-If the point is inside an empty pair, automatically delete both. That
-is, [(|) turns to [|, [\{|\} turns to [|. Can be disabled by setting
-`sp-autodelete-pair' to nil.
-
-If the point is behind a closing pair or behind an opening pair delete
-it as a whole. That is, \{\}| turns to \{|, \{| turns to |. Can be
-disabled by setting `sp-autodelete-closing-pair' and
-`sp-autodelete-opening-pair' to nil.
-
-If the last operation was a wrap and `sp-autodelete-wrap' is
-enabled, invoking this function will unwrap the expression, that
-is remove the just added wrapping."
- ;; NOTE: Only use delete-char inside this function, so we
- ;; don't activate the advice recursively!
-
- ;; only activate if argument is 1 (this is 0-th argument of the
- ;; delete-backward-char), otherwise the user wants to delete
- ;; multiple character, so let him do that
- (sp--with-case-sensitive
- (when (and (= arg 1)
- smartparens-mode)
- (if (and sp-autodelete-wrap
- (eq sp-last-operation 'sp-wrap-region))
- (let ((p (point))
- (b (sp-get sp-last-wrapped-region :beg))
- (e (sp-get sp-last-wrapped-region :end))
- (o (sp-get sp-last-wrapped-region :op-l))
- (c (sp-get sp-last-wrapped-region :cl-l)))
- ;; if the last operation was `sp-wrap-region', and we are at
- ;; the position of either opening or closing pair, delete the
- ;; just-inserted pair
- (when (or (= p (+ b o))
- (= p e))
- (insert "x") ;dummy char to account for the regularly deleted one
- (save-excursion
- (goto-char e)
- (delete-char (- c))
- (goto-char b)
- (delete-char o))
- (setq sp-last-operation 'sp-delete-pair-wrap)))
- (let ((p (point))
- (inside-pair (--first (and (sp--looking-back (sp--strict-regexp-quote (car it)))
- (sp--looking-at (concat "[ \n\t]*" (sp--strict-regexp-quote (cdr it)))))
- sp-pair-list))
- (behind-pair (--first (sp--looking-back (sp--strict-regexp-quote (cdr it))) sp-pair-list))
- (opening-pair (--first (sp--looking-back (sp--strict-regexp-quote (car it))) sp-pair-list)))
-
- (cond
- ;; we're just before the closing quote of a string. If there
- ;; is an opening or closing pair behind the point, remove
- ;; it. This is only really relevant if the pair ends in the
- ;; same character as string quote. We almost never want to
- ;; delete it as an autopair (it would "open up the string").
- ;; So, word\"|" and should produce word\|" or
- ;; word|" (if \" is autopair) instead of word\|.
- ((and (sp-point-in-string)
- (not (sp-point-in-string (1+ p)))
- (sp-point-in-string (1- p))) ;; the string isn't empty
- (cond ;; oh, you ugly duplication :/
- ((and behind-pair sp-autodelete-closing-pair)
- (delete-char (- (1- (length (car behind-pair)))))
- (setq sp-last-operation 'sp-delete-pair-closing))
- ((and opening-pair sp-autodelete-opening-pair)
- (delete-char (- (1- (length (car opening-pair)))))
- (setq sp-last-operation 'sp-delete-pair-opening))))
- ;; we're inside a pair
- ((and inside-pair sp-autodelete-pair)
- (let* ((beg (save-excursion
- (search-backward (car inside-pair))))
- (end (save-excursion
- (search-forward (cdr inside-pair))))
- (cs (sp--get-context p))
- (ce (sp--get-context end))
- (current-sexp (sp-get-sexp)))
- (when (and (or (not (eq cs 'comment)) ;; a => b <=> ~a v b
- (eq ce 'comment))
- (eq beg (sp-get current-sexp :beg))
- (eq end (sp-get current-sexp :end))
- (equal (sp-get current-sexp :op) (car inside-pair))
- (equal (sp-get current-sexp :cl) (cdr inside-pair)))
- (delete-char (- end p))
- (delete-char (- (1- (length (car inside-pair)))))
- (setq sp-last-operation 'sp-delete-pair))))
- ;; we're behind a closing pair
- ((and behind-pair sp-autodelete-closing-pair)
- (delete-char (- (1- (length (cdr behind-pair)))))
- (setq sp-last-operation 'sp-delete-pair-closing))
- ;; we're behind an opening pair and there's no closing pair
- ((and opening-pair sp-autodelete-opening-pair)
- (delete-char (- (1- (length (car opening-pair)))))
- (setq sp-last-operation 'sp-delete-pair-opening))))))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Navigation
-
-(defun sp--looking-at (regexp)
- "Like `looking-at', but always case sensitive."
- (sp--with-case-sensitive
- (looking-at regexp)))
-
-(defun sp--looking-at-p (regexp)
- "Like `looking-at-p', but always case sensitive."
- (sp--with-case-sensitive
- (looking-at-p regexp)))
-
-(defun sp--looking-back (regexp &optional limit not-greedy)
- "Return non-nil if text before point matches regular expression REGEXP.
-
-With optional argument LIMIT search only that many characters
-backward. If LIMIT is nil, default to `sp-max-pair-length'.
-
-If optional argument NON-GREEDY is t search for any matching
-sequence, not necessarily the longest possible."
- (setq limit (or limit sp-max-pair-length))
- (sp--with-case-sensitive
- (let ((from (max 1 (- (point) limit)))
- (to (point))
- (greedy (not not-greedy))
- has-match)
- (if greedy
- (save-excursion
- (goto-char from)
- (save-match-data
- (while (and (not has-match) (< (point) to))
- ;; don't use looking-at because we can't limit that search
- (if (and (save-excursion (re-search-forward regexp to t))
- (= (match-end 0) to))
- (setq has-match (match-data))
- (forward-char 1))))
- (when has-match
- (set-match-data has-match)
- t))
- (save-excursion
- (not (null (search-backward-regexp (concat "\\(?:" regexp "\\)\\=") from t))))))))
-
-(defun sp--looking-back-p (regexp &optional limit not-greedy)
- "Same as `sp--looking-back' but do not change the match data."
- (save-match-data
- (sp--looking-back regexp limit not-greedy)))
-
-(defun sp--search-backward-regexp (regexp &optional bound noerror count)
- "Works just like `search-backward-regexp', but returns the
-longest possible match. That means that searching for
-\"defun|fun\" backwards would return \"defun\" instead of
-\"fun\", which would be matched first.
-
-This is an internal function. Only use this for searching for
-pairs!"
- (setq count (or count 1))
- (setq bound (or (sp--get-backward-bound) bound))
- (sp--with-case-sensitive
- (let (r)
- (while (> count 0)
- (when (search-backward-regexp regexp bound noerror)
- (goto-char (match-end 0))
- (if (sp--looking-back regexp)
- (setq r (goto-char (match-beginning 0)))
- (if noerror nil (error "Search failed: %s" regexp))))
- (setq count (1- count)))
- r)))
-
-(defun sp--search-forward-regexp (regexp &optional bound noerror count)
- "Just like `search-forward-regexp', but always case sensitive."
- (setq bound (or (sp--get-forward-bound) bound))
- (sp--with-case-sensitive
- (search-forward-regexp regexp bound noerror count)))
-
-(defun sp-get-quoted-string-bounds (&optional point)
- "Return the bounds of the string around POINT.
-
-POINT defaults to `point'.
-
-If the point is not inside a quoted string, return nil."
- (setq point (or point (point)))
- (save-excursion
- (goto-char point)
- (let ((parse-data (syntax-ppss)))
- (when (nth 3 parse-data)
- (let* ((open (nth 8 parse-data))
- (close (save-excursion
- (parse-partial-sexp
- (point) (point-max)
- nil nil parse-data 'syntax-table)
- (point))))
- (cons open close))))))
-
-;; TODO: the repeated conditions are ugly, refactor this!
-(defun sp-get-comment-bounds ()
- "If the point is inside a comment, return its bounds."
- (when (or (sp-point-in-comment)
- (looking-at "[[:space:]]+\\s<"))
- (let ((open (save-excursion
- (--when-let (nth 8 (sp--syntax-ppss))
- (goto-char it))
- (while (and (not (bobp))
- (or (when (sp-point-in-comment)
- (backward-char 1)
- t)
- (when (save-excursion
- (beginning-of-line)
- (looking-at "^[[:space:]]+\\s<"))
- (when (>= (forward-line -1) 0)
- (end-of-line))
- t))))
- ;; this means we got here by `sp-point-in-comment' condition
- (unless (and (bobp) (sp-point-in-comment))
- (forward-char))
- (point)))
- (close (save-excursion
- (while (and (not (eobp))
- (or (sp-point-in-comment)
- (looking-at "[[:space:]]+\\s<")))
- (forward-char 1))
- (let ((pp (1- (point))))
- (when (not (or (eobp)
- (sp-point-in-comment)
- (looking-at "[[:space:]]+\\s<")
- (and (eq (char-syntax
- (char-after pp)) ?>)
- (not (eq (char-after pp) ?\n)))
- (/= (logand
- (lsh 1 18)
- (car (syntax-after pp))) 0)
- (/= (logand
- (lsh 1 19)
- (car (syntax-after pp))) 0)))
- (backward-char 1)))
- (point))))
- (cons open close))))
-
-(defun sp--get-string-or-comment-bounds ()
- "Get the bounds of string or comment the point is in."
- (or (sp-get-quoted-string-bounds)
- (sp-get-comment-bounds)))
-
-(defmacro sp--search-and-save-match (search-fn pattern bound res beg end str)
- "Save the last match info."
- `(progn
- (setq ,res (funcall ,search-fn ,pattern ,bound t))
- (when ,res
- (setq ,beg (match-beginning 0))
- (setq ,end (match-end 0))
- (setq ,str (match-string 0)))
- ,res))
-
-(cl-defun sp--skip-match-p (ms mb me
- &key
- (global-skip (cdr (--first (memq major-mode (car it)) sp-navigate-skip-match)))
- (pair-skip (sp-get-pair ms :skip-match)))
- "Return non-nil if this match should be skipped.
-
-This function uses two tests, one specified in
-`sp-navigate-skip-match' (this is global setting for all pairs in
-given major mode) and by a function specified in :skip-match
-property of the pair.
-
-If you are calling this function in a heavy loop, you can supply
-the test functions as keyword arguments to speed up the lookup."
- (save-match-data
- (or (when global-skip (funcall global-skip ms mb me))
- (when pair-skip (funcall pair-skip ms mb me)))))
-
-(defmacro sp--valid-initial-delimiter-p (form)
- "Test the last match using `sp--skip-match-p'. The form should
-be a function call that sets the match data."
- (declare (debug (form)))
- (let ((match (make-symbol "match"))
- (pair-skip (make-symbol "pair-skip")))
- `(and ,form
- (let* ((,match (match-string 0))
- (,pair-skip (or (sp-get-pair ,match :skip-match)
- (sp-get-pair (car (--first
- (equal (cdr it) ,match)
- sp-pair-list))
- :skip-match))))
- (not (sp--skip-match-p
- ,match
- (match-beginning 0)
- (match-end 0)
- :pair-skip ,pair-skip))))))
-
-(defun sp--elisp-skip-match (ms mb _me)
- "Function used to test for escapes in lisp modes.
-
-Non-nil return value means to skip the result."
- (and ms
- (> mb 1)
- (save-excursion
- (goto-char mb)
- (save-match-data
- (or (and (sp--looking-back "\\\\" 1 t)
- ;; it might be a part of ?\\ token
- (not (sp--looking-back "\\?\\\\\\\\" 3 t)))
- (and (not (sp-point-in-string-or-comment))
- (sp--looking-back "\\?" 1 t) ;;TODO surely we can do better
- (not (sp--looking-back "\\\\\\?" 2 t))
- (not (sp--looking-back "\\s_\\?" 2 t))
- (not (sp--looking-back "\\sw\\?" 2 t))))))))
-
-(defun sp--backslash-skip-match (ms mb _me)
- (and ms
- (save-excursion
- (goto-char mb)
- (sp--looking-back "\\\\" 1 t))))
-
-;; TODO: since this function is used for all the navigation, we should
-;; optimize it a lot! Get some elisp profiler! Also, we should split
-;; this into smaller functions (esp. the "first expression search"
-;; business)
-(defun sp-get-paired-expression (&optional back)
- "Find the nearest balanced pair expression after point.
-
-The expressions considered are those delimited by pairs on
-`sp-pair-list'."
- (sp--with-case-sensitive
- (save-excursion
- (let* ((search-fn (if (not back) 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (global-skip-fn (cdr (--first (memq major-mode (car it)) sp-navigate-skip-match)))
- (pair-list (sp--get-allowed-pair-list))
- ;; TODO UGLY HACK!!! When the situation is:
- ;; ..)|;; comment
- ;; the context the point gets is the comment. But if we
- ;; are searching backward, that is incorrect, because in
- ;; that case we want the context of the closing pair.
- ;; Therefore, if the direction is backward, we need to move
- ;; one point backward, then test the comment/string thing,
- ;; then compute the correct bounds, and then restore the
- ;; point so the search will pick up the )
-
- ;; However, we need to distinguish the cases where we are
- ;; in comment and trying to get out, and when we are in any
- ;; context and we jump into string (in that case, we should
- ;; report code context!). For example:
- ;; "foo"|;bar
- ;; or
- ;; "foo"|bar
- ;; should both report code context
- ;; and "|(foo)" should report string context.
-
- ;; Beware the case when we have a string inside a comment, like
- ;; (foo) ;; bar "baz"| qux
- ;; In this case we want to report comment context even when
- ;; backing into the "" (which however is commented)
-
- ;; Yet another case is when we are not in a comment but
- ;; directly after one and we search backwards, consider:
- ;; /* foo bar */|
- ;; in C-like language. In this case, we want to report the
- ;; context as comment.
-
- ;; In some languages, special paren syntax with a prefix
- ;; serves to mark strings. This means that regular
- ;; delimiters, like () are used to delimit strings. For
- ;; example, in ruby the sequence %w(...) signifies a
- ;; string. If the point is after such a sequence and we
- ;; are searching back, we must use the string context,
- ;; because the paren is now a string delimiter. This is
- ;; usually implemented with "string fence" syntax, so we
- ;; will simply check for that.
-
- ;; Thanks for being consistent at handling syntax bounds Emacs!
- (in-string-or-comment (if back
- (let ((in-comment (sp-point-in-comment))
- (in-string (sp-point-in-string)))
- (save-excursion
- (unless (= (point) (point-min))
- (backward-char)
- (cond
- ((eq (car (syntax-after (point))) 15) (point))
- (in-comment (when (sp-point-in-comment) (1+ (point))))
- ((and (not in-comment) (sp-point-in-comment)) (1+ (point)))
- ((or in-comment in-string) (1+ (point)))))))
- (when (sp-point-in-string-or-comment) (point))))
- (string-bounds (and in-string-or-comment
- (progn
- (goto-char in-string-or-comment)
- (sp--get-string-or-comment-bounds))))
- (fw-bound (if in-string-or-comment (cdr string-bounds) (point-max)))
- (bw-bound (if in-string-or-comment (car string-bounds) (point-min)))
- s e forward mb me ms r done
- possible-pairs possible-interfering-pairs possible-ops possible-cls)
- (while (and (not done)
- (sp--search-and-save-match
- search-fn
- ;; #556 The regexp we use here might exclude or
- ;; include extra pairs in case the next match is in
- ;; a different context. There's no way to know
- ;; beforehand where we land, so we need to consider
- ;; *all* pairs in the search and then re-check with
- ;; a regexp based on the context of the found pair
- (sp--get-allowed-regexp
- ;; use all the pairs!
- (sp--get-pair-list))
- (if back bw-bound fw-bound)
- r mb me ms))
- ;; search for the first opening pair. Here, only consider tags
- ;; that are allowed in the current context.
- (unless (or (not (save-excursion
- (if back
- (progn
- (goto-char me)
- (sp--looking-back-p (sp--get-allowed-regexp)))
- (goto-char mb)
- (sp--looking-at-p (sp--get-allowed-regexp)))))
- (sp--skip-match-p ms mb me :global-skip global-skip-fn))
- ;; if the point originally wasn't inside of a string or comment
- ;; but now is, jump out of the string/comment and only search
- ;; the code. This ensures that the comments and strings are
- ;; skipped if we search inside code.
- (if (and (not in-string-or-comment)
- (if back
- ;; When searching back, the point lands on the
- ;; first character of whatever pair we've found
- ;; and it is in the proper context, for example
- ;; "|(foo)"
- (sp-point-in-string-or-comment)
- ;; However, when searching forward, the point
- ;; lands after the last char of the pair so to get
- ;; its context we must back up one character
- (sp-point-in-string-or-comment (1- (point)))))
- (-if-let (bounds (sp--get-string-or-comment-bounds))
- (let ((jump-to (if back (car bounds) (cdr bounds))))
- (goto-char jump-to)
- ;; Can't move out of comment because eob, #427
- (when (eobp)
- (setq done t)))
- (setq done t))
- (setq done t))))
- (when r
- (setq possible-pairs (--filter (or (equal ms (car it))
- (equal ms (cdr it)))
- pair-list))
- (setq possible-ops (-map 'car possible-pairs))
- (setq possible-cls (-map 'cdr possible-pairs))
- (setq pair-list (-difference pair-list possible-pairs))
- (setq possible-interfering-pairs pair-list)
- (while possible-interfering-pairs
- (setq possible-interfering-pairs
- (--filter (or (-contains? possible-ops (car it))
- (-contains? possible-cls (cdr it)))
- pair-list))
- (setq pair-list (-difference pair-list possible-interfering-pairs))
- (setq possible-ops (append possible-ops (-map 'car possible-interfering-pairs)))
- (setq possible-cls (append possible-cls (-map 'cdr possible-interfering-pairs))))
- (when (--any? (equal ms it) possible-ops)
- (setq forward t)
- (setq s mb)
- (when back
- (forward-char (length ms))))
- (when (--any? (equal ms it) possible-cls)
- (setq forward nil)
- (setq e me)
- (when (not back)
- (backward-char (length ms))))
- (let* ((opens (if forward possible-ops possible-cls))
- (closes (if forward possible-cls possible-ops))
- (needle (sp--strict-regexp-opt (append possible-ops possible-cls)))
- (search-fn (if forward 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (depth 1)
- (eof (if forward 'eobp 'bobp))
- (b (if forward fw-bound bw-bound))
- (open (substring-no-properties ms))
- (close (substring-no-properties ms))
- (failure (funcall eof))
- (skip-match-pair-fns (->> possible-ops
- (--mapcat (-when-let (smf (sp-get-pair it :skip-match))
- (list (cons it smf) (cons (sp-get-pair it :close) smf)))))))
- (while (and (> depth 0) (not (funcall eof)))
- (sp--search-and-save-match search-fn needle b r mb me ms)
- (if r
- (unless (or (and (not in-string-or-comment)
- (if forward (save-excursion
- (backward-char)
- (sp-point-in-string-or-comment))
- (sp-point-in-string-or-comment)))
- ;; check the individual pair skipper. We
- ;; need to test all the possible-ops,
- ;; which makes it a bit ugly :/
- (let ((skip-match-pair-fn
- (cdr (--first (equal (car it) ms) skip-match-pair-fns))))
- (sp--skip-match-p ms mb me :global-skip global-skip-fn :pair-skip skip-match-pair-fn)))
- (when (--any? (equal ms it) opens) (setq depth (1+ depth)))
- (when (--any? (equal ms it) closes) (setq depth (1- depth))))
- (unless (minibufferp)
- (sp-message :unmatched-expression))
- (setq depth -1)
- (setq failure t)))
- (if forward
- (setq e me)
- (setq s mb))
- (setq close (substring-no-properties ms))
- (if (or failure
- (/= depth 0))
- (progn
- (unless (minibufferp)
- (sp-message :unmatched-expression))
- nil)
- (let ((end-in-cos (sp-point-in-string-or-comment (1- e)))) ;; fix the "point on comment" issue
- (cond
- ((or (and (sp-point-in-string-or-comment s) (not end-in-cos))
- (and (not (sp-point-in-string-or-comment s)) end-in-cos))
- (unless (minibufferp)
- (sp-message :delimiter-in-string))
- nil)
- (t
- (let* ((op (if forward open close)))
- (list :beg s
- :end e
- :op op
- :cl (if forward close open)
- :prefix (sp--get-prefix s op)
- :suffix (sp--get-suffix e op)))))))))))))
-
-;; TODO: this does not consider unbalanced quotes in comments!!!
-(defun sp--find-next-stringlike-delimiter (needle search-fn-f &optional limit skip-fn)
- "Find the next string-like delimiter, considering the escapes
-and the skip-match predicate."
- (let (hit match)
- (while (and (not hit)
- (funcall search-fn-f needle limit t))
- (save-match-data
- (setq match (match-string-no-properties 0))
- (unless (or (save-match-data
- (save-excursion
- (goto-char (match-beginning 0))
- (or (sp--looking-back-p "\\\\" 2) ;; assumes \ is always the escape... bad?
- (and (eq major-mode 'emacs-lisp-mode)
- (not (sp-point-in-string))
- (sp--looking-back-p "?" 1)))))
- ;; TODO: HACK: global-skip is hack here!!!
- (sp--skip-match-p match (match-beginning 0) (match-end 0)
- :pair-skip (or skip-fn
- (sp-get-pair match :skip-match))
- :global-skip nil))
- (setq hit (match-data)))))
- hit))
-
-(defun sp-get-stringlike-expression (&optional back)
- "Find the nearest string-like expression after point.
-
-String-like expression is expression enclosed with the same
-opening and closing delimiter, such as *...*, \"...\", `...` etc."
- (sp--with-case-sensitive
- (save-excursion
- (let ((needle (sp--get-stringlike-regexp))
- (search-fn-f (if (not back) 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (search-fn-b (if back 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (count 0)
- m b e skip-match-fn limit ok)
- (when (not (equal needle ""))
- (when (sp--find-next-stringlike-delimiter needle search-fn-f)
- ;; assumes \ is always the escape... bad?
- (setq m (match-string-no-properties 0))
- (setq needle (regexp-quote m))
- (setq skip-match-fn (sp-get-pair m :skip-match))
- (cond
- ((sp-point-in-string)
- (setq limit (sp-get-quoted-string-bounds)))
- ((sp-point-in-comment)
- (setq limit (sp-get-comment-bounds))))
- (save-excursion
- (while (sp--find-next-stringlike-delimiter needle 'search-backward-regexp (car limit) skip-match-fn)
- (setq count (1+ count))))
- (when (= (mod count 2) 0)
- (sp--find-next-stringlike-delimiter needle search-fn-b nil))
- (save-excursion
- (setq ok (sp--find-next-stringlike-delimiter needle 'sp--search-backward-regexp (car limit)))
- (setq e (match-beginning 0)))
- (setq ok (and ok (sp--find-next-stringlike-delimiter needle 'search-forward-regexp (cdr limit))))
- (setq b (match-end 0))
- (when ok
- (let ((mb b) (me e))
- (setq b (min mb me))
- (setq e (max mb me)))
- (list :beg b :end e :op m :cl m :prefix (sp--get-prefix b m) :suffix (sp--get-suffix e m)))))))))
-
-(defun sp--textmode-stringlike-regexp (delimiters &optional direction)
- "Get a regexp matching text-mode string-like DELIMITERS.
-
-Capture group 1 or 2 has the delimiter itself, depending on the
-direction (forward, backward).
-
-If DIRECTION is :open, create a regexp matching opening only.
-
-If DIRECTION is :close, create a regexp matching closing only.
-
-If DIRECTION is nil, create a regexp matching both directions."
- (let* ((delims (regexp-opt delimiters))
- (re (concat
- (if (or (not direction)
- (eq direction :open))
- (concat "\\(?:" "\\(?:\\`\\|[ \t\n\r]\\)" "\\(" delims "\\)" "[^ \t\n\r]\\)") "")
- (if (not direction) "\\|" "")
- (if (or (not direction)
- (eq direction :close))
- (concat "\\(?:[^ \t\n\r]" "\\(" delims "\\)" "\\(?:[ \t\n\r[:punct:]]\\|\\'\\)" "\\)") ""))))
- re))
-
-(defun sp--find-next-textmode-stringlike-delimiter (needle search-fn-f &optional limit)
- "Find the next string-like delimiter, considering the escapes
-and the skip-match predicate."
- (let (hit)
- (while (and (not hit)
- (funcall search-fn-f needle limit t))
- (save-match-data
- (let* ((group (if (match-string 1) 1 2))
- (match (match-string-no-properties group))
- (mb (match-beginning group))
- (me (match-end group))
- (skip-fn (sp-get-pair match :skip-match)))
- (unless (sp--skip-match-p match mb me :pair-skip skip-fn :global-skip nil)
- (setq hit (list match (if (= group 1) :open :close)))))))
- hit))
-
-(defun sp-get-textmode-stringlike-expression (&optional back)
- "Find the nearest text-mode string-like expression.
-
-If BACK is non-nil search in the backwards direction.
-
-Text-mode string-like expression is one where the delimiters must
-be surrounded by whitespace from the outside. For example,
-
-foo *bar* baz
-
-is a valid expression enclosed in ** pair, but
-
-foo*bar*baz OR foo *bar*baz OR foo*bar* baz
-
-are not.
-
-This is the case in almost every markup language, and so we will
-adjust the parsing to only consider such pairs as delimiters.
-This makes the parsing much faster as it transforms the problem
-to non-stringlike matching and we can use a simple
-counting (stack) algorithm."
- (save-excursion
- (let ((restart-from (point))
- hit re)
- (while (not hit)
- (goto-char restart-from)
- (save-excursion
- (ignore-errors
- (if back (forward-char) (backward-char)))
- (let* ((delimiters (-map 'car (sp--get-allowed-stringlike-list)))
- (needle (sp--textmode-stringlike-regexp delimiters))
- (search-fn-f (if (not back) 'sp--search-forward-regexp 'sp--search-backward-regexp)))
- (-if-let ((delim type) (sp--find-next-textmode-stringlike-delimiter needle search-fn-f))
- (let ((search-fn (if (eq type :open) 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (needle (sp--textmode-stringlike-regexp (list delim) (if (eq type :open) :close :open))))
- (setq restart-from (point))
- ;; this adjustments are made because elisp regexp
- ;; can't do lookahead assertions... so we match and
- ;; then back up.
- (ignore-errors
- (when (and (not back) (eq type :open)) (backward-char (1+ (length delim))))
- (when (and (not back) (eq type :close) (not (eobp))) (backward-char 1))
- (when (and back (eq type :close)) (forward-char (1+ (length delim))))
- (when (and back (eq type :open) (not (bobp))) (forward-char 1)))
- (let ((other-end (point)))
- (when (sp--find-next-textmode-stringlike-delimiter needle search-fn)
- ;; Beware, we also need to test the beg/end of
- ;; buffer, because we have that variant in the
- ;; regexp. In that case the match does not
- ;; consume anything and we needn't do any
- ;; correction.
- (let* ((this-end (if (eq type :open)
- (max (point-min) (if (eobp) (point) (1- (point))))
- (min (point-max) (if (bobp) (point) (1+ (point))))))
- (b (min this-end other-end))
- (e (max this-end other-end)))
- (setq re (list :beg b
- :end e
- :op delim
- :cl delim
- :prefix (sp--get-prefix b delim) :suffix (sp--get-suffix e delim)))
- (setq hit t)
- ;; We ignore matches that contain two
- ;; consecutive newlines, as that usually means
- ;; there's a new paragraph somewhere inbetween
- ;; TODO: make this customizable
- (when (sp-get re
- (save-excursion
- (goto-char :beg)
- (re-search-forward "\n\n\\|\r\r" :end t)))
- (setq re nil)
- (setq hit nil))))))
- (setq hit :no-more)))))
- re)))
-
-(defun sp-use-textmode-stringlike-parser-p ()
- "Test if we should use textmode stringlike parser or not."
- (let ((modes (-filter 'symbolp sp-navigate-use-textmode-stringlike-parser))
- (derived (-map 'cdr (-remove 'symbolp sp-navigate-use-textmode-stringlike-parser))))
- (or (--any? (eq major-mode it) modes)
- (apply 'derived-mode-p derived))))
-
-(defun sp-get-stringlike-or-textmode-expression (&optional back delimiter)
- "Return a stringlike expression using stringlike or textmode parser.
-
-DELIMITER is a candidate in case we performed a search before
-calling this function and we know it's the closest string
-delimiter to try. This is purely a performance hack, do not rely
-on it when calling directly."
- (if (sp-use-textmode-stringlike-parser-p)
- (sp-get-textmode-stringlike-expression back)
- ;; performance hack. If the delimiter is a character in
- ;; syntax class 34, grab the string-like expression using
- ;; `sp-get-string'
- (if (and delimiter
- (= (length delimiter) 1)
- ;; TODO: this "smart" behaviour is duplicated in
- ;; `sp-get-thing', maybe the whole string parsing could
- ;; be extracted to some common function (actually we
- ;; should probably use this one from `sp-get-thing')
- (eq (char-syntax (string-to-char delimiter)) 34))
- (if (eq t (sp-point-in-string))
- ;; TODO: this is duplicated in `sp-get-thing', move to a function
- (save-excursion
- (save-restriction
- (widen)
- (-let (((beg . end) (sp-get-quoted-string-bounds)))
- (narrow-to-region beg end))
- (sp-get-stringlike-expression back)))
- (sp-get-string back))
- (sp-get-stringlike-expression back))))
-
-(defun sp-get-expression (&optional back)
- "Find the nearest balanced expression of any kind.
-
-For markup and text modes a special, more efficient stringlike
-parser is available, see `sp-get-textmode-stringlike-expression'.
-By default, this is enabled in all modes derived from
-`text-mode'. You can change it by customizing
-`sp-navigate-use-textmode-stringlike-parser'."
- (let ((pre (sp--get-allowed-regexp))
- (sre (sp--get-stringlike-regexp))
- (search-fn (if (not back) 'sp--search-forward-regexp 'sp--search-backward-regexp))
- (ps (if back (1- (point-min)) (1+ (point-max))))
- (ss (if back (1- (point-min)) (1+ (point-max))))
- (string-delim nil))
- (setq ps (if (equal pre "") ps
- (or (save-excursion (funcall search-fn pre nil t)) ps)))
- (setq ss (if (equal sre "") ss
- (or (--when-let (save-excursion
- (sp--find-next-stringlike-delimiter sre search-fn))
- (setq string-delim (match-string 0))
- (save-match-data
- (set-match-data it)
- (if back (match-beginning 0) (match-end 0))))
- ss)))
- ;; TODO: simplify this logic somehow... (this really depends
- ;; on a rewrite of the core parser logic: separation of "find
- ;; the valid opening" and "parse it")
-
- ;; Here, we sacrifice readability for performance. Because we
- ;; only use regexp to look forward for the closest pair, it
- ;; might occasionally happen that what we picked in fact
- ;; *can't* form a pair and it returns error (for example, it
- ;; is an unclosed pair or a quote between words like'so, which
- ;; doesn't form a pair). In such a case, or when the pair
- ;; found is further than the other possible pair type (for
- ;; example, we think we should parse stringlike, but we skip
- ;; the first occurrence and the next one is only after a
- ;; regular pair, which we should've picked instead), we must
- ;; try the other parser as well.
- (-let (((type . re) (if (or (and (not back) (< ps ss))
- (and back (> ps ss)))
- (cons :regular (sp-get-paired-expression back))
- (cons :string (sp-get-stringlike-or-textmode-expression back string-delim)))))
- (when re
- (sp-get re
- (cond
- ;; If the returned sexp is regular, but the
- ;; to-be-tried-string-expression is before it, we try
- ;; to parse it as well, it might be a complete sexp in
- ;; which case it should be returned.
- ((and (eq type :regular)
- (or (and (not back) (< ss :beg))
- (and back (> ss :end))))
- (or (sp-get-stringlike-or-textmode-expression back string-delim) re))
- ((and (eq type :string)
- (or (and (not back) (< ps :beg))
- (and back (> ps :end))))
- (or (sp-get-paired-expression back) re))
- (t re)))))))
-
-(defun sp-get-sexp (&optional back)
- "Find the nearest balanced expression that is after (before) point.
-
-Search backward if BACK is non-nil. This also means, if the
-point is inside an expression, this expression is returned.
-
-If `major-mode' is member of `sp-navigate-consider-sgml-tags',
-sgml tags will also be considered as sexps in current buffer.
-
-If the search starts outside a comment, all subsequent comments
-are skipped.
-
-If the search starts inside a string or comment, it tries to find
-the first balanced expression that is completely contained inside
-the string or comment. If no such expression exist, a warning is
-raised (for example, when you comment out imbalanced expression).
-However, if you start a search from within a string and the next
-complete sexp lies completely outside, this is returned. Note
-that this only works in modes where strings and comments are
-properly defined via the syntax tables.
-
-The return value is a plist with following keys:
-
- :beg - point in the buffer before the opening
- delimiter (ignoring prefix)
- :end - point in the buffer after the closing delimiter
- :op - opening delimiter
- :cl - closing delimiter
- :prefix - expression prefix
- :suffix - expression suffix
-
-However, you should never access this structure directly as it is
-subject to change. Instead, use the macro `sp-get' which also
-provide shortcuts for many commonly used queries (such as length
-of opening/closing delimiter or prefix)."
- (sp--maybe-init)
- (sp--with-case-sensitive
- (cond
- (sp-prefix-tag-object
- (sp-get-sgml-tag back))
- (sp-prefix-pair-object
- (sp-get-paired-expression back))
- ((memq major-mode sp-navigate-consider-sgml-tags)
- (let ((paired (sp-get-expression back)))
- (if (and paired
- (equal "<" (sp-get paired :op)))
- ;; if the point is inside the tag delimiter, return the pair.
- (if (sp-get paired (and (<= :beg-in (point)) (>= :end-in (point))))
- paired
- ;; if the tag can't be completed, we can at least return
- ;; the <> pair
- (or (sp-get-sgml-tag back) paired))
- ;; we can still try the tag if the first < or > is closer than
- ;; the pair. This is a bit too complicated... seems like a
- ;; more clever solution would be needed in the future, esp if
- ;; we add the python hack.
- (cond
- ((and (not back)
- (< (save-excursion
- (or (search-forward "<" nil t) (point-max)))
- (or (sp-get paired :beg) (point-max))))
- (or (sp-get-sgml-tag) paired))
- ((and back
- (> (save-excursion
- (or (search-backward ">" nil t) (point-min)))
- (or (sp-get paired :end) (point-max))))
- (or (sp-get-sgml-tag t) paired))
- (t paired)))))
- (t (sp-get-expression back)))))
-
-(defun sp--get-hybrid-sexp-beg ()
- "Get the beginning of hybrid sexp.
-See `sp-get-hybrid-sexp' for definition."
- (save-excursion
- (cl-labels ((indent-or-beg-of-line
- (lb)
- (if (sp-point-in-blank-line)
- lb
- (back-to-indentation)
- (point))))
- (let ((p (progn (when (sp-point-in-symbol) (sp-backward-sexp)) (point)))
- (lb (line-beginning-position))
- (cur (--if-let (save-excursion (sp-backward-sexp)) it (list :end 0))) ;hack
- last)
- (if (< (sp-get cur :end) lb)
- ;; if the line is not empty, we move the beg to the indent
- (indent-or-beg-of-line lb)
- (while (sp-get cur
- (and cur
- (> :end lb)
- (<= :end p)))
- (setq last cur)
- (setq cur (sp-backward-sexp)))
- (if last
- (sp-get last :beg-prf)
- ;; happens when there is no sexp before the opening delim of
- ;; the enclosing sexp. In case it is on line above, we take
- ;; the maximum wrt lb.
- (sp-get cur (max :beg-in (indent-or-beg-of-line lb)))))))))
-
-(defun sp--narrow-to-line ()
- "Narrow to the current line."
- (narrow-to-region (line-beginning-position) (line-end-position)))
-
-(defun sp--get-hybrid-sexp-end ()
- "Get the end of hybrid sexp.
-See `sp-get-hybrid-sexp' for definition."
- (save-excursion
- (cl-labels ((skip-prefix-backward
- (p)
- (save-excursion
- (goto-char p)
- (save-restriction
- (sp--narrow-to-line)
- (skip-syntax-backward " .")
- (point)))))
- (let ((p (progn (when (sp-point-in-symbol) (sp-backward-sexp)) (point)))
- (le (line-end-position))
- (cur (--if-let (save-excursion (sp-forward-sexp)) it (list :beg (1+ (point-max))))) ;hack
- last)
- (if (> (sp-get cur :beg) le)
- (if (sp-point-in-blank-line) le (skip-prefix-backward le))
- (while (sp-get cur
- (and cur
- (< :beg le)
- (>= :beg p)))
- (setq last cur)
- (setq cur (sp-forward-sexp)))
- (let ((r (skip-prefix-backward
- (if last
- (sp-get last :end)
- ;; happens when there is no sexp before the closing delim of
- ;; the enclosing sexp. In case it is on line below, we take
- ;; the minimum wrt le.
- (sp-get cur (min :end-in le))))))
- (goto-char r)
- ;; fix the situation when point ends in comment
- (cond
- ((sp-point-in-comment)
- (if (= (line-number-at-pos p)
- (line-number-at-pos r))
- (line-end-position)
- (goto-char p)
- (line-end-position)))
- (t r))))))))
-
-(defun sp--get-hybrid-suffix (p)
- "Get the hybrid sexp suffix, which is any punctuation after
-the end, possibly preceded by whitespace."
- (save-excursion
- (goto-char p)
- (buffer-substring-no-properties
- p
- (save-restriction
- (sp--narrow-to-line)
- (skip-syntax-forward " ")
- (if (not (looking-at "\\s."))
- p
- (skip-syntax-forward ".")
- (point))))))
-
-(defun sp-get-hybrid-sexp ()
- "Return the hybrid sexp around point.
-
-A hybrid sexp is defined as the smallest balanced region containing
-the point while not expanding further than the current line. That is,
-any hanging sexps will be included, but the expansion stops at the
-enclosing list boundaries or line boundaries."
- (let ((end (sp--get-hybrid-sexp-end)))
- (list :beg (sp--get-hybrid-sexp-beg)
- :end end
- :op ""
- :cl ""
- :prefix ""
- :suffix (sp--get-hybrid-suffix end))))
-
-(defun sp-get-enclosing-sexp (&optional arg)
- "Return the balanced expression that wraps point at the same level.
-
-With ARG, ascend that many times. This function expects a positive
-argument."
- (setq arg (or arg 1))
- (save-excursion
- (let ((n arg)
- (ok t)
- (okr))
- (while (and (> n 0) ok)
- (setq ok t)
- (setq okr nil)
- ;; if we are inside string, get the string bounds and "string
- ;; expression"
- (when (sp-point-in-string)
- (setq okr (sp-get-string)))
- ;; get the "normal" expression defined by pairs
- (let ((p (point)))
- (setq ok (sp-get-sexp))
- (cond
- ((and ok (= (sp-get ok :beg) p))
- (goto-char (sp-get ok :end))
- (setq n (1+ n)))
- ((and ok (< (sp-get ok :beg) p))
- (goto-char (sp-get ok :end)))
- (t
- (while (and ok (>= (sp-get ok :beg) p))
- (setq ok (sp-get-sexp))
- (when ok (goto-char (sp-get ok :end)))))))
- ;; if the pair expression is enclosed inside a string, return
- ;; the pair expression, otherwise return the string expression
- (when okr
- (unless (and ok
- (sp-compare-sexps ok okr >=)
- (sp-compare-sexps ok okr <= :end))
- (setq ok okr)
- (goto-char (sp-get ok :end))))
- (setq n (1- n)))
- (if (not (and (not ok)
- sp-navigate-comments-as-sexps))
- ok
- (when (sp-point-in-comment)
- (let* ((cb (sp-get-comment-bounds))
- (b (save-excursion
- (goto-char (car cb))
- (sp-skip-backward-to-symbol t)
- (point)))
- (e (save-excursion
- (goto-char (cdr cb))
- (sp-skip-forward-to-symbol t)
- (point))))
- (list :beg b :end e :op "" :cl "" :prefix sp-comment-char)))))))
-
-(defun sp-get-list-items (&optional lst)
- "Return the information about expressions inside LST.
-
-LST should be a data structure in format as returned by
-`sp-get-sexp'.
-
-The return value is a list of such structures in order as they
-occur inside LST describing each expression, with LST itself
-prepended to the front.
-
-If LST is nil, the list at point is used (that is the list
-following point after `sp-backward-up-sexp' is called)."
- (let ((r nil))
- (save-excursion
- (unless lst
- (setq lst (sp-backward-up-sexp)))
- (when lst
- (goto-char (sp-get lst :beg-in))
- (while (< (point) (sp-get lst :end))
- (!cons (sp-forward-sexp) r))
- (cons lst (nreverse (cdr r)))))))
-
-(cl-defun sp--get-prefix (&optional (p (point)) op)
- "Get the prefix of EXPR.
-
-Prefix is any continuous sequence of characters in \"expression
-prefix\" syntax class. You can also specify a set of syntax code
-characters or a regexp for a specific major mode. See
-`sp-sexp-prefix'.
-
-The point is expected to be at the opening delimiter of the sexp
-and the prefix is searched backwards.
-
-If the prefix property is defined for OP, the associated regexp
-is used to retrieve the prefix instead of the global setting."
- (sp--with-case-sensitive
- (save-excursion
- (goto-char p)
- (let* ((pref (sp-get-pair op :prefix))
- (prefix
- (if pref
- (when (sp--looking-back pref sp-max-prefix-length)
- (match-string-no-properties 0))
- (-if-let (mmode-prefix (cdr (assoc major-mode sp-sexp-prefix)))
- (cond
- ((and (eq (car mmode-prefix) 'regexp)
- (sp--looking-back (cadr mmode-prefix)))
- (match-string-no-properties 0))
- ((eq (car mmode-prefix) 'syntax)
- (skip-syntax-backward (cadr mmode-prefix))
- (buffer-substring-no-properties (point) p))
- (t ""))
- (backward-prefix-chars)
- (buffer-substring-no-properties (point) p)))))
- ;; do not consider it a prefix if it matches some opening or
- ;; closing delimiter which is allowed for parsing in current
- ;; context
- (goto-char p)
- (if (and (< 0 (length prefix))
- (or (sp--do-action-p prefix 'navigate)
- (sp--do-action-p
- (car (--first (equal (cdr it) prefix)
- sp-pair-list))
- 'navigate)))
- ""
- prefix)))))
-
-(cl-defun sp--get-suffix (&optional (p (point)) op)
- "Get the suffix of EXPR.
-
-Suffix is any continuous sequence of characters in the
-\"punctuation suffix\" syntax class. You can also specify a set
-of syntax code characters or a regexp for a specific major mode.
-See `sp-sexp-suffix'.
-
-If the suffix property is defined for OP, the associated regexp
-is used to retrieve the suffix instead of the global setting."
- (sp--with-case-sensitive
- (save-excursion
- (goto-char p)
- (let* ((suff (sp-get-pair op :suffix))
- (suffix
- (if suff
- (when (sp--looking-at suff)
- (match-string-no-properties 0))
- (-if-let (mmode-suffix (cdr (assoc major-mode sp-sexp-suffix)))
- (cond
- ((and (eq (car mmode-suffix) 'regexp)
- (sp--looking-at (cadr mmode-suffix)))
- (match-string-no-properties 0))
- ((eq (car mmode-suffix) 'syntax)
- (skip-syntax-forward (cadr mmode-suffix))
- (buffer-substring-no-properties p (point)))
- (t ""))
- (skip-syntax-forward ".")
- (buffer-substring-no-properties p (point))))))
- ;; do not consider it a suffix if it matches some opening or
- ;; closing delimiter which is allowed for parsing in current
- ;; context
- (goto-char p)
- (if (and (< 0 (length suffix))
- (or (sp--do-action-p suffix 'navigate)
- (sp--do-action-p
- (car (--first (equal (cdr it) suffix)
- sp-pair-list))
- 'navigate)))
- ""
- suffix)))))
-
-(defun sp-get-symbol (&optional back)
- "Find the nearest symbol that is after point, or before point if BACK is non-nil.
-
-This also means, if the point is inside a symbol, this symbol is
-returned. Symbol is defined as a chunk of text recognized by
-`sp-forward-symbol'.
-
-The return value is a plist with the same format as the value
-returned by `sp-get-sexp'."
- (sp--maybe-init)
- (let (b e last-or-first)
- (save-excursion
- (if back
- (progn
- (sp-skip-backward-to-symbol)
- (when (= (point) (point-min)) (setq last-or-first t))
- (sp-forward-symbol -1)
- (setq b (point))
- (sp-forward-symbol 1)
- (setq e (point)))
- (sp-skip-forward-to-symbol)
- (when (= (point) (point-max)) (setq last-or-first t))
- (sp-forward-symbol 1)
- (setq e (point))
- (sp-forward-symbol -1)
- (setq b (point))))
- (unless last-or-first
- (list :beg b :end e :op "" :cl "" :prefix (sp--get-prefix b) :suffix (sp--get-suffix e)))))
-
-(defun sp--get-string (bounds)
- "Return the `sp-get-sexp' format info about the string.
-
-This function simply transforms BOUNDS, which is a cons (BEG
-. END) into format compatible with `sp-get-sexp'."
- (let* ((op (char-to-string (char-after (car bounds))))
- (cl (char-to-string (char-before (cdr bounds)))))
- ;; if the closing and opening isn't the same token, we should
- ;; return nil
- (when (equal op cl)
- (list :beg (car bounds)
- :end (cdr bounds)
- :op cl
- :cl cl
- :prefix (sp--get-prefix (car bounds) op)
- :suffix (sp--get-suffix (cdr bounds) cl)))))
-
-(defun sp-get-string (&optional back)
- "Find the nearest string after point, or before if BACK is non-nil.
-
-This also means if the point is inside a string, this string is
-returned. If there are another symbols between point and the
-string, nil is returned. That means that this function only
-return non-nil if the string is the very next meaningful
-expression.
-
-The return value is a plist with the same format as the value
-returned by `sp-get-sexp'."
- (sp--maybe-init)
- (if (sp-point-in-comment)
- (sp-get-stringlike-expression back)
- (if (sp-point-in-string)
- (let ((r (sp-get-quoted-string-bounds)))
- (sp--get-string r))
- (save-excursion
- (sp-skip-into-string back)
- (--when-let (sp-get-quoted-string-bounds)
- (sp--get-string it))))))
-
-(defun sp-get-whitespace ()
- "Get the whitespace around point.
-
-Whitespace here is defined as any of the characters: space, tab
-and newline."
- (list :beg (save-excursion (skip-chars-backward " \t\n") (point))
- :end (save-excursion (skip-chars-forward " \t\n") (point))
- :op ""
- :cl ""
- :prefix ""
- :suffix ""))
-
-(defun sp--sgml-get-tag-name (match)
- (let ((sub (if (equal "/" (substring match 1 2))
- (substring match 2)
- (substring match 1))))
- (car (split-string sub "\\( \\|>\\)"))))
-
-(defun sp--sgml-opening-p (tag)
- (not (equal "/" (substring tag 1 2))))
-
-(defun sp--sgml-ignore-tag (tag)
- "Return non-nil if tag should be ignored in search, nil otherwise."
- (member tag '("!--" "!DOCTYPE")))
-
-(defun sp-get-sgml-tag (&optional back)
- (sp--maybe-init)
- (sp--with-case-sensitive
- (save-excursion
- (let ((search-fn (if (not back) 'sp--search-forward-regexp 'search-backward-regexp))
- tag tag-name needle
- open-start open-end
- close-start close-end)
- (when (and (funcall search-fn "?.*?\\s-?.*?>" nil t)
- (progn
- (setq tag (substring-no-properties (match-string 0)))
- (setq tag-name (sp--sgml-get-tag-name tag))
- (not (sp--sgml-ignore-tag tag-name))))
- (setq needle (concat "?" tag-name))
- (let* ((forward (sp--sgml-opening-p tag))
- (search-fn (if forward 'sp--search-forward-regexp 'search-backward-regexp))
- (depth 1))
- (save-excursion
- (if (not back)
- (progn
- (setq open-end (point))
- (search-backward-regexp "<" nil t)
- (setq open-start (point)))
- (setq open-start (point))
- (search-forward-regexp ">" nil t)
- (setq open-end (point))))
- (cond
- ((and (not back) (not forward))
- (goto-char (match-beginning 0)))
- ((and back forward)
- (goto-char (match-end 0))))
- (while (> depth 0)
- (if (funcall search-fn needle nil t)
- (if (sp--sgml-opening-p (match-string 0))
- (if forward (setq depth (1+ depth)) (setq depth (1- depth)))
- (if forward (setq depth (1- depth)) (setq depth (1+ depth))))
- (setq depth -1)))
- (if (eq depth -1)
- (progn (sp-message :no-matching-tag) nil)
- (save-excursion
- (if forward
- (progn
- (setq close-start (match-beginning 0))
- (search-forward-regexp ">" nil t)
- (setq close-end (point)))
- (setq close-start (point))
- (search-forward-regexp ">" nil t)
- (setq close-end (point))))
- (let ((op (buffer-substring-no-properties open-start open-end))
- (cl (buffer-substring-no-properties close-start close-end)))
- (list :beg (if forward open-start close-start)
- :end (if forward close-end open-end)
- :op (if forward op cl)
- :cl (if forward cl op)
- :prefix ""
- :suffix "")))))))))
-
-(defun sp--end-delimiter-closure (pairs pair-list)
- "Compute the \"end-delimiter\" closure of set PAIRS.
-
-PAIRS can be:
-- single pair ID
-- single cons with opening and closing delimiter
-- list of pair IDs
-- list of conses of opening and closing delimiters
-
-For example, if we have pairs (if . end) and (def . end), then
-the closure of \"if\" pair are both of these because they share
-the closing delimiter. Therefore, in the navigation functions,
-both have to be considered by the parser."
- (let* ((pairs (-flatten (list pairs)))
- (pairs (if (consp (car pairs)) (-map 'car pairs) pairs))
- (pairs (--filter (member (car it) pairs) pair-list))
- (closure (-mapcat
- (lambda (x)
- (--filter (equal (cdr x) (cdr it)) pair-list))
- pairs)))
- closure))
-
-(defun sp-restrict-to-pairs (pairs function)
- "Call the FUNCTION restricted to PAIRS.
-
-PAIRS is either an opening delimiter of a list of opening
-delimiters.
-
-FUNCTION is a function symbol.
-
-For example, you can restrict function `sp-down-sexp' to the
-pair (\"{\" . \"}\") for easier navigation of blocks in C-like
-languages."
- (let* ((pairs (-flatten (list pairs)))
- (new-pairs (--filter (member (car it) pairs) sp-pair-list))
- (sp-pair-list (sp--end-delimiter-closure new-pairs sp-pair-list)))
- (call-interactively function)))
-
-(defun sp-restrict-to-object (object function)
- "Call the FUNCTION restricted to OBJECT.
-
-OBJECT is one of following symbols (you have to quote it!):
-- `sp-prefix-pair-object'
-- `sp-prefix-tag-object'
-- `sp-prefix-symbol-object'
-
-This function will enable this prefix and then call FUNCTION.
-
-FUNCTION is a function symbol.
-
-This function is equivalent to doing:
-
- (let ((sp-prefix-object t))
- (call-interactively function))
-
-For example, you can restrict function `sp-forward-sexp' to just
-the pairs for easier navigation of blocks in C-like languages."
- (cl-letf (((symbol-value object) t))
- (call-interactively function)))
-
-;; TODO: add shorter alias?
-(defun sp-restrict-to-pairs-interactive (pairs function)
- "Return an interactive lambda that calls FUNCTION restricted to PAIRS.
-
-See `sp-restrict-to-pairs'.
-
-This function implements a \"decorator pattern\", that is, you
-can apply another scoping function to the output of this function
-and the effects will added together. In particular, you can
-combine it with:
-
-- `sp-restrict-to-object-interactive'
-
-You can also bind the output of this function directly to a key, like:
-
- (global-set-key (kbd ...) (sp-restrict-to-pairs-interactive \"{\" 'sp-down-sexp))
-
-This will be a function that descends down only into { } pair,
-ignoring all others."
- (lambda (&optional arg)
- (interactive "P")
- (sp-restrict-to-pairs pairs function)))
-
-(defun sp-restrict-to-object-interactive (object function)
- "Return an interactive lambda that calls FUNCTION restricted to OBJECT.
-
-See `sp-restrict-to-object'.
-
-This function implements a \"decorator pattern\", that is, you
-can apply another scoping function to the output of this function
-and the effects will added together. In particular, you can
-combine it with:
-
-- `sp-restrict-to-pairs-interactive'
-
-You can also bind the output of this function directly to a key, like:
-
- (global-set-key (kbd ...) (sp-restrict-to-object-interactive
- 'sp-prefix-pair-object
- 'sp-forward-sexp))
-
-This will be a function that navigates only by using paired
-expressions, ignoring strings and sgml tags."
- (lambda (&optional arg)
- (interactive "P")
- (sp-restrict-to-object object function)))
-
-(defun sp-prefix-tag-object (&optional arg)
- "Read the command and invoke it on the next tag object.
-
-If you specify a regular emacs prefix argument this is passed to
-the executed command. Therefore, executing
-\"\\[universal-argument] 2 \\[sp-prefix-tag-object] \\[sp-forward-sexp]\" will move two tag
-expressions forward, ignoring possible symbols or paired
-expressions inbetween.
-
-Tag object is anything delimited by sgml tag."
- (interactive "P")
- (let* ((cmd (read-key-sequence "" t))
- (com (key-binding cmd))
- (sp-prefix-tag-object t))
- (if (commandp com)
- (call-interactively com)
- (execute-kbd-macro cmd))))
-
-(defun sp-prefix-pair-object (&optional arg)
- "Read the command and invoke it on the next pair object.
-
-If you specify a regular emacs prefix argument this is passed to
-the executed command. Therefore, executing
-\"\\[universal-argument] 2 \\[sp-prefix-pair-object] \\[sp-forward-sexp]\" will move two paired
-expressions forward, ignoring possible symbols inbetween.
-
-Pair object is anything delimited by pairs from `sp-pair-list'."
- (interactive "P")
- (let* ((cmd (read-key-sequence "" t))
- (com (key-binding cmd))
- (sp-prefix-pair-object t))
- (if (commandp com)
- (call-interactively com)
- (execute-kbd-macro cmd))))
-
-(defun sp-prefix-symbol-object (&optional arg)
- "Read the command and invoke it on the next pair object.
-
-If you specify a regular emacs prefix argument this is passed to
-the executed command. Therefore, executing
-\"\\[universal-argument] 2 \\[sp-prefix-symbol-object] \\[sp-forward-sexp]\" will move two symbols
-forward, ignoring any structure.
-
-Symbol is defined as a chunk of text recognized by
-`sp-forward-symbol'."
- (interactive "P")
- (let* ((cmd (read-key-sequence "" t))
- (com (key-binding cmd))
- (sp-prefix-symbol-object t))
- (if (commandp com)
- (call-interactively com)
- (execute-kbd-macro cmd))))
-
-(defun sp-prefix-save-excursion (&optional arg)
- "Execute the command keeping the point fixed.
-
-If you specify a regular emacs prefix argument this is passed to
-the executed command."
- (interactive "P")
- (let* ((cmd (read-key-sequence "" t))
- (com (key-binding cmd)))
- (sp--keep-indentation
- (save-excursion
- (if (commandp com)
- (call-interactively com)
- (execute-kbd-macro cmd))))))
-
-(defun sp-get-thing (&optional back)
- "Find next thing after point, or before if BACK is non-nil.
-
-Thing is either symbol (`sp-get-symbol'),
-string (`sp-get-string') or balanced expression recognized by
-`sp-get-sexp'.
-
-If `sp-navigate-consider-symbols' is nil, only balanced
-expressions are considered."
- (sp--maybe-init)
- (sp--with-case-sensitive
- (cond
- (sp-prefix-tag-object (sp-get-sgml-tag back))
- (sp-prefix-pair-object (sp-get-paired-expression back))
- (sp-prefix-symbol-object (sp-get-symbol back))
- (t
- (if back
- (if (not sp-navigate-consider-symbols)
- (sp-get-sexp t)
- (save-excursion
- (cond
- ((sp-point-in-empty-string)
- (sp-get-string t))
- (t
- (sp-skip-backward-to-symbol t nil t)
- (cond
- ;; this is an optimization, we do not need to look up
- ;; the "pair" expression first. If this fails, follow
- ;; up with regular sexps
- ((and (memq major-mode sp-navigate-consider-sgml-tags)
- (sp--looking-back ">")
- (sp-get-sgml-tag t)))
- ((sp--valid-initial-delimiter-p (sp--looking-back (sp--get-closing-regexp (sp--get-allowed-pair-list)) nil))
- (sp-get-sexp t))
- ((sp--valid-initial-delimiter-p (sp--looking-back (sp--get-opening-regexp (sp--get-allowed-pair-list)) nil))
- (sp-get-sexp t))
- ((and (eq (syntax-class (syntax-after (1- (point)))) 7)
- (not (sp-char-is-escaped-p (1- (point)))))
- (if (eq t (sp-point-in-string))
- (save-excursion
- (save-restriction
- (widen)
- (-let (((beg . end) (sp-get-quoted-string-bounds)))
- (narrow-to-region beg end))
- (sp-get-stringlike-expression t)))
- (sp-get-string t)))
- ((sp--valid-initial-delimiter-p (sp--looking-back (sp--get-stringlike-regexp) nil))
- (sp-get-expression t))
- ;; We might be somewhere inside the prefix of the
- ;; sexp after the point. Since the prefix can be
- ;; specified as regexp and not syntax class, it might
- ;; itself by a symbol which would invalidly get
- ;; picked here.
- (t (-when-let (sym (sp-get-symbol t))
- (save-excursion
- (sp-get sym (goto-char :end))
- (if (sp--valid-initial-delimiter-p (sp--looking-at (sp--get-opening-regexp (sp--get-allowed-pair-list))))
- (let* ((ms (match-string 0))
- (pref (sp--get-prefix (point) ms)))
- (if (and pref
- (not (equal pref "")))
- (sp-get-sexp t)
- sym))
- sym)))))))))
- (if (not sp-navigate-consider-symbols)
- (sp-get-sexp nil)
- (save-excursion
- (cond
- ((sp-point-in-empty-string)
- (sp-get-string nil))
- (t
- (sp-skip-forward-to-symbol t nil t)
- (cond
- ((and (memq major-mode sp-navigate-consider-sgml-tags)
- (looking-at "<")
- (sp-get-sgml-tag)))
- ((sp--valid-initial-delimiter-p (sp--looking-at (sp--get-opening-regexp (sp--get-allowed-pair-list))))
- (sp-get-sexp nil))
- ((sp--valid-initial-delimiter-p (sp--looking-at (sp--get-closing-regexp (sp--get-allowed-pair-list))))
- (sp-get-sexp nil))
- ;; TODO: merge the following two conditions and use
- ;; `sp-get-stringlike-or-textmode-expression'
- ((and (eq (syntax-class (syntax-after (point))) 7)
- (not (sp-char-is-escaped-p)))
- ;; It might happen that the string delimiter we are
- ;; looking at is nested inside another string
- ;; delimited by string fences (for example nested "
- ;; and ' in python). In this case we can't use
- ;; `sp-get-string' parser because it would pick up the
- ;; outer string. So if we are inside a string and
- ;; `syntax-ppss' returns t as delimiter we need to use
- ;; `sp-get-stringlike-expression'
- (if (eq t (sp-point-in-string))
- (save-excursion
- (save-restriction
- (widen)
- (-let (((beg . end) (sp-get-quoted-string-bounds)))
- (narrow-to-region beg end))
- (sp-get-stringlike-expression nil)))
- (sp-get-string nil)))
- ((sp--valid-initial-delimiter-p (sp--looking-at (sp--get-stringlike-regexp)))
- (sp-get-expression nil))
- ;; it can still be that we are looking at a /prefix/ of a
- ;; sexp. We should skip a symbol forward and check if it
- ;; is a sexp, and then maybe readjust the output.
- (t (let* ((sym (sp-get-symbol nil))
- (sym-string (and sym (sp-get sym (buffer-substring-no-properties :beg :end))))
- (point-before-prefix (point)))
- (when sym-string
- (if (sp--valid-initial-delimiter-p (sp--search-forward-regexp (sp--get-opening-regexp (sp--get-pair-list-context 'navigate)) nil t))
- (let* ((ms (match-string 0))
- (pref (progn
- ;; need to move before the
- ;; opening, so (point) evals
- ;; there.
- (backward-char (length ms))
- (sp--get-prefix (point) ms))))
- ;; We use >= because the first skip to
- ;; symbol might have skipped some prefix
- ;; chars which make prefix of the symbol
- ;; which together make prefix of a sexp.
- ;; For example \foo{} in latex, where \ is
- ;; prefix of symbol foo and \foo is prefix
- ;; of {
- (if (and pref
- (not (equal pref ""))
- (>= point-before-prefix (- (point) (length pref))))
- (sp-get-sexp nil)
- sym))
- sym))))))))))))))
-
-(defun sp-narrow-to-sexp (arg)
- "Make text outside current balanced expression invisible.
-A numeric arg specifies to move up by that many enclosing expressions.
-
-See also `narrow-to-region' and `narrow-to-defun'."
- (interactive "p")
- (-when-let (enc (sp-get-enclosing-sexp arg))
- (sp-get enc (narrow-to-region :beg-prf :end))))
-
-(defun sp-forward-sexp (&optional arg)
- "Move forward across one balanced expression.
-
-With ARG, do it that many times. Negative arg -N means move
-backward across N balanced expressions. If there is no forward
-expression, jump out of the current one (effectively doing
-`sp-up-sexp').
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions.
-
-Examples: (prefix arg in comment)
-
- |(foo bar baz) -> (foo bar baz)|
-
- (|foo bar baz) -> (foo| bar baz)
-
- (|foo bar baz) -> (foo bar| baz) ;; 2
-
- (foo (bar baz|)) -> (foo (bar baz)|)"
- (interactive "^p")
- (setq arg (or arg 1))
- (if (< arg 0)
- (sp-backward-sexp (- arg))
- (let* ((n arg)
- (ok t))
- (while (and ok (> n 0))
- (setq ok (sp-get-thing))
- (setq n (1- n))
- (when ok (goto-char (sp-get ok :end))))
- ok)))
-
-(put 'sp-forward-sexp 'CUA 'move)
-
-(defun sp-backward-sexp (&optional arg)
- "Move backward across one balanced expression (sexp).
-
-With ARG, do it that many times. Negative arg -N means move
-forward across N balanced expressions. If there is no previous
-expression, jump out of the current one (effectively doing
-`sp-backward-up-sexp').
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions.
-
-Examples: (prefix arg in comment)
-
- (foo bar baz)| -> |(foo bar baz)
-
- (foo| bar baz) -> (|foo bar baz)
-
- (foo bar| baz) -> (|foo bar baz) ;; 2
-
- (|(foo bar) baz) -> ((|foo bar) baz)"
- (interactive "^p")
- (setq arg (or arg 1))
- (if (< arg 0)
- (sp-forward-sexp (- arg))
- (let* ((n arg)
- (ok t))
- (while (and ok (> n 0))
- (setq ok (sp-get-thing t))
- (setq n (1- n))
- (when ok (goto-char (sp-get ok :beg))))
- ok)))
-
-(put 'sp-backward-sexp 'CUA 'move)
-
-(defun sp-next-sexp (&optional arg)
- "Move forward to the beginning of next balanced expression.
-
-With ARG, do it that many times. If there is no next expression
-at current level, jump one level up (effectively doing
-`sp-backward-up-sexp'). Negative arg -N means move to the
-beginning of N-th previous balanced expression.
-
-If `sp-navigate-interactive-always-progress-point' is non-nil,
-and this is called interactively, the point will move to the
-first expression in forward direction where it will end up
-greater than the current location.
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions.
-
-Examples:
-
- ((foo) |bar (baz quux)) -> ((foo) bar |(baz quux))
-
- ((foo) bar |(baz quux)) -> |((foo) bar (baz quux))
-
-and with non-nil `sp-navigate-interactive-always-progress-point'
-
- (f|oo bar) -> (foo |bar)
-
- ((fo|o) (bar)) -> ((foo) |(bar))"
- (interactive "^p")
- (setq arg (or arg 1))
- (if (<= arg 0)
- (sp-backward-sexp (- arg))
- (if (and sp-navigate-interactive-always-progress-point
- (called-interactively-p 'any))
- (progn
- (while (< 0 arg)
- (let ((point-start (point)))
- (while (--when-let (sp-forward-sexp)
- (<= (sp-get it :beg) point-start))))
- (setq arg (1- arg)))
- (goto-char (sp-get (sp-get-thing t) :beg)))
- (if (= arg 1)
- (-when-let (ok (sp-get-thing))
- (if (= (point) (sp-get ok :beg))
- (progn (sp-forward-sexp 2)
- (sp-backward-sexp))
- (goto-char (sp-get ok :beg))
- ok))
- (sp-forward-sexp arg)
- (sp-backward-sexp)))))
-
-(put 'sp-next-sexp 'CUA 'move)
-
-(defun sp-previous-sexp (&optional arg)
- "Move backward to the end of previous balanced expression.
-
-With ARG, do it that many times. If there is no next
-expression at current level, jump one level up (effectively
-doing `sp-up-sexp'). Negative arg -N means move to the end of
-N-th following balanced expression.
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions.
-
-If `sp-navigate-interactive-always-progress-point' is non-nil,
-and this is called interactively, the point will move to the
-first expression in backward direction where it will end up
-less than the current location.
-
-Examples:
-
- ((foo) bar| (baz quux)) -> ((foo)| bar (baz quux))
-
- ((foo)| bar (baz quux)) -> ((foo) bar (baz quux))|
-
-and if `sp-navigate-interactive-always-progress-point' is non-nil
-
- (foo b|ar baz) -> (foo| bar baz)
-
- (foo (b|ar baz)) -> (foo| (bar baz))"
- (interactive "^p")
- (setq arg (or arg 1))
- (if (<= arg 0)
- (sp-forward-sexp (- arg))
- (if (and sp-navigate-interactive-always-progress-point
- ;; (called-interactively-p 'any)
- )
- (progn
- (while (< 0 arg)
- (let ((point-start (point)))
- (while (--when-let (sp-backward-sexp)
- (>= (sp-get it :end) point-start))))
- (setq arg (1- arg)))
- (goto-char (sp-get (sp-get-thing) :end)))
- (if (= arg 1)
- (-when-let (ok (sp-get-thing t))
- (if (= (point) (sp-get ok :end))
- (progn (sp-backward-sexp 2)
- (sp-forward-sexp))
- (goto-char (sp-get ok :end))
- ok))
- (sp-backward-sexp arg)
- (sp-forward-sexp)))))
-
-(put 'sp-previous-sexp 'CUA 'move)
-
-(defun sp-forward-parallel-sexp (&optional arg)
- "Move forward across one balanced expressions at the same depth.
-
-If calling `sp-forward-sexp' at point would result in raising a
-level up, loop back to the first expression at current level,
-that is the first child of the enclosing sexp as defined by
-`sp-get-enclosing-sexp'."
- (interactive "^p")
- (setq arg (or arg 1))
- (if (< arg 0)
- (sp-backward-parallel-sexp (- arg))
- (let (re)
- (while (> arg 0)
- (setq arg (1- arg))
- (let ((next (sp-get-thing))
- (prev (sp-get-thing t)))
- (setq
- re
- (cond
- ((eq next nil)
- (goto-char (point-min))
- (sp-forward-sexp))
- ((eq prev nil)
- (goto-char (sp-get next :end))
- next)
- (t (if (> (sp-get next :beg) (sp-get prev :beg))
- (progn
- (goto-char (sp-get next :end))
- next)
- (goto-char (sp-get next :beg-in))
- (sp-forward-sexp)))))))
- re)))
-
-(defun sp-backward-parallel-sexp (&optional arg)
- "Move backward across one balanced expressions at the same depth.
-
-If calling `sp-backward-sexp' at point would result in raising a
-level up, loop back to the last expression at current level, that
-is the last child of the enclosing sexp as defined by
-`sp-get-enclosing-sexp'."
- (interactive "^p")
- (setq arg (or arg 1))
- (if (< arg 0)
- (sp-forward-parallel-sexp (- arg))
- (let (re)
- (while (> arg 0)
- (setq arg (1- arg))
- (let ((next (sp-get-thing))
- (prev (sp-get-thing t)))
- (setq
- re
- (cond
- ((eq prev nil)
- (goto-char (point-max))
- (sp-backward-sexp))
- ((eq next nil)
- (goto-char (sp-get prev :beg))
- prev)
- (t (if (< (sp-get prev :end) (sp-get next :end))
- (progn
- (goto-char (sp-get prev :beg))
- prev)
- (goto-char (sp-get prev :end-in))
- (sp-backward-sexp)))))))
- re)))
-
-(defun sp--raw-argument-p (arg)
- "Return t if ARG represents raw argument, that is a non-empty list."
- (and (listp arg) (car arg)))
-
-(defun sp--negate-argument (arg)
- "Return the argument ARG but negated.
-
-If the argument is a raw prefix argument (cons num nil) return a
-list with its car negated. If the argument is just the - symbol,
-return 1. If the argument is nil, return -1. Otherwise negate
-the input number."
- (cond
- ((sp--raw-argument-p arg) (list (- (car arg))))
- ((eq arg '-) 1)
- ((not arg) -1)
- (t (- arg))))
-
-(defun sp-down-sexp (&optional arg)
- "Move forward down one level of sexp.
-
-With ARG, do this that many times. A negative argument -N means
-move backward but still go down a level.
-
-If ARG is raw prefix argument \\[universal-argument], descend forward as much as
-possible.
-
-If ARG is raw prefix argument \\[universal-argument] \\[universal-argument], jump to the beginning of
-current list.
-
-If the point is inside sexp and there is no down expression to
-descend to, jump to the beginning of current one. If moving
-backwards, jump to end of current one.
-
-Examples:
-
- |foo (bar (baz quux)) -> foo (|bar (baz quux))
-
- |foo (bar (baz quux)) -> foo (bar (|baz quux)) ;; 2
-
- |foo (bar (baz (quux) blab)) -> foo (bar (baz (|quux) blab)) ;; \\[universal-argument]
-
- (foo (bar baz) |quux) -> (|foo (bar baz) quux)
-
- (blab foo |(bar baz) quux) -> (|blab foo (bar baz) quux) ;; \\[universal-argument] \\[universal-argument]"
- (interactive "^P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (n (abs arg))
- (ok t)
- (last-point -1))
- (if (and raw (= (abs arg) 16))
- ;; jump to the beginning/end of current list
- (-when-let (enc (sp-get-enclosing-sexp))
- (if (> arg 0)
- (goto-char (sp-get enc :beg-in))
- (goto-char (sp-get enc :end-in)))
- (setq ok enc))
- ;; otherwise descend normally
- (while (and ok (> n 0))
- (setq ok (sp-get-sexp (< arg 0)))
- ;; if the prefix was C-u, we do not decrease n and instead set
- ;; it to -1 when (point) == "last ok"
- (if raw
- (when (= (point) last-point)
- (setq n -1))
- (setq n (1- n)))
- (when ok
- (setq last-point (point))
- (if (< arg 0)
- (goto-char (sp-get ok :end-in))
- (goto-char (sp-get ok :beg-in))))))
- ok))
-
-(put 'sp-down-sexp 'CUA 'move)
-
-(defun sp-backward-down-sexp (&optional arg)
- "Move backward down one level of sexp.
-
-With ARG, do this that many times. A negative argument -N means
-move forward but still go down a level.
-
-If ARG is raw prefix argument \\[universal-argument], descend backward as much as
-possible.
-
-If ARG is raw prefix argument \\[universal-argument] \\[universal-argument], jump to the end of current
-list.
-
-If the point is inside sexp and there is no down expression to
-descend to, jump to the end of current one. If moving forward,
-jump to beginning of current one.
-
-Examples:
-
- foo (bar (baz quux))| -> foo (bar (baz quux)|)
-
- (bar (baz quux)) foo| -> (bar (baz quux|)) foo ;; 2
-
- foo (bar (baz (quux) blab))| -> foo (bar (baz (quux|) blab)) ;; \\[universal-argument]
-
- (foo| (bar baz) quux) -> (foo (bar baz) quux|)
-
- (foo (bar baz) |quux blab) -> (foo (bar baz) quux blab|) ;; \\[universal-argument] \\[universal-argument]"
- (interactive "^P")
- (sp-down-sexp (sp--negate-argument arg)))
-
-(put 'sp-backward-down-sexp 'CUA 'move)
-
-(defun sp-beginning-of-sexp (&optional arg)
- "Jump to beginning of the sexp the point is in.
-
-The beginning is the point after the opening delimiter.
-
-With no argument, this is the same as calling
-\\[universal-argument] \\[universal-argument] `sp-down-sexp'
-
-With ARG positive N > 1, move forward out of the current
-expression, move N-2 expressions forward and move down one level
-into next expression.
-
-With ARG negative -N < 1, move backward out of the current
-expression, move N-1 expressions backward and move down one level
-into next expression.
-
-With ARG raw prefix argument \\[universal-argument] move out of the current expressions
-and then to the beginning of enclosing expression.
-
-Examples:
-
- (foo (bar baz) quux| (blab glob)) -> (|foo (bar baz) quux (blab glob))
-
- (foo (bar baz|) quux (blab glob)) -> (foo (|bar baz) quux (blab glob))
-
- (|foo) (bar) (baz quux) -> (foo) (bar) (|baz quux) ;; 3
-
- (foo bar) (baz) (quux|) -> (|foo bar) (baz) (quux) ;; -3
-
- ((foo bar) (baz |quux) blab) -> (|(foo bar) (baz quux) blab) ;; \\[universal-argument]"
- (interactive "^P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (re (cond
- ((and raw (= arg 4))
- (sp-up-sexp)
- (sp-beginning-of-sexp))
- ((= arg 1)
- (sp-down-sexp '(16)))
- ((< arg 0)
- (sp-backward-up-sexp)
- (sp-forward-sexp (1+ arg))
- (sp-down-sexp))
- ((> arg 0)
- (sp-up-sexp)
- (sp-forward-sexp (- arg 2))
- (sp-down-sexp)))))
- (sp--run-hook-with-args (sp-get re :op) :post-handlers 'beginning-of-sexp)
- re))
-
-(put 'sp-beginning-of-sexp 'CUA 'move)
-
-(defun sp-end-of-sexp (&optional arg)
- "Jump to end of the sexp the point is in.
-
-The end is the point before the closing delimiter.
-
-With no argument, this is the same as calling
-\\[universal-argument] \\[universal-argument] `sp-backward-down-sexp'.
-
-With ARG positive N > 1, move forward out of the current
-expression, move N-1 expressions forward and move down backward
-one level into previous expression.
-
-With ARG negative -N < 1, move backward out of the current
-expression, move N-2 expressions backward and move down backward
-one level into previous expression.
-
-With ARG raw prefix argument \\[universal-argument] move out of the current expressions
-and then to the end of enclosing expression.
-
-Examples:
-
- (foo |(bar baz) quux (blab glob)) -> (foo (bar baz) quux (blab glob)|)
-
- (foo (|bar baz) quux (blab glob)) -> (foo (bar baz|) quux (blab glob))
-
- (|foo) (bar) (baz quux) -> (foo) (bar) (baz quux|) ;; 3
-
- (foo bar) (baz) (quux|) -> (foo bar|) (baz) (quux) ;; -3
-
- ((foo |bar) (baz quux) blab) -> ((foo bar) (baz quux) blab|) ;; \\[universal-argument]"
- (interactive "^P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (re (cond
- ((and raw (= arg 4))
- (sp-up-sexp)
- (sp-end-of-sexp))
- ((= arg 1)
- (sp-down-sexp '(-16)))
- ((< arg 0)
- (sp-backward-up-sexp)
- (sp-forward-sexp (+ 2 arg))
- (sp-backward-down-sexp))
- ((> arg 0)
- (sp-up-sexp)
- (sp-forward-sexp (1- arg))
- (sp-backward-down-sexp)))))
- (sp--run-hook-with-args (sp-get re :op) :post-handlers 'end-of-sexp)
- re))
-
-(put 'sp-end-of-sexp 'CUA 'move)
-
-(defun sp-beginning-of-next-sexp (&optional arg)
- "Jump to the beginning of next sexp on the same depth.
-
-Optional argument ARG defaults to 1 and means how many times we
-should repeat.
-
-This acts exactly as `sp-beginning-of-sexp' but adds 1 to the
-numeric argument.
-
-Examples:
-
- (f|oo) (bar) (baz) -> (foo) (|bar) (baz)
-
- (f|oo) (bar) (baz) -> (foo) (bar) (|baz) ;; 2"
- (interactive "^P")
- (if (sp--raw-argument-p arg)
- (sp-beginning-of-sexp arg)
- (let ((arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (sp-beginning-of-sexp (1+ arg))
- (sp-beginning-of-sexp (1- arg))))))
-
-(put 'sp-beginning-of-next-sexp 'CUA 'move)
-
-(defun sp-beginning-of-previous-sexp (&optional arg)
- "Jump to the beginning of previous sexp on the same depth.
-
-Optional argument ARG defaults to 1 and means how many times we
-should repeat.
-
-This acts exactly as `sp-beginning-of-sexp' with negative
-argument but subtracts 1 from it.
-
-Examples:
-
- (foo) (b|ar) (baz) -> (|foo) (bar) (baz)
-
- (foo) (bar) (b|az) -> (|foo) (bar) (baz) ;; 2"
- (interactive "^P")
- (if (sp--raw-argument-p arg)
- (sp-beginning-of-sexp (sp--negate-argument arg))
- (let ((arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (sp-beginning-of-sexp (- (1+ arg)))
- (sp-beginning-of-sexp (- (1- arg)))))))
-
-(put 'sp-beginning-of-previous-sexp 'CUA 'move)
-
-(defun sp-end-of-next-sexp (&optional arg)
- "Jump to the end of next sexp on the same depth.
-
-Optional argument ARG defaults to 1 and means how many times we
-should repeat.
-
-This acts exactly as `sp-end-of-sexp' but adds 1 to the
-numeric argument.
-
-Examples:
-
- (f|oo) (bar) (baz) -> (foo) (bar|) (baz)
-
- (f|oo) (bar) (baz) -> (foo) (bar) (baz|) ;; 2"
- (interactive "^P")
- (if (sp--raw-argument-p arg)
- (sp-end-of-sexp arg)
- (let ((arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (sp-end-of-sexp (1+ arg))
- (sp-end-of-sexp (1- arg))))))
-
-(put 'sp-end-of-next-sexp 'CUA 'move)
-
-(defun sp-end-of-previous-sexp (&optional arg)
- "Jump to the end of previous sexp on the same depth.
-
-Optional argument ARG defaults to 1 and means how many times we
-should repeat.
-
-This acts exactly as `sp-end-of-sexp' with negative
-argument but subtracts 1 from it.
-
-Examples:
-
- (foo) (b|ar) (baz) -> (foo|) (bar) (baz)
-
- (foo) (bar) (b|az) -> (foo|) (bar) (baz) ;; 2"
- (interactive "^P")
- (if (sp--raw-argument-p arg)
- (sp-end-of-sexp (sp--negate-argument arg))
- (let ((arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (sp-end-of-sexp (- (1+ arg)))
- (sp-end-of-sexp (- (1- arg)))))))
-
-(put 'sp-end-of-previous-sexp 'CUA 'move)
-
-;; TODO: split the reindent code so we can call it inside strings on
-;; sexps like [foo ]... We can't reindent that by default because it
-;; can be a regular expression or something where the whitespace
-;; matters. For now, disable reindent in strings if the sexp is not
-;; the string quote itself.
-(defun sp-up-sexp (&optional arg interactive)
- "Move forward out of one level of parentheses.
-
-With ARG, do this that many times. A negative argument means
-move backward but still to a less deep spot.
-
-The argument INTERACTIVE is for internal use only.
-
-If called interactively and `sp-navigate-reindent-after-up' is
-enabled for current major-mode, remove the whitespace between end
-of the expression and the last \"thing\" inside the expression.
-
-If `sp-navigate-close-if-unbalanced' is non-nil, close the
-unbalanced expressions automatically.
-
-Examples:
-
- (foo |(bar baz) quux blab) -> (foo (bar baz) quux blab)|
-
- (foo (bar |baz) quux blab) -> (foo (bar baz) quux blab)| ;; 2
-
- (foo bar |baz -> (foo bar baz)| ;; re-indent the expression
- )
-
- (foo |(bar baz) -> (foo)| (bar baz) ;; close unbalanced expr."
- (interactive "^p\np")
- (setq arg (or arg 1))
- (sp--with-case-sensitive
- (let ((ok (sp-get-enclosing-sexp (abs arg))))
- (if ok
- (progn
- (if (> arg 0)
- (goto-char (sp-get ok :end))
- (goto-char (sp-get ok :beg)))
- (when (and (= (abs arg) 1)
- (not (equal (sp-get ok :prefix) sp-comment-char))
- (or (memq major-mode (assq 'always sp-navigate-reindent-after-up))
- (and (memq major-mode (assq 'interactive sp-navigate-reindent-after-up))
- interactive))
- (or sp-navigate-reindent-after-up-in-string
- (sp-get ok (not (sp-point-in-string :end-in))))
- ;; if the sexp to be reindented is not a string
- ;; but is inside a string, we should rather do
- ;; nothing than break semantics (in e.g. regexp
- ;; [...])
- (let ((str (sp-point-in-string)))
- (or (not str)
- ;; op must be the delimiter of the string we're in
- (eq (sp-get ok :op)
- (or (eq str t)
- (char-to-string str))))))
- ;; TODO: this needs different indent rules for different
- ;; modes. Should we concern with such things? Lisp rules are
- ;; funny in HTML... :/
- (save-excursion
- (if (> arg 0)
- (progn
- (goto-char (sp-get ok :end-in))
- (let ((prev (sp-get-thing t)))
- ;; if the expression is empty remove everything inside
- (if (sp-compare-sexps ok prev)
- (sp-get ok (delete-region :beg-in :end-in))
- (when (save-excursion
- (skip-chars-backward " \t\n")
- (= (point) (sp-get prev :end-suf)))
- (delete-region (sp-get prev :end-suf) (point))))))
- (goto-char (sp-get ok :beg-in))
- (let ((next (sp-get-thing)))
- (if (sp-compare-sexps ok next)
- (sp-get ok (delete-region :beg-in :end-in))
- (when (save-excursion
- (skip-chars-forward " \t\n")
- (= (point) (sp-get next :beg-prf)))
- (delete-region (point) (sp-get next :beg-prf)))))))))
- ;; on forward up, we can detect that the pair was not closed.
- ;; Therefore, jump sexps backwards until we hit the error, then
- ;; extract the opening pair and insert it at point. Only works
- ;; for pairs defined in `sp-pair-list'.
- (when (and (> arg 0)
- sp-navigate-close-if-unbalanced)
- (let (active-pair)
- (save-excursion
- ;; add support for SGML tags here
- (while (sp-backward-sexp))
- (sp-skip-backward-to-symbol t)
- (when (sp--looking-back (sp--get-opening-regexp))
- (let* ((op (match-string 0)))
- (setq active-pair (assoc op sp-pair-list)))))
- (when active-pair
- (sp-backward-sexp)
- (sp-forward-sexp)
- (insert (cdr active-pair))))))
- ok)))
-
-(put 'sp-up-sexp 'CUA 'move)
-
-(defun sp-backward-up-sexp (&optional arg interactive)
- "Move backward out of one level of parentheses.
-
-With ARG, do this that many times. A negative argument means
-move forward but still to a less deep spot.
-
-The argument INTERACTIVE is for internal use only.
-
-If called interactively and `sp-navigate-reindent-after-up' is
-enabled for current major-mode, remove the whitespace between
-beginning of the expression and the first \"thing\" inside the
-expression.
-
-Examples:
-
- (foo (bar baz) quux| blab) -> |(foo (bar baz) quux blab)
-
- (foo (bar |baz) quux blab) -> |(foo (bar baz) quux blab) ;; 2
-
- ( -> |(foo bar baz)
- foo |bar baz)"
- (interactive "^p\np")
- (setq arg (or arg 1))
- (sp-up-sexp (- arg) interactive))
-
-(put 'sp-backward-up-sexp 'CUA 'move)
-
-(defvar sp-last-kill-whitespace nil
- "Save the whitespace cleaned after the last kill.
-
-If the next command is `sp-kill-sexp', append the whitespace
-between the successive kills.")
-
-(defun sp--kill-or-copy-region (beg end &optional dont-kill)
- "Kill or copy region between BEG and END according to DONT-KILL.
-If `evil-mode' is active, copying a region will also add it to the 0 register.
-Additionally, if command was prefixed with a register, copy the region
-to that register."
- (interactive)
- (let ((result
- (if dont-kill
- (copy-region-as-kill beg end)
- (kill-region beg end))))
- (when (bound-and-true-p evil-mode)
- (when dont-kill
- (evil-set-register ?0 (evil-get-register ?1)))
- (when evil-this-register
- (evil-set-register evil-this-register (evil-get-register ?1))
- (setq evil-this-register nil)))
- result))
-
-(defun sp-kill-sexp (&optional arg dont-kill)
- "Kill the balanced expression following point.
-
-If point is inside an expression and there is no following
-expression, kill the topmost enclosing expression.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction.
-
-With ARG being raw prefix \\[universal-argument], kill all the expressions from
-point up until the end of current list. With raw prefix \\[negative-argument] \\[universal-argument],
-kill all the expressions from beginning of current list up until
-point. If point is inside a symbol, this is also killed. If
-there is no expression after/before the point, just delete the
-whitespace up until the closing/opening delimiter.
-
-With ARG being raw prefix \\[universal-argument] \\[universal-argument], kill current list (the list
-point is inside).
-
-With ARG numeric prefix 0 (zero) kill the insides of the current
-list, that is everything from after the opening delimiter to
-before the closing delimiter.
-
-If ARG is nil, default to 1 (kill single expression forward)
-
-If second optional argument DONT-KILL is non-nil, save the to be
-killed region in the kill ring, but do not kill the region from
-buffer.
-
-With `sp-navigate-consider-symbols', symbols and strings are also
-considered balanced expressions.
-
-Examples:
-
- (foo |(abc) bar) -> (foo | bar) ;; nil, defaults to 1
-
- (foo (bar) | baz) -> | ;; 2
-
- (foo |(bar) baz) -> | ;; \\[universal-argument] \\[universal-argument]
-
- (1 |2 3 4 5 6) -> (1|) ;; \\[universal-argument]
-
- (1 |2 3 4 5 6) -> (1 | 5 6) ;; 3
-
- (1 2 3 4 5| 6) -> (1 2 3 | 6) ;; -2
-
- (1 2 3 4| 5 6) -> (|5 6) ;; - \\[universal-argument]
-
- (1 2 | ) -> (1 2|) ;; \\[universal-argument], kill useless whitespace
-
- (1 2 3 |4 5 6) -> (|) ;; 0
-
-Note: prefix argument is shown after the example in
-\"comment\". Assumes `sp-navigate-consider-symbols' equal to t."
- (interactive "P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (n (abs arg))
- (ok t)
- (b (point-max))
- (e (point)))
- (cond
- ;; kill to the end or beginning of list
- ((and raw
- (= n 4))
- (let ((next (sp-get-thing (< arg 0)))
- (enc (sp-get-enclosing-sexp)))
- (if (sp-compare-sexps next enc)
- (when (not dont-kill)
- (let ((del (sp-get-whitespace)))
- (sp-get del (delete-region :beg :end))))
- (if (> arg 0)
- (sp--kill-or-copy-region
- (sp-get next :beg-prf) (sp-get enc :end-in) dont-kill)
- (sp--kill-or-copy-region
- (sp-get next :end) (sp-get enc :beg-in) dont-kill))
- (when (not dont-kill)
- (let ((del (sp-get-whitespace)))
- (sp-get del (delete-region :beg :end)))))))
- ;; kill the enclosing list
- ((and raw
- (= n 16))
- (let ((lst (sp-backward-up-sexp)))
- (sp-get lst (sp--kill-or-copy-region
- :beg-prf :end dont-kill))))
- ;; kill inside of sexp
- ((= n 0)
- (let ((e (sp-get-enclosing-sexp)))
- (when e
- (sp-get e (sp--kill-or-copy-region
- :beg-in :end-in dont-kill)))))
- ;; regular kill
- (t
- (save-excursion
- (while (and (> n 0) ok)
- (setq ok (sp-forward-sexp (sp--signum arg)))
- (sp-get ok
- (when (< :beg-prf b) (setq b :beg-prf))
- (when (> :end e) (setq e :end)))
- (setq n (1- n))))
- (when ok
- (let ((bm (set-marker (make-marker) b)))
- (if (eq last-command 'kill-region)
- (progn
- (when (member sp-successive-kill-preserve-whitespace '(1 2))
- (kill-append sp-last-kill-whitespace nil))
- (sp--kill-or-copy-region
- (if (> b (point)) (point) b) e dont-kill))
- (sp--kill-or-copy-region b e dont-kill))
- ;; kill useless junk whitespace, but only if we're actually
- ;; killing the region
- (when (not dont-kill)
- (sp--cleanup-after-kill)
- ;; kill useless newlines
- (when (string-match-p "\n" (buffer-substring-no-properties bm (point)))
- (setq sp-last-kill-whitespace
- (concat sp-last-kill-whitespace
- (buffer-substring-no-properties bm (point))))
- (delete-region bm (point)))
- (when (= 0 sp-successive-kill-preserve-whitespace)
- (kill-append sp-last-kill-whitespace nil)))))))))
-
-(defun sp--cleanup-after-kill ()
- (unless (save-match-data (looking-back "^[\t\s]+" (1- (line-beginning-position))))
- (let ((bdel (save-excursion
- (when (sp--looking-back-p " " 1)
- (skip-chars-backward " \t")
- (when (not (sp--looking-back-p (sp--get-opening-regexp)))
- (forward-char)))
- (point)))
- (edel (save-excursion
- (when (looking-at " ")
- (skip-chars-forward " \t")
- (when (not (or (sp--looking-at (sp--get-closing-regexp))
- (looking-at "$")))
- (backward-char)))
- (point))))
- (when (eq this-command 'kill-region)
- (setq sp-last-kill-whitespace
- (if (/= 2 sp-successive-kill-preserve-whitespace)
- (buffer-substring-no-properties bdel edel)
- "")))
- (delete-region bdel edel)))
- (if (memq major-mode sp-lisp-modes)
- ;; WARNING: The above white-space killing routine might preserve
- ;; less whitespace than there actually is because the indent
- ;; might further eat some up
- (indent-according-to-mode)
- (unless (memq major-mode sp-no-reindent-after-kill-modes)
- (save-excursion
- (sp--indent-region (line-beginning-position) (line-end-position)))
- (when (> (save-excursion
- (back-to-indentation)
- (current-indentation))
- (current-column))
- (back-to-indentation)))))
-
-(defun sp-backward-kill-sexp (&optional arg dont-kill)
- "Kill the balanced expression preceding point.
-
-This is exactly like calling `sp-kill-sexp' with minus ARG.
-In other words, the direction of all commands is reversed. For
-more information, see the documentation of `sp-kill-sexp'.
-
-Examples:
-
- (foo (abc)| bar) -> (foo | bar)
-
- blab (foo (bar baz) quux)| -> blab |
-
- (1 2 3 |4 5 6) -> (|4 5 6) ;; \\[universal-argument]"
- (interactive "P")
- (sp-kill-sexp (sp--negate-argument arg) dont-kill))
-
-(defun sp-copy-sexp (&optional arg)
- "Copy the following ARG expressions to the kill-ring.
-
-This is exactly like calling `sp-kill-sexp' with second argument
-t. All the special prefix arguments work the same way."
- (interactive "P")
- (save-excursion
- (sp-kill-sexp arg t)))
-
-(defun sp-backward-copy-sexp (&optional arg)
- "Copy the previous ARG expressions to the kill-ring.
-
-This is exactly like calling `sp-backward-kill-sexp' with second argument
-t. All the special prefix arguments work the same way."
- (interactive "P")
- (save-excursion
- (sp-kill-sexp (sp--negate-argument arg) t)))
-
-(defun sp-clone-sexp ()
- "Clone sexp after or around point.
-
-If the form immediately after point is a sexp, clone it below the
-current one and put the point in front of it.
-
-Otherwise get the enclosing sexp and clone it below the current
-enclosing sexp."
- (interactive)
- (-when-let (ok (let ((sexp (sp-get-thing)))
- (if (not (equal (sp-get sexp :op) ""))
- sexp
- (sp-get-enclosing-sexp))))
- (sp-get ok
- (undo-boundary)
- (if (< :beg-prf (point))
- ;; this is the case where point is inside a sexp, we place
- ;; the "clone" before the current enclosing sexp and move
- ;; the old one below. Note that the "net result" is the
- ;; same as the other case, but the implementation must
- ;; reflect different relative position of the point wrt
- ;; "current" sexp.
- (save-excursion
- (goto-char :beg-prf)
- (insert-buffer-substring-no-properties
- (current-buffer) :beg-prf :end-suf)
- (newline-and-indent))
- ;; in this case we are in front, so we move after the current
- ;; one, place the clone and move it below
- (goto-char :end-suf)
- (save-excursion
- (insert-buffer-substring-no-properties
- (current-buffer) :beg-prf :end-suf))
- (newline-and-indent))
- (sp-indent-defun))))
-
-(defun sp-kill-hybrid-sexp (arg)
- "Kill a line as if with `kill-line', but respecting delimiters.
-
-With ARG being raw prefix \\[universal-argument] \\[universal-argument], kill the hybrid sexp
-the point is in (see `sp-get-hybrid-sexp').
-
-With ARG numeric prefix 0 (zero) just call `kill-line'.
-
-You can customize the behaviour of this command by toggling
-`sp-hybrid-kill-excessive-whitespace'.
-
-Examples:
-
- foo | bar baz -> foo | ;; nil
-
- foo (bar | baz) quux -> foo (bar |) quux ;; nil
-
- foo | bar (baz -> foo | ;; nil
- quux)
-
- foo \"bar |baz quux\" quack -> foo \"bar |\" quack ;; nil
-
- foo (bar
- baz) qu|ux (quack -> foo | hoo ;; \\[universal-argument] \\[universal-argument]
- zaq) hoo
-
- foo | (bar -> foo | ;; C-0
- baz) baz)"
- (interactive "P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (orig-indent (save-excursion
- (back-to-indentation)
- (current-column)))
- (orig-column (current-column)))
- (cond
- ((= arg 0) (kill-line))
- ((and raw (= arg 16))
- (let ((hl (sp-get-hybrid-sexp)))
- (sp-get hl (kill-region :beg-prf :end-suf))))
- (t
- (let ((hl (sp-get-hybrid-sexp)))
- (save-excursion
- (when (and (or (eq sp-hybrid-kill-entire-symbol t)
- (and (functionp sp-hybrid-kill-entire-symbol)
- (not (funcall sp-hybrid-kill-entire-symbol))))
- (sp-point-in-symbol))
- (sp-backward-sexp))
- (sp-get hl
- (let ((end (min (point-max) (if (looking-at "[ \t]*$")
- (1+ :end-suf)
- :end-suf))))
- (when sp-hybrid-kill-excessive-whitespace
- (save-excursion
- (goto-char end)
- (skip-chars-forward "\n\t\r\s")
- (cond
- ((eq 'kill sp-hybrid-kill-excessive-whitespace)
- (setq end (point)))
- (t (delete-region end (point))))))
- (kill-region (point) end)))))
- (sp--cleanup-after-kill)
- ;; if we've killed the entire line, do *not* contract the indent
- ;; to just one space
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (line-end-position))
- (if (and (= 0 orig-column)
- kill-whole-line)
- (delete-char 1) ;; delete the newline
- (let ((need-indent (- orig-indent (current-column))))
- (when (> need-indent 0)
- (insert (make-string need-indent ?\ ))))))))))
-
-(defun sp-kill-whole-line ()
- "Kill current line in sexp-aware manner.
-
-First, go to the beginning of current line and then try to kill
-as much as possible on the current line but without breaking
-balance.
-
-If there is a hanging sexp at the end of line the it is killed as
-well.
-
-If there is a closing delimiter for a sexp \"up\" current sexp,
-the kill is not extended after it. For more details see
-`sp-kill-hybrid-sexp'.
-
-Examples:
-
- (progn (progn
- (some |long sexp)) -> |)"
- (interactive)
- (beginning-of-line)
- (sp-kill-hybrid-sexp nil))
-
-(defun sp--transpose-objects (first second)
- "Transpose FIRST and SECOND object while preserving the
-whitespace between them."
- (save-excursion
- (goto-char (sp-get second :beg-prf))
- (let ((ins (sp-get second (delete-and-extract-region :beg-prf :end)))
- (between (delete-and-extract-region (sp-get first :end) (point))))
- (goto-char (sp-get first :beg-prf))
- (insert ins between))))
-
-(defun sp-transpose-sexp (&optional arg)
- "Transpose the expressions around point.
-
-The operation will move the point after the transposed block, so
-the next transpose will \"drag\" it forward.
-
-With arg positive N, apply that many times, dragging the
-expression forward.
-
-With arg negative -N, apply N times backward, pushing the word
-before cursor backward. This will therefore not transpose the
-expressions before and after point, but push the expression
-before point over the one before it.
-
-Examples:
-
- foo |bar baz -> bar foo| baz
-
- foo |bar baz -> bar baz foo| ;; 2
-
- (foo) |(bar baz) -> (bar baz) (foo)|
-
- (foo bar) -> (baz quux) ;; keeps the formatting
- |(baz quux) |(foo bar)
-
- foo bar baz| -> foo baz| bar ;; -1"
- (interactive "P")
- (let* ((arg (prefix-numeric-value arg))
- (n (abs arg)))
- ;; if we're inside a symbol, we need to move out of it first
- (when (> arg 0)
- (when (sp-point-in-symbol)
- (sp-forward-symbol)))
- (while (> n 0)
- (when (< arg 0) (sp-backward-sexp))
- (let* ((next (save-excursion (sp-forward-sexp)))
- (prev (save-excursion (goto-char (sp-get next :beg-prf)) (sp-backward-sexp))))
- (sp--transpose-objects prev next)
- (when (< arg 0)
- (goto-char (+ (sp-get prev :beg-prf) (sp-get next :len))))
- (setq n (1- n))))))
-
-(defun sp-transpose-hybrid-sexp (&optional arg)
- "Transpose the hybrid sexps around point.
-
-`sp-backward-sexp' is used to enter the previous hybrid sexp.
-
-With ARG numeric prefix call `transpose-lines' with this
-argument.
-
-The operation will move the point at the next line after the
-transposed block if it is at the end of line already.
-
-Examples:
-
- foo bar baz (quux
- |baz (quux -> quack)
- quack) foo bar\\n|
-
-
- [(foo) (bar) -> [(baz)
- |(baz)] (foo) (bar)|]
-
- foo bar baz -> quux flux
- |quux flux foo bar baz\\n|"
- (interactive "P")
- (if (numberp arg)
- (transpose-lines arg)
- (let* ((next (save-excursion
- (sp-forward-sexp)
- (sp-backward-sexp)
- (sp-get-hybrid-sexp)))
- (prev (save-excursion
- (goto-char (sp-get next :beg))
- (sp-backward-sexp)
- (sp-get-hybrid-sexp))))
- (if (sp-compare-sexps prev next > :end)
- (sp-message :invalid-context-prev)
- (sp--transpose-objects prev next))
- (when (looking-at "[\n\t ]+")
- (forward-line)
- (back-to-indentation)))))
-
-(defun sp-push-hybrid-sexp ()
- "Push the hybrid sexp after point over the following one.
-
-`sp-forward-sexp' is used to enter the following hybrid sexp.
-
-Examples:
-
- |x = big_function_call(a, |(a,
- b) b) = read_user_input()
- ->
- (a, x = big_function_call(a,
- b) = read_user_input() b)"
- (interactive)
- (let* ((cur (sp-get-hybrid-sexp))
- (next (save-excursion
- (goto-char (sp-get cur :end))
- (sp-forward-sexp)
- (sp-get-hybrid-sexp))))
- (if (sp-compare-sexps cur next >)
- (sp-message :invalid-context-cur)
- (sp--transpose-objects cur next))))
-
-;; The following two functions are inspired by "adjust-parens.el"
-;; package available at
-;; http://elpa.gnu.org/packages/adjust-parens-1.0.el
-(defun sp-indent-adjust-sexp ()
- "Add the hybrid sexp at line into previous sexp. All forms
-between the two are also inserted. Specifically, if the point is
-on empty line, move the closing delimiter there, so the next
-typed text will become the last item of the previous sexp.
-
-This acts similarly to `sp-add-to-previous-sexp' but with special
-handling of empty lines."
- (interactive)
- (let* ((hsexp (sp-get-hybrid-sexp))
- (prev-sexp (save-excursion
- (goto-char (sp-get hsexp :beg))
- (sp-get-sexp t))))
- (if (not (and prev-sexp hsexp
- (sp-compare-sexps prev-sexp hsexp < :end :beg)))
- (sp-message :no-structure-found)
- (save-excursion
- (sp-get prev-sexp
- (goto-char (sp-get hsexp :end))
- (insert :cl)
- (goto-char :end-in)
- (delete-char :cl-l)))
- (sp-get (sp-get-enclosing-sexp) (sp--indent-region :beg :end))
- (indent-according-to-mode)
- (sp--run-hook-with-args (sp-get prev-sexp :op) :post-handlers 'indent-adjust-sexp))))
-
-(defun sp-dedent-adjust-sexp ()
- "Remove the hybrid sexp at line from previous sexp. All
-sibling forms after it are also removed (not deleted, just placed
-outside of the enclosing list). Specifically, if the point is on
-empty line followed by closing delimiter of enclosing list, move
-the closing delimiter after the last item in the list.
-
-This acts similarly to `sp-forward-barf-sexp' but with special
-handling of empty lines."
- (interactive)
- (-when-let (enc (sp-get-enclosing-sexp))
- (save-excursion
- ;; if we're looking at whitespace and end of sexp, move the
- ;; closing paren over the whitespace but *after* the last item
- ;; in the list (barf would also go *before* the last item)
- (sp-skip-forward-to-symbol t)
- (if (= (point) (sp-get enc :end-in))
- (let ((prev-sexp (sp-get-thing t)))
- (sp-get enc
- (delete-char :cl-l)
- (goto-char (sp-get prev-sexp :end))
- ;; see next TODO
- (save-restriction
- (sp--narrow-to-line)
- (skip-syntax-forward " ")
- (skip-syntax-forward "."))
- (insert :cl)))
- ;; otherwise just C-u barf
- (sp-skip-backward-to-symbol t)
- (sp-forward-barf-sexp '(4))
- ;; we need to take special care of any hanging
- ;; punctuation. TODO: this should be a sexp suffix? HACK until
- ;; we fix barf to get the info.
- (save-restriction
- (sp-get (sp-backward-down-sexp)
- (goto-char :end)
- (delete-char (- :cl-l))
- (sp--narrow-to-line)
- (skip-syntax-forward " ")
- (skip-syntax-forward ".")
- (insert :cl)))
- (sp-get enc (sp--indent-region :beg :end))))
- (indent-according-to-mode)
- (sp--run-hook-with-args (sp-get enc :op) :post-handlers 'dedent-adjust-sexp)))
-
-;; "When the hook is called point is *after* the just moved closing delimiter."
-;; TODO: add hook
-(defun sp-slurp-hybrid-sexp ()
- "Add hybrid sexp following the current list in it by moving the
-closing delimiter.
-
-This is philosophically similar to `sp-forward-slurp-sexp' but
-works better in \"line-based\" languages like C or Java.
-
-Because the structure is much looser in these languages, this
-command currently does not support all the prefix argument
-triggers that `sp-forward-slurp-sexp' does."
- (interactive)
- (let (slurped-within-line)
- (-if-let* ((enc (sp-get-enclosing-sexp))
- (bsexp (save-excursion
- (sp-get enc (goto-char :end))
- (when (sp-compare-sexps (sp-forward-sexp) enc >)
- (sp-get-hybrid-sexp)))))
- (save-excursion
- (sp-get enc
- (goto-char :end-suf)
- (delete-char (- (+ :cl-l :suffix-l)))
- ;; TODO: move to hook
- (when (sp-point-in-blank-line)
- (delete-region (line-beginning-position) (1+ (line-end-position))))
- (sp-forward-sexp)
-
- (when (eq (line-number-at-pos :beg)
- (line-number-at-pos :end))
- (setq slurped-within-line t))
- ;; If we're slurping over multiple lines, include the suffix on the next line.
- ;; I.e. while () {|} -> while () {\n foo(); \n}
- (unless slurped-within-line
- (sp-get (sp-get-hybrid-sexp) (goto-char :end-suf)))
- (insert :cl :suffix))
- ;; TODO: move to hook
- (sp-get (sp--next-thing-selection -1)
- (save-excursion
- (if (save-excursion
- (goto-char :beg-in)
- (looking-at "[ \t]*$"))
- (progn
- (goto-char :end-in)
- (newline))
- ;; copy the whitespace after opening delim and put it in
- ;; front of the closing. This will ensure pretty { foo }
- ;; or {foo}
- (goto-char :end-in)
- (insert (buffer-substring-no-properties
- :beg-in
- (+ :beg-in (save-excursion
- (goto-char :beg-in)
- (skip-syntax-forward " ")))))))
- (unless (or (looking-at "[ \t]*$")
- (looking-at (sp--get-stringlike-regexp))
- (looking-at (sp--get-closing-regexp))
- slurped-within-line)
- (newline)))
- (sp-get (sp--next-thing-selection -1) (sp--indent-region :beg :end))
- ;; we need to call this again to get the new structure after
- ;; indent.
- (sp--next-thing-selection -1))
- (sp-message :invalid-structure)
- nil)))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; "paredit" operations
-
-(defun sp-forward-slurp-sexp (&optional arg)
- "Add sexp following the current list in it by moving the closing delimiter.
-
-If the current list is the last in a parent list, extend that
-list (and possibly apply recursively until we can extend a list
-or end of file).
-
-If ARG is N, apply this function that many times.
-
-If ARG is negative -N, extend the opening pair instead (that is,
-backward).
-
-If ARG is raw prefix \\[universal-argument], extend all the way to the end of the parent list.
-
-If both the current expression and the expression to be slurped
-are strings, they are joined together.
-
-See also `sp-slurp-hybrid-sexp' which is similar but handles
-C-style syntax better.
-
-Examples:
-
- (foo |bar) baz -> (foo |bar baz)
-
- [(foo |bar)] baz -> [(foo |bar) baz]
-
- [(foo |bar) baz] -> [(foo |bar baz)]
-
- ((|foo) bar baz quux) -> ((|foo bar baz quux)) ;; with \\[universal-argument]
-
- \"foo| bar\" \"baz quux\" -> \"foo| bar baz quux\""
- (interactive "P")
- (if (> (prefix-numeric-value arg) 0)
- (let ((n (abs (prefix-numeric-value arg)))
- (enc (sp-get-enclosing-sexp))
- (in-comment (sp-point-in-comment))
- next-thing ok)
- (when enc
- (save-excursion
- (if (sp--raw-argument-p arg)
- (progn
- (goto-char (sp-get enc :end-suf))
- (setq next-thing (sp-get-enclosing-sexp))
- (when next-thing
- (goto-char (sp-get next-thing :end-in))
- (sp--run-hook-with-args (sp-get enc :op) :pre-handlers 'slurp-forward
- (list :arg arg :enc enc :next-thing next-thing))
- (sp-get enc (insert :cl :suffix))
- (goto-char (sp-get enc :end-suf))
- (delete-char (sp-get enc (- (+ :cl-l :suffix-l))))
- (sp--indent-region (sp-get enc :beg-prf) (sp-get next-thing :end))
- (sp--run-hook-with-args (sp-get enc :op) :post-handlers 'slurp-forward
- (list :arg arg :enc enc :next-thing next-thing))))
- (while (> n 0)
- (goto-char (sp-get enc :end-suf))
- (setq ok enc)
- (setq next-thing (sp-get-thing nil))
- (while (sp-compare-sexps next-thing ok <)
- (goto-char (sp-get next-thing :end-suf))
- (setq ok next-thing)
- (setq next-thing (sp-get-thing nil)))
- ;; do not allow slurping into a different context from
- ;; inside a comment
- (if (and in-comment
- (save-excursion
- (sp-get next-thing
- (goto-char :beg)
- (not (sp-point-in-comment)))))
- (progn
- (sp-message :cant-slurp-context)
- (setq n -1))
- (if ok
- (progn
- (if (and (equal (sp-get next-thing :cl) "\"")
- (equal (sp-get ok :cl) "\""))
- (progn
- (sp--join-sexp ok next-thing)
- (goto-char (- (sp-get next-thing :end) 2))
- (plist-put enc :end (- (sp-get next-thing :end) 2)))
- (let ((inner-sexp
- (save-excursion
- (goto-char (sp-get ok :end-in))
- (sp-get-thing t))))
- (delete-char (sp-get ok (- (+ :cl-l :suffix-l))))
- ;; this calculation corrects the absence
- ;; of already deleted cls
- (goto-char (- (sp-get next-thing :end-suf)
- (sp-get ok (+ :cl-l :suffix-l))))
- ;; only insert space if not inserting it
- ;; would merge two sexps together
- (when (and (sp-get ok (/= :len-in 0))
- (sp-compare-sexps
- inner-sexp
- (sp-get-thing t))
- (= (sp-get ok :end-suf)
- (sp-get next-thing :beg-prf)))
- (save-excursion
- (goto-char (sp-get ok :end-in))
- (insert " "))))
- (sp--run-hook-with-args
- (sp-get enc :op) :pre-handlers 'slurp-forward
- (list :arg arg :enc enc :ok ok :next-thing next-thing))
- (sp-get ok (insert :cl :suffix))
- (sp--indent-region (sp-get ok :beg-prf) (point))
- ;; HACK: update the "enc" data structure if ok==enc
- (when (= (sp-get enc :beg) (sp-get ok :beg)) (plist-put enc :end (point)))
- (sp--run-hook-with-args
- (sp-get enc :op) :post-handlers 'slurp-forward
- (list :arg arg :enc enc :ok ok :next-thing next-thing)))
- (setq n (1- n)))
- (sp-message :cant-slurp)
- (setq n -1))))))))
- (sp-backward-slurp-sexp (sp--negate-argument arg))))
-
-(defun sp-backward-slurp-sexp (&optional arg)
- "Add the sexp preceding the current list in it by moving the opening delimiter.
-
-If the current list is the first in a parent list, extend that
-list (and possibly apply recursively until we can extend a list
-or beginning of file).
-
-If arg is N, apply this function that many times.
-
-If arg is negative -N, extend the closing pair instead (that is,
-forward).
-
-If ARG is raw prefix \\[universal-argument], extend all the way to the beginning of the parent list.
-
-If both the current expression and the expression to be slurped
-are strings, they are joined together.
-
-Examples:
-
- foo (bar| baz) -> (foo bar| baz)
-
- foo [(bar| baz)] -> [foo (bar| baz)]
-
- [foo (bar| baz)] -> [(foo bar| baz)]
-
- (foo bar baz (|quux)) -> ((foo bar baz |quux)) ;; with \\[universal-argument]
-
- \"foo bar\" \"baz |quux\" -> \"foo bar baz |quux\""
- (interactive "P")
- (if (> (prefix-numeric-value arg) 0)
- (let ((n (abs (prefix-numeric-value arg)))
- (enc (sp-get-enclosing-sexp))
- (in-comment (sp-point-in-comment))
- next-thing ok)
- (when enc
- (save-excursion
- (if (sp--raw-argument-p arg)
- (progn
- (goto-char (sp-get enc :beg-prf))
- (setq next-thing (sp-get-enclosing-sexp))
- (when next-thing
- (delete-char (sp-get enc (+ :op-l :prefix-l)))
- (goto-char (sp-get next-thing :beg-in))
- (sp--run-hook-with-args
- (sp-get enc :op) :pre-handlers 'slurp-backward
- (list :arg arg :enc enc :next-thing next-thing))
- (sp-get enc (insert :prefix :op))
- (sp--indent-region (sp-get next-thing :beg-in) (sp-get enc :end))
- (sp--run-hook-with-args
- (sp-get enc :op) :post-handlers 'slurp-backward
- (list :arg arg :enc enc :next-thing next-thing))))
- (while (> n 0)
- (goto-char (sp-get enc :beg-prf))
- (setq ok enc)
- (setq next-thing (sp-get-thing t))
- (while (sp-compare-sexps next-thing ok > :end)
- (goto-char (sp-get next-thing :beg-prf))
- (setq ok next-thing)
- (setq next-thing (sp-get-thing t)))
- ;; do not allow slurping into a different context from
- ;; inside a comment
- (if (and in-comment
- (save-excursion
- (sp-get next-thing
- (goto-char :beg)
- (not (sp-point-in-comment)))))
- (progn
- (sp-message :cant-slurp-context)
- (setq n -1))
- (if ok
- (progn
- (if (and (equal (sp-get next-thing :cl) "\"")
- (equal (sp-get ok :cl) "\""))
- (progn
- (sp--join-sexp next-thing ok)
- (goto-char (sp-get next-thing :beg-prf))
- (plist-put enc :beg (sp-get next-thing :beg)))
- (let ((inner-sexp
- (save-excursion
- (goto-char (sp-get ok :beg-in))
- (sp-get-thing))))
- (delete-char (sp-get ok (+ :op-l :prefix-l)))
- (goto-char (sp-get next-thing :beg-prf))
- ;; only insert space if not inserting it
- ;; would merge two sexps together
- (when (and (sp-get ok (/= :len-in 0))
- (= (sp-get ok (- (sp-get inner-sexp :end)
- :op-l :prefix-l))
- (sp-get (sp-get-thing) :end))
- (= (sp-get ok :beg-prf)
- (sp-get next-thing :end-suf)))
- (save-excursion
- (goto-char (sp-get ok (- :beg-in :op-l :prefix-l)))
- (insert " "))))
- (sp--run-hook-with-args
- (sp-get enc :op) :pre-handlers 'slurp-backward
- (list :arg arg :enc enc :ok ok :next-thing next-thing))
- (sp-get ok (insert :prefix :op))
- (sp--indent-region (point) (sp-get ok :end))
- ;; HACK: update the "enc" data structure if ok==enc
- (when (sp-compare-sexps enc ok) (plist-put enc :beg (- (point) (sp-get ok :op-l))))
- (sp--run-hook-with-args
- (sp-get enc :op) :post-handlers 'slurp-backward
- (list :arg arg :enc enc :ok ok :next-thing next-thing)))
- (setq n (1- n)))
- (sp-message :cant-slurp)
- (setq n -1))))))))
- (sp-forward-slurp-sexp (sp--negate-argument arg))))
-
-(defun sp-add-to-previous-sexp (&optional arg)
- "Add the expression around point to the first list preceding point.
-
-With ARG positive N add that many expressions to the preceding
-list.
-
-If ARG is raw prefix argument \\[universal-argument] add all expressions until
-the end of enclosing list to the previous list.
-
-If ARG is raw prefix argument \\[universal-argument] \\[universal-argument] add the current
-list into the previous list.
-
-Examples:
-
- (foo bar) |baz quux -> (foo bar |baz) quux
-
- (foo bar) |baz quux -> (foo bar |baz quux) ;; 2
-
- (blab (foo bar) |baz quux) -> (blab (foo bar |baz quux)) ;; \\[universal-argument]
-
- (foo bar) (baz |quux) -> (foo bar (baz |quux)) ;; \\[universal-argument] \\[universal-argument]"
- (interactive "P")
- (save-excursion
- (cond
- ((equal arg '(16))
- (sp-backward-up-sexp)
- (sp-backward-down-sexp)
- (sp-forward-slurp-sexp))
- (t
- (sp-backward-down-sexp)
- (sp-forward-slurp-sexp arg))))
- (indent-according-to-mode))
-
-(defun sp-add-to-next-sexp (&optional arg)
- "Add the expressions around point to the first list following point.
-
-With ARG positive N add that many expressions to the following
-list.
-
-If ARG is raw prefix argument \\[universal-argument] add all expressions until
-the beginning of enclosing list to the following list.
-
-If ARG is raw prefix argument \\[universal-argument] \\[universal-argument] add the current
-list into the following list.
-
-Examples:
-
- foo bar| (baz quux) -> foo (bar| baz quux)
-
- foo bar| (baz quux) -> (foo bar| baz quux) ;; 2
-
- (foo bar |(bar quux) blab) -> ((foo bar |bar quux) blab) ;; \\[universal-argument]
-
- (foo |bar) (baz quux) -> ((foo |bar) baz quux) ;; \\[universal-argument] \\[universal-argument]"
- (interactive "P")
- (save-excursion
- (cond
- ((equal arg '(16))
- (sp-up-sexp)
- (sp-down-sexp)
- (sp-backward-slurp-sexp))
- (t
- (sp-down-sexp)
- (sp-backward-slurp-sexp arg)))))
-
-(defun sp-forward-barf-sexp (&optional arg)
- "Remove the last sexp in the current list by moving the closing delimiter.
-
-If ARG is positive number N, barf that many expressions.
-
-If ARG is negative number -N, contract the opening pair instead.
-
-If ARG is raw prefix \\[universal-argument], barf all expressions from the one after
-point to the end of current list and place the point before the
-closing delimiter of the list.
-
-If the current list is empty, do nothing.
-
-Examples: (prefix arg in comment)
-
- (foo bar| baz) -> (foo bar|) baz ;; nil (defaults to 1)
-
- (foo| [bar baz]) -> (foo|) [bar baz] ;; 1
-
- (1 2 3| 4 5 6) -> (1 2 3|) 4 5 6 ;; \\[universal-argument] (or numeric prefix 3)
-
- (foo bar| baz) -> foo (bar| baz) ;; -1"
- (interactive "P")
- (let* ((raw (sp--raw-argument-p arg))
- (old-arg arg)
- (arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (if (sp-point-in-blank-sexp)
- (sp-message :blank-sexp)
- (save-excursion
- (let ((enc (sp-get-enclosing-sexp)))
- (sp-get enc
- (cond
- ((and raw (= arg 4))
- (sp-get (sp-get-thing t)
- (goto-char :end-suf)))
- (t
- (goto-char :end-in)
- (sp-backward-sexp arg)
- (when (<= (point) :beg)
- (goto-char :beg-in))))
- ;; we know for sure there is at least one thing in the list
- (let ((back (sp-get-thing t)))
- (if (sp-compare-sexps back enc)
- (goto-char :beg-in)
- (goto-char (sp-get back :end-suf))))
- (sp--run-hook-with-args :op :pre-handlers 'barf-forward
- (list :arg arg :enc enc)))
- (sp-get (sp-get-enclosing-sexp)
- (sp-do-move-cl (point))
- (sp--indent-region :beg :end)
- (sp--run-hook-with-args :op :post-handlers 'barf-forward
- (list :arg arg :enc enc))))))
- (sp-backward-barf-sexp (sp--negate-argument old-arg)))))
-
-(defun sp-backward-barf-sexp (&optional arg)
- "This is exactly like calling `sp-forward-barf-sexp' with minus ARG.
-In other words, instead of contracting the closing pair, the
-opening pair is contracted. For more information, see the
-documentation of `sp-forward-barf-sexp'.
-
-Examples:
-
- (foo bar| baz) -> foo (bar| baz)
-
- ([foo bar] |baz) -> [foo bar] (|baz)
-
- (1 2 3 |4 5 6) -> 1 2 3 (|4 5 6) ;; \\[universal-argument] (or 3)"
- (interactive "P")
- (let* ((raw (sp--raw-argument-p arg))
- (old-arg arg)
- (arg (prefix-numeric-value arg)))
- (if (> arg 0)
- (if (sp-point-in-blank-sexp)
- (sp-message :blank-sexp)
- (save-excursion
- (let ((enc (sp-get-enclosing-sexp)))
- (sp-get enc
- (cond
- ((and raw (= arg 4))
- (sp-get (sp-get-thing)
- (goto-char :beg-prf)))
- (t
- (goto-char :beg-in)
- (sp-forward-sexp arg)
- (when (>= (point) :end)
- (goto-char :end-in))))
- ;; we know for sure there is at least one thing in the list
- (let ((next (sp-get-thing)))
- (if (sp-compare-sexps next enc)
- (goto-char :end-in)
- (goto-char (sp-get next :beg-prf))))
- (sp--run-hook-with-args :op :pre-handlers 'barf-backward
- (list :arg arg :enc enc)))
- (sp-get (sp-get-enclosing-sexp)
- (sp-do-move-op (point))
- (sp--indent-region :beg :end)
- (sp--run-hook-with-args :op :post-handlers 'barf-backward
- (list :arg arg :enc enc))))))
- (sp-forward-barf-sexp (sp--negate-argument old-arg)))))
-
-;; TODO: get rid of the macro anyway, it's stupid!
-(defmacro sp--skip-to-symbol-1 (forward)
- "Generate `sp-skip-forward-to-symbol' or `sp-skip-backward-to-symbol'."
- (let ((inc (if forward '1+ '1-))
- (dec (if forward '1- '1+))
- (forward-fn (if forward 'forward-char 'backward-char))
- (next-char-fn (if forward 'following-char 'preceding-char))
- (looking (if forward 'sp--looking-at 'sp--looking-back))
- (prefix-fn (if forward 'sp--get-suffix 'sp--get-prefix))
- (eob-test (if forward '(eobp) '(bobp)))
- (comment-bound (if forward 'cdr 'car)))
- `(let ((in-comment (sp-point-in-comment))
- ;; HACK: if we run out of current context this might skip a
- ;; pair that was not allowed before. However, such a call is
- ;; never made in SP, so it's OK for now
- (allowed-pairs (sp--get-allowed-regexp))
- (allowed-open (sp--get-opening-regexp (sp--get-allowed-pair-list)))
- (allowed-close (sp--get-closing-regexp (sp--get-allowed-pair-list)))
- (allowed-strings (sp--get-stringlike-regexp))
- (prefix nil))
- (while (and (not (or ,eob-test
- (and stop-after-string
- (not (sp-point-in-string))
- (sp-point-in-string (,dec (point))))
- (and stop-at-string
- (not (sp-point-in-string))
- (sp-point-in-string (,inc (point))))
- (and stop-inside-string
- (sp-point-in-string)
- (not (sp-point-in-string (,inc (point)))))
- (and (,looking allowed-pairs)
- (or in-comment (not (sp-point-in-comment))))
- (and (,looking allowed-strings)
- (or in-comment (not (sp-point-in-comment))))))
- (or (member (char-syntax (,next-char-fn)) '(?< ?> ?! ?| ?\ ?\\ ?\" ?' ?.))
- (/= 0 (logand (lsh 1 20) (car (syntax-after
- ,(if forward
- '(point)
- '(1- (point)))))))
- (unless in-comment (sp-point-in-comment))
- ;; This is the case where we are starting at
- ;; pair (looking at it) and there is some
- ;; prefix which is not recognized by syntax,
- ;; i.e. defined by regexp. This should only be
- ;; tested once in principle before the next
- ;; time we land on a delimiter this whole loop
- ;; stops based on the first branch of the `and'
- ;; condition in `while' so using expensive
- ;; functions here is not a bg deal.
- (and (or (,(if forward 'sp--looking-back 'sp--looking-at)
- ,(if forward 'allowed-close 'allowed-open))
- (,(if forward 'sp--looking-back 'sp--looking-at) allowed-strings))
- (progn
- (setq prefix (,prefix-fn))
- (> (length prefix) 0)))))
- (if (and (not in-comment)
- (sp-point-in-comment))
- (progn
- (goto-char (,comment-bound (sp-get-comment-bounds)))
- (unless ,eob-test (,forward-fn 1)))
- (unless ,eob-test
- (,forward-fn (max (length prefix) 1))))))))
-
-(defun sp-skip-forward-to-symbol (&optional stop-at-string stop-after-string stop-inside-string)
- "Skip whitespace and comments moving forward.
-
-If STOP-AT-STRING is non-nil, stop before entering a string (if
-not already in a string).
-
-If STOP-AFTER-STRING is non-nil, stop after exiting a string.
-
-If STOP-INSIDE-STRING is non-nil, stop before exiting a string.
-
-Examples:
-
- foo| bar -> foo |bar
-
- foo| [bar baz] -> foo |[bar baz]"
- (interactive "^")
- (sp--skip-to-symbol-1 t))
-
-(put 'sp-skip-forward-to-symbol 'CUA 'move)
-
-(defun sp-skip-backward-to-symbol (&optional stop-at-string stop-after-string stop-inside-string)
- "Skip whitespace and comments moving backward.
-If STOP-AT-STRING is non-nil, stop before entering a string (if
-not already in a string).
-
-If STOP-AFTER-STRING is non-nil, stop after exiting a string.
-
-If STOP-INSIDE-STRING is non-nil, stop before exiting a string.
-
-Examples:
-
- foo |bar -> foo| bar
-
- [bar baz] |foo -> [bar baz]| foo"
- (interactive "^")
- (sp--skip-to-symbol-1 nil))
-
-(put 'sp-skip-backward-to-symbol 'CUA 'move)
-
-(defun sp-skip-into-string (&optional back)
- "Move the point into the next string.
-
-With BACK non-nil, move backwards."
- (if back
- (while (not (sp-point-in-string))
- (backward-char))
- (while (not (sp-point-in-string))
- (forward-char))))
-
-;; TODO: in ruby, "foo |if bar" now moves correctly, but there's a
-;; noticable lag before it jumps over "if". This is probably caused
-;; by :skip-match handlers. Investigate!
-(defun sp-forward-symbol (&optional arg)
- "Move point to the next position that is the end of a symbol.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction.
-
-A symbol is any sequence of characters that are in either the
-word constituent or symbol constituent syntax class. Current
-symbol only extend to the possible opening or closing delimiter
-as defined by `sp-add-pair' even if part of this delimiter
-would match \"symbol\" syntax classes.
-
-Examples:
-
- |foo bar baz -> foo| bar baz
-
- |foo (bar (baz)) -> foo (bar| (baz)) ;; 2
-
- |foo (bar (baz) quux) -> foo (bar (baz) quux|) ;; 4"
- (interactive "^p")
- (setq arg (or arg 1))
- (sp--with-case-sensitive
- (let* ((n (abs arg))
- (fw (> arg 0))
- (allowed (sp--get-allowed-pair-list))
- (open (sp--get-opening-regexp allowed))
- (close (sp--get-closing-regexp allowed)))
- (if fw
- (while (> n 0)
- ;; First we need to get to the beginning of a symbol. This means
- ;; skipping all whitespace and pair delimiters until we hit
- ;; something in \sw or \s_
- (while (cond
- ((eobp) nil)
- ((not (memq (char-syntax (following-char)) '(?w ?_)))
- (forward-char)
- t)
- ;; if allowed is empty, the regexp matches anything
- ;; and we go into infinite loop, cf. Issue #400
- ((and allowed (sp--valid-initial-delimiter-p (sp--looking-at open)))
- (goto-char (match-end 0)))
- ((and allowed (sp--valid-initial-delimiter-p (sp--looking-at close)))
- (goto-char (match-end 0)))))
- (while (and (not (eobp))
- (or (not allowed)
- (not (or (sp--valid-initial-delimiter-p (sp--looking-at open))
- (sp--valid-initial-delimiter-p (sp--looking-at close)))))
- (memq (char-syntax (following-char)) '(?w ?_)))
- (forward-char))
- (setq n (1- n)))
- (sp-backward-symbol n)))))
-
-(put 'sp-forward-symbol 'CUA 'move)
-
-(defun sp-backward-symbol (&optional arg)
- "Move point to the next position that is the beginning of a symbol.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-forward direction.
-
-A symbol is any sequence of characters that are in either the word
-constituent or symbol constituent syntax class. Current symbol only
-extend to the possible opening or closing delimiter as defined by
-`sp-add-pair' even if part of this delimiter would match \"symbol\"
-syntax classes.
-
-Examples:
-
- foo bar| baz -> foo |bar baz
-
- ((foo bar) baz)| -> ((foo |bar) baz) ;; 2
-
- (quux ((foo) bar) baz)| -> (|quux ((foo) bar) baz) ;; 4"
- (interactive "^p")
- (setq arg (or arg 1))
- (sp--with-case-sensitive
- (let ((n (abs arg))
- (fw (> arg 0))
- (open (sp--get-opening-regexp (sp--get-allowed-pair-list)))
- (close (sp--get-closing-regexp (sp--get-allowed-pair-list))))
- (if fw
- (while (> n 0)
- (while (cond
- ((bobp) nil)
- ((not (memq (char-syntax (preceding-char)) '(?w ?_)))
- (backward-char)
- t)
- ((sp--valid-initial-delimiter-p (sp--looking-back open))
- (goto-char (match-beginning 0)))
- ((sp--valid-initial-delimiter-p (sp--looking-back close))
- (goto-char (match-beginning 0)))))
- (while (and (not (bobp))
- (not (or (sp--valid-initial-delimiter-p (sp--looking-back open))
- (sp--valid-initial-delimiter-p (sp--looking-back close))))
- (memq (char-syntax (preceding-char)) '(?w ?_)))
- (backward-char))
- ;; skip characters which are symbols with prefix flag
- (while (and (not (eobp))
- (/= 0 (logand (lsh 1 20) (car (syntax-after (point))))))
- (forward-char 1))
- (setq n (1- n)))
- (sp-forward-symbol n)))))
-
-(put 'sp-backward-symbol 'CUA 'move)
-
-(defun sp-rewrap-sexp (pair &optional keep-old)
- "Rewrap the enclosing expression with a different pair.
-
-PAIR is the new enclosing pair.
-
-If optional argument KEEP-OLD is set, keep old delimiter and wrap
-with PAIR on the outside of the current expression.
-
-When used interactively, the new pair is specified in minibuffer
-by typing the *opening* delimiter, same way as with pair
-wrapping.
-
-When used interactively with raw prefix argument \\[universal-argument], KEEP-OLD
-is set to non-nil.
-
-Examples:
-
- (foo |bar baz) -> [foo |bar baz] ;; [
-
- (foo |bar baz) -> [(foo |bar baz)] ;; \\[universal-argument] ["
- (interactive (list
- (let ((available-pairs (sp--get-pair-list-context 'wrap))
- ev ac (pair-prefix ""))
- (while (not ac)
- (setq ev (read-event (format "Rewrap with: %s" pair-prefix) t))
- (setq pair-prefix (concat pair-prefix (format-kbd-macro (vector ev))))
- (unless (--any? (string-prefix-p pair-prefix (car it)) available-pairs)
- (user-error "Impossible pair prefix selected: %s" pair-prefix))
- (setq ac (--first (equal pair-prefix (car it)) available-pairs)))
- ac)
- current-prefix-arg))
- (-when-let (enc (sp-get-enclosing-sexp))
- (save-excursion
- (sp-get enc
- (goto-char :end)
- (unless keep-old
- (delete-char (- :cl-l)))
- (insert (cdr pair))
- (goto-char :beg)
- (insert (car pair))
- (unless keep-old
- (delete-char :op-l))
- (setq sp-last-wrapped-region
- (sp--get-last-wraped-region
- :beg (+ :end
- (length (car pair))
- (length (cdr pair))
- (- :op-l)
- (- :cl-l))
- (car pair) (cdr pair)))))
- (sp--run-hook-with-args (car pair) :post-handlers 'rewrap-sexp
- (list :parent (sp-get enc :op)))))
-
-(defun sp-swap-enclosing-sexp (&optional arg)
- "Swap the enclosing delimiters of this and the parent expression.
-
-With N > 0 numeric argument, ascend that many levels before
-swapping.
-
-Examples:
-
- (foo [|bar] baz) -> [foo (|bar) baz] ;; 1
-
- (foo {bar [|baz] quux} quack) -> [foo {bar (|baz) quux} quack] ;; 2"
- (interactive "p")
- (let ((enc (sp-get-enclosing-sexp))
- (encp (sp-get-enclosing-sexp (1+ arg))))
- (if (and enc encp)
- (save-excursion
- (sp-get encp
- (goto-char :end)
- (delete-char (- :cl-l)))
- (sp-get enc
- (insert :cl)
- (goto-char :end)
- (delete-char (- :cl-l)))
- (sp-get encp (insert :cl))
- (sp-get enc (goto-char :beg-prf))
- (sp-get encp (insert :prefix :op))
- (sp-get enc (delete-char (+ :op-l :prefix-l)))
- (sp-get encp (goto-char :beg-prf))
- (sp-get enc (insert :prefix :op))
- (sp-get encp (delete-char (+ :op-l :prefix-l))))
- (sp-message :point-not-deep-enough))))
-
-(defun sp--unwrap-sexp (sexp &optional no-cleanup)
- "Unwrap expression defined by SEXP.
-
-Warning: this function remove possible empty lines and reindents
-the unwrapped sexp, so the SEXP structure will no longer
-represent a valid object in a buffer!"
- (sp-get sexp
- (delete-region :end-in :end)
- (delete-region :beg-prf :beg-in))
- ;; if the delimiters were the only thing on the line, we should also
- ;; get rid of the (possible) empty line that will be the result of
- ;; their removal. This is especially nice in HTML mode or
- ;; long-running tags like \[\] in latex.
- (unless no-cleanup
- (let ((new-start (sp-get sexp :beg-prf))
- (new-end (sp-get sexp (- :end-in :op-l :prefix-l)))
- indent-from indent-to)
- (save-excursion
- (goto-char new-end)
- (when (string-match-p "^[\n\t ]+\\'" (thing-at-point 'line))
- (let ((b (bounds-of-thing-at-point 'line)))
- (delete-region (car b) (cdr b))))
- (setq indent-to (point))
- (goto-char new-start)
- (when (string-match-p "^[\n\t ]+\\'" (thing-at-point 'line))
- (let ((b (bounds-of-thing-at-point 'line)))
- (delete-region (car b) (cdr b))))
- (setq indent-from (point)))
- (unless (memq major-mode sp-no-reindent-after-kill-modes)
- (sp--keep-indentation
- (sp--indent-region indent-from indent-to))))))
-
-(defun sp-change-inner ()
- "Change the inside of the next expression.
-
-First, kill the inside of the next balanced expression, then move
-point just after the opening delimiter.
-
-Examples:
-
- (f|oo [bar] baz) -> (foo [|] baz)
-
- {|'foo': 'bar'} -> {'|': 'bar'}"
- (interactive)
- (-when-let (ok (sp-get-sexp))
- (sp-get ok
- (kill-region :beg-in :end-in)
- (goto-char :beg-in))))
-
-(defun sp-unwrap-sexp (&optional arg)
- "Unwrap the following expression.
-
-With ARG N, unwrap Nth expression as returned by
-`sp-forward-sexp'. If ARG is negative -N, unwrap Nth expression
-backwards as returned by `sp-backward-sexp'.
-
-Return the information about the just unwrapped expression. Note
-that this structure does not represent a valid expression in the
-buffer.
-
-Examples:
-
- |(foo bar baz) -> |foo bar baz
-
- (foo bar| baz) -> foo bar| baz
-
- |(foo) (bar) (baz) -> |(foo) bar (baz) ;; 2"
- (interactive "p")
- (setq arg (or arg 1))
- (let ((sp-navigate-consider-symbols nil))
- (let ((ok (save-excursion (sp-forward-sexp arg))))
- (when ok (sp--unwrap-sexp ok))
- ok)))
-
-(defun sp-backward-unwrap-sexp (&optional arg)
- "Unwrap the previous expression.
-
-With ARG N, unwrap Nth expression as returned by
-`sp-backward-sexp'. If ARG is negative -N, unwrap Nth expression
-forward as returned by `sp-forward-sexp'.
-
-Examples:
-
- (foo bar baz)| -> foo bar baz|
-
- (foo bar)| (baz) -> foo bar| (baz)
-
- (foo) (bar) (baz)| -> foo (bar) (baz) ;; 3"
- (interactive "p")
- (sp-unwrap-sexp (- (or arg 1))))
-
-(defun sp-splice-sexp (&optional arg)
- "Unwrap the current list.
-
-With ARG N, unwrap Nth list as returned by applying `sp-up-sexp'
-N times. This function expect positive arg.
-
-Examples:
-
- (foo (bar| baz) quux) -> (foo bar| baz quux)
-
- (foo |(bar baz) quux) -> foo |(bar baz) quux
-
- (foo (bar| baz) quux) -> foo (bar| baz) quux ;; 2"
- (interactive "p")
- (setq arg (or arg 1))
- (-when-let (ok (sp-get-enclosing-sexp arg))
- (if (equal ";" (sp-get ok :prefix))
- (sp-get ok
- (save-excursion
- (goto-char :beg)
- (-when-let (enc (sp-get-enclosing-sexp arg))
- (sp--unwrap-sexp enc))))
- (sp--unwrap-sexp ok))))
-
-(defun sp--splice-sexp-do-killing (beg end expr &optional jump-end)
- "Save the text in the region between BEG and END inside EXPR,
-then delete EXPR and insert the saved text.
-
-If optional argument JUPM-END is equal to the symbol 'end move
-the point after the re-inserted text."
- (let (str p)
- (setq str (buffer-substring-no-properties beg end))
- (delete-region (sp-get expr :beg-prf) (sp-get expr :end))
- (save-excursion
- (insert str)
- (sp--indent-region (sp-get expr :beg-prf) (point))
- (setq p (point)))
- (when (eq jump-end 'end) (goto-char p))))
-
-(defun sp-splice-sexp-killing-backward (&optional arg)
- "Unwrap the current list and kill all the expressions
-between start of this list and the point.
-
-With the optional argument ARG, repeat that many times. This
-argument should be positive number.
-
-Examples:
-
- (foo (let ((x 5)) |(sqrt n)) bar) -> (foo |(sqrt n) bar)
-
- (when ok| |(perform-operation-1)
- (perform-operation-1) -> (perform-operation-2)
- (perform-operation-2))
-
- (save-excursion -> |(awesome-stuff-happens) ;; 2
- (unless (test)
- |(awesome-stuff-happens)))
-
-Note that to kill only the content and not the enclosing
-delimiters you can use \\[universal-argument] \\[sp-backward-kill-sexp].
-See `sp-backward-kill-sexp' for more information."
- (interactive "p")
- (while (> arg 0)
- (sp-splice-sexp-killing-around '(4))
- (setq arg (1- arg))))
-
-;; TODO: write in terms of `sp-splice-sexp-killing-around'.
-(defun sp-splice-sexp-killing-forward (&optional arg)
- "Unwrap the current list and kill all the expressions between
-the point and the end of this list.
-
-With the optional argument ARG, repeat that many times. This
-argument should be positive number.
-
-Examples:
-
- (a (b c| d e) f) -> (a b c| f)
-
- (+ (x |y z) w) -> (+ x| w)
-
-Note that to kill only the content and not the enclosing
-delimiters you can use \\[universal-argument] \\[sp-kill-sexp].
-See `sp-kill-sexp' for more information."
- (interactive "p")
- (while (> arg 0)
- (let ((ok (sp-get-enclosing-sexp 1)))
- (if ok
- (let ((next (sp-get-thing t)))
- (if (sp-compare-sexps next ok)
- (sp-kill-sexp '(16))
- (sp--splice-sexp-do-killing
- (sp-get next :end) ;search backward
- (sp-get ok :beg-in)
- ok 'end)))
- (setq arg -1)))
- (setq arg (1- arg))))
-
-(defun sp-splice-sexp-killing-around (&optional arg)
- "Unwrap the current list and kill everything inside except next expression.
-
-With ARG save that many next expressions. With ARG negative -N,
-save that many expressions backward.
-
-If ARG is raw prefix argument \\[universal-argument] this function behaves exactly
-the same as `sp-splice-sexp-killing-backward'.
-
-If ARG is negative raw prefix argument \\[negative-argument] \\[universal-argument] this function
-behaves exactly the same as `sp-splice-sexp-killing-forward'.
-
-Note that the behaviour with the prefix argument seems to be
-reversed. This is because the backward variant is much more
-common and hence deserve shorter binding.
-
-If ARG is raw prefix argument \\[universal-argument] \\[universal-argument] raise the expression the point
-is inside of. This is the same as `sp-backward-up-sexp' followed by
-`sp-splice-sexp-killing-around'.
-
-Examples:
-
- (a b |(c d) e f) -> |(c d) ;; with arg = 1
-
- (a b |c d e f) -> |c d ;; with arg = 2
-
- (- (car x) |a 3) -> (car x)| ;; with arg = -1
-
- (foo (bar |baz) quux) -> |(bar baz) ;; with arg = \\[universal-argument] \\[universal-argument]"
- (interactive "P")
- (cond
- ((equal arg '(-4))
- (sp-splice-sexp-killing-forward 1))
- (t
- (if (equal arg '(16))
- (progn
- (sp-backward-up-sexp)
- (setq arg 1)))
- (let* (inside-comment-inside-sexp
- (num-arg (prefix-numeric-value arg))
- (ok ;; (sp-get-enclosing-sexp 1)
- (save-excursion
- (sp-skip-backward-to-symbol)
- ;; if the point is inside a comment, we want to
- ;; operate on the sexp that contains it. however,
- ;; if we are inside a sexp inside a comment, we
- ;; should operate on that instead.
- (if (sp-point-in-comment)
- (let ((enc (sp-get-enclosing-sexp 1))
- (cb (sp-get-comment-bounds)))
- (if (> (sp-get enc :beg) (car cb))
- (progn
- (setq inside-comment-inside-sexp t)
- enc)
- (goto-char (cdr cb))
- ;; todo: replace with something more
- ;; abstract
- (skip-chars-forward "\t\n ")
- (sp-get-enclosing-sexp 1)))
- (sp-get-enclosing-sexp 1)))))
- (when ok
- (when (and (sp-point-in-comment)
- (not inside-comment-inside-sexp))
- (let ((cb (sp-get-comment-bounds)))
- (goto-char (if (> num-arg 0) (car cb) (cdr cb)))))
- (sp-skip-backward-to-symbol)
- (-let* ((next (sp--next-thing-selection arg))
- ((from . to)
- (cond
- ((and (sp-point-in-comment)
- (not inside-comment-inside-sexp))
- (if (> num-arg 0)
- ;; only extends to keep the comment if raising
- ;; towards the end.
- (cons (car (sp-get-comment-bounds))
- (sp-get next :end-suf))
- (sp-get next (cons :beg-prf :end-suf))))
- ((and (sp-point-in-comment)
- inside-comment-inside-sexp)
- (sp-get next (cons :beg-prf :end-suf)))
- ;; If we are splicing before a comment, the
- ;; comment might be connected to the sexp
- ;; after it, so we better don't kill it. Only
- ;; do that if the comment is on its own line
- ;; though, otherwise it is connected to the
- ;; sexp before it.
- ((save-excursion
- (skip-chars-forward "\t\n ")
- (when (and (> num-arg 0)
- (sp-point-in-comment)
- (save-excursion
- (skip-chars-backward "\t ")
- (bolp)))
- (cons (point) (sp-get next :end-suf)))))
- ;; similarly, if there is a comment before
- ;; this sexp, keep it.
- ((save-excursion
- (sp-backward-symbol)
- (when (and (> num-arg 0)
- (sp-point-in-comment)
- (goto-char (car (sp-get-comment-bounds)))
- (> (point) (sp-get ok :beg))
- (save-excursion
- (skip-chars-backward "\t ")
- (bolp)))
- (cons (point) (sp-get next :end-suf)))))
- (t (sp-get next (cons :beg-prf :end-suf))))))
- (sp--splice-sexp-do-killing from to
- ok (if (> num-arg 0) nil 'end))))))))
-
-(defalias 'sp-raise-sexp 'sp-splice-sexp-killing-around)
-
-(defun sp-convolute-sexp (&optional arg)
- "Convolute balanced expressions.
-
-Save the expressions preceding point and delete them. Then
-splice the resulting expression. Wrap the current enclosing list
-with the delimiters of the spliced list and insert the saved
-expressions.
-
-If point is in a symbol, move to end of symbol before convolving.
-
-With ARG positive N, move up N lists before wrapping.
-
-Examples:
-
-We want to move the `while' before the `let'.
-
- (let ((stuff 1) (while (we-are-good)
- (other 2)) (let ((stuff 1)
- (while (we-are-good) -> (other 2))
- |(do-thing 1) |(do-thing 1)
- (do-thing 2) (do-thing 2)
- (do-thing 3))) (do-thing 3)))
-
- (forward-char (sp-get env |:op-l)) -> (sp-get env (forward-char |:op-l))"
- (interactive "p")
- (save-excursion
- (when (sp-point-in-symbol)
- (sp-forward-symbol))
- (when (looking-at-p " ")
- (just-one-space))
- (let* ((old-buffer-size (buffer-size))
- (enc (sp-get-enclosing-sexp))
- (inner-close (sp-get enc (delete-and-extract-region
- (save-excursion
- (goto-char :end-in)
- (sp-backward-whitespace))
- :end)))
- (inner-raise (sp-get enc (delete-and-extract-region
- :beg-prf
- (save-excursion
- (sp-forward-whitespace)))))
- (whitespace (sp-get enc
- ;; this happens when the entire inside sexp was removed.
- (when (= old-buffer-size (+ (buffer-size) :len))
- (delete-and-extract-region
- (save-excursion
- (goto-char :beg-prf)
- (max (line-beginning-position) (sp-backward-whitespace)))
- :beg-prf))))
- (encp (sp-get-enclosing-sexp arg)))
- (sp-get encp
- (goto-char :end)
- (insert inner-close)
- (goto-char :beg-prf)
- (insert inner-raise (if whitespace whitespace ""))
- (sp-get (sp-get-enclosing-sexp)
- (sp--indent-region :beg :end)))))
- (indent-according-to-mode))
-
-(defun sp-absorb-sexp (&optional arg)
- "Absorb previous expression.
-
-Save the expressions preceding point and delete them. Then slurp
-an expression backward and insert the saved expressions.
-
-With ARG positive N, absorb that many expressions.
-
-Examples:
-
- (do-stuff 1) (save-excursion
- (save-excursion -> |(do-stuff 1)
- |(do-stuff 2)) (do-stuff 2))
-
- foo bar (concat |baz quux) -> (concat |foo bar baz quux) ;; 2"
- (interactive "p")
- (sp-forward-whitespace)
- (let* ((old (point))
- (raise (progn
- (sp-beginning-of-sexp)
- (buffer-substring (point) old))))
- (delete-region (point) old)
- (sp-backward-slurp-sexp arg)
- (sp-forward-whitespace)
- (sp-beginning-of-sexp)
- (insert raise)
- (save-excursion
- (sp-backward-up-sexp)
- (indent-sexp)))
- (sp-forward-whitespace))
-
-(defun sp-emit-sexp (&optional arg)
- "Move all expression preceding point except the first one out of the current list.
-
-With ARG positive N, keep that many expressions from the start of
-the current list.
-
-This is similar as `sp-backward-barf-sexp' but it also drags the
-first N expressions with the delimiter.
-
-Examples:
-
- (save-excursion (do-stuff 1)
- (do-stuff 1) (do-stuff 2)
- (do-stuff 2) -> (save-excursion
- |(do-stuff 3)) |(do-stuff 3))
-
- (while not-done-yet (execute-only-once)
- (execute-only-once) -> (while not-done-yet ;; arg = 2
- |(execute-in-loop)) |(execute-in-loop))"
- (interactive "p")
- (let (save-text)
- (save-excursion
- (sp-beginning-of-sexp)
- (let* ((start (point)))
- (sp-forward-sexp arg)
- (sp-skip-forward-to-symbol t)
- (setq save-text (buffer-substring start (point)))
- (delete-region start (point))))
- (save-excursion (sp-backward-barf-sexp '(4)))
- (sp-down-sexp)
- (insert save-text)
- (save-excursion
- (sp-backward-up-sexp)
- (indent-sexp))))
-
-(defun sp-extract-before-sexp (&optional arg)
- "Move the expression after point before the enclosing balanced expression.
-
-The point moves with the extracted expression.
-
-With ARG positive N, extract N expressions after point.
-
-With ARG negative -N, extract N expressions before point.
-
-With ARG being raw prefix argument \\[universal-argument], extract all the expressions
-up until the end of enclosing list.
-
-If the raw prefix is negative, this behaves as \\[universal-argument] `sp-backward-barf-sexp'."
- (interactive "P")
- (if (equal arg '(-4))
- (sp-backward-barf-sexp '(4))
- (sp-select-next-thing arg)
- (let ((enc (sp-get-enclosing-sexp))
- save-text b e nl)
- (save-excursion
- ;; TODO: extract this use pattern into general "get X things
- ;; with or without surrounding whitespace."
- (setq b (region-beginning))
- (setq e (region-end))
- (goto-char (sp-get enc :end-in))
- (if (save-excursion
- (skip-chars-backward "\t ")
- (bolp))
- (let ((whitespace (sp-get-whitespace)))
- (sp-get whitespace (when (= :beg e)
- (delete-region :beg :end))))
- (setq nl t))
- (setq save-text (delete-and-extract-region b e))
- (when nl
- (let ((whitespace (sp-get-whitespace)))
- (sp-get whitespace (delete-region :beg :end))))
- (goto-char (sp-get enc :beg-prf))
- (insert save-text "\n")
- (sp-get enc (sp--indent-region :beg-prf :end)))
- ;; if we're at an empty line, remove it
- (when (string-match-p "^[\n\t ]+\\'" (thing-at-point 'line))
- (let ((b (bounds-of-thing-at-point 'line)))
- (delete-region (car b) (cdr b))))
- (goto-char (sp-get enc :beg-prf)))))
-
-(defun sp-extract-after-sexp (&optional arg)
- "Move the expression after point after the enclosing balanced expression.
-
-The point moves with the extracted expression.
-
-With ARG positive N, extract N expressions after point.
-
-With ARG negative -N, extract N expressions before point.
-
-With ARG being raw prefix argument \\[universal-argument], extract all the
-expressions up until the end of enclosing list.
-
-With ARG being negative raw prefix argument \\[negative-argument] \\[universal-argument], extract all the
-expressions up until the start of enclosing list."
- ;; this is uch uglier than the "before" version, since the
- ;; calculations forward have to account for the deleted text. Figure
- ;; out a way to make it smoother.
- (interactive "P")
- (sp-select-next-thing arg)
- (sp--with-case-sensitive
- (let ((enc (sp-get-enclosing-sexp))
- (dws 0) ;length of deleted whitespace
- save-text b e nl)
- (save-excursion
- (setq b (region-beginning))
- (setq e (region-end))
- (goto-char (sp-get enc :end-in))
- (if (save-excursion
- (skip-chars-backward "\t ")
- (bolp))
- (let ((whitespace (sp-get-whitespace)))
- (sp-get whitespace
- (when (= :beg e)
- (delete-region :beg :end)
- (setq dws (- :end :beg)))))
- (setq nl t))
- (setq save-text (delete-and-extract-region b e))
- (when nl
- (let ((whitespace (sp-get-whitespace)))
- (sp-get whitespace (delete-region :beg :end))
- (sp-get whitespace (setq dws (+ dws (- :end :beg))))))
- (sp-get enc (goto-char (- :end (length save-text) dws)))
- (insert "\n" save-text)
- (sp-get enc (sp--indent-region :beg-prf :end))
- (setq e (point)))
- ;; if we're at an empty line, remove it
- (setq dws 0) ; variable reuse, ugly :/
- (when (string-match-p "^[\n\t ]+\\'" (thing-at-point 'line))
- (let ((b (bounds-of-thing-at-point 'line)))
- (delete-region (car b) (cdr b))
- (setq dws (- (cdr b) (car b)))))
- (when (sp--looking-back (sp--get-opening-regexp) nil t)
- (let ((whitespace (sp-get-whitespace)))
- (sp-get whitespace
- (delete-region :beg :end)
- (setq dws (- :end :beg)))))
- (goto-char (- e dws)))))
-
-(defun sp-forward-whitespace (&optional arg)
- "Skip forward past the whitespace characters.
-With non-nil ARG return number of characters skipped."
- (interactive "^P")
- (let ((rel-move (skip-chars-forward " \t\n")))
- (if arg rel-move (point))))
-
-(put 'sp-forward-whitespace 'CUA 'move)
-
-(defun sp-backward-whitespace (&optional arg)
- "Skip backward past the whitespace characters.
-With non-nil ARG return number of characters skipped."
- (interactive "^P")
- (let ((rel-move (skip-chars-backward " \t\n")))
- (if arg rel-move (point))))
-
-(put 'sp-backward-whitespace 'CUA 'move)
-
-(defun sp-split-sexp (arg)
- "Split the list or string the point is on into two.
-
-If ARG is a raw prefix \\[universal-argument] split all the sexps in current expression
-in separate lists enclosed with delimiters of the current
-expression.
-
-See also setting `sp-split-sexp-always-split-as-string' which
-determines how sexps inside strings are treated and also for a
-discussion of how to automatically add concatenation operators to
-string splitting.
-
-Examples:
-
- (foo bar |baz quux) -> (foo bar) |(baz quux)
-
- \"foo bar |baz quux\" -> \"foo bar\" |\"baz quux\"
-
- ([foo |bar baz] quux) -> ([foo] |[bar baz] quux)
-
- (foo bar| baz quux) -> (foo) (bar|) (baz) (quux) ;; \\[universal-argument]"
- (interactive "P")
- (cond
- ((equal arg '(4))
- (-when-let (items (sp-get-list-items))
- (let ((op (sp-get (car items) :op))
- (cl (sp-get (car items) :cl))
- (beg (sp-get (car items) :beg))
- (end (sp-get (car items) :end)))
- (!cdr items)
- (setq items (nreverse items))
- (save-excursion
- (goto-char end)
- (delete-char (- (length cl)))
- (while items
- (sp-get (car items)
- (goto-char :end)
- (insert cl)
- (goto-char :beg)
- (insert op))
- (!cdr items))
- (goto-char beg)
- (delete-char (length op))))))
- (t
- (let ((should-split-as-string
- (and sp-split-sexp-always-split-as-string
- (sp-point-in-string))))
- (-when-let (ok (if should-split-as-string
- (save-excursion
- (goto-char (1- (cdr (sp-get-quoted-string-bounds))))
- (sp-get-enclosing-sexp 1))
- (sp-get-enclosing-sexp 1)))
- (sp-get ok
- (sp--run-hook-with-args :op :pre-handlers 'split-sexp)
- (if should-split-as-string
- (progn
- (insert :cl)
- (save-excursion (insert :op)))
- (forward-char (- (prog1 (sp-backward-whitespace t) (insert :cl))))
- (save-excursion (sp-forward-whitespace) (insert :op)))
- (sp--run-hook-with-args :op :post-handlers 'split-sexp)))))))
-
-(defun sp--join-sexp (prev next)
- "Join the expressions PREV and NEXT if they are of the same type.
-
-The expression with smaller :beg is considered the previous one,
-so the input order does not actually matter.
-
-Return the information about resulting expression."
- (if (and (sp-compare-sexps prev next equal :op)
- (sp-compare-sexps prev next equal :cl))
- ;; if there's some prefix on the second expression, remove it.
- ;; We do not move it to the first expression, it is assumed
- ;; there's one already
- (progn
- (if (sp-compare-sexps prev next >)
- (let ((tmp prev))
- (setq prev next)
- (setq next tmp)))
- (sp-get next (delete-region :beg-prf :beg-in))
- (sp-get prev (delete-region :end-in :end))
- (list :beg (sp-get prev :beg)
- :end (- (sp-get next (- :end :op-l :prefix-l)) (sp-get prev :cl-l))
- :op (sp-get prev :op)
- :cl (sp-get prev :cl)
- :prefix (sp-get prev :prefix)))
- (sp-message :different-type)))
-
-(defun sp-join-sexp (&optional arg)
- "Join the sexp before and after point if they are of the same type.
-
-If ARG is positive N, join N expressions after the point with the
-one before the point.
-
-If ARG is negative -N, join N expressions before the point with
-the one after the point.
-
-If ARG is a raw prefix \\[universal-argument] join all the things up until the end
-of current expression.
-
-The joining stops at the first expression of different type.
-
-Examples:
-
- (foo bar) |(baz) -> (foo bar |baz)
-
- (foo) |(bar) (baz) -> (foo |bar baz) ;; 2
-
- [foo] [bar] |[baz] -> [foo bar |baz] ;; -2
-
- (foo bar (baz)| (quux) (blob bluq)) -> (foo bar (baz| quux blob bluq)) ;; \\[universal-argument]"
- (interactive "P")
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (n (abs arg))
- (prev (save-excursion (sp-backward-sexp (sp--signum arg))))
- next)
- (save-excursion
- (cond
- ((and raw (= n 4))
- (setq next (sp-forward-sexp (sp--signum arg)))
- (while (cond
- ((> arg 0)
- (sp-compare-sexps next prev > :beg :end))
- ((< arg 0)
- (sp-compare-sexps next prev < :end :beg)))
- (setq prev (sp--join-sexp prev next))
- (setq next (sp-forward-sexp (sp--signum arg)))))
- (t (while (> n 0)
- (setq next (sp-forward-sexp (sp--signum arg)))
- (setq prev (sp--join-sexp prev next))
- (setq n (1- n)))))
- prev)))
-
-(defun sp--next-thing-selection (&optional arg point)
- "Return the bounds of selection over next thing.
-
-See `sp-select-next-thing' for the meaning of ARG.
-
-If POINT is non-nil, it is assumed it's a point inside the buffer
-from which the selection extends, either forward or backward,
-depending on the value of ARG.
-
-The return value has the same format as `sp-get-sexp'. This does
-not necessarily represent a valid balanced expression!"
- (save-excursion
- (let* ((raw (sp--raw-argument-p arg))
- (arg (prefix-numeric-value arg))
- (beg point) (end point)
- (op "") (cl "")
- (prefix "")
- (suffix ""))
- (cond
- ;; select up until end of list
- ((and raw (= arg 4))
- (let ((enc (sp-get-enclosing-sexp)))
- (if (not enc)
- (error "No enclosing expression")
- (save-excursion
- (goto-char (sp-get enc :end-in))
- (-when-let (ok (sp-get-thing t))
- (sp-get ok
- (setq end :end)
- (setq cl :cl)
- (setq suffix :suffix)))))
- (unless point
- (-when-let (ok (sp-get-thing))
- (if (sp-compare-sexps ok enc)
- (progn
- (setq beg end)
- (setq end (sp-get enc :end-in)))
- (sp-get ok
- (setq beg :beg)
- (setq op :op)
- (setq prefix :prefix)))))))
- ;; select up until beg of list
- ((and raw (= arg -4))
- (let ((enc (sp-get-enclosing-sexp)))
- (if (not enc)
- (error "No enclosing expression")
- (save-excursion
- (goto-char (sp-get enc :beg-in))
- (-when-let (ok (sp-get-thing))
- (sp-get ok
- (setq beg :beg)
- (setq op :op)
- (setq prefix :prefix))))))
- (unless point
- (-when-let (ok (sp-get-thing t))
- (sp-get ok
- (setq end :end)
- (setq cl :cl)
- (setq suffix :suffix)))))
- ;; select the enclosing expression
- ((and raw (= (abs arg) 16))
- (let ((enc (sp-get-enclosing-sexp)))
- (if (not enc)
- (error "No enclosing expression")
- (sp-get enc (setq beg :beg) (setq end :end)
- (setq op :op) (setq cl :cl)
- (setq prefix :prefix)
- (setq suffix :suffix)))))
- ;; normal selection, select N expressions
- ((> arg 0)
- (let* ((first (sp-forward-sexp))
- (last first))
- (setq arg (1- arg))
- (setq beg (or point (sp-get first :beg)))
- (while (and (> arg 0) last)
- (setq last (sp-forward-sexp))
- (let ((nb (sp-get last :beg))) (when (< nb beg)
- (setq first last)
- (setq beg nb)))
- (setq arg (1- arg)))
- (unless (and point (= point beg))
- (sp-get first
- (setq beg :beg)
- (setq op :op)
- (setq prefix :prefix)))
- (sp-get last
- (setq end :end)
- (setq cl :cl)
- (setq suffix :suffix))))
- ;; normal select, select -N expressions
- ((< arg 0)
- (let* ((first (sp-backward-sexp))
- (last first))
- (setq arg (1+ arg))
- (setq end (or point (sp-get first :end)))
- (while (and (< arg 0) last)
- (setq last (sp-backward-sexp))
- (let ((ne (sp-get last :end))) (when (> ne end)
- (setq first last)
- (setq end ne)))
- (setq arg (1+ arg)))
- (sp-get last
- (setq beg :beg)
- (setq op :op)
- (setq prefix :prefix))
- (unless (and point (= point end))
- (sp-get first
- (setq end :end)
- (setq cl :cl)
- (setq suffix :suffix)))))
- ;; N = 0, select insides
- ((= arg 0)
- (let ((enc (sp-get-enclosing-sexp)))
- (if (not enc)
- (error "No enclosing expression")
- (save-excursion
- (goto-char (sp-get enc :beg-in))
- (-when-let (ok (sp-get-thing))
- (sp-get ok
- (setq beg :beg)
- (setq op :op)
- (setq prefix :prefix))))
- (save-excursion
- (goto-char (sp-get enc :end-in))
- (-when-let (ok (sp-get-thing t))
- (sp-get ok
- (setq end :end)
- (setq cl :cl)
- (setq suffix :suffix))))))))
- (list :beg beg :end end :op op :cl cl :prefix prefix :suffix suffix))))
-
-(defun sp-select-next-thing (&optional arg point)
- "Set active region over next thing as recognized by `sp-get-thing'.
-
-If ARG is positive N, select N expressions forward.
-
-If ARG is negative -N, select N expressions backward.
-
-If ARG is a raw prefix \\[universal-argument] select all the things up until the
-end of current expression.
-
-If ARG is a raw prefix \\[universal-argument] \\[universal-argument] select the current expression (as
-if doing `sp-backward-up-sexp' followed by
-`sp-select-next-thing').
-
-If ARG is number 0 (zero), select all the things inside the
-current expression.
-
-If POINT is non-nil, it is assumed it's a point inside the buffer
-from which the selection extends, either forward or backward,
-depending on the value of ARG.
-
-If the currently active region contains a balanced expression,
-following invocation of `sp-select-next-thing' will select the
-inside of this expression . Therefore calling this function
-twice with no active region will select the inside of the next
-expression.
-
-If the point is right in front of the expression any potential
-prefix is ignored. For example, '|(foo) would only select (foo)
-and not include ' in the selection. If you wish to also select
-the prefix, you have to move the point backwards.
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions."
- (interactive "P")
- (let* ((selection (sp--next-thing-selection arg point))
- (p (point))
- (b (sp-get selection :beg))
- (e (sp-get selection :end))
- contracted)
- ;; Show a helpful error if we're trying to move beyond the
- ;; beginning or end of the buffer.
- (when (or (null b) (null e))
- (user-error (if (bobp) "At beginning of buffer" "At end of buffer")))
- ;; if region is active and ready to use, check if this selection
- ;; == old selection. If so, reselect the insides
- (when (region-active-p)
- (let ((rb (region-beginning))
- (re (region-end)))
- (when (and (sp-get selection
- (or (= rb :beg)
- (= rb :beg-prf)))
- (= re (sp-get selection :end)))
- (sp-get selection
- (setq b :beg-in)
- (setq e :end-in))
- (setq contracted t))))
- ;; if we moved forward check if the old-point was in front of an
- ;; expression and after a prefix. If so, remove the prefix from
- ;; the selection
- (unless (and (> (prefix-numeric-value arg) 0)
- (not (sp--raw-argument-p arg))
- (= b p))
- (unless contracted (setq b (sp-get selection :beg-prf))))
- (push-mark b t t)
- (goto-char e)
- selection))
-
-(defun sp-select-previous-thing (&optional arg point)
- "Set active region over ARG previous things as recognized by `sp-get-thing'.
-
-If ARG is negative -N, select that many expressions forward.
-
-With `sp-navigate-consider-symbols' symbols and strings are also
-considered balanced expressions."
- (interactive "P")
- (sp-select-next-thing (sp--negate-argument arg) point))
-
-(defun sp-select-next-thing-exchange (&optional arg point)
- "Just like `sp-select-next-thing' but run `exchange-point-and-mark' afterwards."
- (interactive "P")
- (prog1
- (sp-select-next-thing arg point)
- (exchange-point-and-mark)))
-
-(defun sp-select-previous-thing-exchange (&optional arg point)
- "Just like `sp-select-previous-thing' but run `exchange-point-and-mark' afterwards."
- (interactive "P")
- (prog1
- (sp-select-previous-thing arg point)
- (exchange-point-and-mark)))
-
-(defun sp-mark-sexp (&optional arg allow-extend)
- "Set mark ARG balanced expressions from point.
-The place mark goes is the same place \\[sp-forward-sexp] would
-move to with the same argument.
-Interactively, if this command is repeated
-or (in Transient Mark mode) if the mark is active,
-it marks the next ARG sexps after the ones already marked.
-This command assumes point is not in a string or comment."
- (interactive "P\np")
- (cond ((and allow-extend
- (or (and (eq last-command this-command) (mark t))
- (and transient-mark-mode mark-active)))
- (setq arg (if arg (prefix-numeric-value arg)
- (if (< (mark) (point)) -1 1)))
- (set-mark
- (save-excursion
- (let ((p (point)))
- (goto-char (mark))
- (sp-forward-sexp arg)
- (unless (sp-region-ok-p p (point))
- (user-error "Can not extend selection: region invalid"))
- (point)))))
- (t
- (push-mark
- (save-excursion
- (sp-forward-sexp (prefix-numeric-value arg))
- (point))
- nil t))))
-
-(defun sp-delete-char (&optional arg)
- "Delete a character forward or move forward over a delimiter.
-
-If on an opening delimiter, move forward into balanced expression.
-
-If on a closing delimiter, refuse to delete unless the balanced
-expression is empty, in which case delete the entire expression.
-
-If the delimiter does not form a balanced expression, it will be
-deleted normally.
-
-With a numeric prefix argument N > 0, delete N characters forward.
-
-With a numeric prefix argument N < 0, delete N characters backward.
-
-With a numeric prefix argument N = 0, simply delete a character
-forward, without regard for delimiter balancing.
-
-If ARG is raw prefix argument \\[universal-argument], delete
-characters forward until a closing delimiter whose deletion would
-break the proper pairing is hit.
-
-Examples:
-
- (quu|x \"zot\") -> (quu| \"zot\")
-
- (quux |\"zot\") -> (quux \"|zot\") -> (quux \"|ot\")
-
- (foo (|) bar) -> (foo | bar)
-
- |(foo bar) -> (|foo bar)"
- (interactive "P")
- (sp--with-case-sensitive
- (let* ((raw (sp--raw-argument-p arg))
- ;; if you edit 10 gigabyte files in Emacs, you're gonna have
- ;; a bad time.
- (n (if raw 100000000
- (prefix-numeric-value arg))))
- (cond
- ((> n 0)
- (while (> n 0)
- (cond
- ((let ((ok (sp-point-in-empty-sexp)))
- (when ok
- (backward-char (length (car ok)))
- (delete-char (+ (length (car ok)) (length (cdr ok)))))
- ok)
- ;; make this customizable
- (setq n (1- n)))
- ((and (sp-point-in-string)
- (save-excursion (forward-char) (not (sp-point-in-string))))
- (setq n 0))
- ((sp--looking-at (sp--get-opening-regexp (sp--get-pair-list-context 'navigate)))
- (-if-let (thing (save-match-data (sp-get-thing)))
- (cond
- ((= (sp-get thing :end-in) (point))
- (setq n 0))
- ((= (sp-get thing :beg) (point))
- (goto-char (sp-get thing :beg-in)))
- (t
- (delete-char (length (match-string 0)))))
- (delete-char (length (match-string 0))))
- ;; make this customizable
- (setq n (1- n)))
- ((and (not (sp-point-in-string))
- (save-excursion (forward-char) (sp-point-in-string)))
- (forward-char)
- ;; make this customizable
- (setq n (1- n)))
- ((sp--looking-at (sp--get-closing-regexp (sp--get-pair-list-context 'navigate)))
- (if (save-match-data (sp-get-thing))
- ;; make this customizable -- maybe we want to skip and
- ;; continue deleting
- (setq n 0)
- (delete-char (length (match-string 0)))
- (setq n (1- n))))
- ((bound-and-true-p hungry-delete-mode)
- (hungry-delete-forward 1)
- (setq n (1- n)))
- (t
- (delete-char 1)
- (setq n (1- n))))))
- ((= n 0) (delete-char 1))
- (t (sp-backward-delete-char (sp--negate-argument arg)))))))
-
-(defun sp-backward-delete-char (&optional arg)
- "Delete a character backward or move backward over a delimiter.
-
-If on a closing delimiter, move backward into balanced expression.
-
-If on a opening delimiter, refuse to delete unless the balanced
-expression is empty, in which case delete the entire expression.
-
-If the delimiter does not form a balanced expression, it will be
-deleted normally.
-
-With a numeric prefix argument N > 0, delete N characters backward.
-
-With a numeric prefix argument N < 0, delete N characters forward.
-
-With a numeric prefix argument N = 0, simply delete a character
-backward, without regard for delimiter balancing.
-
-If ARG is raw prefix argument \\[universal-argument], delete
-characters backward until a opening delimiter whose deletion would
-break the proper pairing is hit.
-
-Examples:
-
- (\"zot\" q|uux) -> (\"zot\" |uux)
-
- (\"zot\"| quux) -> (\"zot|\" quux) -> (\"zo|\" quux)
-
- (foo (|) bar) -> (foo | bar)
-
- (foo bar)| -> (foo bar|)"
- (interactive "P")
- (if (and sp-autodelete-wrap
- (eq sp-last-operation 'sp-wrap-region))
- (sp-backward-unwrap-sexp)
- (sp--with-case-sensitive
- (let* ((raw (sp--raw-argument-p arg))
- ;; if you edit 10 gigabyte files in Emacs, you're gonna have
- ;; a bad time.
- (n (if raw 100000000
- (prefix-numeric-value arg))))
- (cond
- ((> n 0)
- (while (> n 0)
- (cond
- ((let ((ok (sp-point-in-empty-sexp)))
- (when ok
- (backward-char (length (car ok)))
- (delete-char (+ (length (car ok)) (length (cdr ok)))))
- ok)
- ;; make this customizable
- (setq n (1- n)))
- ((and (sp-point-in-string)
- (save-excursion (backward-char) (not (sp-point-in-string))))
- (setq n 0))
- ((sp--looking-back (sp--get-closing-regexp (sp--get-pair-list-context 'navigate)))
- (-if-let (thing (save-match-data (sp-get-thing t)))
- (cond
- ((= (sp-get thing :end) (point))
- (goto-char (sp-get thing :end-in)))
- ((= (sp-get thing :beg-in) (point))
- (setq n 0))
- (t
- (delete-char (- (length (match-string 0))))))
- (delete-char (- (length (match-string 0)))))
- ;; make this customizable
- (setq n (1- n)))
- ((and (not (sp-point-in-string))
- (save-excursion (backward-char) (sp-point-in-string)))
- (backward-char)
- ;; make this customizable
- (setq n (1- n)))
- ((sp--looking-back (sp--get-opening-regexp (sp--get-pair-list-context 'navigate)))
- (if (save-match-data (sp-get-thing t))
- ;; make this customizable -- maybe we want to skip and
- ;; continue deleting
- (setq n 0)
- (delete-char (- (length (match-string 0))))
- (setq n (1- n))))
- ((bound-and-true-p hungry-delete-mode)
- (hungry-delete-backward 1)
- (setq n (1- n)))
- (t
- (delete-char -1)
- (setq n (1- n))))))
- ((= n 0) (delete-char -1))
- (t (sp-delete-char (sp--negate-argument arg))))))))
-
-(put 'sp-backward-delete-char 'delete-selection 'supersede)
-(put 'sp-delete-char 'delete-selection 'supersede)
-
-(defun sp-point-in-empty-sexp (&optional pos)
- "Return non-nil if point is in empty sexp or string.
-
-The return value is active cons pair of opening and closing sexp
-delimiter enclosing this sexp."
- (setq pos (or pos (point)))
- (let (op act)
- (cond
- ((sp--looking-back (sp--get-opening-regexp (sp--get-pair-list-context 'navigate)))
- (setq op (match-string 0))
- (setq act (--first (equal (car it) op) sp-pair-list))
- (when (sp--looking-at (regexp-quote (cdr act))) act))
- ((sp-point-in-empty-string pos)))))
-
-(defun sp-point-in-empty-string (&optional pos)
- "Return non-nil if point is in empty string.
-
-The return value is actually cons pair of opening and closing
-string delimiter enclosing this string."
- (setq pos (or pos (point)))
- (when (and (sp-point-in-string)
- (save-excursion (if (= (point-max) (point))
- t
- (forward-char) (not (sp-point-in-string))))
- (save-excursion (backward-char) (not (sp-point-in-string))))
- (save-excursion
- (let* ((syntax (nth 3 (syntax-ppss pos)))
- (c (char-to-string (if (eq syntax t) (following-char) syntax))))
- (cons c c)))))
-
-(defun sp--use-subword ()
- "Return non-nil if word killing commands should kill subwords.
-This is the case if `subword-mode' is enabled and
-`sp-use-subword' is non-nil."
- (and sp-use-subword (bound-and-true-p subword-mode)))
-
-(defun sp--kill-word (&optional n)
- "Kill N words or subwords."
- (let ((n (or n 1)))
- (if (sp--use-subword)
- (subword-kill n)
- (kill-word n))))
-
-(defun sp--forward-word (&optional n)
- "Move forward N words or subwords."
- (let ((n (or n 1)))
- (if (sp--use-subword)
- (subword-forward n)
- (forward-word n))))
-
-(defun sp--backward-word (&optional n)
- "Move backward N words or subwords."
- (let ((n (or n 1)))
- (if (sp--use-subword)
- (subword-backward n)
- (backward-word n))))
-
-(defun sp-kill-symbol (&optional arg word)
- "Kill a symbol forward, skipping over any intervening delimiters.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction.
-
-See `sp-forward-symbol' for what constitutes a symbol."
- (interactive "p")
- (sp--with-case-sensitive
- (if (> arg 0)
- (while (> arg 0)
- (if (and word (sp-point-in-symbol))
- (sp--kill-word 1)
- (let ((s (sp-get-symbol))
- (p (point)))
- (when s
- (sp-get s
- (let ((delims (buffer-substring :beg-prf p)))
- (if (string-match-p "\\`\\(\\s.\\|\\s-\\)*\\'" delims)
- (if word
- (kill-region p (save-excursion (sp--forward-word) (point)))
- (kill-region p :end))
- (let ((kill-from (if (> p :beg-prf) :beg :beg-prf)))
- (goto-char kill-from)
- (if word
- (kill-region kill-from (save-excursion (sp--forward-word) (point)))
- (kill-region kill-from :end)))))))))
- (sp--cleanup-after-kill)
- (setq arg (1- arg)))
- (sp-backward-kill-symbol (sp--negate-argument arg) word))))
-
-(defun sp-kill-word (&optional arg)
- "Kill a word forward, skipping over intervening delimiters.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction."
- (interactive "p")
- (sp-kill-symbol arg t))
-
-(defun sp-delete-symbol (&optional arg word)
- "Delete a symbol forward, skipping over any intervening delimiters.
-
-Deleted symbol does not go to the clipboard or kill ring.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction.
-
-See `sp-forward-symbol' for what constitutes a symbol."
- (interactive "p")
- (let* ((kill-ring kill-ring)
- (select-enable-clipboard nil))
- (sp-kill-symbol arg word)))
-
-(defun sp-delete-word (&optional arg)
- "Delete a word forward, skipping over intervening delimiters.
-
-Deleted word does not go to the clipboard or kill ring.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction."
- (interactive "p")
- (sp-delete-symbol arg t))
-
-(defun sp-backward-kill-symbol (&optional arg word)
- "Kill a symbol backward, skipping over any intervening delimiters.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-forward direction.
-
-See `sp-backward-symbol' for what constitutes a symbol."
- (interactive "p")
- (sp--with-case-sensitive
- (if (> arg 0)
- (while (> arg 0)
- (if (and word (sp-point-in-symbol))
- (sp--kill-word -1)
- (let ((s (sp-get-symbol t))
- (p (point)))
- (when s
- (sp-get s
- (let ((delims (buffer-substring :end p)))
- (if (string-match-p "\\`\\(\\s.\\|\\s-\\)*\\'" delims)
- ;; Note: the arguments to kill-region are
- ;; "reversed" (end before beg) so that the
- ;; successive kills are prepended in the kill
- ;; ring. See the implementation of
- ;; `kill-region' for more info
- (if word
- (kill-region p (save-excursion (sp--backward-word) (point)))
- (kill-region p :beg-prf))
- (goto-char :end)
- (if word
- (kill-region :end (save-excursion (sp--backward-word) (point)))
- (kill-region :end :beg-prf))))))))
- (sp--cleanup-after-kill)
- (setq arg (1- arg)))
- (sp-kill-symbol (sp--negate-argument arg) word))))
-
-(defun sp-backward-kill-word (&optional arg)
- "Kill a word backward, skipping over intervening delimiters.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction."
- (interactive "p")
- (sp-backward-kill-symbol arg t))
-
-(defun sp-backward-delete-symbol (&optional arg word)
- "Delete a symbol backward, skipping over any intervening delimiters.
-
-Deleted symbol does not go to the clipboard or kill ring.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-forward direction.
-
-See `sp-backward-symbol' for what constitutes a symbol."
- (interactive "p")
- (let* ((kill-ring kill-ring)
- (select-enable-clipboard nil))
- (sp-backward-kill-symbol arg word)))
-
-(defun sp-backward-delete-word (&optional arg)
- "Delete a word backward, skipping over intervening delimiters.
-
-Deleted word does not go to the clipboard or kill ring.
-
-With ARG being positive number N, repeat that many times.
-
-With ARG being Negative number -N, repeat that many times in
-backward direction."
- (interactive "p")
- (sp-backward-delete-symbol arg t))
-
-(defun sp-delete-region (beg end)
- "Delete the text between point and mark, like `delete-region'.
-
-BEG and END are the bounds of region to be deleted.
-
-If that text is unbalanced, signal an error instead.
-With a prefix argument, skip the balance check."
- (interactive "r")
- (when (or current-prefix-arg
- (sp-region-ok-p beg end)
- (user-error (sp-message :unbalanced-region :return)))
- (setq this-command 'delete-region)
- (delete-region beg end)))
-
-(defun sp-kill-region (beg end)
- "Kill the text between point and mark, like `kill-region'.
-
-BEG and END are the bounds of region to be killed.
-
-If that text is unbalanced, signal an error instead.
-With a prefix argument, skip the balance check."
- (interactive "r")
- (when (or current-prefix-arg
- (sp-region-ok-p beg end)
- (user-error (sp-message :unbalanced-region :return)))
- (setq this-command 'kill-region)
- (kill-region beg end)))
-
-(defun sp-indent-defun (&optional arg)
- "Reindent the current defun.
-
-If point is inside a string or comment, fill the current
-paragraph instead, and with ARG, justify as well.
-
-Otherwise, reindent the current defun, and adjust the position
-of the point."
- (interactive "P")
- (if (sp-point-in-string-or-comment)
- (fill-paragraph arg)
- (let ((column (current-column))
- (indentation (sp--current-indentation)))
- (save-excursion
- (end-of-defun)
- (beginning-of-defun)
- (indent-sexp))
- (sp--back-to-indentation column indentation))))
-
-(cl-defun sp-region-ok-p (start end)
- "Test if region between START and END is balanced.
-
-A balanced region is one where all opening delimiters are matched
-by closing delimiters.
-
-This function does *not* check that the delimiters are correctly
-ordered, that is [(]) is correct even though it is not logically
-properly balanced."
- (interactive "r")
- (save-excursion
- (save-restriction
- (when (eq (sp-point-in-string start) (sp-point-in-string end))
- (narrow-to-region start end)
- (let ((regex (sp--get-allowed-regexp (-difference sp-pair-list (sp--get-allowed-pair-list)))))
- (goto-char (point-min))
- (while (or (prog1 (sp-forward-sexp)
- (sp-skip-forward-to-symbol))
- ;; skip impossible delimiters
- (when (looking-at-p regex)
- (goto-char (match-end 0)))))
- (looking-at-p "[[:blank:]\n]*\\'"))))))
-
-(defun sp-newline ()
- "Insert a newline and indent it.
-
-This is like `newline-and-indent', but it not only indents the
-line that the point is on but also the S-expression following the
-point, if there is one.
-
-If in a string, just insert a literal newline.
-
-If in a comment and if followed by invalid structure, call
-`indent-new-comment-line' to keep the invalid structure in a
-comment."
- (interactive)
- (cond
- ((sp-point-in-string)
- (newline))
- ((sp-point-in-comment)
- (if (sp-region-ok-p (point) (point-at-eol))
- (progn (newline-and-indent) (ignore-errors (indent-sexp)))
- (indent-new-comment-line)))
- (t
- (newline-and-indent)
- (ignore-errors (indent-sexp)))))
-
-(defun sp-comment ()
- "Insert the comment character and adjust hanging sexps such
- that it doesn't break structure."
- (interactive)
- (if (sp-point-in-string-or-comment)
- (if (= 1 (length (single-key-description last-command-event))) ;; pretty hacky
- (insert (single-key-description last-command-event))
- (insert comment-start))
- (sp--with-case-sensitive
- (let ((old-point (point))
- (column (current-column))
- (indentation (sp--current-indentation))
- (old-line (line-number-at-pos))
- (hsexp (sp-get-hybrid-sexp))
- (newline-inserted 0))
- (goto-char (sp-get hsexp :end))
- (if (and (sp--looking-at-p (concat "\\s-*" (sp--get-closing-regexp)))
- (= old-line (line-number-at-pos)))
- (progn
- (setq old-point (point))
- (newline)
- (setq newline-inserted (1+ (- (line-end-position) (point)))))
- (when (/= old-line (line-number-at-pos))
- (sp-backward-sexp)
- (setq old-point (+ old-point (skip-syntax-backward " ")))
- (newline)
- (setq newline-inserted (- (line-end-position) (point)))))
- ;; @{ indenting madness
- (goto-char old-point)
- (sp-get hsexp (sp--indent-region :beg (+ :end newline-inserted)))
- (sp--back-to-indentation column indentation)
- ;; @}
- (let ((comment-delim (or (cdr (--first (memq major-mode (car it)) sp-comment-string))
- comment-start)))
- (when (and (/= 0 (current-column))
- (not (sp--looking-back-p "\\s-")))
- (insert " "))
- (insert comment-delim)
- (when (/= newline-inserted 0)
- (save-excursion
- (forward-line 1)
- (indent-according-to-mode))))))))
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; show-smartparens-mode
-
-(defgroup show-smartparens nil
- "Show smartparens minor mode."
- :group 'smartparens)
-
-(defcustom sp-show-pair-delay 0.125
- "Time in seconds to delay before showing a matching pair."
- :type '(number :tag "seconds")
- :group 'show-smartparens)
-
-(defcustom sp-show-enclosing-pair-commands '(
- sp-show-enclosing-pair
- sp-forward-slurp-sexp
- sp-backward-slurp-sexp
- sp-forward-barf-sexp
- sp-backward-barf-sexp
- )
- "List of commands after which the enclosing pair is highlighted.
-
-After the next command the pair will automatically disappear."
- :type '(repeat symbol)
- :group 'show-smartparens)
-
-(defcustom sp-show-pair-from-inside nil
- "If non-nil, highlight the enclosing pair if immediately after
-the opening delimiter or before the closing delimiter."
- :type 'boolean
- :group 'show-smartparens)
-
-(defface sp-show-pair-match-face
- '((t (:inherit show-paren-match)))
- "`show-smartparens-mode' face used for a matching pair."
- :group 'show-smartparens)
-
-(defface sp-show-pair-mismatch-face
- '((t (:inherit show-paren-mismatch)))
- "`show-smartparens-mode' face used for a mismatching pair."
- :group 'show-smartparens)
-
-(defface sp-show-pair-enclosing
- '((t (:inherit highlight)))
- "The face used to highlight pair overlays."
- :group 'show-smartparens)
-
-(defvar sp-show-pair-idle-timer nil)
-
-(defvar sp-show-pair-overlays nil)
-
-(defvar sp-show-pair-previous-match-positions nil)
-
-(defvar sp-show-pair-previous-point nil)
-
-(defvar sp-show-pair-enc-overlays nil)
-
-;;;###autoload
-(define-minor-mode show-smartparens-mode
- "Toggle visualization of matching pairs. When enabled, any
-matching pair is highlighted after `sp-show-pair-delay' seconds
-of Emacs idle time if the point is immediately in front or after
-a pair. This mode works similarly to `show-paren-mode', but
-support custom pairs."
- :init-value nil
- :group 'show-smartparens
- (if show-smartparens-mode
- (unless sp-show-pair-idle-timer
- (setq sp-show-pair-idle-timer
- (run-with-idle-timer sp-show-pair-delay t
- 'sp-show--pair-function)))
- (when sp-show-pair-overlays
- (sp-show--pair-delete-overlays))))
-
-;;;###autoload
-(define-globalized-minor-mode show-smartparens-global-mode
- show-smartparens-mode
- turn-on-show-smartparens-mode)
-
-;;;###autoload
-(defun turn-on-show-smartparens-mode ()
- "Turn on `show-smartparens-mode'."
- (interactive)
- (unless (or (member major-mode sp-ignore-modes-list)
- (and (not (derived-mode-p 'comint-mode))
- (eq (get major-mode 'mode-class) 'special)))
- (show-smartparens-mode t)))
-
-;;;###autoload
-(defun turn-off-show-smartparens-mode ()
- "Turn off `show-smartparens-mode'."
- (interactive)
- (show-smartparens-mode -1))
-
-(defun sp-show-enclosing-pair ()
- "Highlight the enclosing pair around point."
- (interactive))
-
-(defun sp-highlight-current-sexp (arg)
- "Highlight the expression returned by the next command, preserving point position."
- (interactive "P")
- (let* ((cmd (read-key-sequence "" t))
- (com (key-binding cmd)))
- (if (commandp com)
- (save-excursion
- (let ((ok (call-interactively com)))
- (sp-show--pair-enc-function ok)))
- (execute-kbd-macro cmd))))
-
-(defun sp-show--pair-function ()
- "Display the show pair overlays and print the line of the
-matching paren in the echo area if not visible on screen."
- (when show-smartparens-mode
- (sp--with-case-sensitive
- (save-match-data
- (cl-labels ((scan-and-place-overlays
- (match &optional back)
- ;; we can use `sp-get-thing' here because we *are* at some
- ;; pair opening, and so only the tag or the sexp can trigger.
- (-if-let (ok (sp-get-thing back))
- (sp-get ok
- (when (or (and back
- (or (= :end (point))
- (= :beg-in (point))))
- (and (not back)
- (or (= :beg (point))
- (= :end-in (point)))))
- (sp-show--pair-create-overlays :beg :end :op-l :cl-l)
- (when (and sp-echo-match-when-invisible
- (not (or (active-minibuffer-window) cursor-in-echo-area)))
- (sp-show--pair-echo-match :beg :end :op-l :cl-l))))
- (if back
- (sp-show--pair-create-mismatch-overlay (- (point) (length match))
- (length match))
- (sp-show--pair-create-mismatch-overlay (point) (length match)))
- (setq sp-show-pair-previous-match-positions nil)
- (setq sp-show-pair-previous-point nil))))
- (let* ((pair-list (sp--get-allowed-pair-list))
- (opening (sp--get-opening-regexp pair-list))
- (closing (sp--get-closing-regexp pair-list))
- (allowed (and sp-show-pair-from-inside (sp--get-allowed-regexp))))
- (cond
- ;; if we are in a situation "()|", we should highlight the
- ;; regular pair and not the string pair "from inside"
- ((and (not (sp--evil-normal-state-p))
- (not (sp--evil-motion-state-p))
- (not (sp--evil-visual-state-p))
- (sp--looking-back (if sp-show-pair-from-inside allowed closing)))
- (scan-and-place-overlays (match-string 0) :back))
- ((or (and (or (sp--evil-normal-state-p)
- (sp--evil-motion-state-p)
- (sp--evil-visual-state-p))
- (sp--looking-at (sp--get-allowed-regexp)))
- (sp--looking-at (if sp-show-pair-from-inside allowed opening))
- (looking-at (sp--get-stringlike-regexp))
- (and (memq major-mode sp-navigate-consider-sgml-tags)
- (looking-at "<")))
- (scan-and-place-overlays (match-string 0)))
- ((or (sp--looking-back (if sp-show-pair-from-inside allowed closing))
- (sp--looking-back (sp--get-stringlike-regexp))
- (and (memq major-mode sp-navigate-consider-sgml-tags)
- (sp--looking-back ">")))
- (scan-and-place-overlays (match-string 0) :back))
- (sp-show-pair-overlays
- (sp-show--pair-delete-overlays)
- (setq sp-show-pair-previous-match-positions nil)
- (setq sp-show-pair-previous-point nil)))))))))
-
-(defun sp-show--pair-enc-function (&optional thing)
- "Display the show pair overlays for enclosing expression."
- (when show-smartparens-mode
- (-when-let (enc (or thing (sp-get-enclosing-sexp)))
- (sp-get enc (sp-show--pair-create-enc-overlays :beg :end :op-l :cl-l)))))
-
-(defun sp-show--pair-create-overlays (start end olen clen)
- "Create the show pair overlays."
- (when sp-show-pair-overlays
- (sp-show--pair-delete-overlays))
- (let* ((oleft (make-overlay start (+ start olen) nil t nil))
- (oright (make-overlay (- end clen) end nil t nil)))
- (setq sp-show-pair-overlays (cons oleft oright))
- (overlay-put oleft 'face 'sp-show-pair-match-face)
- (overlay-put oright 'face 'sp-show-pair-match-face)
- (overlay-put oleft 'priority 1000)
- (overlay-put oright 'priority 1000)
- (overlay-put oleft 'type 'show-pair)))
-
-(defun sp-show--pair-echo-match (start end olen clen)
- "Print the line of the matching paren in the echo area if not
-visible on screen. Needs to be called after the show-pair overlay
-has been created."
- (let ((match-positions (list start end olen clen)))
- (when (not (and (equal sp-show-pair-previous-match-positions match-positions)
- (equal sp-show-pair-previous-point (point))))
- (setq sp-show-pair-previous-match-positions match-positions)
- (setq sp-show-pair-previous-point (point))
- (let* ((visible-start (pos-visible-in-window-p start))
- (visible-end (pos-visible-in-window-p end))
- (where (cond
- ((not visible-start) start)
- ((not visible-end) end)
- nil)))
- (when where
- (save-excursion
- (let* ((from (progn (goto-char where) (beginning-of-line) (point)))
- (to (progn (end-of-line) (point)))
- (line (buffer-substring from to))
- (message-log-max)) ;; don't log in messages
- ;; Add smartparens overlay for opening parens
- (let* ((i1 (- start from))
- (i2 (+ i1 olen)))
- (when (and (< i1 (length line)) (>= i2 0))
- (add-face-text-property (max i1 0) (min i2 (length line))
- 'sp-show-pair-match-face nil line)))
- ;; Add smartparens overlay for closing parens
- (let* ((i1 (- end from 1))
- (i2 (+ i1 clen)))
- (when (and (< i1 (length line)) (>= i2 0))
- (add-face-text-property (max i1 0) (min i2 (length line))
- 'sp-show-pair-match-face nil line)))
- ;; echo line of match
- (message "Matches: %s" (string-trim line)))))))))
-
-(defun sp-show--pair-create-enc-overlays (start end olen clen)
- "Create the show pair enclosing overlays"
- (when sp-show-pair-enc-overlays
- (sp-show--pair-delete-enc-overlays))
- (let* ((oleft (make-overlay start (+ start olen) nil t nil))
- (oright (make-overlay (- end clen) end nil t nil)))
- (setq sp-show-pair-enc-overlays (cons oleft oright))
- (overlay-put oleft 'face 'sp-show-pair-enclosing)
- (overlay-put oright 'face 'sp-show-pair-enclosing)
- (overlay-put oleft 'priority 1000)
- (overlay-put oright 'priority 1000)
- (overlay-put oleft 'type 'show-pair-enc)))
-
-(defun sp-show--pair-create-mismatch-overlay (start len)
- "Create the mismatch pair overlay."
- (when sp-show-pair-overlays
- (sp-show--pair-delete-overlays))
- (let ((o (make-overlay start (+ start len) nil t nil)))
- (setq sp-show-pair-overlays (cons o nil))
- (overlay-put o 'face 'sp-show-pair-mismatch-face)
- (overlay-put o 'priority 1000)
- (overlay-put o 'type 'show-pair)))
-
-(defun sp-show--pair-delete-overlays ()
- "Remove both show pair overlays."
- (when sp-show-pair-overlays
- (when (car sp-show-pair-overlays)
- (delete-overlay (car sp-show-pair-overlays)))
- (when (cdr sp-show-pair-overlays)
- (delete-overlay (cdr sp-show-pair-overlays)))
- (setq sp-show-pair-overlays nil)))
-
-(defun sp-show--pair-delete-enc-overlays ()
- "Remove both show pair enclosing overlays."
- (when sp-show-pair-enc-overlays
- (when (car sp-show-pair-enc-overlays)
- (delete-overlay (car sp-show-pair-enc-overlays)))
- (when (cdr sp-show-pair-enc-overlays)
- (delete-overlay (cdr sp-show-pair-enc-overlays)))
- (setq sp-show-pair-enc-overlays nil)))
-
-
-;; global initialization
-(defadvice delete-backward-char (before sp-delete-pair-advice activate)
- (save-match-data
- (sp-delete-pair (ad-get-arg 0))))
-(defadvice haskell-indentation-delete-backward-char (before sp-delete-pair-advice activate)
- (save-match-data
- (sp-delete-pair (ad-get-arg 0))))
-(add-hook 'post-command-hook 'sp--post-command-hook-handler)
-(sp--set-base-key-bindings)
-(sp--update-override-key-bindings)
-
-(defadvice company--insert-candidate (after sp-company--insert-candidate activate)
- "If `smartparens-mode' is active, we check if the completed string
-has a pair definition. If so, we insert the closing pair."
- (when smartparens-mode
- (sp-insert-pair))
- ad-return-value)
-
-(defadvice hippie-expand (after sp-auto-complete-advice activate)
- (when smartparens-mode
- (sp-insert-pair)))
-
-(defvar sp--mc/cursor-specific-vars
- '(
- sp-wrap-point
- sp-wrap-mark
- sp-last-wrapped-region
- sp-pair-overlay-list
- sp-wrap-overlays
- sp-wrap-tag-overlays
- sp-last-operation
- sp-previous-point
- )
- "A list of vars that need to be tracked on a per-cursor basis.")
-
-(defvar mc/cursor-specific-vars)
-(eval-after-load 'multiple-cursors
- '(dolist (it sp--mc/cursor-specific-vars)
- (add-to-list 'mc/cursor-specific-vars it)))
-
-(provide 'smartparens)
-
-;; Local Variables:
-;; coding: utf-8
-;; eval: (font-lock-add-keywords nil `((,(concat "(" (regexp-opt '("sp-do-move-op" "sp-do-move-cl" "sp-do-put-op" "sp-do-put-cl" "sp-do-del-op" "sp-do-del-cl") t) "\\_>") 1 'font-lock-variable-name-face)))
-;; End:
-
-;;; smartparens.el ends here
diff --git a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.elc b/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.elc
deleted file mode 100644
index 5fd1098..0000000
Binary files a/emacs/.emacs.d/elpa/smartparens-20171201.242/smartparens.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-autoloads.el b/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-autoloads.el
deleted file mode 100644
index 1b7d289..0000000
--- a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-autoloads.el
+++ /dev/null
@@ -1,15 +0,0 @@
-;;; smartrep-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil nil ("smartrep.el") (23124 14371 418857 34000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; smartrep-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-pkg.el b/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-pkg.el
deleted file mode 100644
index 4c4ac3a..0000000
--- a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "smartrep" "20150508.1930" "Support sequential operation which omitted prefix keys." 'nil :commit "f0ff5a6d7b8603603598ae3045c98b011e58d86e" :url "https://github.com/myuhe/smartrep.el" :keywords '("convenience"))
diff --git a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.el b/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.el
deleted file mode 100644
index a8fd5ac..0000000
--- a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.el
+++ /dev/null
@@ -1,195 +0,0 @@
-;;; smartrep.el --- Support sequential operation which omitted prefix keys.
-
-;; Filename: smartrep.el
-;; Description: Support sequential operation which omitted prefix keys.
-;; Author: myuhe
-;; Maintainer: myuhe
-;; Copyright (C) :2011,2012 myuhe all rights reserved.
-;; Created: :2011-12-19
-;; Version: 1.0.0
-;; Package-Version: 20150508.1930
-;; Keywords: convenience
-;; URL: https://github.com/myuhe/smartrep.el
-
-;; 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, or (at your option)
-;; any later version.
-
-;; This file 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 GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 0:110-1301, USA.
-
-;;; Commentary:
-
-;; Installation:
-;; Put the smartrep.el to your load-path.
-;; And add to .emacs: (require 'smartrep)
-
-;;; Changelog:
-
-;; 2012-01-06 Remove unnecessary cord.
-;; 2012-01-06 read-key is replaced read-event for compatibility. thanks @tomy_kaira !!
-;; 2012-01-11 Support function calling form. (buzztaiki)
-;; Call interactively when command. (buzztaiki)
-;; Support unquoted function. (buzztaiki)
-;; 2012-01-11 new command `smartrep-restore-original-position' `smartrep-quit' (rubikitch)
-;; add mode line notification (rubikitch)
-;; 2012-01-12 add mode-line-color notification
-;;
-
-;;; Code:
-(eval-when-compile
- (require 'cl))
-
-(defgroup smartrep nil
- "Support sequential operation which omitted prefix keys"
- :group 'keyboard)
-
-(defcustom smartrep-mode-line-string-activated "========== SMARTREP =========="
- "Lighter when smartrep-mode is activated"
- :type 'string
- :group 'smartrep)
-
-(defcustom smartrep-mode-line-active-bg (face-background 'highlight)
- "Background color when smartrep-mode is activated"
- :type 'string
- :group 'smartrep)
-
-(defvar smartrep-key-string nil)
-
-(defvar smartrep-read-event
- (if (fboundp 'read-event) 'read-event 'read-key)
- "Function to be used for reading keyboard events.")
-
-(defvar smartrep-mode-line-string nil
- "Mode line indicator for smartrep.")
-
-(defvar smartrep-global-alist-hash (make-hash-table :test 'equal))
-
-(defvar smartrep-original-position nil
- "A cons holding the point and window-start when smartrep is invoked.")
-
-(let ((cell (or (memq 'mode-line-position mode-line-format)
- (memq 'mode-line-buffer-identification mode-line-format)))
- (newcdr 'smartrep-mode-line-string))
- (when cell
- (unless (member newcdr mode-line-format)
- (setcdr cell (cons newcdr (cdr cell))))))
-
-(defun smartrep-define-key (keymap prefix alist)
- (when (eq keymap global-map)
- (puthash prefix alist smartrep-global-alist-hash))
- (setq alist
- (if (eq keymap global-map)
- alist
- (append alist (gethash prefix smartrep-global-alist-hash))))
- (let ((oa (make-vector 13 nil)))
- (mapc (lambda(x)
- (let ((obj (intern (prin1-to-string
- (smartrep-unquote (cdr x)))
- oa)))
- (fset obj (smartrep-map alist))
- (define-key keymap
- (read-kbd-macro
- (concat prefix " " (car x))) obj)))
- alist)))
-(put 'smartrep-define-key 'lisp-indent-function 2)
-
-(defun smartrep-map (alist)
- (lexical-let ((lst alist))
- (lambda () (interactive) (smartrep-map-internal lst))))
-
-(defun smartrep-restore-original-position ()
- (interactive)
- (destructuring-bind (pt . wstart) smartrep-original-position
- (goto-char pt)
- (set-window-start (selected-window) wstart)))
-
-(defun smartrep-quit ()
- (interactive)
- (setq smartrep-mode-line-string "")
- (smartrep-restore-original-position)
- (keyboard-quit))
-
-(defun smartrep-map-internal (lst)
- (interactive)
- (setq smartrep-mode-line-string smartrep-mode-line-string-activated)
- (let ((ml-original-bg (face-background 'mode-line)))
- (when smartrep-mode-line-active-bg
- (set-face-background 'mode-line smartrep-mode-line-active-bg)
- (force-mode-line-update))
- (setq smartrep-original-position (cons (point) (window-start)))
- (unwind-protect
- (let ((repeat-repeat-char last-command-event))
- (smartrep-do-fun repeat-repeat-char lst)
- (when repeat-repeat-char
- (smartrep-read-event-loop lst)))
- (setq smartrep-mode-line-string "")
- (when smartrep-mode-line-active-bg
- (set-face-background 'mode-line ml-original-bg)
- (force-mode-line-update)))))
-
-(defun smartrep-read-event-loop (lst)
- (lexical-let ((undo-inhibit-record-point t))
- (unwind-protect
- (while
- (lexical-let ((evt (funcall smartrep-read-event)))
- ;; (eq (or (car-safe evt) evt)
- ;; (or (car-safe repeat-repeat-char)
- ;; repeat-repeat-char))
- (setq smartrep-key-string evt)
- (smartrep-extract-char evt lst))
- (smartrep-do-fun smartrep-key-string lst)))
- (setq unread-command-events (list last-input-event))))
-
-(defun smartrep-extract-char (char alist)
- (car (smartrep-filter char alist)))
-
-(defun smartrep-extract-fun (char alist)
- (let* ((rawform (cdr (smartrep-filter char alist)))
- (form (smartrep-unquote rawform)))
- (cond
- ((commandp form)
- (setq this-command form)
- (unwind-protect
- (call-interactively form)
- (setq last-command form)))
- ((functionp form) (funcall form))
- ((and (listp form) (symbolp (car form))) (eval form))
- (t (error "Unsupported form %c %s" char rawform)))))
-
-(defun smartrep-do-fun (char alist)
- (condition-case err
- (progn
- (run-hooks 'pre-command-hook)
- (smartrep-extract-fun char alist)
- (run-hooks 'post-command-hook))
- (error
- (ding)
- (message "%s" (cdr err)))))
-
-
-(defun smartrep-unquote (form)
- (if (and (listp form) (memq (car form) '(quote function)))
- (eval form)
- form))
-
-(defun smartrep-filter (char alist)
- (loop for (key . form) in alist
- for rkm = (read-kbd-macro key)
- for number = (if (vectorp rkm)
- (aref rkm 0)
- (string-to-char rkm))
- if (eq char number)
- return (cons number form)))
-
-(provide 'smartrep)
-
-;;; smartrep.el ends here
diff --git a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.elc b/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.elc
deleted file mode 100644
index 8915c93..0000000
Binary files a/emacs/.emacs.d/elpa/smartrep-20150508.1930/smartrep.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-autoloads.el b/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-autoloads.el
deleted file mode 100644
index da2996a..0000000
--- a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-autoloads.el
+++ /dev/null
@@ -1,32 +0,0 @@
-;;; swiper-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "swiper" "swiper.el" (23124 14377 85550 917000))
-;;; Generated autoloads from swiper.el
-
-(autoload 'swiper-avy "swiper" "\
-Jump to one of the current swiper candidates.
-
-\(fn)" t nil)
-
-(autoload 'swiper "swiper" "\
-`isearch' with an overview.
-When non-nil, INITIAL-INPUT is the initial search pattern.
-
-\(fn &optional INITIAL-INPUT)" t nil)
-
-(autoload 'swiper-all "swiper" "\
-Run `swiper' for all open buffers.
-
-\(fn &optional INITIAL-INPUT)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; swiper-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-pkg.el b/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-pkg.el
deleted file mode 100644
index 4768740..0000000
--- a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "swiper" "20180102.1035" "Isearch with an overview. Oh, man!" '((emacs "24.1") (ivy "0.9.0")) :commit "71476ff62b6c42f8a5cd7776f37ef8db0c1d8945" :url "https://github.com/abo-abo/swiper" :keywords '("matching"))
diff --git a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.el b/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.el
deleted file mode 100644
index 0bcc44f..0000000
--- a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.el
+++ /dev/null
@@ -1,988 +0,0 @@
-;;; swiper.el --- Isearch with an overview. Oh, man! -*- lexical-binding: t -*-
-
-;; Copyright (C) 2015-2017 Free Software Foundation, Inc.
-
-;; Author: Oleh Krehel
-;; URL: https://github.com/abo-abo/swiper
-;; Package-Version: 20180102.1035
-;; Version: 0.10.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.9.0"))
-;; Keywords: matching
-
-;; This file is part of GNU Emacs.
-
-;; This file 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, 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.
-
-;; For a full copy of the GNU General Public License
-;; see .
-
-;;; Commentary:
-;;
-;; This package gives an overview of the current regex search
-;; candidates. The search regex can be split into groups with a
-;; space. Each group is highlighted with a different face.
-;;
-;; It can double as a quick `regex-builder', although only single
-;; lines will be matched.
-
-;;; Code:
-(require 'ivy)
-
-(defgroup swiper nil
- "`isearch' with an overview."
- :group 'matching
- :prefix "swiper-")
-
-(defface swiper-match-face-1
- '((t (:inherit isearch-lazy-highlight-face)))
- "The background face for `swiper' matches.")
-
-(defface swiper-match-face-2
- '((t (:inherit isearch)))
- "Face for `swiper' matches modulo 1.")
-
-(defface swiper-match-face-3
- '((t (:inherit match)))
- "Face for `swiper' matches modulo 2.")
-
-(defface swiper-match-face-4
- '((t (:inherit isearch-fail)))
- "Face for `swiper' matches modulo 3.")
-
-(defface swiper-line-face
- '((t (:inherit highlight)))
- "Face for current `swiper' line.")
-
-(defcustom swiper-faces '(swiper-match-face-1
- swiper-match-face-2
- swiper-match-face-3
- swiper-match-face-4)
- "List of `swiper' faces for group matches."
- :group 'ivy-faces
- :type 'list)
-
-(defcustom swiper-min-highlight 2
- "Only highlight matches for regexps at least this long."
- :type 'integer)
-
-(defcustom swiper-include-line-number-in-search nil
- "Include line number in text of search candidates."
- :type 'boolean
- :group 'swiper)
-
-(defcustom swiper-goto-start-of-match nil
- "When non-nil, go to the start of the match, not its end."
- :type 'boolean
- :group 'swiper)
-
-(defvar swiper-map
- (let ((map (make-sparse-keymap)))
- (define-key map (kbd "M-q") 'swiper-query-replace)
- (define-key map (kbd "C-l") 'swiper-recenter-top-bottom)
- (define-key map (kbd "C-'") 'swiper-avy)
- (define-key map (kbd "C-7") 'swiper-mc)
- (define-key map (kbd "C-c C-f") 'swiper-toggle-face-matching)
- map)
- "Keymap for swiper.")
-
-(defun swiper-query-replace ()
- "Start `query-replace' with string to replace from last search string."
- (interactive)
- (if (null (window-minibuffer-p))
- (user-error "Should only be called in the minibuffer through `swiper-map'")
- (let* ((enable-recursive-minibuffers t)
- (from (ivy--regex ivy-text))
- (to (minibuffer-with-setup-hook
- (lambda ()
- (setq minibuffer-default
- (if (string-match "\\`\\\\_<\\(.*\\)\\\\_>\\'" ivy-text)
- (match-string 1 ivy-text)
- ivy-text)))
- (read-from-minibuffer (format "Query replace %s with: " from)))))
- (swiper--cleanup)
- (ivy-exit-with-action
- (lambda (_)
- (with-ivy-window
- (move-beginning-of-line 1)
- (let ((inhibit-read-only t))
- (perform-replace from to
- t t nil))))))))
-
-(defun swiper-all-query-replace ()
- "Start `query-replace' with string to replace from last search string."
- (interactive)
- (if (null (window-minibuffer-p))
- (user-error
- "Should only be called in the minibuffer through `swiper-all-map'")
- (let* ((enable-recursive-minibuffers t)
- (from (ivy--regex ivy-text))
- (to (query-replace-read-to from "Query replace" t)))
- (swiper--cleanup)
- (ivy-exit-with-action
- (lambda (_)
- (let ((wnd-conf (current-window-configuration))
- (inhibit-message t))
- (unwind-protect
- (dolist (cand ivy--old-cands)
- (let ((buffer (get-text-property 0 'buffer cand)))
- (switch-to-buffer buffer)
- (goto-char (point-min))
- (perform-replace from to t t nil)))
- (set-window-configuration wnd-conf))))))))
-
-(defvar avy-background)
-(defvar avy-all-windows)
-(defvar avy-style)
-(defvar avy-keys)
-(declare-function avy--regex-candidates "ext:avy")
-(declare-function avy--process "ext:avy")
-(declare-function avy--overlay-post "ext:avy")
-(declare-function avy-action-goto "ext:avy")
-(declare-function avy-candidate-beg "ext:avy")
-(declare-function avy--done "ext:avy")
-(declare-function avy--make-backgrounds "ext:avy")
-(declare-function avy-window-list "ext:avy")
-(declare-function avy-read "ext:avy")
-(declare-function avy-read-de-bruijn "ext:avy")
-(declare-function avy-tree "ext:avy")
-(declare-function avy-push-mark "ext:avy")
-(declare-function avy--remove-leading-chars "ext:avy")
-
-;;;###autoload
-(defun swiper-avy ()
- "Jump to one of the current swiper candidates."
- (interactive)
- (unless (require 'avy nil 'noerror)
- (error "Package avy isn't installed"))
- (unless (string= ivy-text "")
- (let* ((avy-all-windows nil)
- ;; We'll have overlapping overlays, so we sort all the
- ;; overlays in the visible region by their start, and then
- ;; throw out non-Swiper overlays or overlapping Swiper
- ;; overlays.
- (visible-overlays (cl-sort (with-ivy-window
- (overlays-in (window-start)
- (window-end)))
- #'< :key #'overlay-start))
- (min-overlay-start 0)
- (overlays-for-avy (cl-remove-if-not
- (lambda (ov)
- (when (and (>= (overlay-start ov)
- min-overlay-start)
- (memq (overlay-get ov 'face)
- swiper-faces))
- (setq min-overlay-start (overlay-start ov))))
- visible-overlays))
- (candidates (append
- (mapcar (lambda (ov)
- (cons (overlay-start ov)
- (overlay-get ov 'window)))
- overlays-for-avy)
- (save-excursion
- (save-restriction
- (narrow-to-region (window-start) (window-end))
- (goto-char (point-min))
- (forward-line)
- (let ((cands))
- (while (< (point) (point-max))
- (push (cons (1+ (point))
- (selected-window))
- cands)
- (forward-line))
- cands)))))
- (candidate (unwind-protect
- (prog2
- (avy--make-backgrounds
- (append (avy-window-list)
- (list (ivy-state-window ivy-last))))
- (if (eq avy-style 'de-bruijn)
- (avy-read-de-bruijn
- candidates avy-keys)
- (avy-read (avy-tree candidates avy-keys)
- #'avy--overlay-post
- #'avy--remove-leading-chars))
- (avy-push-mark))
- (avy--done))))
- (if (window-minibuffer-p (cdr candidate))
- (progn
- (ivy-set-index (- (line-number-at-pos (car candidate)) 2))
- (ivy--exhibit)
- (ivy-done)
- (ivy-call))
- (ivy-quit-and-run
- (avy-action-goto (avy-candidate-beg candidate)))))))
-
-(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors-core")
-(declare-function multiple-cursors-mode "ext:multiple-cursors-core")
-
-(defun swiper-mc ()
- "Create a fake cursor for each `swiper' candidate."
- (interactive)
- (unless (require 'multiple-cursors nil t)
- (error "Multiple-cursors isn't installed"))
- (unless (window-minibuffer-p)
- (error "Call me only from `swiper'"))
- (let ((cands (nreverse ivy--old-cands)))
- (unless (string= ivy-text "")
- (ivy-exit-with-action
- (lambda (_)
- (let (cand)
- (while (setq cand (pop cands))
- (swiper--action cand)
- (when cands
- (mc/create-fake-cursor-at-point))))
- (multiple-cursors-mode 1))))))
-
-(defun swiper-recenter-top-bottom (&optional arg)
- "Call (`recenter-top-bottom' ARG)."
- (interactive "P")
- (with-ivy-window
- (recenter-top-bottom arg)))
-
-(defvar swiper-font-lock-exclude
- '(bbdb-mode
- bookmark-bmenu-mode
- package-menu-mode
- gnus-summary-mode
- gnus-article-mode
- gnus-group-mode
- emms-playlist-mode
- emms-stream-mode
- erc-mode
- forth-mode
- forth-block-mode
- nix-mode
- org-agenda-mode
- dired-mode
- jabber-chat-mode
- elfeed-search-mode
- elfeed-show-mode
- fundamental-mode
- Man-mode
- woman-mode
- mu4e-view-mode
- mu4e-headers-mode
- notmuch-tree-mode
- notmuch-search-mode
- help-mode
- debbugs-gnu-mode
- occur-mode
- occur-edit-mode
- bongo-mode
- bongo-library-mode
- magit-popup-mode
- adoc-mode
- bongo-playlist-mode
- eww-mode
- treemacs-mode
- twittering-mode
- vc-dir-mode
- rcirc-mode
- circe-channel-mode
- circe-server-mode
- circe-query-mode
- sauron-mode
- w3m-mode)
- "List of major-modes that are incompatible with `font-lock-ensure'.")
-
-(defun swiper-font-lock-ensure-p ()
- "Return non-nil if we should `font-lock-ensure'."
- (or (derived-mode-p 'magit-mode)
- (bound-and-true-p magit-blame-mode)
- (memq major-mode swiper-font-lock-exclude)))
-
-(defun swiper-font-lock-ensure ()
- "Ensure the entired buffer is highlighted."
- (unless (swiper-font-lock-ensure-p)
- (unless (or (> (buffer-size) 100000) (null font-lock-mode))
- (if (fboundp 'font-lock-ensure)
- (font-lock-ensure)
- (with-no-warnings (font-lock-fontify-buffer))))))
-
-(defvar swiper--format-spec ""
- "Store the current candidates format spec.")
-
-(defvar swiper--width nil
- "Store the number of digits needed for the longest line nubmer.")
-
-(defvar swiper-use-visual-line nil
- "When non-nil, use `line-move' instead of `forward-line'.")
-
-(declare-function outline-show-all "outline")
-
-(defun swiper--candidates (&optional numbers-width)
- "Return a list of this buffer lines.
-
-NUMBERS-WIDTH, when specified, is used for width spec of line
-numbers; replaces calculating the width from buffer line count."
- (if (and visual-line-mode
- ;; super-slow otherwise
- (< (buffer-size) 20000))
- (progn
- (when (eq major-mode 'org-mode)
- (require 'outline)
- (if (fboundp 'outline-show-all)
- (outline-show-all)
- (with-no-warnings
- (show-all))))
- (setq swiper-use-visual-line t))
- (setq swiper-use-visual-line nil))
- (let ((n-lines (count-lines (point-min) (point-max))))
- (unless (zerop n-lines)
- (setq swiper--width (or numbers-width
- (1+ (floor (log n-lines 10)))))
- (setq swiper--format-spec
- (format "%%-%dd " swiper--width))
- (let ((line-number 0)
- (advancer (if swiper-use-visual-line
- (lambda (arg) (line-move arg t))
- #'forward-line))
- candidates)
- (save-excursion
- (goto-char (point-min))
- (swiper-font-lock-ensure)
- (while (< (point) (point-max))
- (let ((str (concat
- " "
- (replace-regexp-in-string
- "\t" " "
- (if swiper-use-visual-line
- (buffer-substring
- (save-excursion
- (beginning-of-visual-line)
- (point))
- (save-excursion
- (end-of-visual-line)
- (point)))
- (buffer-substring
- (point)
- (line-end-position)))))))
- (setq str (ivy-cleanup-string str))
- (let ((line-number-str
- (format swiper--format-spec (cl-incf line-number))))
- (if swiper-include-line-number-in-search
- (setq str (concat line-number-str str))
- (put-text-property
- 0 1 'display line-number-str str))
- (put-text-property
- 0 1 'swiper-line-number line-number-str str))
- (push str candidates))
- (funcall advancer 1))
- (nreverse candidates))))))
-
-(defvar swiper--opoint 1
- "The point when `swiper' starts.")
-
-;;;###autoload
-(defun swiper (&optional initial-input)
- "`isearch' with an overview.
-When non-nil, INITIAL-INPUT is the initial search pattern."
- (interactive)
- (swiper--ivy (swiper--candidates) initial-input))
-
-(declare-function string-trim-right "subr-x")
-(defvar swiper--current-window-start nil)
-
-(defun swiper-occur (&optional revert)
- "Generate a custom occur buffer for `swiper'.
-When REVERT is non-nil, regenerate the current *ivy-occur* buffer."
- (require 'subr-x)
- (let* ((buffer (ivy-state-buffer ivy-last))
- (fname (propertize
- (with-ivy-window
- (if (buffer-file-name buffer)
- (file-name-nondirectory
- (buffer-file-name buffer))
- (buffer-name buffer)))
- 'face
- 'compilation-info))
- (cands (mapcar
- (lambda (s)
- (format "%s:%s:%s"
- fname
- (propertize
- (string-trim-right
- (get-text-property 0 'swiper-line-number s))
- 'face 'compilation-line-number)
- (substring s 1)))
- (if (null revert)
- ivy--old-cands
- (setq ivy--old-re nil)
- (let ((ivy--regex-function 'swiper--re-builder))
- (ivy--filter
- (progn (string-match "\"\\(.*\\)\"" (buffer-name))
- (match-string 1 (buffer-name)))
- (with-current-buffer buffer
- (swiper--candidates))))))))
- (unless (eq major-mode 'ivy-occur-grep-mode)
- (ivy-occur-grep-mode)
- (font-lock-mode -1))
- (setq swiper--current-window-start nil)
- (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
- default-directory))
- (insert (format "%d candidates:\n" (length cands)))
- (ivy--occur-insert-lines
- (mapcar
- (lambda (cand) (concat "./" cand))
- cands))
- (goto-char (point-min))
- (forward-line 4)))
-
-(ivy-set-occur 'swiper 'swiper-occur)
-
-(declare-function evil-set-jump "ext:evil-jumps")
-
-(defvar swiper--current-line nil)
-(defvar swiper--current-match-start nil)
-(defvar swiper--point-min nil)
-(defvar swiper--point-max nil)
-(defvar swiper--reveal-mode nil)
-
-(defun swiper--init ()
- "Perform initialization common to both completion methods."
- (setq swiper--current-line nil)
- (setq swiper--current-match-start nil)
- (setq swiper--current-window-start nil)
- (setq swiper--opoint (point))
- (setq swiper--point-min (point-min))
- (setq swiper--point-max (point-max))
- (when (setq swiper--reveal-mode
- (bound-and-true-p reveal-mode))
- (reveal-mode -1))
- (when (bound-and-true-p evil-mode)
- (evil-set-jump)))
-
-(declare-function char-fold-to-regexp "char-fold")
-
-(defun swiper--re-builder (str)
- "Transform STR into a swiper regex.
-This is the regex used in the minibuffer where candidates have
-line numbers. For the buffer, use `ivy--regex' instead."
- (let* ((re-builder
- (or (cdr (assoc 'swiper ivy-re-builders-alist))
- (cdr (assoc t ivy-re-builders-alist))))
- (re (cond
- ((equal str "")
- "")
- ((equal str "^")
- (setq ivy--subexps 0)
- ".")
- ((string-match "^\\^" str)
- (let ((re (funcall re-builder (substring str 1))))
- (if (zerop ivy--subexps)
- (prog1 (format "^ ?\\(%s\\)" re)
- (setq ivy--subexps 1))
- (format "^ %s" re))))
- ((eq (bound-and-true-p search-default-mode) 'char-fold-to-regexp)
- (mapconcat #'char-fold-to-regexp (ivy--split str) ".*"))
- (t
- (funcall re-builder str)))))
- re))
-
-(defvar swiper-history nil
- "History for `swiper'.")
-
-(defvar swiper-invocation-face nil
- "The face at the point of invocation of `swiper'.")
-
-(defcustom swiper-stay-on-quit nil
- "When non-nil don't go back to search start on abort."
- :type 'boolean)
-
-(defun swiper--ivy (candidates &optional initial-input)
- "Select one of CANDIDATES and move there.
-When non-nil, INITIAL-INPUT is the initial search pattern."
- (swiper--init)
- (setq swiper-invocation-face
- (plist-get (text-properties-at (point)) 'face))
- (let ((preselect
- (if swiper-use-visual-line
- (count-screen-lines
- (point-min)
- (save-excursion (beginning-of-visual-line) (point)))
- (1- (line-number-at-pos))))
- (minibuffer-allow-text-properties t)
- res)
- (unwind-protect
- (and
- (setq res
- (ivy-read
- "Swiper: "
- candidates
- :initial-input initial-input
- :keymap swiper-map
- :preselect preselect
- :require-match t
- :update-fn #'swiper--update-input-ivy
- :unwind #'swiper--cleanup
- :action #'swiper--action
- :re-builder #'swiper--re-builder
- :history 'swiper-history
- :caller 'swiper))
- (point))
- (unless (or res swiper-stay-on-quit)
- (goto-char swiper--opoint))
- (when (and (null res) (> (length ivy-text) 0))
- (cl-pushnew ivy-text swiper-history))
- (when swiper--reveal-mode
- (reveal-mode 1)))))
-
-(defun swiper-toggle-face-matching ()
- "Toggle matching only the candidates with `swiper-invocation-face'."
- (interactive)
- (setf (ivy-state-matcher ivy-last)
- (if (ivy-state-matcher ivy-last)
- nil
- #'swiper--face-matcher))
- (setq ivy--old-re nil))
-
-(defun swiper--face-matcher (regexp candidates)
- "Return REGEXP matching CANDIDATES.
-Matched candidates should have `swiper-invocation-face'."
- (cl-remove-if-not
- (lambda (x)
- (and
- (string-match regexp x)
- (let ((s (match-string 0 x))
- (i 0))
- (while (and (< i (length s))
- (text-property-any
- i (1+ i)
- 'face swiper-invocation-face
- s))
- (cl-incf i))
- (eq i (length s)))))
- candidates))
-
-(defun swiper--ensure-visible ()
- "Remove overlays hiding point."
- (let ((overlays (overlays-at (1- (point))))
- ov expose)
- (while (setq ov (pop overlays))
- (if (and (invisible-p (overlay-get ov 'invisible))
- (setq expose (overlay-get ov 'isearch-open-invisible)))
- (funcall expose ov)))))
-
-(defvar swiper--overlays nil
- "Store overlays.")
-
-(defun swiper--cleanup ()
- "Clean up the overlays."
- (while swiper--overlays
- (delete-overlay (pop swiper--overlays)))
- (save-excursion
- (goto-char (point-min))
- (isearch-clean-overlays)))
-
-(defun swiper--update-input-ivy ()
- "Called when `ivy' input is updated."
- (with-ivy-window
- (swiper--cleanup)
- (when (> (length (ivy-state-current ivy-last)) 0)
- (let* ((re (funcall ivy--regex-function ivy-text))
- (re (if (stringp re) re (caar re)))
- (re (replace-regexp-in-string
- " " "\t"
- re))
- (str (get-text-property 0 'swiper-line-number (ivy-state-current ivy-last)))
- (num (if (string-match "^[0-9]+" str)
- (string-to-number (match-string 0 str))
- 0)))
- (unless (eq this-command 'ivy-yank-word)
- (when (cl-plusp num)
- (unless (if swiper--current-line
- (eq swiper--current-line num)
- (eq (line-number-at-pos) num))
- (goto-char swiper--point-min)
- (if swiper-use-visual-line
- (line-move (1- num))
- (forward-line (1- num))))
- (if (and (equal ivy-text "")
- (>= swiper--opoint (line-beginning-position))
- (<= swiper--opoint (line-end-position)))
- (goto-char swiper--opoint)
- (if (eq swiper--current-line num)
- (when swiper--current-match-start
- (goto-char swiper--current-match-start))
- (setq swiper--current-line num))
- (when (re-search-forward re (line-end-position) t)
- (setq swiper--current-match-start (match-beginning 0))))
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
- (unless (and (>= (point) (window-start))
- (<= (point) (window-end (ivy-state-window ivy-last) t)))
- (recenter))
- (setq swiper--current-window-start (window-start))))
- (swiper--add-overlays
- re
- (max (window-start) swiper--point-min)
- (min (window-end (selected-window) t) swiper--point-max))))))
-
-(defun swiper--add-overlays (re &optional beg end wnd)
- "Add overlays for RE regexp in visible part of the current buffer.
-BEG and END, when specified, are the point bounds.
-WND, when specified is the window."
- (setq wnd (or wnd (ivy-state-window ivy-last)))
- (let ((ov (if visual-line-mode
- (make-overlay
- (save-excursion
- (beginning-of-visual-line)
- (point))
- (save-excursion
- (end-of-visual-line)
- (point)))
- (make-overlay
- (line-beginning-position)
- (1+ (line-end-position))))))
- (overlay-put ov 'face 'swiper-line-face)
- (overlay-put ov 'window wnd)
- (push ov swiper--overlays)
- (let* ((wh (window-height))
- (beg (or beg (save-excursion
- (forward-line (- wh))
- (point))))
- (end (or end (save-excursion
- (forward-line wh)
- (point))))
- (case-fold-search (and ivy-case-fold-search
- (string= re (downcase re)))))
- (when (>= (length re) swiper-min-highlight)
- (save-excursion
- (goto-char beg)
- ;; RE can become an invalid regexp
- (while (and (ignore-errors (re-search-forward re end t))
- (> (- (match-end 0) (match-beginning 0)) 0))
- (let ((mb (match-beginning 0))
- (me (match-end 0)))
- (unless (> (- me mb) 2017)
- (swiper--add-overlay mb me
- (if (zerop ivy--subexps)
- (cadr swiper-faces)
- (car swiper-faces))
- wnd 0)))
- (let ((i 1)
- (j 0))
- (while (<= (cl-incf j) ivy--subexps)
- (let ((bm (match-beginning j))
- (em (match-end j)))
- (when (and (integerp em)
- (integerp bm))
- (while (and (< j ivy--subexps)
- (integerp (match-beginning (+ j 1)))
- (= em (match-beginning (+ j 1))))
- (setq em (match-end (cl-incf j))))
- (swiper--add-overlay
- bm em
- (nth (1+ (mod (+ i 2) (1- (length swiper-faces))))
- swiper-faces)
- wnd i)
- (cl-incf i)))))))))))
-
-(defun swiper--add-overlay (beg end face wnd priority)
- "Add overlay bound by BEG and END to `swiper--overlays'.
-FACE, WND and PRIORITY are properties corresponding to
-the face, window and priority of the overlay."
- (let ((overlay (make-overlay beg end)))
- (push overlay swiper--overlays)
- (overlay-put overlay 'face face)
- (overlay-put overlay 'window wnd)
- (overlay-put overlay 'priority priority)))
-
-(defcustom swiper-action-recenter nil
- "When non-nil, recenter after exiting `swiper'."
- :type 'boolean)
-(defvar evil-search-module)
-(defvar evil-ex-search-pattern)
-(defvar evil-ex-search-persistent-highlight)
-(defvar evil-ex-search-direction)
-(declare-function evil-ex-search-activate-highlight "evil-ex")
-
-
-(defun swiper--action (x)
- "Goto line X."
- (let ((ln (1- (read (or (get-text-property 0 'swiper-line-number x)
- (and (string-match ":\\([0-9]+\\):.*\\'" x)
- (match-string-no-properties 1 x))))))
- (re (ivy--regex ivy-text)))
- (if (null x)
- (user-error "No candidates")
- (with-ivy-window
- (unless (equal (current-buffer)
- (ivy-state-buffer ivy-last))
- (switch-to-buffer (ivy-state-buffer ivy-last)))
- (goto-char swiper--point-min)
- (funcall (if swiper-use-visual-line
- #'line-move
- #'forward-line)
- ln)
- (when (and (re-search-forward re (line-end-position) t) swiper-goto-start-of-match)
- (goto-char (match-beginning 0)))
- (swiper--ensure-visible)
- (cond (swiper-action-recenter
- (recenter))
- (swiper--current-window-start
- (set-window-start (selected-window) swiper--current-window-start)))
- (when (/= (point) swiper--opoint)
- (unless (and transient-mark-mode mark-active)
- (when (eq ivy-exit 'done)
- (push-mark swiper--opoint t)
- (message "Mark saved where search started"))))
- (add-to-history
- 'regexp-search-ring
- re
- regexp-search-ring-max)
- (when (and (bound-and-true-p evil-mode)
- (eq evil-search-module 'evil-search))
- (add-to-history 'evil-ex-search-history re)
- (setq evil-ex-search-pattern (list re t t))
- (setq evil-ex-search-direction 'forward)
- (when evil-ex-search-persistent-highlight
- (evil-ex-search-activate-highlight evil-ex-search-pattern)))))))
-
-(defun swiper-from-isearch ()
- "Invoke `swiper' from isearch."
- (interactive)
- (let ((query (if isearch-regexp
- isearch-string
- (regexp-quote isearch-string))))
- (isearch-exit)
- (swiper query)))
-
-(defvar swiper-multi-buffers nil
- "Store the current list of buffers.")
-
-(defvar swiper-multi-candidates nil
- "Store the list of candidates for `swiper-multi'.")
-
-(defun swiper-multi-prompt ()
- "Return prompt for `swiper-multi'."
- (format "Buffers (%s): "
- (mapconcat #'identity swiper-multi-buffers ", ")))
-
-(defun swiper-multi ()
- "Select one or more buffers.
-Run `swiper' for those buffers."
- (interactive)
- (setq swiper-multi-buffers nil)
- (let ((ivy-use-virtual-buffers nil))
- (ivy-read (swiper-multi-prompt)
- 'internal-complete-buffer
- :action 'swiper-multi-action-1))
- (ivy-read "Swiper: " swiper-multi-candidates
- :action 'swiper-multi-action-2
- :unwind #'swiper--cleanup
- :caller 'swiper-multi))
-
-(defun swiper-multi-action-1 (x)
- "Add X to list of selected buffers `swiper-multi-buffers'.
-If X is already part of the list, remove it instead. Quit the selection if
-X is selected by either `ivy-done', `ivy-alt-done' or `ivy-immediate-done',
-otherwise continue prompting for buffers."
- (if (member x swiper-multi-buffers)
- (progn
- (setq swiper-multi-buffers (delete x swiper-multi-buffers)))
- (unless (equal x "")
- (setq swiper-multi-buffers (append swiper-multi-buffers (list x)))))
- (let ((prompt (swiper-multi-prompt)))
- (setf (ivy-state-prompt ivy-last) prompt)
- (setq ivy--prompt (concat "%-4d " prompt)))
- (cond ((memq this-command '(ivy-done
- ivy-alt-done
- ivy-immediate-done))
- (setq swiper-multi-candidates
- (swiper--multi-candidates
- (mapcar #'get-buffer swiper-multi-buffers))))
- ((eq this-command 'ivy-call)
- (with-selected-window (active-minibuffer-window)
- (delete-minibuffer-contents)))))
-
-(defun swiper-multi-action-2 (x)
- "Move to candidate X from `swiper-multi'."
- (when (> (length x) 0)
- (let ((buffer-name (get-text-property 0 'buffer x)))
- (when buffer-name
- (with-ivy-window
- (switch-to-buffer buffer-name)
- (goto-char (point-min))
- (forward-line (1- (read (get-text-property 0 'swiper-line-number x))))
- (re-search-forward
- (ivy--regex ivy-text)
- (line-end-position) t)
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
- (unless (eq ivy-exit 'done)
- (swiper--cleanup)
- (swiper--add-overlays (ivy--regex ivy-text))))))))
-
-(defun swiper-all-buffer-p (buffer)
- "Return non-nil if BUFFER should be considered by `swiper-all'."
- (let ((mode (buffer-local-value 'major-mode (get-buffer buffer))))
- (cond
- ;; Ignore TAGS buffers, they tend to add duplicate results.
- ((eq mode #'tags-table-mode) nil)
- ;; Always consider dired buffers, even though they're not backed
- ;; by a file.
- ((eq mode #'dired-mode) t)
- ;; Always consider stash buffers too, as they may have
- ;; interesting content not present in any buffers. We don't #'
- ;; quote to satisfy the byte-compiler.
- ((eq mode 'magit-stash-mode) t)
- ;; Email buffers have no file, but are useful to search
- ((eq mode 'gnus-article-mode) t)
- ;; Otherwise, only consider the file if it's backed by a file.
- (t (buffer-file-name buffer)))))
-
-;;* `swiper-all'
-(defun swiper-all-function (str)
- "Search in all open buffers for STR."
- (if (and (< (length str) 3))
- (list "" (format "%d chars more" (- 3 (length ivy-text))))
- (let* ((buffers (cl-remove-if-not #'swiper-all-buffer-p (buffer-list)))
- (re-full (funcall ivy--regex-function str))
- re re-tail
- cands match
- (case-fold-search
- (and ivy-case-fold-search
- (string= str (downcase str)))))
- (if (stringp re-full)
- (setq re re-full)
- (setq re (caar re-full))
- (setq re-tail (cdr re-full)))
- (dolist (buffer buffers)
- (with-current-buffer buffer
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward re nil t)
- (setq match (if (memq major-mode '(org-mode dired-mode))
- (buffer-substring-no-properties
- (line-beginning-position)
- (line-end-position))
- (buffer-substring
- (line-beginning-position)
- (line-end-position))))
- (put-text-property
- 0 1 'buffer
- (buffer-name)
- match)
- (put-text-property 0 1 'point (point) match)
- (when (or (null re-tail) (ivy-re-match re-tail match))
- (push match cands))))))
- (setq ivy--old-re re-full)
- (if (null cands)
- (list "")
- (setq ivy--old-cands (nreverse cands))))))
-
-(defvar swiper-window-width 80)
-
-(defun swiper--all-format-function (cands)
- "Format CANDS for `swiper-all'.
-See `ivy-format-function' for further information."
- (let* ((ww swiper-window-width)
- (col2 1)
- (cands-with-buffer
- (mapcar (lambda (s)
- (let ((buffer (get-text-property 0 'buffer s)))
- (setq col2 (max col2 (length buffer)))
- (cons s buffer))) cands))
- (col1 (- ww 4 col2)))
- (setq cands
- (mapcar (lambda (x)
- (if (cdr x)
- (let ((s (ivy--truncate-string (car x) col1)))
- (concat
- s
- (make-string
- (max 0
- (- ww (string-width s) (length (cdr x))))
- ?\ )
- (cdr x)))
- (car x)))
- cands-with-buffer))
- (ivy--format-function-generic
- (lambda (str)
- (ivy--add-face str 'ivy-current-match))
- (lambda (str)
- str)
- cands
- "\n")))
-
-(defvar swiper-all-map
- (let ((map (make-sparse-keymap)))
- (define-key map (kbd "M-q") 'swiper-all-query-replace)
- map)
- "Keymap for `swiper-all'.")
-
-;;;###autoload
-(defun swiper-all (&optional initial-input)
- "Run `swiper' for all open buffers."
- (interactive)
- (let* ((swiper-window-width (- (frame-width) (if (display-graphic-p) 0 1)))
- (ivy-format-function #'swiper--all-format-function))
- (ivy-read "swiper-all: " 'swiper-all-function
- :action 'swiper-all-action
- :unwind #'swiper--cleanup
- :update-fn (lambda ()
- (swiper-all-action (ivy-state-current ivy-last)))
- :dynamic-collection t
- :keymap swiper-all-map
- :initial-input initial-input
- :caller 'swiper-multi)))
-
-(defun swiper-all-action (x)
- "Move to candidate X from `swiper-all'."
- (when (> (length x) 0)
- (let ((buffer-name (get-text-property 0 'buffer x)))
- (when buffer-name
- (with-ivy-window
- (switch-to-buffer buffer-name)
- (goto-char (get-text-property 0 'point x))
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
- (unless (eq ivy-exit 'done)
- (swiper--cleanup)
- (swiper--add-overlays (ivy--regex ivy-text))))))))
-
-(defun swiper--multi-candidates (buffers)
- "Extract candidates from BUFFERS."
- (let* ((ww (window-width))
- (res nil)
- (column-2 (apply #'max
- (mapcar
- (lambda (b)
- (length (buffer-name b)))
- buffers)))
- (column-1 (- ww 4 column-2 1)))
- (dolist (buf buffers)
- (with-current-buffer buf
- (setq res
- (append
- (mapcar
- (lambda (s)
- (setq s (concat (ivy--truncate-string s column-1) " "))
- (let ((len (length s)))
- (put-text-property
- (1- len) len 'display
- (concat
- (make-string
- (max 0
- (- ww (string-width s) (length (buffer-name)) 3))
- ?\ )
- (buffer-name))
- s)
- s))
- (swiper--candidates 4))
- res))
- nil))
- res))
-
-(provide 'swiper)
-
-;;; swiper.el ends here
diff --git a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.elc b/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.elc
deleted file mode 100644
index 65a7e9f..0000000
Binary files a/emacs/.emacs.d/elpa/swiper-20180102.1035/swiper.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-autoloads.el b/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-autoloads.el
deleted file mode 100644
index 51bf98c..0000000
--- a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-autoloads.el
+++ /dev/null
@@ -1,59 +0,0 @@
-;;; undo-tree-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "undo-tree" "undo-tree.el" (23124 14372 62193
-;;;;;; 457000))
-;;; Generated autoloads from undo-tree.el
-
-(autoload 'undo-tree-mode "undo-tree" "\
-Toggle undo-tree mode.
-With no argument, this command toggles the mode.
-A positive prefix argument turns the mode on.
-A negative prefix argument turns it off.
-
-Undo-tree-mode replaces Emacs' standard undo feature with a more
-powerful yet easier to use version, that treats the undo history
-as what it is: a tree.
-
-The following keys are available in `undo-tree-mode':
-
- \\{undo-tree-map}
-
-Within the undo-tree visualizer, the following keys are available:
-
- \\{undo-tree-visualizer-mode-map}
-
-\(fn &optional ARG)" t nil)
-
-(defvar global-undo-tree-mode nil "\
-Non-nil if Global Undo-Tree mode is enabled.
-See the `global-undo-tree-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 `global-undo-tree-mode'.")
-
-(custom-autoload 'global-undo-tree-mode "undo-tree" nil)
-
-(autoload 'global-undo-tree-mode "undo-tree" "\
-Toggle Undo-Tree mode in all buffers.
-With prefix ARG, enable Global Undo-Tree mode if ARG is positive;
-otherwise, disable it. If called from Lisp, enable the mode if
-ARG is omitted or nil.
-
-Undo-Tree mode is enabled in all buffers where
-`turn-on-undo-tree-mode' would do it.
-See `undo-tree-mode' for more information on Undo-Tree mode.
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; undo-tree-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-pkg.el b/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-pkg.el
deleted file mode 100644
index 378b712..0000000
--- a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "undo-tree" "20170706.246" "Treat undo history as a tree" 'nil :commit "e9a9102f515acd7523158f20e83f300600374989" :url "http://www.dr-qubit.org/emacs.php" :keywords '("convenience" "files" "undo" "redo" "history" "tree"))
diff --git a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.el b/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.el
deleted file mode 100644
index 063c2df..0000000
--- a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.el
+++ /dev/null
@@ -1,4433 +0,0 @@
-;;; undo-tree.el --- Treat undo history as a tree -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2009-2014 Free Software Foundation, Inc
-
-;; Author: Toby Cubitt
-;; Maintainer: Toby Cubitt
-;; Version: 0.6.6
-;; Package-Version: 20170706.246
-;; Keywords: convenience, files, undo, redo, history, tree
-;; URL: http://www.dr-qubit.org/emacs.php
-;; Repository: http://www.dr-qubit.org/git/undo-tree.git
-
-;; This file is part of Emacs.
-;;
-;; This file 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 GNU Emacs. If not, see .
-
-
-;;; Commentary:
-;;
-;; Emacs has a powerful undo system. Unlike the standard undo/redo system in
-;; most software, it allows you to recover *any* past state of a buffer
-;; (whereas the standard undo/redo system can lose past states as soon as you
-;; redo). However, this power comes at a price: many people find Emacs' undo
-;; system confusing and difficult to use, spawning a number of packages that
-;; replace it with the less powerful but more intuitive undo/redo system.
-;;
-;; Both the loss of data with standard undo/redo, and the confusion of Emacs'
-;; undo, stem from trying to treat undo history as a linear sequence of
-;; changes. It's not. The `undo-tree-mode' provided by this package replaces
-;; Emacs' undo system with a system that treats undo history as what it is: a
-;; branching tree of changes. This simple idea allows the more intuitive
-;; behaviour of the standard undo/redo system to be combined with the power of
-;; never losing any history. An added side bonus is that undo history can in
-;; some cases be stored more efficiently, allowing more changes to accumulate
-;; before Emacs starts discarding history.
-;;
-;; The only downside to this more advanced yet simpler undo system is that it
-;; was inspired by Vim. But, after all, most successful religions steal the
-;; best ideas from their competitors!
-;;
-;;
-;; Installation
-;; ============
-;;
-;; This package has only been tested with Emacs versions 24 and CVS. It should
-;; work in Emacs versions 22 and 23 too, but will not work without
-;; modifications in earlier versions of Emacs.
-;;
-;; To install `undo-tree-mode', make sure this file is saved in a directory in
-;; your `load-path', and add the line:
-;;
-;; (require 'undo-tree)
-;;
-;; to your .emacs file. Byte-compiling undo-tree.el is recommended (e.g. using
-;; "M-x byte-compile-file" from within emacs).
-;;
-;; If you want to replace the standard Emacs' undo system with the
-;; `undo-tree-mode' system in all buffers, you can enable it globally by
-;; adding:
-;;
-;; (global-undo-tree-mode)
-;;
-;; to your .emacs file.
-;;
-;;
-;; Quick-Start
-;; ===========
-;;
-;; If you're the kind of person who likes to jump in the car and drive,
-;; without bothering to first figure out whether the button on the left dips
-;; the headlights or operates the ejector seat (after all, you'll soon figure
-;; it out when you push it), then here's the minimum you need to know:
-;;
-;; `undo-tree-mode' and `global-undo-tree-mode'
-;; Enable undo-tree mode (either in the current buffer or globally).
-;;
-;; C-_ C-/ (`undo-tree-undo')
-;; Undo changes.
-;;
-;; M-_ C-? (`undo-tree-redo')
-;; Redo changes.
-;;
-;; `undo-tree-switch-branch'
-;; Switch undo-tree branch.
-;; (What does this mean? Better press the button and see!)
-;;
-;; C-x u (`undo-tree-visualize')
-;; Visualize the undo tree.
-;; (Better try pressing this button too!)
-;;
-;; C-x r u (`undo-tree-save-state-to-register')
-;; Save current buffer state to register.
-;;
-;; C-x r U (`undo-tree-restore-state-from-register')
-;; Restore buffer state from register.
-;;
-;;
-;;
-;; In the undo-tree visualizer:
-;;
-;; p C-p (`undo-tree-visualize-undo')
-;; Undo changes.
-;;
-;; n C-n (`undo-tree-visualize-redo')
-;; Redo changes.
-;;
-;; b C-b (`undo-tree-visualize-switch-branch-left')
-;; Switch to previous undo-tree branch.
-;;
-;; f C-f (`undo-tree-visualize-switch-branch-right')
-;; Switch to next undo-tree branch.
-;;
-;; C- M-{ (`undo-tree-visualize-undo-to-x')
-;; Undo changes up to last branch point.
-;;
-;; C- M-} (`undo-tree-visualize-redo-to-x')
-;; Redo changes down to next branch point.
-;;
-;; n C-n (`undo-tree-visualize-redo')
-;; Redo changes.
-;;
-;; (`undo-tree-visualizer-mouse-set')
-;; Set state to node at mouse click.
-;;
-;; t (`undo-tree-visualizer-toggle-timestamps')
-;; Toggle display of time-stamps.
-;;
-;; d (`undo-tree-visualizer-toggle-diff')
-;; Toggle diff display.
-;;
-;; s (`undo-tree-visualizer-selection-mode')
-;; Toggle keyboard selection mode.
-;;
-;; q (`undo-tree-visualizer-quit')
-;; Quit undo-tree-visualizer.
-;;
-;; C-q (`undo-tree-visualizer-abort')
-;; Abort undo-tree-visualizer.
-;;
-;; , <
-;; Scroll left.
-;;
-;; . >
-;; Scroll right.
-;;
-;; M-v
-;; Scroll up.
-;;
-;; C-v
-;; Scroll down.
-;;
-;;
-;;
-;; In visualizer selection mode:
-;;
-;; p C-p (`undo-tree-visualizer-select-previous')
-;; Select previous node.
-;;
-;; n C-n (`undo-tree-visualizer-select-next')
-;; Select next node.
-;;
-;; b C-b (`undo-tree-visualizer-select-left')
-;; Select left sibling node.
-;;
-;; f C-f (`undo-tree-visualizer-select-right')
-;; Select right sibling node.
-;;
-;; M-v
-;; Select node 10 above.
-;;
-;; C-v
-;; Select node 10 below.
-;;
-;; (`undo-tree-visualizer-set')
-;; Set state to selected node and exit selection mode.
-;;
-;; s (`undo-tree-visualizer-mode')
-;; Exit selection mode.
-;;
-;; t (`undo-tree-visualizer-toggle-timestamps')
-;; Toggle display of time-stamps.
-;;
-;; d (`undo-tree-visualizer-toggle-diff')
-;; Toggle diff display.
-;;
-;; q (`undo-tree-visualizer-quit')
-;; Quit undo-tree-visualizer.
-;;
-;; C-q (`undo-tree-visualizer-abort')
-;; Abort undo-tree-visualizer.
-;;
-;; , <
-;; Scroll left.
-;;
-;; . >
-;; Scroll right.
-;;
-;;
-;;
-;; Persistent undo history:
-;;
-;; Note: Requires Emacs version 24.3 or higher.
-;;
-;; `undo-tree-auto-save-history' (variable)
-;; automatically save and restore undo-tree history along with buffer
-;; (disabled by default)
-;;
-;; `undo-tree-save-history' (command)
-;; manually save undo history to file
-;;
-;; `undo-tree-load-history' (command)
-;; manually load undo history from file
-;;
-;;
-;;
-;; Compressing undo history:
-;;
-;; Undo history files cannot grow beyond the maximum undo tree size, which
-;; is limited by `undo-limit', `undo-strong-limit' and
-;; `undo-outer-limit'. Nevertheless, undo history files can grow quite
-;; large. If you want to automatically compress undo history, add the
-;; following advice to your .emacs file (replacing ".gz" with the filename
-;; extension of your favourite compression algorithm):
-;;
-;; (defadvice undo-tree-make-history-save-file-name
-;; (after undo-tree activate)
-;; (setq ad-return-value (concat ad-return-value ".gz")))
-;;
-;;
-;;
-;;
-;; Undo Systems
-;; ============
-;;
-;; To understand the different undo systems, it's easiest to consider an
-;; example. Imagine you make a few edits in a buffer. As you edit, you
-;; accumulate a history of changes, which we might visualize as a string of
-;; past buffer states, growing downwards:
-;;
-;; o (initial buffer state)
-;; |
-;; |
-;; o (first edit)
-;; |
-;; |
-;; o (second edit)
-;; |
-;; |
-;; x (current buffer state)
-;;
-;;
-;; Now imagine that you undo the last two changes. We can visualize this as
-;; rewinding the current state back two steps:
-;;
-;; o (initial buffer state)
-;; |
-;; |
-;; x (current buffer state)
-;; |
-;; |
-;; o
-;; |
-;; |
-;; o
-;;
-;;
-;; However, this isn't a good representation of what Emacs' undo system
-;; does. Instead, it treats the undos as *new* changes to the buffer, and adds
-;; them to the history:
-;;
-;; o (initial buffer state)
-;; |
-;; |
-;; o (first edit)
-;; |
-;; |
-;; o (second edit)
-;; |
-;; |
-;; x (buffer state before undo)
-;; |
-;; |
-;; o (first undo)
-;; |
-;; |
-;; x (second undo)
-;;
-;;
-;; Actually, since the buffer returns to a previous state after an undo,
-;; perhaps a better way to visualize it is to imagine the string of changes
-;; turning back on itself:
-;;
-;; (initial buffer state) o
-;; |
-;; |
-;; (first edit) o x (second undo)
-;; | |
-;; | |
-;; (second edit) o o (first undo)
-;; | /
-;; |/
-;; o (buffer state before undo)
-;;
-;; Treating undos as new changes might seem a strange thing to do. But the
-;; advantage becomes clear as soon as we imagine what happens when you edit
-;; the buffer again. Since you've undone a couple of changes, new edits will
-;; branch off from the buffer state that you've rewound to. Conceptually, it
-;; looks like this:
-;;
-;; o (initial buffer state)
-;; |
-;; |
-;; o
-;; |\
-;; | \
-;; o x (new edit)
-;; |
-;; |
-;; o
-;;
-;; The standard undo/redo system only lets you go backwards and forwards
-;; linearly. So as soon as you make that new edit, it discards the old
-;; branch. Emacs' undo just keeps adding changes to the end of the string. So
-;; the undo history in the two systems now looks like this:
-;;
-;; Undo/Redo: Emacs' undo
-;;
-;; o o
-;; | |
-;; | |
-;; o o o
-;; .\ | |\
-;; . \ | | \
-;; . x (new edit) o o |
-;; (discarded . | / |
-;; branch) . |/ |
-;; . o |
-;; |
-;; |
-;; x (new edit)
-;;
-;; Now, what if you change your mind about those undos, and decide you did
-;; like those other changes you'd made after all? With the standard undo/redo
-;; system, you're lost. There's no way to recover them, because that branch
-;; was discarded when you made the new edit.
-;;
-;; However, in Emacs' undo system, those old buffer states are still there in
-;; the undo history. You just have to rewind back through the new edit, and
-;; back through the changes made by the undos, until you reach them. Of
-;; course, since Emacs treats undos (even undos of undos!) as new changes,
-;; you're really weaving backwards and forwards through the history, all the
-;; time adding new changes to the end of the string as you go:
-;;
-;; o
-;; |
-;; |
-;; o o o (undo new edit)
-;; | |\ |\
-;; | | \ | \
-;; o o | | o (undo the undo)
-;; | / | | |
-;; |/ | | |
-;; (trying to get o | | x (undo the undo)
-;; to this state) | /
-;; |/
-;; o
-;;
-;; So far, this is still reasonably intuitive to use. It doesn't behave so
-;; differently to standard undo/redo, except that by going back far enough you
-;; can access changes that would be lost in standard undo/redo.
-;;
-;; However, imagine that after undoing as just described, you decide you
-;; actually want to rewind right back to the initial state. If you're lucky,
-;; and haven't invoked any command since the last undo, you can just keep on
-;; undoing until you get back to the start:
-;;
-;; (trying to get o x (got there!)
-;; to this state) | |
-;; | |
-;; o o o o (keep undoing)
-;; | |\ |\ |
-;; | | \ | \ |
-;; o o | | o o (keep undoing)
-;; | / | | | /
-;; |/ | | |/
-;; (already undid o | | o (got this far)
-;; to this state) | /
-;; |/
-;; o
-;;
-;; But if you're unlucky, and you happen to have moved the point (say) after
-;; getting to the state labelled "got this far", then you've "broken the undo
-;; chain". Hold on to something solid, because things are about to get
-;; hairy. If you try to undo now, Emacs thinks you're trying to undo the
-;; undos! So to get back to the initial state you now have to rewind through
-;; *all* the changes, including the undos you just did:
-;;
-;; (trying to get o x (finally got there!)
-;; to this state) | |
-;; | |
-;; o o o o o o
-;; | |\ |\ |\ |\ |
-;; | | \ | \ | \ | \ |
-;; o o | | o o | | o o
-;; | / | | | / | | | /
-;; |/ | | |/ | | |/
-;; (already undid o | | o<. | | o
-;; to this state) | / : | /
-;; |/ : |/
-;; o : o
-;; :
-;; (got this far, but
-;; broke the undo chain)
-;;
-;; Confused?
-;;
-;; In practice you can just hold down the undo key until you reach the buffer
-;; state that you want. But whatever you do, don't move around in the buffer
-;; to *check* that you've got back to where you want! Because you'll break the
-;; undo chain, and then you'll have to traverse the entire string of undos
-;; again, just to get back to the point at which you broke the
-;; chain. Undo-in-region and commands such as `undo-only' help to make using
-;; Emacs' undo a little easier, but nonetheless it remains confusing for many
-;; people.
-;;
-;;
-;; So what does `undo-tree-mode' do? Remember the diagram we drew to represent
-;; the history we've been discussing (make a few edits, undo a couple of them,
-;; and edit again)? The diagram that conceptually represented our undo
-;; history, before we started discussing specific undo systems? It looked like
-;; this:
-;;
-;; o (initial buffer state)
-;; |
-;; |
-;; o
-;; |\
-;; | \
-;; o x (current state)
-;; |
-;; |
-;; o
-;;
-;; Well, that's *exactly* what the undo history looks like to
-;; `undo-tree-mode'. It doesn't discard the old branch (as standard undo/redo
-;; does), nor does it treat undos as new changes to be added to the end of a
-;; linear string of buffer states (as Emacs' undo does). It just keeps track
-;; of the tree of branching changes that make up the entire undo history.
-;;
-;; If you undo from this point, you'll rewind back up the tree to the previous
-;; state:
-;;
-;; o
-;; |
-;; |
-;; x (undo)
-;; |\
-;; | \
-;; o o
-;; |
-;; |
-;; o
-;;
-;; If you were to undo again, you'd rewind back to the initial state. If on
-;; the other hand you redo the change, you'll end up back at the bottom of the
-;; most recent branch:
-;;
-;; o (undo takes you here)
-;; |
-;; |
-;; o (start here)
-;; |\
-;; | \
-;; o x (redo takes you here)
-;; |
-;; |
-;; o
-;;
-;; So far, this is just like the standard undo/redo system. But what if you
-;; want to return to a buffer state located on a previous branch of the
-;; history? Since `undo-tree-mode' keeps the entire history, you simply need
-;; to tell it to switch to a different branch, and then redo the changes you
-;; want:
-;;
-;; o
-;; |
-;; |
-;; o (start here, but switch
-;; |\ to the other branch)
-;; | \
-;; (redo) o o
-;; |
-;; |
-;; (redo) x
-;;
-;; Now you're on the other branch, if you undo and redo changes you'll stay on
-;; that branch, moving up and down through the buffer states located on that
-;; branch. Until you decide to switch branches again, of course.
-;;
-;; Real undo trees might have multiple branches and sub-branches:
-;;
-;; o
-;; ____|______
-;; / \
-;; o o
-;; ____|__ __|
-;; / | \ / \
-;; o o o o x
-;; | |
-;; / \ / \
-;; o o o o
-;;
-;; Trying to imagine what Emacs' undo would do as you move about such a tree
-;; will likely frazzle your brain circuits! But in `undo-tree-mode', you're
-;; just moving around this undo history tree. Most of the time, you'll
-;; probably only need to stay on the most recent branch, in which case it
-;; behaves like standard undo/redo, and is just as simple to understand. But
-;; if you ever need to recover a buffer state on a different branch, the
-;; possibility of switching between branches and accessing the full undo
-;; history is still there.
-;;
-;;
-;;
-;; The Undo-Tree Visualizer
-;; ========================
-;;
-;; Actually, it gets better. You don't have to imagine all these tree
-;; diagrams, because `undo-tree-mode' includes an undo-tree visualizer which
-;; draws them for you! In fact, it draws even better diagrams: it highlights
-;; the node representing the current buffer state, it highlights the current
-;; branch, and you can toggle the display of time-stamps (by hitting "t") and
-;; a diff of the undo changes (by hitting "d"). (There's one other tiny
-;; difference: the visualizer puts the most recent branch on the left rather
-;; than the right.)
-;;
-;; Bring up the undo tree visualizer whenever you want by hitting "C-x u".
-;;
-;; In the visualizer, the usual keys for moving up and down a buffer instead
-;; move up and down the undo history tree (e.g. the up and down arrow keys, or
-;; "C-n" and "C-p"). The state of the "parent" buffer (the buffer whose undo
-;; history you are visualizing) is updated as you move around the undo tree in
-;; the visualizer. If you reach a branch point in the visualizer, the usual
-;; keys for moving forward and backward in a buffer instead switch branch
-;; (e.g. the left and right arrow keys, or "C-f" and "C-b").
-;;
-;; Clicking with the mouse on any node in the visualizer will take you
-;; directly to that node, resetting the state of the parent buffer to the
-;; state represented by that node.
-;;
-;; You can also select nodes directly using the keyboard, by hitting "s" to
-;; toggle selection mode. The usual motion keys now allow you to move around
-;; the tree without changing the parent buffer. Hitting will reset the
-;; state of the parent buffer to the state represented by the currently
-;; selected node.
-;;
-;; It can be useful to see how long ago the parent buffer was in the state
-;; represented by a particular node in the visualizer. Hitting "t" in the
-;; visualizer toggles the display of time-stamps for all the nodes. (Note
-;; that, because of the way `undo-tree-mode' works, these time-stamps may be
-;; somewhat later than the true times, especially if it's been a long time
-;; since you last undid any changes.)
-;;
-;; To get some idea of what changes are represented by a given node in the
-;; tree, it can be useful to see a diff of the changes. Hit "d" in the
-;; visualizer to toggle a diff display. This normally displays a diff between
-;; the current state and the previous one, i.e. it shows you the changes that
-;; will be applied if you undo (move up the tree). However, the diff display
-;; really comes into its own in the visualizer's selection mode (see above),
-;; where it instead shows a diff between the current state and the currently
-;; selected state, i.e. it shows you the changes that will be applied if you
-;; reset to the selected state.
-;;
-;; (Note that the diff is generated by the Emacs `diff' command, and is
-;; displayed using `diff-mode'. See the corresponding customization groups if
-;; you want to customize the diff display.)
-;;
-;; Finally, hitting "q" will quit the visualizer, leaving the parent buffer in
-;; whatever state you ended at. Hitting "C-q" will abort the visualizer,
-;; returning the parent buffer to whatever state it was originally in when the
-;; visualizer was invoked.
-;;
-;;
-;;
-;; Undo-in-Region
-;; ==============
-;;
-;; Emacs allows a very useful and powerful method of undoing only selected
-;; changes: when a region is active, only changes that affect the text within
-;; that region will be undone. With the standard Emacs undo system, changes
-;; produced by undoing-in-region naturally get added onto the end of the
-;; linear undo history:
-;;
-;; o
-;; |
-;; | x (second undo-in-region)
-;; o |
-;; | |
-;; | o (first undo-in-region)
-;; o |
-;; | /
-;; |/
-;; o
-;;
-;; You can of course redo these undos-in-region as usual, by undoing the
-;; undos:
-;;
-;; o
-;; |
-;; | o_
-;; o | \
-;; | | |
-;; | o o (undo the undo-in-region)
-;; o | |
-;; | / |
-;; |/ |
-;; o x (undo the undo-in-region)
-;;
-;;
-;; In `undo-tree-mode', undo-in-region works much the same way: when there's
-;; an active region, undoing only undoes changes that affect that region. In
-;; `undo-tree-mode', redoing when there's an active region similarly only
-;; redoes changes that affect that region.
-;;
-;; However, the way these undo- and redo-in-region changes are recorded in the
-;; undo history is quite different. The good news is, you don't need to
-;; understand this to use undo- and redo-in-region in `undo-tree-mode' - just
-;; go ahead and use them! They'll probably work as you expect. But if you're
-;; masochistic enough to want to understand conceptually what's happening to
-;; the undo tree as you undo- and redo-in-region, then read on...
-;;
-;;
-;; Undo-in-region creates a new branch in the undo history. The new branch
-;; consists of an undo step that undoes some of the changes that affect the
-;; current region, and another step that undoes the remaining changes needed
-;; to rejoin the previous undo history.
-;;
-;; Previous undo history Undo-in-region
-;;
-;; o o
-;; | |
-;; | |
-;; | |
-;; o o
-;; | |
-;; | |
-;; | |
-;; o o_
-;; | | \
-;; | | x (undo-in-region)
-;; | | |
-;; x o o
-;;
-;; As long as you don't change the active region after undoing-in-region,
-;; continuing to undo-in-region extends the new branch, pulling more changes
-;; that affect the current region into an undo step immediately above your
-;; current location in the undo tree, and pushing the point at which the new
-;; branch is attached further up the tree:
-;;
-;; First undo-in-region Second undo-in-region
-;;
-;; o o
-;; | |
-;; | |
-;; | |
-;; o o_
-;; | | \
-;; | | x (undo-in-region)
-;; | | |
-;; o_ o |
-;; | \ | |
-;; | x | o
-;; | | | |
-;; o o o o
-;;
-;; Redoing takes you back down the undo tree, as usual (as long as you haven't
-;; changed the active region after undoing-in-region, it doesn't matter if it
-;; is still active):
-;;
-;; o
-;; |
-;; |
-;; |
-;; o_
-;; | \
-;; | o
-;; | |
-;; o |
-;; | |
-;; | o (redo)
-;; | |
-;; o x (redo)
-;;
-;;
-;; What about redo-in-region? Obviously, redo-in-region only makes sense if
-;; you have already undone some changes, so that there are some changes to
-;; redo! Redoing-in-region splits off a new branch of the undo history below
-;; your current location in the undo tree. This time, the new branch consists
-;; of a first redo step that redoes some of the redo changes that affect the
-;; current region, followed by *all* the remaining redo changes.
-;;
-;; Previous undo history Redo-in-region
-;;
-;; o o
-;; | |
-;; | |
-;; | |
-;; x o_
-;; | | \
-;; | | x (redo-in-region)
-;; | | |
-;; o o |
-;; | | |
-;; | | |
-;; | | |
-;; o o o
-;;
-;; As long as you don't change the active region after redoing-in-region,
-;; continuing to redo-in-region extends the new branch, pulling more redo
-;; changes into a redo step immediately below your current location in the
-;; undo tree.
-;;
-;; First redo-in-region Second redo-in-region
-;;
-;; o o
-;; | |
-;; | |
-;; | |
-;; o_ o_
-;; | \ | \
-;; | x | o
-;; | | | |
-;; o | o |
-;; | | | |
-;; | | | x (redo-in-region)
-;; | | | |
-;; o o o o
-;;
-;; Note that undo-in-region and redo-in-region only ever add new changes to
-;; the undo tree, they *never* modify existing undo history. So you can always
-;; return to previous buffer states by switching to a previous branch of the
-;; tree.
-
-
-
-;;; Code:
-
-(eval-when-compile (require 'cl))
-(require 'diff)
-
-
-
-;;; =====================================================================
-;;; Compatibility hacks for older Emacsen
-
-;; `characterp' isn't defined in Emacs versions < 23
-(unless (fboundp 'characterp)
- (defalias 'characterp 'char-valid-p))
-
-;; `region-active-p' isn't defined in Emacs versions < 23
-(unless (fboundp 'region-active-p)
- (defun region-active-p () (and transient-mark-mode mark-active)))
-
-
-;; `registerv' defstruct isn't defined in Emacs versions < 24
-(unless (fboundp 'registerv-make)
- (defmacro registerv-make (data &rest _dummy) data))
-
-(unless (fboundp 'registerv-data)
- (defmacro registerv-data (data) data))
-
-
-;; `diff-no-select' and `diff-file-local-copy' aren't defined in Emacs
-;; versions < 24 (copied and adapted from Emacs 24)
-(unless (fboundp 'diff-no-select)
- (defun diff-no-select (old new &optional switches no-async buf)
- ;; Noninteractive helper for creating and reverting diff buffers
- (unless (bufferp new) (setq new (expand-file-name new)))
- (unless (bufferp old) (setq old (expand-file-name old)))
- (or switches (setq switches diff-switches)) ; If not specified, use default.
- (unless (listp switches) (setq switches (list switches)))
- (or buf (setq buf (get-buffer-create "*Diff*")))
- (let* ((old-alt (diff-file-local-copy old))
- (new-alt (diff-file-local-copy new))
- (command
- (mapconcat 'identity
- `(,diff-command
- ;; Use explicitly specified switches
- ,@switches
- ,@(mapcar #'shell-quote-argument
- (nconc
- (when (or old-alt new-alt)
- (list "-L" (if (stringp old)
- old (prin1-to-string old))
- "-L" (if (stringp new)
- new (prin1-to-string new))))
- (list (or old-alt old)
- (or new-alt new)))))
- " "))
- (thisdir default-directory))
- (with-current-buffer buf
- (setq buffer-read-only t)
- (buffer-disable-undo (current-buffer))
- (let ((inhibit-read-only t))
- (erase-buffer))
- (buffer-enable-undo (current-buffer))
- (diff-mode)
- (set (make-local-variable 'revert-buffer-function)
- (lambda (_ignore-auto _noconfirm)
- (diff-no-select old new switches no-async (current-buffer))))
- (setq default-directory thisdir)
- (let ((inhibit-read-only t))
- (insert command "\n"))
- (if (and (not no-async) (fboundp 'start-process))
- (let ((proc (start-process "Diff" buf shell-file-name
- shell-command-switch command)))
- (set-process-filter proc 'diff-process-filter)
- (set-process-sentinel
- proc (lambda (proc _msg)
- (with-current-buffer (process-buffer proc)
- (diff-sentinel (process-exit-status proc))
- (if old-alt (delete-file old-alt))
- (if new-alt (delete-file new-alt))))))
- ;; Async processes aren't available.
- (let ((inhibit-read-only t))
- (diff-sentinel
- (call-process shell-file-name nil buf nil
- shell-command-switch command))
- (if old-alt (delete-file old-alt))
- (if new-alt (delete-file new-alt)))))
- buf)))
-
-(unless (fboundp 'diff-file-local-copy)
- (defun diff-file-local-copy (file-or-buf)
- (if (bufferp file-or-buf)
- (with-current-buffer file-or-buf
- (let ((tempfile (make-temp-file "buffer-content-")))
- (write-region nil nil tempfile nil 'nomessage)
- tempfile))
- (file-local-copy file-or-buf))))
-
-
-;; `user-error' isn't defined in Emacs < 24.3
-(unless (fboundp 'user-error)
- (defalias 'user-error 'error)
- ;; prevent debugger being called on user errors
- (add-to-list 'debug-ignored-errors "^No further undo information")
- (add-to-list 'debug-ignored-errors "^No further redo information")
- (add-to-list 'debug-ignored-errors "^No further redo information for region"))
-
-
-
-
-
-;;; =====================================================================
-;;; Global variables and customization options
-
-(defvar buffer-undo-tree nil
- "Tree of undo entries in current buffer.")
-(put 'buffer-undo-tree 'permanent-local t)
-(make-variable-buffer-local 'buffer-undo-tree)
-
-
-(defgroup undo-tree nil
- "Tree undo/redo."
- :group 'undo)
-
-(defcustom undo-tree-mode-lighter " Undo-Tree"
- "Lighter displayed in mode line
-when `undo-tree-mode' is enabled."
- :group 'undo-tree
- :type 'string)
-
-
-(defcustom undo-tree-incompatible-major-modes '(term-mode)
- "List of major-modes in which `undo-tree-mode' should not be enabled.
-\(See `turn-on-undo-tree-mode'.\)"
- :group 'undo-tree
- :type '(repeat symbol))
-
-
-(defcustom undo-tree-enable-undo-in-region t
- "When non-nil, enable undo-in-region.
-
-When undo-in-region is enabled, undoing or redoing when the
-region is active (in `transient-mark-mode') or with a prefix
-argument (not in `transient-mark-mode') only undoes changes
-within the current region."
- :group 'undo-tree
- :type 'boolean)
-
-
-(defcustom undo-tree-auto-save-history nil
- "When non-nil, `undo-tree-mode' will save undo history to file
-when a buffer is saved to file.
-
-It will automatically load undo history when a buffer is loaded
-from file, if an undo save file exists.
-
-By default, undo-tree history is saved to a file called
-\"..~undo-tree~\" in the same directory as the
-file itself. To save under a different directory, customize
-`undo-tree-history-directory-alist' (see the documentation for
-that variable for details).
-
-WARNING! `undo-tree-auto-save-history' will not work properly in
-Emacs versions prior to 24.3, so it cannot be enabled via
-the customization interface in versions earlier than that one. To
-ignore this warning and enable it regardless, set
-`undo-tree-auto-save-history' to a non-nil value outside of
-customize."
- :group 'undo-tree
- :type (if (version-list-< (version-to-list emacs-version) '(24 3))
- '(choice (const :tag "" nil))
- 'boolean))
-
-
-(defcustom undo-tree-history-directory-alist nil
- "Alist of filename patterns and undo history directory names.
-Each element looks like (REGEXP . DIRECTORY). Undo history for
-files with names matching REGEXP will be saved in DIRECTORY.
-DIRECTORY may be relative or absolute. If it is absolute, so
-that all matching files are backed up into the same directory,
-the file names in this directory will be the full name of the
-file backed up with all directory separators changed to `!' to
-prevent clashes. This will not work correctly if your filesystem
-truncates the resulting name.
-
-For the common case of all backups going into one directory, the
-alist should contain a single element pairing \".\" with the
-appropriate directory name.
-
-If this variable is nil, or it fails to match a filename, the
-backup is made in the original file's directory.
-
-On MS-DOS filesystems without long names this variable is always
-ignored."
- :group 'undo-tree
- :type '(repeat (cons (regexp :tag "Regexp matching filename")
- (directory :tag "Undo history directory name"))))
-
-
-
-(defcustom undo-tree-visualizer-relative-timestamps t
- "When non-nil, display times relative to current time
-when displaying time stamps in visualizer.
-
-Otherwise, display absolute times."
- :group 'undo-tree
- :type 'boolean)
-
-
-(defcustom undo-tree-visualizer-timestamps nil
- "When non-nil, display time-stamps by default
-in undo-tree visualizer.
-
-\\You can always toggle time-stamps on and off \
-using \\[undo-tree-visualizer-toggle-timestamps], regardless of the
-setting of this variable."
- :group 'undo-tree
- :type 'boolean)
-
-
-(defcustom undo-tree-visualizer-diff nil
- "When non-nil, display diff by default in undo-tree visualizer.
-
-\\You can always toggle the diff display \
-using \\[undo-tree-visualizer-toggle-diff], regardless of the
-setting of this variable."
- :group 'undo-tree
- :type 'boolean)
-
-
-(defcustom undo-tree-visualizer-lazy-drawing 100
- "When non-nil, use lazy undo-tree drawing in visualizer.
-
-Setting this to a number causes the visualizer to switch to lazy
-drawing when the number of nodes in the tree is larger than this
-value.
-
-Lazy drawing means that only the visible portion of the tree will
-be drawn initially, and the tree will be extended later as
-needed. For the most part, the only visible effect of this is to
-significantly speed up displaying the visualizer for very large
-trees.
-
-There is one potential negative effect of lazy drawing. Other
-branches of the tree will only be drawn once the node from which
-they branch off becomes visible. So it can happen that certain
-portions of the tree that would be shown with lazy drawing
-disabled, will not be drawn immediately when it is
-enabled. However, this effect is quite rare in practice."
- :group 'undo-tree
- :type '(choice (const :tag "never" nil)
- (const :tag "always" t)
- (integer :tag "> size")))
-
-
-(defface undo-tree-visualizer-default-face
- '((((class color)) :foreground "gray"))
- "Face used to draw undo-tree in visualizer."
- :group 'undo-tree)
-
-(defface undo-tree-visualizer-current-face
- '((((class color)) :foreground "red"))
- "Face used to highlight current undo-tree node in visualizer."
- :group 'undo-tree)
-
-(defface undo-tree-visualizer-active-branch-face
- '((((class color) (background dark))
- (:foreground "white" :weight bold))
- (((class color) (background light))
- (:foreground "black" :weight bold)))
- "Face used to highlight active undo-tree branch in visualizer."
- :group 'undo-tree)
-
-(defface undo-tree-visualizer-register-face
- '((((class color)) :foreground "yellow"))
- "Face used to highlight undo-tree nodes saved to a register
-in visualizer."
- :group 'undo-tree)
-
-(defface undo-tree-visualizer-unmodified-face
- '((((class color)) :foreground "cyan"))
- "Face used to highlight nodes corresponding to unmodified buffers
-in visualizer."
- :group 'undo-tree)
-
-
-(defvar undo-tree-visualizer-parent-buffer nil
- "Parent buffer in visualizer.")
-(put 'undo-tree-visualizer-parent-buffer 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-parent-buffer)
-
-;; stores modification time of parent buffer's file, if any
-(defvar undo-tree-visualizer-parent-mtime nil)
-(put 'undo-tree-visualizer-parent-mtime 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-parent-mtime)
-
-;; stores current horizontal spacing needed for drawing undo-tree
-(defvar undo-tree-visualizer-spacing nil)
-(put 'undo-tree-visualizer-spacing 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-spacing)
-
-;; calculate horizontal spacing required for drawing tree with current
-;; settings
-(defsubst undo-tree-visualizer-calculate-spacing ()
- (if undo-tree-visualizer-timestamps
- (if undo-tree-visualizer-relative-timestamps 9 13)
- 3))
-
-;; holds node that was current when visualizer was invoked
-(defvar undo-tree-visualizer-initial-node nil)
-(put 'undo-tree-visualizer-initial-node 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-initial-node)
-
-;; holds currently selected node in visualizer selection mode
-(defvar undo-tree-visualizer-selected-node nil)
-(put 'undo-tree-visualizer-selected-node 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-selected)
-
-;; used to store nodes at edge of currently drawn portion of tree
-(defvar undo-tree-visualizer-needs-extending-down nil)
-(put 'undo-tree-visualizer-needs-extending-down 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-needs-extending-down)
-(defvar undo-tree-visualizer-needs-extending-up nil)
-(put 'undo-tree-visualizer-needs-extending-up 'permanent-local t)
-(make-variable-buffer-local 'undo-tree-visualizer-needs-extending-up)
-
-;; dynamically bound to t when undoing from visualizer, to inhibit
-;; `undo-tree-kill-visualizer' hook function in parent buffer
-(defvar undo-tree-inhibit-kill-visualizer nil)
-
-;; can be let-bound to a face name, used in drawing functions
-(defvar undo-tree-insert-face nil)
-
-;; visualizer buffer names
-(defconst undo-tree-visualizer-buffer-name " *undo-tree*")
-(defconst undo-tree-diff-buffer-name "*undo-tree Diff*")
-
-;; install history-auto-save hooks
-(add-hook 'write-file-functions 'undo-tree-save-history-hook)
-(add-hook 'find-file-hook 'undo-tree-load-history-hook)
-
-
-
-
-;;; =================================================================
-;;; Default keymaps
-
-(defvar undo-tree-map nil
- "Keymap used in undo-tree-mode.")
-
-(unless undo-tree-map
- (let ((map (make-sparse-keymap)))
- ;; remap `undo' and `undo-only' to `undo-tree-undo'
- (define-key map [remap undo] 'undo-tree-undo)
- (define-key map [remap undo-only] 'undo-tree-undo)
- ;; bind standard undo bindings (since these match redo counterparts)
- (define-key map (kbd "C-/") 'undo-tree-undo)
- (define-key map "\C-_" 'undo-tree-undo)
- ;; redo doesn't exist normally, so define our own keybindings
- (define-key map (kbd "C-?") 'undo-tree-redo)
- (define-key map (kbd "M-_") 'undo-tree-redo)
- ;; just in case something has defined `redo'...
- (define-key map [remap redo] 'undo-tree-redo)
- ;; we use "C-x u" for the undo-tree visualizer
- (define-key map (kbd "\C-x u") 'undo-tree-visualize)
- ;; bind register commands
- (define-key map (kbd "C-x r u") 'undo-tree-save-state-to-register)
- (define-key map (kbd "C-x r U") 'undo-tree-restore-state-from-register)
- ;; set keymap
- (setq undo-tree-map map)))
-
-
-(defvar undo-tree-visualizer-mode-map nil
- "Keymap used in undo-tree visualizer.")
-
-(unless undo-tree-visualizer-mode-map
- (let ((map (make-sparse-keymap)))
- ;; vertical motion keys undo/redo
- (define-key map [remap previous-line] 'undo-tree-visualize-undo)
- (define-key map [remap next-line] 'undo-tree-visualize-redo)
- (define-key map [up] 'undo-tree-visualize-undo)
- (define-key map "p" 'undo-tree-visualize-undo)
- (define-key map "\C-p" 'undo-tree-visualize-undo)
- (define-key map [down] 'undo-tree-visualize-redo)
- (define-key map "n" 'undo-tree-visualize-redo)
- (define-key map "\C-n" 'undo-tree-visualize-redo)
- ;; horizontal motion keys switch branch
- (define-key map [remap forward-char]
- 'undo-tree-visualize-switch-branch-right)
- (define-key map [remap backward-char]
- 'undo-tree-visualize-switch-branch-left)
- (define-key map [right] 'undo-tree-visualize-switch-branch-right)
- (define-key map "f" 'undo-tree-visualize-switch-branch-right)
- (define-key map "\C-f" 'undo-tree-visualize-switch-branch-right)
- (define-key map [left] 'undo-tree-visualize-switch-branch-left)
- (define-key map "b" 'undo-tree-visualize-switch-branch-left)
- (define-key map "\C-b" 'undo-tree-visualize-switch-branch-left)
- ;; paragraph motion keys undo/redo to significant points in tree
- (define-key map [remap backward-paragraph] 'undo-tree-visualize-undo-to-x)
- (define-key map [remap forward-paragraph] 'undo-tree-visualize-redo-to-x)
- (define-key map "\M-{" 'undo-tree-visualize-undo-to-x)
- (define-key map "\M-}" 'undo-tree-visualize-redo-to-x)
- (define-key map [C-up] 'undo-tree-visualize-undo-to-x)
- (define-key map [C-down] 'undo-tree-visualize-redo-to-x)
- ;; mouse sets buffer state to node at click
- (define-key map [mouse-1] 'undo-tree-visualizer-mouse-set)
- ;; toggle timestamps
- (define-key map "t" 'undo-tree-visualizer-toggle-timestamps)
- ;; toggle diff
- (define-key map "d" 'undo-tree-visualizer-toggle-diff)
- ;; toggle selection mode
- (define-key map "s" 'undo-tree-visualizer-selection-mode)
- ;; horizontal scrolling may be needed if the tree is very wide
- (define-key map "," 'undo-tree-visualizer-scroll-left)
- (define-key map "." 'undo-tree-visualizer-scroll-right)
- (define-key map "<" 'undo-tree-visualizer-scroll-left)
- (define-key map ">" 'undo-tree-visualizer-scroll-right)
- ;; vertical scrolling may be needed if the tree is very tall
- (define-key map [next] 'undo-tree-visualizer-scroll-up)
- (define-key map [prior] 'undo-tree-visualizer-scroll-down)
- ;; quit/abort visualizer
- (define-key map "q" 'undo-tree-visualizer-quit)
- (define-key map "\C-q" 'undo-tree-visualizer-abort)
- ;; set keymap
- (setq undo-tree-visualizer-mode-map map)))
-
-
-(defvar undo-tree-visualizer-selection-mode-map nil
- "Keymap used in undo-tree visualizer selection mode.")
-
-(unless undo-tree-visualizer-selection-mode-map
- (let ((map (make-sparse-keymap)))
- ;; vertical motion keys move up and down tree
- (define-key map [remap previous-line]
- 'undo-tree-visualizer-select-previous)
- (define-key map [remap next-line]
- 'undo-tree-visualizer-select-next)
- (define-key map [up] 'undo-tree-visualizer-select-previous)
- (define-key map "p" 'undo-tree-visualizer-select-previous)
- (define-key map "\C-p" 'undo-tree-visualizer-select-previous)
- (define-key map [down] 'undo-tree-visualizer-select-next)
- (define-key map "n" 'undo-tree-visualizer-select-next)
- (define-key map "\C-n" 'undo-tree-visualizer-select-next)
- ;; vertical scroll keys move up and down quickly
- (define-key map [next]
- (lambda () (interactive) (undo-tree-visualizer-select-next 10)))
- (define-key map [prior]
- (lambda () (interactive) (undo-tree-visualizer-select-previous 10)))
- ;; horizontal motion keys move to left and right siblings
- (define-key map [remap forward-char] 'undo-tree-visualizer-select-right)
- (define-key map [remap backward-char] 'undo-tree-visualizer-select-left)
- (define-key map [right] 'undo-tree-visualizer-select-right)
- (define-key map "f" 'undo-tree-visualizer-select-right)
- (define-key map "\C-f" 'undo-tree-visualizer-select-right)
- (define-key map [left] 'undo-tree-visualizer-select-left)
- (define-key map "b" 'undo-tree-visualizer-select-left)
- (define-key map "\C-b" 'undo-tree-visualizer-select-left)
- ;; horizontal scroll keys move left or right quickly
- (define-key map ","
- (lambda () (interactive) (undo-tree-visualizer-select-left 10)))
- (define-key map "."
- (lambda () (interactive) (undo-tree-visualizer-select-right 10)))
- (define-key map "<"
- (lambda () (interactive) (undo-tree-visualizer-select-left 10)))
- (define-key map ">"
- (lambda () (interactive) (undo-tree-visualizer-select-right 10)))
- ;; sets buffer state to node at point
- (define-key map "\r" 'undo-tree-visualizer-set)
- ;; mouse selects node at click
- (define-key map [mouse-1] 'undo-tree-visualizer-mouse-select)
- ;; toggle diff
- (define-key map "d" 'undo-tree-visualizer-selection-toggle-diff)
- ;; set keymap
- (setq undo-tree-visualizer-selection-mode-map map)))
-
-
-(defvar undo-tree-old-undo-menu-item nil)
-
-(defun undo-tree-update-menu-bar ()
- "Update `undo-tree-mode' Edit menu items."
- (if undo-tree-mode
- (progn
- ;; save old undo menu item, and install undo/redo menu items
- (setq undo-tree-old-undo-menu-item
- (cdr (assq 'undo (lookup-key global-map [menu-bar edit]))))
- (define-key (lookup-key global-map [menu-bar edit])
- [undo] '(menu-item "Undo" undo-tree-undo
- :enable (and undo-tree-mode
- (not buffer-read-only)
- (not (eq t buffer-undo-list))
- (not (eq nil buffer-undo-tree))
- (undo-tree-node-previous
- (undo-tree-current buffer-undo-tree)))
- :help "Undo last operation"))
- (define-key-after (lookup-key global-map [menu-bar edit])
- [redo] '(menu-item "Redo" undo-tree-redo
- :enable (and undo-tree-mode
- (not buffer-read-only)
- (not (eq t buffer-undo-list))
- (not (eq nil buffer-undo-tree))
- (undo-tree-node-next
- (undo-tree-current buffer-undo-tree)))
- :help "Redo last operation")
- 'undo))
- ;; uninstall undo/redo menu items
- (define-key (lookup-key global-map [menu-bar edit])
- [undo] undo-tree-old-undo-menu-item)
- (define-key (lookup-key global-map [menu-bar edit])
- [redo] nil)))
-
-(add-hook 'menu-bar-update-hook 'undo-tree-update-menu-bar)
-
-
-
-
-
-;;; =====================================================================
-;;; Undo-tree data structure
-
-(defstruct
- (undo-tree
- :named
- (:constructor nil)
- (:constructor make-undo-tree
- (&aux
- (root (undo-tree-make-node nil nil))
- (current root)
- (size 0)
- (count 0)
- (object-pool (make-hash-table :test 'eq :weakness 'value))))
- ;;(:copier nil)
- )
- root current size count object-pool)
-
-
-
-(defstruct
- (undo-tree-node
- (:type vector) ; create unnamed struct
- (:constructor nil)
- (:constructor undo-tree-make-node
- (previous undo
- &optional redo
- &aux
- (timestamp (current-time))
- (branch 0)))
- (:constructor undo-tree-make-node-backwards
- (next-node undo
- &optional redo
- &aux
- (next (list next-node))
- (timestamp (current-time))
- (branch 0)))
- (:copier nil))
- previous next undo redo timestamp branch meta-data)
-
-
-(defmacro undo-tree-node-p (n)
- (let ((len (length (undo-tree-make-node nil nil))))
- `(and (vectorp ,n) (= (length ,n) ,len))))
-
-
-
-(defstruct
- (undo-tree-region-data
- (:type vector) ; create unnamed struct
- (:constructor nil)
- (:constructor undo-tree-make-region-data
- (&optional undo-beginning undo-end
- redo-beginning redo-end))
- (:constructor undo-tree-make-undo-region-data
- (undo-beginning undo-end))
- (:constructor undo-tree-make-redo-region-data
- (redo-beginning redo-end))
- (:copier nil))
- undo-beginning undo-end redo-beginning redo-end)
-
-
-(defmacro undo-tree-region-data-p (r)
- (let ((len (length (undo-tree-make-region-data))))
- `(and (vectorp ,r) (= (length ,r) ,len))))
-
-(defmacro undo-tree-node-clear-region-data (node)
- `(setf (undo-tree-node-meta-data ,node)
- (delq nil
- (delq :region
- (plist-put (undo-tree-node-meta-data ,node)
- :region nil)))))
-
-
-(defmacro undo-tree-node-undo-beginning (node)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (when (undo-tree-region-data-p r)
- (undo-tree-region-data-undo-beginning r))))
-
-(defmacro undo-tree-node-undo-end (node)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (when (undo-tree-region-data-p r)
- (undo-tree-region-data-undo-end r))))
-
-(defmacro undo-tree-node-redo-beginning (node)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (when (undo-tree-region-data-p r)
- (undo-tree-region-data-redo-beginning r))))
-
-(defmacro undo-tree-node-redo-end (node)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (when (undo-tree-region-data-p r)
- (undo-tree-region-data-redo-end r))))
-
-
-(defsetf undo-tree-node-undo-beginning (node) (val)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (unless (undo-tree-region-data-p r)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :region
- (setq r (undo-tree-make-region-data)))))
- (setf (undo-tree-region-data-undo-beginning r) ,val)))
-
-(defsetf undo-tree-node-undo-end (node) (val)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (unless (undo-tree-region-data-p r)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :region
- (setq r (undo-tree-make-region-data)))))
- (setf (undo-tree-region-data-undo-end r) ,val)))
-
-(defsetf undo-tree-node-redo-beginning (node) (val)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (unless (undo-tree-region-data-p r)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :region
- (setq r (undo-tree-make-region-data)))))
- (setf (undo-tree-region-data-redo-beginning r) ,val)))
-
-(defsetf undo-tree-node-redo-end (node) (val)
- `(let ((r (plist-get (undo-tree-node-meta-data ,node) :region)))
- (unless (undo-tree-region-data-p r)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :region
- (setq r (undo-tree-make-region-data)))))
- (setf (undo-tree-region-data-redo-end r) ,val)))
-
-
-
-(defstruct
- (undo-tree-visualizer-data
- (:type vector) ; create unnamed struct
- (:constructor nil)
- (:constructor undo-tree-make-visualizer-data
- (&optional lwidth cwidth rwidth marker))
- (:copier nil))
- lwidth cwidth rwidth marker)
-
-
-(defmacro undo-tree-visualizer-data-p (v)
- (let ((len (length (undo-tree-make-visualizer-data))))
- `(and (vectorp ,v) (= (length ,v) ,len))))
-
-(defun undo-tree-node-clear-visualizer-data (node)
- (let ((plist (undo-tree-node-meta-data node)))
- (if (eq (car plist) :visualizer)
- (setf (undo-tree-node-meta-data node) (nthcdr 2 plist))
- (while (and plist (not (eq (cadr plist) :visualizer)))
- (setq plist (cdr plist)))
- (if plist (setcdr plist (nthcdr 3 plist))))))
-
-(defmacro undo-tree-node-lwidth (node)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (when (undo-tree-visualizer-data-p v)
- (undo-tree-visualizer-data-lwidth v))))
-
-(defmacro undo-tree-node-cwidth (node)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (when (undo-tree-visualizer-data-p v)
- (undo-tree-visualizer-data-cwidth v))))
-
-(defmacro undo-tree-node-rwidth (node)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (when (undo-tree-visualizer-data-p v)
- (undo-tree-visualizer-data-rwidth v))))
-
-(defmacro undo-tree-node-marker (node)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (when (undo-tree-visualizer-data-p v)
- (undo-tree-visualizer-data-marker v))))
-
-
-(defsetf undo-tree-node-lwidth (node) (val)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (unless (undo-tree-visualizer-data-p v)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :visualizer
- (setq v (undo-tree-make-visualizer-data)))))
- (setf (undo-tree-visualizer-data-lwidth v) ,val)))
-
-(defsetf undo-tree-node-cwidth (node) (val)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (unless (undo-tree-visualizer-data-p v)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :visualizer
- (setq v (undo-tree-make-visualizer-data)))))
- (setf (undo-tree-visualizer-data-cwidth v) ,val)))
-
-(defsetf undo-tree-node-rwidth (node) (val)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (unless (undo-tree-visualizer-data-p v)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :visualizer
- (setq v (undo-tree-make-visualizer-data)))))
- (setf (undo-tree-visualizer-data-rwidth v) ,val)))
-
-(defsetf undo-tree-node-marker (node) (val)
- `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))
- (unless (undo-tree-visualizer-data-p v)
- (setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :visualizer
- (setq v (undo-tree-make-visualizer-data)))))
- (setf (undo-tree-visualizer-data-marker v) ,val)))
-
-
-
-(defstruct
- (undo-tree-register-data
- (:type vector)
- (:constructor nil)
- (:constructor undo-tree-make-register-data (buffer node)))
- buffer node)
-
-(defun undo-tree-register-data-p (data)
- (and (vectorp data)
- (= (length data) 2)
- (undo-tree-node-p (undo-tree-register-data-node data))))
-
-(defun undo-tree-register-data-print-func (data)
- (princ (format "an undo-tree state for buffer %s"
- (undo-tree-register-data-buffer data))))
-
-(defmacro undo-tree-node-register (node)
- `(plist-get (undo-tree-node-meta-data ,node) :register))
-
-(defsetf undo-tree-node-register (node) (val)
- `(setf (undo-tree-node-meta-data ,node)
- (plist-put (undo-tree-node-meta-data ,node) :register ,val)))
-
-
-
-
-;;; =====================================================================
-;;; Basic undo-tree data structure functions
-
-(defun undo-tree-grow (undo)
- "Add an UNDO node to current branch of `buffer-undo-tree'."
- (let* ((current (undo-tree-current buffer-undo-tree))
- (new (undo-tree-make-node current undo)))
- (push new (undo-tree-node-next current))
- (setf (undo-tree-current buffer-undo-tree) new)))
-
-
-(defun undo-tree-grow-backwards (node undo &optional redo)
- "Add new node *above* undo-tree NODE, and return new node.
-Note that this will overwrite NODE's \"previous\" link, so should
-only be used on a detached NODE, never on nodes that are already
-part of `buffer-undo-tree'."
- (let ((new (undo-tree-make-node-backwards node undo redo)))
- (setf (undo-tree-node-previous node) new)
- new))
-
-
-(defun undo-tree-splice-node (node splice)
- "Splice NODE into undo tree, below node SPLICE.
-Note that this will overwrite NODE's \"next\" and \"previous\"
-links, so should only be used on a detached NODE, never on nodes
-that are already part of `buffer-undo-tree'."
- (setf (undo-tree-node-next node) (undo-tree-node-next splice)
- (undo-tree-node-branch node) (undo-tree-node-branch splice)
- (undo-tree-node-previous node) splice
- (undo-tree-node-next splice) (list node)
- (undo-tree-node-branch splice) 0)
- (dolist (n (undo-tree-node-next node))
- (setf (undo-tree-node-previous n) node)))
-
-
-(defun undo-tree-snip-node (node)
- "Snip NODE out of undo tree."
- (let* ((parent (undo-tree-node-previous node))
- position p)
- ;; if NODE is only child, replace parent's next links with NODE's
- (if (= (length (undo-tree-node-next parent)) 0)
- (setf (undo-tree-node-next parent) (undo-tree-node-next node)
- (undo-tree-node-branch parent) (undo-tree-node-branch node))
- ;; otherwise...
- (setq position (undo-tree-position node (undo-tree-node-next parent)))
- (cond
- ;; if active branch used do go via NODE, set parent's branch to active
- ;; branch of NODE
- ((= (undo-tree-node-branch parent) position)
- (setf (undo-tree-node-branch parent)
- (+ position (undo-tree-node-branch node))))
- ;; if active branch didn't go via NODE, update parent's branch to point
- ;; to same node as before
- ((> (undo-tree-node-branch parent) position)
- (incf (undo-tree-node-branch parent)
- (1- (length (undo-tree-node-next node))))))
- ;; replace NODE in parent's next list with NODE's entire next list
- (if (= position 0)
- (setf (undo-tree-node-next parent)
- (nconc (undo-tree-node-next node)
- (cdr (undo-tree-node-next parent))))
- (setq p (nthcdr (1- position) (undo-tree-node-next parent)))
- (setcdr p (nconc (undo-tree-node-next node) (cddr p)))))
- ;; update previous links of NODE's children
- (dolist (n (undo-tree-node-next node))
- (setf (undo-tree-node-previous n) parent))))
-
-
-(defun undo-tree-mapc (--undo-tree-mapc-function-- node)
- ;; Apply FUNCTION to NODE and to each node below it.
- (let ((stack (list node))
- n)
- (while stack
- (setq n (pop stack))
- (funcall --undo-tree-mapc-function-- n)
- (setq stack (append (undo-tree-node-next n) stack)))))
-
-
-(defmacro undo-tree-num-branches ()
- "Return number of branches at current undo tree node."
- '(length (undo-tree-node-next (undo-tree-current buffer-undo-tree))))
-
-
-(defun undo-tree-position (node list)
- "Find the first occurrence of NODE in LIST.
-Return the index of the matching item, or nil of not found.
-Comparison is done with `eq'."
- (let ((i 0))
- (catch 'found
- (while (progn
- (when (eq node (car list)) (throw 'found i))
- (incf i)
- (setq list (cdr list))))
- nil)))
-
-
-(defvar *undo-tree-id-counter* 0)
-(make-variable-buffer-local '*undo-tree-id-counter*)
-
-(defmacro undo-tree-generate-id ()
- ;; Generate a new, unique id (uninterned symbol).
- ;; The name is made by appending a number to "undo-tree-id".
- ;; (Copied from CL package `gensym'.)
- `(let ((num (prog1 *undo-tree-id-counter* (incf *undo-tree-id-counter*))))
- (make-symbol (format "undo-tree-id%d" num))))
-
-
-(defun undo-tree-decircle (undo-tree)
- ;; Nullify PREVIOUS links of UNDO-TREE nodes, to make UNDO-TREE data
- ;; structure non-circular.
- (undo-tree-mapc
- (lambda (node)
- (dolist (n (undo-tree-node-next node))
- (setf (undo-tree-node-previous n) nil)))
- (undo-tree-root undo-tree)))
-
-
-(defun undo-tree-recircle (undo-tree)
- ;; Recreate PREVIOUS links of UNDO-TREE nodes, to restore circular UNDO-TREE
- ;; data structure.
- (undo-tree-mapc
- (lambda (node)
- (dolist (n (undo-tree-node-next node))
- (setf (undo-tree-node-previous n) node)))
- (undo-tree-root undo-tree)))
-
-
-
-
-;;; =====================================================================
-;;; Undo list and undo changeset utility functions
-
-(defmacro undo-list-marker-elt-p (elt)
- `(markerp (car-safe ,elt)))
-
-(defmacro undo-list-GCd-marker-elt-p (elt)
- ;; Return t if ELT is a marker element whose marker has been moved to the
- ;; object-pool, so may potentially have been garbage-collected.
- ;; Note: Valid marker undo elements should be uniquely identified as cons
- ;; cells with a symbol in the car (replacing the marker), and a number in
- ;; the cdr. However, to guard against future changes to undo element
- ;; formats, we perform an additional redundant check on the symbol name.
- `(and (car-safe ,elt)
- (symbolp (car ,elt))
- (let ((str (symbol-name (car ,elt))))
- (and (> (length str) 12)
- (string= (substring str 0 12) "undo-tree-id")))
- (numberp (cdr-safe ,elt))))
-
-
-(defun undo-tree-move-GC-elts-to-pool (elt)
- ;; Move elements that can be garbage-collected into `buffer-undo-tree'
- ;; object pool, substituting a unique id that can be used to retrieve them
- ;; later. (Only markers require this treatment currently.)
- (when (undo-list-marker-elt-p elt)
- (let ((id (undo-tree-generate-id)))
- (puthash id (car elt) (undo-tree-object-pool buffer-undo-tree))
- (setcar elt id))))
-
-
-(defun undo-tree-restore-GC-elts-from-pool (elt)
- ;; Replace object id's in ELT with corresponding objects from
- ;; `buffer-undo-tree' object pool and return modified ELT, or return nil if
- ;; any object in ELT has been garbage-collected.
- (if (undo-list-GCd-marker-elt-p elt)
- (when (setcar elt (gethash (car elt)
- (undo-tree-object-pool buffer-undo-tree)))
- elt)
- elt))
-
-
-(defun undo-list-clean-GCd-elts (undo-list)
- ;; Remove object id's from UNDO-LIST that refer to elements that have been
- ;; garbage-collected. UNDO-LIST is modified by side-effect.
- (while (undo-list-GCd-marker-elt-p (car undo-list))
- (unless (gethash (caar undo-list)
- (undo-tree-object-pool buffer-undo-tree))
- (setq undo-list (cdr undo-list))))
- (let ((p undo-list))
- (while (cdr p)
- (when (and (undo-list-GCd-marker-elt-p (cadr p))
- (null (gethash (car (cadr p))
- (undo-tree-object-pool buffer-undo-tree))))
- (setcdr p (cddr p)))
- (setq p (cdr p))))
- undo-list)
-
-
-(defun undo-list-pop-changeset (&optional discard-pos)
- ;; Pop changeset from `buffer-undo-list'. If DISCARD-POS is non-nil, discard
- ;; any position entries from changeset.
-
- ;; discard undo boundaries and (if DISCARD-POS is non-nil) position entries
- ;; at head of undo list
- (while (or (null (car buffer-undo-list))
- (and discard-pos (integerp (car buffer-undo-list))))
- (setq buffer-undo-list (cdr buffer-undo-list)))
- ;; pop elements up to next undo boundary, discarding position entries if
- ;; DISCARD-POS is non-nil
- (if (eq (car buffer-undo-list) 'undo-tree-canary)
- (push nil buffer-undo-list)
- (let* ((changeset (list (pop buffer-undo-list)))
- (p changeset))
- (while (progn
- (undo-tree-move-GC-elts-to-pool (car p))
- (while (and discard-pos (integerp (car buffer-undo-list)))
- (setq buffer-undo-list (cdr buffer-undo-list)))
- (and (car buffer-undo-list)
- (not (eq (car buffer-undo-list) 'undo-tree-canary))))
- (setcdr p (list (pop buffer-undo-list)))
- (setq p (cdr p)))
- changeset)))
-
-
-(defun undo-tree-copy-list (undo-list)
- ;; Return a deep copy of first changeset in `undo-list'. Object id's are
- ;; replaced by corresponding objects from `buffer-undo-tree' object-pool.
- (let (copy p)
- ;; if first element contains an object id, replace it with object from
- ;; pool, discarding element entirely if it's been GC'd
- (while (and undo-list (null copy))
- (setq copy
- (undo-tree-restore-GC-elts-from-pool (pop undo-list))))
- (when copy
- (setq copy (list copy)
- p copy)
- ;; copy remaining elements, replacing object id's with objects from
- ;; pool, or discarding them entirely if they've been GC'd
- (while undo-list
- (when (setcdr p (undo-tree-restore-GC-elts-from-pool
- (undo-copy-list-1 (pop undo-list))))
- (setcdr p (list (cdr p)))
- (setq p (cdr p))))
- copy)))
-
-
-
-(defun undo-list-transfer-to-tree ()
- ;; Transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'.
-
- ;; `undo-list-transfer-to-tree' should never be called when undo is disabled
- ;; (i.e. `buffer-undo-tree' is t)
- (assert (not (eq buffer-undo-tree t)))
-
- ;; if `buffer-undo-tree' is empty, create initial undo-tree
- (when (null buffer-undo-tree) (setq buffer-undo-tree (make-undo-tree)))
- ;; make sure there's a canary at end of `buffer-undo-list'
- (when (null buffer-undo-list)
- (setq buffer-undo-list '(nil undo-tree-canary)))
-
- (unless (or (eq (cadr buffer-undo-list) 'undo-tree-canary)
- (eq (car buffer-undo-list) 'undo-tree-canary))
- ;; create new node from first changeset in `buffer-undo-list', save old
- ;; `buffer-undo-tree' current node, and make new node the current node
- (let* ((node (undo-tree-make-node nil (undo-list-pop-changeset)))
- (splice (undo-tree-current buffer-undo-tree))
- (size (undo-list-byte-size (undo-tree-node-undo node)))
- (count 1))
- (setf (undo-tree-current buffer-undo-tree) node)
- ;; grow tree fragment backwards using `buffer-undo-list' changesets
- (while (and buffer-undo-list
- (not (eq (cadr buffer-undo-list) 'undo-tree-canary)))
- (setq node
- (undo-tree-grow-backwards node (undo-list-pop-changeset)))
- (incf size (undo-list-byte-size (undo-tree-node-undo node)))
- (incf count))
- ;; if no undo history has been discarded from `buffer-undo-list' since
- ;; last transfer, splice new tree fragment onto end of old
- ;; `buffer-undo-tree' current node
- (if (or (eq (cadr buffer-undo-list) 'undo-tree-canary)
- (eq (car buffer-undo-list) 'undo-tree-canary))
- (progn
- (setf (undo-tree-node-previous node) splice)
- (push node (undo-tree-node-next splice))
- (setf (undo-tree-node-branch splice) 0)
- (incf (undo-tree-size buffer-undo-tree) size)
- (incf (undo-tree-count buffer-undo-tree) count))
- ;; if undo history has been discarded, replace entire
- ;; `buffer-undo-tree' with new tree fragment
- (setq node (undo-tree-grow-backwards node nil))
- (setf (undo-tree-root buffer-undo-tree) node)
- (setq buffer-undo-list '(nil undo-tree-canary))
- (setf (undo-tree-size buffer-undo-tree) size)
- (setf (undo-tree-count buffer-undo-tree) count)
- (setq buffer-undo-list '(nil undo-tree-canary))))
- ;; discard undo history if necessary
- (undo-tree-discard-history)))
-
-
-(defun undo-list-byte-size (undo-list)
- ;; Return size (in bytes) of UNDO-LIST
- (let ((size 0) (p undo-list))
- (while p
- (incf size 8) ; cons cells use up 8 bytes
- (when (and (consp (car p)) (stringp (caar p)))
- (incf size (string-bytes (caar p))))
- (setq p (cdr p)))
- size))
-
-
-
-(defun undo-list-rebuild-from-tree ()
- "Rebuild `buffer-undo-list' from information in `buffer-undo-tree'."
- (unless (eq buffer-undo-list t)
- (undo-list-transfer-to-tree)
- (setq buffer-undo-list nil)
- (when buffer-undo-tree
- (let ((stack (list (list (undo-tree-root buffer-undo-tree)))))
- (push (sort (mapcar 'identity (undo-tree-node-next (caar stack)))
- (lambda (a b)
- (time-less-p (undo-tree-node-timestamp a)
- (undo-tree-node-timestamp b))))
- stack)
- ;; Traverse tree in depth-and-oldest-first order, but add undo records
- ;; on the way down, and redo records on the way up.
- (while (or (car stack)
- (not (eq (car (nth 1 stack))
- (undo-tree-current buffer-undo-tree))))
- (if (car stack)
- (progn
- (setq buffer-undo-list
- (append (undo-tree-node-undo (caar stack))
- buffer-undo-list))
- (undo-boundary)
- (push (sort (mapcar 'identity
- (undo-tree-node-next (caar stack)))
- (lambda (a b)
- (time-less-p (undo-tree-node-timestamp a)
- (undo-tree-node-timestamp b))))
- stack))
- (pop stack)
- (setq buffer-undo-list
- (append (undo-tree-node-redo (caar stack))
- buffer-undo-list))
- (undo-boundary)
- (pop (car stack))))))))
-
-
-
-
-;;; =====================================================================
-;;; History discarding utility functions
-
-(defun undo-tree-oldest-leaf (node)
- ;; Return oldest leaf node below NODE.
- (while (undo-tree-node-next node)
- (setq node
- (car (sort (mapcar 'identity (undo-tree-node-next node))
- (lambda (a b)
- (time-less-p (undo-tree-node-timestamp a)
- (undo-tree-node-timestamp b)))))))
- node)
-
-
-(defun undo-tree-discard-node (node)
- ;; Discard NODE from `buffer-undo-tree', and return next in line for
- ;; discarding.
-
- ;; don't discard current node
- (unless (eq node (undo-tree-current buffer-undo-tree))
-
- ;; discarding root node...
- (if (eq node (undo-tree-root buffer-undo-tree))
- (cond
- ;; should always discard branches before root
- ((> (length (undo-tree-node-next node)) 1)
- (error "Trying to discard undo-tree root which still\
- has multiple branches"))
- ;; don't discard root if current node is only child
- ((eq (car (undo-tree-node-next node))
- (undo-tree-current buffer-undo-tree))
- nil)
- ;; discard root
- (t
- ;; clear any register referring to root
- (let ((r (undo-tree-node-register node)))
- (when (and r (eq (get-register r) node))
- (set-register r nil)))
- ;; make child of root into new root
- (setq node (setf (undo-tree-root buffer-undo-tree)
- (car (undo-tree-node-next node))))
- ;; update undo-tree size
- (decf (undo-tree-size buffer-undo-tree)
- (+ (undo-list-byte-size (undo-tree-node-undo node))
- (undo-list-byte-size (undo-tree-node-redo node))))
- (decf (undo-tree-count buffer-undo-tree))
- ;; discard new root's undo data and PREVIOUS link
- (setf (undo-tree-node-undo node) nil
- (undo-tree-node-redo node) nil
- (undo-tree-node-previous node) nil)
- ;; if new root has branches, or new root is current node, next node
- ;; to discard is oldest leaf, otherwise it's new root
- (if (or (> (length (undo-tree-node-next node)) 1)
- (eq (car (undo-tree-node-next node))
- (undo-tree-current buffer-undo-tree)))
- (undo-tree-oldest-leaf node)
- node)))
-
- ;; discarding leaf node...
- (let* ((parent (undo-tree-node-previous node))
- (current (nth (undo-tree-node-branch parent)
- (undo-tree-node-next parent))))
- ;; clear any register referring to the discarded node
- (let ((r (undo-tree-node-register node)))
- (when (and r (eq (get-register r) node))
- (set-register r nil)))
- ;; update undo-tree size
- (decf (undo-tree-size buffer-undo-tree)
- (+ (undo-list-byte-size (undo-tree-node-undo node))
- (undo-list-byte-size (undo-tree-node-redo node))))
- (decf (undo-tree-count buffer-undo-tree))
- ;; discard leaf
- (setf (undo-tree-node-next parent)
- (delq node (undo-tree-node-next parent))
- (undo-tree-node-branch parent)
- (undo-tree-position current (undo-tree-node-next parent)))
- ;; if parent has branches, or parent is current node, next node to
- ;; discard is oldest leaf, otherwise it's the parent itself
- (if (or (eq parent (undo-tree-current buffer-undo-tree))
- (and (undo-tree-node-next parent)
- (or (not (eq parent (undo-tree-root buffer-undo-tree)))
- (> (length (undo-tree-node-next parent)) 1))))
- (undo-tree-oldest-leaf parent)
- parent)))))
-
-
-
-(defun undo-tree-discard-history ()
- "Discard undo history until we're within memory usage limits
-set by `undo-limit', `undo-strong-limit' and `undo-outer-limit'."
-
- (when (> (undo-tree-size buffer-undo-tree) undo-limit)
- ;; if there are no branches off root, first node to discard is root;
- ;; otherwise it's leaf node at botom of oldest branch
- (let ((node (if (> (length (undo-tree-node-next
- (undo-tree-root buffer-undo-tree))) 1)
- (undo-tree-oldest-leaf (undo-tree-root buffer-undo-tree))
- (undo-tree-root buffer-undo-tree))))
-
- ;; discard nodes until memory use is within `undo-strong-limit'
- (while (and node
- (> (undo-tree-size buffer-undo-tree) undo-strong-limit))
- (setq node (undo-tree-discard-node node)))
-
- ;; discard nodes until next node to discard would bring memory use
- ;; within `undo-limit'
- (while (and node
- ;; check first if last discard has brought us within
- ;; `undo-limit', in case we can avoid more expensive
- ;; `undo-strong-limit' calculation
- ;; Note: this assumes undo-strong-limit > undo-limit;
- ;; if not, effectively undo-strong-limit = undo-limit
- (> (undo-tree-size buffer-undo-tree) undo-limit)
- (> (- (undo-tree-size buffer-undo-tree)
- ;; if next node to discard is root, the memory we
- ;; free-up comes from discarding changesets from its
- ;; only child...
- (if (eq node (undo-tree-root buffer-undo-tree))
- (+ (undo-list-byte-size
- (undo-tree-node-undo
- (car (undo-tree-node-next node))))
- (undo-list-byte-size
- (undo-tree-node-redo
- (car (undo-tree-node-next node)))))
- ;; ...otherwise, it comes from discarding changesets
- ;; from along with the node itself
- (+ (undo-list-byte-size (undo-tree-node-undo node))
- (undo-list-byte-size (undo-tree-node-redo node)))
- ))
- undo-limit))
- (setq node (undo-tree-discard-node node)))
-
- ;; if we're still over the `undo-outer-limit', discard entire history
- (when (> (undo-tree-size buffer-undo-tree) undo-outer-limit)
- ;; query first if `undo-ask-before-discard' is set
- (if undo-ask-before-discard
- (when (yes-or-no-p
- (format
- "Buffer `%s' undo info is %d bytes long; discard it? "
- (buffer-name) (undo-tree-size buffer-undo-tree)))
- (setq buffer-undo-tree nil))
- ;; otherwise, discard and display warning
- (display-warning
- '(undo discard-info)
- (concat
- (format "Buffer `%s' undo info was %d bytes long.\n"
- (buffer-name) (undo-tree-size buffer-undo-tree))
- "The undo info was discarded because it exceeded\
- `undo-outer-limit'.
-
-This is normal if you executed a command that made a huge change
-to the buffer. In that case, to prevent similar problems in the
-future, set `undo-outer-limit' to a value that is large enough to
-cover the maximum size of normal changes you expect a single
-command to make, but not so large that it might exceed the
-maximum memory allotted to Emacs.
-
-If you did not execute any such command, the situation is
-probably due to a bug and you should report it.
-
-You can disable the popping up of this buffer by adding the entry
-\(undo discard-info) to the user option `warning-suppress-types',
-which is defined in the `warnings' library.\n")
- :warning)
- (setq buffer-undo-tree nil)))
- )))
-
-
-
-
-;;; =====================================================================
-;;; Visualizer utility functions
-
-(defun undo-tree-compute-widths (node)
- "Recursively compute widths for nodes below NODE."
- (let ((stack (list node))
- res)
- (while stack
- ;; try to compute widths for node at top of stack
- (if (undo-tree-node-p
- (setq res (undo-tree-node-compute-widths (car stack))))
- ;; if computation fails, it returns a node whose widths still need
- ;; computing, which we push onto the stack
- (push res stack)
- ;; otherwise, store widths and remove it from stack
- (setf (undo-tree-node-lwidth (car stack)) (aref res 0)
- (undo-tree-node-cwidth (car stack)) (aref res 1)
- (undo-tree-node-rwidth (car stack)) (aref res 2))
- (pop stack)))))
-
-
-(defun undo-tree-node-compute-widths (node)
- ;; Compute NODE's left-, centre-, and right-subtree widths. Returns widths
- ;; (in a vector) if successful. Otherwise, returns a node whose widths need
- ;; calculating before NODE's can be calculated.
- (let ((num-children (length (undo-tree-node-next node)))
- (lwidth 0) (cwidth 0) (rwidth 0) p)
- (catch 'need-widths
- (cond
- ;; leaf nodes have 0 width
- ((= 0 num-children)
- (setf cwidth 1
- (undo-tree-node-lwidth node) 0
- (undo-tree-node-cwidth node) 1
- (undo-tree-node-rwidth node) 0))
-
- ;; odd number of children
- ((= (mod num-children 2) 1)
- (setq p (undo-tree-node-next node))
- ;; compute left-width
- (dotimes (i (/ num-children 2))
- (if (undo-tree-node-lwidth (car p))
- (incf lwidth (+ (undo-tree-node-lwidth (car p))
- (undo-tree-node-cwidth (car p))
- (undo-tree-node-rwidth (car p))))
- ;; if child's widths haven't been computed, return that child
- (throw 'need-widths (car p)))
- (setq p (cdr p)))
- (if (undo-tree-node-lwidth (car p))
- (incf lwidth (undo-tree-node-lwidth (car p)))
- (throw 'need-widths (car p)))
- ;; centre-width is inherited from middle child
- (setf cwidth (undo-tree-node-cwidth (car p)))
- ;; compute right-width
- (incf rwidth (undo-tree-node-rwidth (car p)))
- (setq p (cdr p))
- (dotimes (i (/ num-children 2))
- (if (undo-tree-node-lwidth (car p))
- (incf rwidth (+ (undo-tree-node-lwidth (car p))
- (undo-tree-node-cwidth (car p))
- (undo-tree-node-rwidth (car p))))
- (throw 'need-widths (car p)))
- (setq p (cdr p))))
-
- ;; even number of children
- (t
- (setq p (undo-tree-node-next node))
- ;; compute left-width
- (dotimes (i (/ num-children 2))
- (if (undo-tree-node-lwidth (car p))
- (incf lwidth (+ (undo-tree-node-lwidth (car p))
- (undo-tree-node-cwidth (car p))
- (undo-tree-node-rwidth (car p))))
- (throw 'need-widths (car p)))
- (setq p (cdr p)))
- ;; centre-width is 0 when number of children is even
- (setq cwidth 0)
- ;; compute right-width
- (dotimes (i (/ num-children 2))
- (if (undo-tree-node-lwidth (car p))
- (incf rwidth (+ (undo-tree-node-lwidth (car p))
- (undo-tree-node-cwidth (car p))
- (undo-tree-node-rwidth (car p))))
- (throw 'need-widths (car p)))
- (setq p (cdr p)))))
-
- ;; return left-, centre- and right-widths
- (vector lwidth cwidth rwidth))))
-
-
-(defun undo-tree-clear-visualizer-data (tree)
- ;; Clear visualizer data below NODE.
- (undo-tree-mapc
- (lambda (n) (undo-tree-node-clear-visualizer-data n))
- (undo-tree-root tree)))
-
-
-(defun undo-tree-node-unmodified-p (node &optional mtime)
- ;; Return non-nil if NODE corresponds to a buffer state that once upon a
- ;; time was unmodified. If a file modification time MTIME is specified,
- ;; return non-nil if the corresponding buffer state really is unmodified.
- (let (changeset ntime)
- (setq changeset
- (or (undo-tree-node-redo node)
- (and (setq changeset (car (undo-tree-node-next node)))
- (undo-tree-node-undo changeset)))
- ntime
- (catch 'found
- (dolist (elt changeset)
- (when (and (consp elt) (eq (car elt) t) (consp (cdr elt))
- (throw 'found (cdr elt)))))))
- (and ntime
- (or (null mtime)
- ;; high-precision timestamps
- (if (listp (cdr ntime))
- (equal ntime mtime)
- ;; old-style timestamps
- (and (= (car ntime) (car mtime))
- (= (cdr ntime) (cadr mtime))))))))
-
-
-
-
-;;; =====================================================================
-;;; Undo-in-region utility functions
-
-;; `undo-elt-in-region' uses this as a dynamically-scoped variable
-(defvar undo-adjusted-markers nil)
-
-
-(defun undo-tree-pull-undo-in-region-branch (start end)
- ;; Pull out entries from undo changesets to create a new undo-in-region
- ;; branch, which undoes changeset entries lying between START and END first,
- ;; followed by remaining entries from the changesets, before rejoining the
- ;; existing undo tree history. Repeated calls will, if appropriate, extend
- ;; the current undo-in-region branch rather than creating a new one.
-
- ;; if we're just reverting the last redo-in-region, we don't need to
- ;; manipulate the undo tree at all
- (if (undo-tree-reverting-redo-in-region-p start end)
- t ; return t to indicate success
-
- ;; We build the `region-changeset' and `delta-list' lists forwards, using
- ;; pointers `r' and `d' to the penultimate element of the list. So that we
- ;; don't have to treat the first element differently, we prepend a dummy
- ;; leading nil to the lists, and have the pointers point to that
- ;; initially.
- ;; Note: using '(nil) instead of (list nil) in the `let*' results in
- ;; bizarre errors when the code is byte-compiled, where parts of the
- ;; lists appear to survive across different calls to this function.
- ;; An obscure byte-compiler bug, perhaps?
- (let* ((region-changeset (list nil))
- (r region-changeset)
- (delta-list (list nil))
- (d delta-list)
- (node (undo-tree-current buffer-undo-tree))
- (repeated-undo-in-region
- (undo-tree-repeated-undo-in-region-p start end))
- undo-adjusted-markers ; `undo-elt-in-region' expects this
- fragment splice original-fragment original-splice original-current
- got-visible-elt undo-list elt)
-
- ;; --- initialisation ---
- (cond
- ;; if this is a repeated undo in the same region, start pulling changes
- ;; from NODE at which undo-in-region branch iss attached, and detatch
- ;; the branch, using it as initial FRAGMENT of branch being constructed
- (repeated-undo-in-region
- (setq original-current node
- fragment (car (undo-tree-node-next node))
- splice node)
- ;; undo up to node at which undo-in-region branch is attached
- ;; (recognizable as first node with more than one branch)
- (let ((mark-active nil))
- (while (= (length (undo-tree-node-next node)) 1)
- (undo-tree-undo-1)
- (setq fragment node
- node (undo-tree-current buffer-undo-tree))))
- (when (eq splice node) (setq splice nil))
- ;; detatch undo-in-region branch
- (setf (undo-tree-node-next node)
- (delq fragment (undo-tree-node-next node))
- (undo-tree-node-previous fragment) nil
- original-fragment fragment
- original-splice node))
-
- ;; if this is a new undo-in-region, initial FRAGMENT is a copy of all
- ;; nodes below the current one in the active branch
- ((undo-tree-node-next node)
- (setq fragment (undo-tree-make-node nil nil)
- splice fragment)
- (while (setq node (nth (undo-tree-node-branch node)
- (undo-tree-node-next node)))
- (push (undo-tree-make-node
- splice
- (undo-copy-list (undo-tree-node-undo node))
- (undo-copy-list (undo-tree-node-redo node)))
- (undo-tree-node-next splice))
- (setq splice (car (undo-tree-node-next splice))))
- (setq fragment (car (undo-tree-node-next fragment))
- splice nil
- node (undo-tree-current buffer-undo-tree))))
-
-
- ;; --- pull undo-in-region elements into branch ---
- ;; work backwards up tree, pulling out undo elements within region until
- ;; we've got one that undoes a visible change (insertion or deletion)
- (catch 'abort
- (while (and (not got-visible-elt) node (undo-tree-node-undo node))
- ;; we cons a dummy nil element on the front of the changeset so that
- ;; we can conveniently remove the first (real) element from the
- ;; changeset if we need to; the leading nil is removed once we're
- ;; done with this changeset
- (setq undo-list (cons nil (undo-copy-list (undo-tree-node-undo node)))
- elt (cadr undo-list))
- (if fragment
- (progn
- (setq fragment (undo-tree-grow-backwards fragment undo-list))
- (unless splice (setq splice fragment)))
- (setq fragment (undo-tree-make-node nil undo-list))
- (setq splice fragment))
-
- (while elt
- (cond
- ;; keep elements within region
- ((undo-elt-in-region elt start end)
- ;; set flag if kept element is visible (insertion or deletion)
- (when (and (consp elt)
- (or (stringp (car elt)) (integerp (car elt))))
- (setq got-visible-elt t))
- ;; adjust buffer positions in elements previously undone before
- ;; kept element, as kept element will now be undone first
- (undo-tree-adjust-elements-to-elt splice elt)
- ;; move kept element to undo-in-region changeset, adjusting its
- ;; buffer position as it will now be undone first
- (setcdr r (list (undo-tree-apply-deltas elt (cdr delta-list))))
- (setq r (cdr r))
- (setcdr undo-list (cddr undo-list)))
-
- ;; discard "was unmodified" elements
- ;; FIXME: deal properly with these
- ((and (consp elt) (eq (car elt) t))
- (setcdr undo-list (cddr undo-list)))
-
- ;; if element crosses region, we can't pull any more elements
- ((undo-elt-crosses-region elt start end)
- ;; if we've found a visible element, it must be earlier in
- ;; current node's changeset; stop pulling elements (null
- ;; `undo-list' and non-nil `got-visible-elt' cause loop to exit)
- (if got-visible-elt
- (setq undo-list nil)
- ;; if we haven't found a visible element yet, pulling
- ;; undo-in-region branch has failed
- (setq region-changeset nil)
- (throw 'abort t)))
-
- ;; if rejecting element, add its delta (if any) to the list
- (t
- (let ((delta (undo-delta elt)))
- (when (/= 0 (cdr delta))
- (setcdr d (list delta))
- (setq d (cdr d))))
- (setq undo-list (cdr undo-list))))
-
- ;; process next element of current changeset
- (setq elt (cadr undo-list)))
-
- ;; if there are remaining elements in changeset, remove dummy nil
- ;; from front
- (if (cadr (undo-tree-node-undo fragment))
- (pop (undo-tree-node-undo fragment))
- ;; otherwise, if we've kept all elements in changeset, discard
- ;; empty changeset
- (when (eq splice fragment) (setq splice nil))
- (setq fragment (car (undo-tree-node-next fragment))))
- ;; process changeset from next node up the tree
- (setq node (undo-tree-node-previous node))))
-
- ;; pop dummy nil from front of `region-changeset'
- (setq region-changeset (cdr region-changeset))
-
-
- ;; --- integrate branch into tree ---
- ;; if no undo-in-region elements were found, restore undo tree
- (if (null region-changeset)
- (when original-current
- (push original-fragment (undo-tree-node-next original-splice))
- (setf (undo-tree-node-branch original-splice) 0
- (undo-tree-node-previous original-fragment) original-splice)
- (let ((mark-active nil))
- (while (not (eq (undo-tree-current buffer-undo-tree)
- original-current))
- (undo-tree-redo-1)))
- nil) ; return nil to indicate failure
-
- ;; otherwise...
- ;; need to undo up to node where new branch will be attached, to
- ;; ensure redo entries are populated, and then redo back to where we
- ;; started
- (let ((mark-active nil)
- (current (undo-tree-current buffer-undo-tree)))
- (while (not (eq (undo-tree-current buffer-undo-tree) node))
- (undo-tree-undo-1))
- (while (not (eq (undo-tree-current buffer-undo-tree) current))
- (undo-tree-redo-1)))
-
- (cond
- ;; if there's no remaining fragment, just create undo-in-region node
- ;; and attach it to parent of last node from which elements were
- ;; pulled
- ((null fragment)
- (setq fragment (undo-tree-make-node node region-changeset))
- (push fragment (undo-tree-node-next node))
- (setf (undo-tree-node-branch node) 0)
- ;; set current node to undo-in-region node
- (setf (undo-tree-current buffer-undo-tree) fragment))
-
- ;; if no splice point has been set, add undo-in-region node to top of
- ;; fragment and attach it to parent of last node from which elements
- ;; were pulled
- ((null splice)
- (setq fragment (undo-tree-grow-backwards fragment region-changeset))
- (push fragment (undo-tree-node-next node))
- (setf (undo-tree-node-branch node) 0
- (undo-tree-node-previous fragment) node)
- ;; set current node to undo-in-region node
- (setf (undo-tree-current buffer-undo-tree) fragment))
-
- ;; if fragment contains nodes, attach fragment to parent of last node
- ;; from which elements were pulled, and splice in undo-in-region node
- (t
- (setf (undo-tree-node-previous fragment) node)
- (push fragment (undo-tree-node-next node))
- (setf (undo-tree-node-branch node) 0)
- ;; if this is a repeated undo-in-region, then we've left the current
- ;; node at the original splice-point; we need to set the current
- ;; node to the equivalent node on the undo-in-region branch and redo
- ;; back to where we started
- (when repeated-undo-in-region
- (setf (undo-tree-current buffer-undo-tree)
- (undo-tree-node-previous original-fragment))
- (let ((mark-active nil))
- (while (not (eq (undo-tree-current buffer-undo-tree) splice))
- (undo-tree-redo-1 nil 'preserve-undo))))
- ;; splice new undo-in-region node into fragment
- (setq node (undo-tree-make-node nil region-changeset))
- (undo-tree-splice-node node splice)
- ;; set current node to undo-in-region node
- (setf (undo-tree-current buffer-undo-tree) node)))
-
- ;; update undo-tree size
- (setq node (undo-tree-node-previous fragment))
- (while (progn
- (and (setq node (car (undo-tree-node-next node)))
- (not (eq node original-fragment))
- (incf (undo-tree-count buffer-undo-tree))
- (incf (undo-tree-size buffer-undo-tree)
- (+ (undo-list-byte-size (undo-tree-node-undo node))
- (undo-list-byte-size (undo-tree-node-redo node)))))))
- t) ; indicate undo-in-region branch was successfully pulled
- )))
-
-
-
-(defun undo-tree-pull-redo-in-region-branch (start end)
- ;; Pull out entries from redo changesets to create a new redo-in-region
- ;; branch, which redoes changeset entries lying between START and END first,
- ;; followed by remaining entries from the changesets. Repeated calls will,
- ;; if appropriate, extend the current redo-in-region branch rather than
- ;; creating a new one.
-
- ;; if we're just reverting the last undo-in-region, we don't need to
- ;; manipulate the undo tree at all
- (if (undo-tree-reverting-undo-in-region-p start end)
- t ; return t to indicate success
-
- ;; We build the `region-changeset' and `delta-list' lists forwards, using
- ;; pointers `r' and `d' to the penultimate element of the list. So that we
- ;; don't have to treat the first element differently, we prepend a dummy
- ;; leading nil to the lists, and have the pointers point to that
- ;; initially.
- ;; Note: using '(nil) instead of (list nil) in the `let*' causes bizarre
- ;; errors when the code is byte-compiled, where parts of the lists
- ;; appear to survive across different calls to this function. An
- ;; obscure byte-compiler bug, perhaps?
- (let* ((region-changeset (list nil))
- (r region-changeset)
- (delta-list (list nil))
- (d delta-list)
- (node (undo-tree-current buffer-undo-tree))
- (repeated-redo-in-region
- (undo-tree-repeated-redo-in-region-p start end))
- undo-adjusted-markers ; `undo-elt-in-region' expects this
- fragment splice got-visible-elt redo-list elt)
-
- ;; --- inisitalisation ---
- (cond
- ;; if this is a repeated redo-in-region, detach fragment below current
- ;; node
- (repeated-redo-in-region
- (when (setq fragment (car (undo-tree-node-next node)))
- (setf (undo-tree-node-previous fragment) nil
- (undo-tree-node-next node)
- (delq fragment (undo-tree-node-next node)))))
- ;; if this is a new redo-in-region, initial fragment is a copy of all
- ;; nodes below the current one in the active branch
- ((undo-tree-node-next node)
- (setq fragment (undo-tree-make-node nil nil)
- splice fragment)
- (while (setq node (nth (undo-tree-node-branch node)
- (undo-tree-node-next node)))
- (push (undo-tree-make-node
- splice nil
- (undo-copy-list (undo-tree-node-redo node)))
- (undo-tree-node-next splice))
- (setq splice (car (undo-tree-node-next splice))))
- (setq fragment (car (undo-tree-node-next fragment)))))
-
-
- ;; --- pull redo-in-region elements into branch ---
- ;; work down fragment, pulling out redo elements within region until
- ;; we've got one that redoes a visible change (insertion or deletion)
- (setq node fragment)
- (catch 'abort
- (while (and (not got-visible-elt) node (undo-tree-node-redo node))
- ;; we cons a dummy nil element on the front of the changeset so that
- ;; we can conveniently remove the first (real) element from the
- ;; changeset if we need to; the leading nil is removed once we're
- ;; done with this changeset
- (setq redo-list (push nil (undo-tree-node-redo node))
- elt (cadr redo-list))
- (while elt
- (cond
- ;; keep elements within region
- ((undo-elt-in-region elt start end)
- ;; set flag if kept element is visible (insertion or deletion)
- (when (and (consp elt)
- (or (stringp (car elt)) (integerp (car elt))))
- (setq got-visible-elt t))
- ;; adjust buffer positions in elements previously redone before
- ;; kept element, as kept element will now be redone first
- (undo-tree-adjust-elements-to-elt fragment elt t)
- ;; move kept element to redo-in-region changeset, adjusting its
- ;; buffer position as it will now be redone first
- (setcdr r (list (undo-tree-apply-deltas elt (cdr delta-list) -1)))
- (setq r (cdr r))
- (setcdr redo-list (cddr redo-list)))
-
- ;; discard "was unmodified" elements
- ;; FIXME: deal properly with these
- ((and (consp elt) (eq (car elt) t))
- (setcdr redo-list (cddr redo-list)))
-
- ;; if element crosses region, we can't pull any more elements
- ((undo-elt-crosses-region elt start end)
- ;; if we've found a visible element, it must be earlier in
- ;; current node's changeset; stop pulling elements (null
- ;; `redo-list' and non-nil `got-visible-elt' cause loop to exit)
- (if got-visible-elt
- (setq redo-list nil)
- ;; if we haven't found a visible element yet, pulling
- ;; redo-in-region branch has failed
- (setq region-changeset nil)
- (throw 'abort t)))
-
- ;; if rejecting element, add its delta (if any) to the list
- (t
- (let ((delta (undo-delta elt)))
- (when (/= 0 (cdr delta))
- (setcdr d (list delta))
- (setq d (cdr d))))
- (setq redo-list (cdr redo-list))))
-
- ;; process next element of current changeset
- (setq elt (cadr redo-list)))
-
- ;; if there are remaining elements in changeset, remove dummy nil
- ;; from front
- (if (cadr (undo-tree-node-redo node))
- (pop (undo-tree-node-undo node))
- ;; otherwise, if we've kept all elements in changeset, discard
- ;; empty changeset
- (if (eq fragment node)
- (setq fragment (car (undo-tree-node-next fragment)))
- (undo-tree-snip-node node)))
- ;; process changeset from next node in fragment
- (setq node (car (undo-tree-node-next node)))))
-
- ;; pop dummy nil from front of `region-changeset'
- (setq region-changeset (cdr region-changeset))
-
-
- ;; --- integrate branch into tree ---
- (setq node (undo-tree-current buffer-undo-tree))
- ;; if no redo-in-region elements were found, restore undo tree
- (if (null (car region-changeset))
- (when (and repeated-redo-in-region fragment)
- (push fragment (undo-tree-node-next node))
- (setf (undo-tree-node-branch node) 0
- (undo-tree-node-previous fragment) node)
- nil) ; return nil to indicate failure
-
- ;; otherwise, add redo-in-region node to top of fragment, and attach
- ;; it below current node
- (setq fragment
- (if fragment
- (undo-tree-grow-backwards fragment nil region-changeset)
- (undo-tree-make-node nil nil region-changeset)))
- (push fragment (undo-tree-node-next node))
- (setf (undo-tree-node-branch node) 0
- (undo-tree-node-previous fragment) node)
- ;; update undo-tree size
- (unless repeated-redo-in-region
- (setq node fragment)
- (while (and (setq node (car (undo-tree-node-next node)))
- (incf (undo-tree-count buffer-undo-tree))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size
- (undo-tree-node-redo node))))))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo fragment)))
- t) ; indicate redo-in-region branch was successfully pulled
- )))
-
-
-
-(defun undo-tree-adjust-elements-to-elt (node undo-elt &optional below)
- "Adjust buffer positions of undo elements, starting at NODE's
-and going up the tree (or down the active branch if BELOW is
-non-nil) and through the nodes' undo elements until we reach
-UNDO-ELT. UNDO-ELT must appear somewhere in the undo changeset
-of either NODE itself or some node above it in the tree."
- (let ((delta (list (undo-delta undo-elt)))
- (undo-list (undo-tree-node-undo node)))
- ;; adjust elements until we reach UNDO-ELT
- (while (and (car undo-list)
- (not (eq (car undo-list) undo-elt)))
- (setcar undo-list
- (undo-tree-apply-deltas (car undo-list) delta -1))
- ;; move to next undo element in list, or to next node if we've run out
- ;; of elements
- (unless (car (setq undo-list (cdr undo-list)))
- (if below
- (setq node (nth (undo-tree-node-branch node)
- (undo-tree-node-next node)))
- (setq node (undo-tree-node-previous node)))
- (setq undo-list (undo-tree-node-undo node))))))
-
-
-
-(defun undo-tree-apply-deltas (undo-elt deltas &optional sgn)
- ;; Apply DELTAS in order to UNDO-ELT, multiplying deltas by SGN
- ;; (only useful value for SGN is -1).
- (let (position offset)
- (dolist (delta deltas)
- (setq position (car delta)
- offset (* (cdr delta) (or sgn 1)))
- (cond
- ;; POSITION
- ((integerp undo-elt)
- (when (>= undo-elt position)
- (setq undo-elt (- undo-elt offset))))
- ;; nil (or any other atom)
- ((atom undo-elt))
- ;; (TEXT . POSITION)
- ((stringp (car undo-elt))
- (let ((text-pos (abs (cdr undo-elt)))
- (point-at-end (< (cdr undo-elt) 0)))
- (if (>= text-pos position)
- (setcdr undo-elt (* (if point-at-end -1 1)
- (- text-pos offset))))))
- ;; (BEGIN . END)
- ((integerp (car undo-elt))
- (when (>= (car undo-elt) position)
- (setcar undo-elt (- (car undo-elt) offset))
- (setcdr undo-elt (- (cdr undo-elt) offset))))
- ;; (nil PROPERTY VALUE BEG . END)
- ((null (car undo-elt))
- (let ((tail (nthcdr 3 undo-elt)))
- (when (>= (car tail) position)
- (setcar tail (- (car tail) offset))
- (setcdr tail (- (cdr tail) offset)))))
- ))
- undo-elt))
-
-
-
-(defun undo-tree-repeated-undo-in-region-p (start end)
- ;; Return non-nil if undo-in-region between START and END is a repeated
- ;; undo-in-region
- (let ((node (undo-tree-current buffer-undo-tree)))
- (and (setq node
- (nth (undo-tree-node-branch node) (undo-tree-node-next node)))
- (eq (undo-tree-node-undo-beginning node) start)
- (eq (undo-tree-node-undo-end node) end))))
-
-
-(defun undo-tree-repeated-redo-in-region-p (start end)
- ;; Return non-nil if undo-in-region between START and END is a repeated
- ;; undo-in-region
- (let ((node (undo-tree-current buffer-undo-tree)))
- (and (eq (undo-tree-node-redo-beginning node) start)
- (eq (undo-tree-node-redo-end node) end))))
-
-
-;; Return non-nil if undo-in-region between START and END is simply
-;; reverting the last redo-in-region
-(defalias 'undo-tree-reverting-undo-in-region-p
- 'undo-tree-repeated-undo-in-region-p)
-
-
-;; Return non-nil if redo-in-region between START and END is simply
-;; reverting the last undo-in-region
-(defalias 'undo-tree-reverting-redo-in-region-p
- 'undo-tree-repeated-redo-in-region-p)
-
-
-
-
-;;; =====================================================================
-;;; Undo-tree commands
-
-;;;###autoload
-(define-minor-mode undo-tree-mode
- "Toggle undo-tree mode.
-With no argument, this command toggles the mode.
-A positive prefix argument turns the mode on.
-A negative prefix argument turns it off.
-
-Undo-tree-mode replaces Emacs' standard undo feature with a more
-powerful yet easier to use version, that treats the undo history
-as what it is: a tree.
-
-The following keys are available in `undo-tree-mode':
-
- \\{undo-tree-map}
-
-Within the undo-tree visualizer, the following keys are available:
-
- \\{undo-tree-visualizer-mode-map}"
-
- nil ; init value
- undo-tree-mode-lighter ; lighter
- undo-tree-map ; keymap
-
- ;; if disabling `undo-tree-mode', rebuild `buffer-undo-list' from tree so
- ;; Emacs undo can work
- (when (not undo-tree-mode)
- (undo-list-rebuild-from-tree)
- (setq buffer-undo-tree nil)))
-
-
-(defun turn-on-undo-tree-mode (&optional print-message)
- "Enable `undo-tree-mode' in the current buffer, when appropriate.
-Some major modes implement their own undo system, which should
-not normally be overridden by `undo-tree-mode'. This command does
-not enable `undo-tree-mode' in such buffers. If you want to force
-`undo-tree-mode' to be enabled regardless, use (undo-tree-mode 1)
-instead.
-
-The heuristic used to detect major modes in which
-`undo-tree-mode' should not be used is to check whether either
-the `undo' command has been remapped, or the default undo
-keybindings (C-/ and C-_) have been overridden somewhere other
-than in the global map. In addition, `undo-tree-mode' will not be
-enabled if the buffer's `major-mode' appears in
-`undo-tree-incompatible-major-modes'."
- (interactive "p")
- (if (or (key-binding [remap undo])
- (undo-tree-overridden-undo-bindings-p)
- (memq major-mode undo-tree-incompatible-major-modes))
- (when print-message
- (message "Buffer does not support undo-tree-mode;\
- undo-tree-mode NOT enabled"))
- (undo-tree-mode 1)))
-
-
-(defun undo-tree-overridden-undo-bindings-p ()
- "Returns t if default undo bindings are overridden, nil otherwise.
-Checks if either of the default undo key bindings (\"C-/\" or
-\"C-_\") are overridden in the current buffer by any keymap other
-than the global one. (So global redefinitions of the default undo
-key bindings do not count.)"
- (let ((binding1 (lookup-key (current-global-map) [?\C-/]))
- (binding2 (lookup-key (current-global-map) [?\C-_])))
- (global-set-key [?\C-/] 'undo)
- (global-set-key [?\C-_] 'undo)
- (unwind-protect
- (or (and (key-binding [?\C-/])
- (not (eq (key-binding [?\C-/]) 'undo)))
- (and (key-binding [?\C-_])
- (not (eq (key-binding [?\C-_]) 'undo))))
- (global-set-key [?\C-/] binding1)
- (global-set-key [?\C-_] binding2))))
-
-
-;;;###autoload
-(define-globalized-minor-mode global-undo-tree-mode
- undo-tree-mode turn-on-undo-tree-mode)
-
-
-
-(defun undo-tree-undo (&optional arg)
- "Undo changes.
-Repeat this command to undo more changes.
-A numeric ARG serves as a repeat count.
-
-In Transient Mark mode when the mark is active, only undo changes
-within the current region. Similarly, when not in Transient Mark
-mode, just \\[universal-argument] as an argument limits undo to
-changes within the current region."
- (interactive "*P")
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; throw error if undo is disabled in buffer
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- (undo-tree-undo-1 arg)
- ;; inform user if at branch point
- (when (> (undo-tree-num-branches) 1) (message "Undo branch point!")))
-
-
-(defun undo-tree-undo-1 (&optional arg preserve-redo preserve-timestamps)
- ;; Internal undo function. An active mark in `transient-mark-mode', or
- ;; non-nil ARG otherwise, enables undo-in-region. Non-nil PRESERVE-REDO
- ;; causes the existing redo record to be preserved, rather than replacing it
- ;; with the new one generated by undoing. Non-nil PRESERVE-TIMESTAMPS
- ;; disables updating of timestamps in visited undo-tree nodes. (This latter
- ;; should *only* be used when temporarily visiting another undo state and
- ;; immediately returning to the original state afterwards. Otherwise, it
- ;; could cause history-discarding errors.)
- (let ((undo-in-progress t)
- (undo-in-region (and undo-tree-enable-undo-in-region
- (or (region-active-p)
- (and arg (not (numberp arg))))))
- pos current)
- ;; transfer entries accumulated in `buffer-undo-list' to
- ;; `buffer-undo-tree'
- (undo-list-transfer-to-tree)
-
- (dotimes (i (or (and (numberp arg) (prefix-numeric-value arg)) 1))
- ;; check if at top of undo tree
- (unless (undo-tree-node-previous (undo-tree-current buffer-undo-tree))
- (user-error "No further undo information"))
-
- ;; if region is active, or a non-numeric prefix argument was supplied,
- ;; try to pull out a new branch of changes affecting the region
- (when (and undo-in-region
- (not (undo-tree-pull-undo-in-region-branch
- (region-beginning) (region-end))))
- (user-error "No further undo information for region"))
-
- ;; remove any GC'd elements from node's undo list
- (setq current (undo-tree-current buffer-undo-tree))
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current)))
- (setf (undo-tree-node-undo current)
- (undo-list-clean-GCd-elts (undo-tree-node-undo current)))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current)))
- ;; undo one record from undo tree
- (when undo-in-region
- (setq pos (set-marker (make-marker) (point)))
- (set-marker-insertion-type pos t))
- (primitive-undo 1 (undo-tree-copy-list (undo-tree-node-undo current)))
- (undo-boundary)
-
- ;; if preserving old redo record, discard new redo entries that
- ;; `primitive-undo' has added to `buffer-undo-list', and remove any GC'd
- ;; elements from node's redo list
- (if preserve-redo
- (progn
- (undo-list-pop-changeset)
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current)))
- (setf (undo-tree-node-redo current)
- (undo-list-clean-GCd-elts (undo-tree-node-redo current)))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current))))
- ;; otherwise, record redo entries that `primitive-undo' has added to
- ;; `buffer-undo-list' in current node's redo record, replacing
- ;; existing entry if one already exists
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current)))
- (setf (undo-tree-node-redo current)
- (undo-list-pop-changeset 'discard-pos))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current))))
-
- ;; rewind current node and update timestamp
- (setf (undo-tree-current buffer-undo-tree)
- (undo-tree-node-previous (undo-tree-current buffer-undo-tree)))
- (unless preserve-timestamps
- (setf (undo-tree-node-timestamp (undo-tree-current buffer-undo-tree))
- (current-time)))
-
- ;; if undoing-in-region, record current node, region and direction so we
- ;; can tell if undo-in-region is repeated, and re-activate mark if in
- ;; `transient-mark-mode'; if not, erase any leftover data
- (if (not undo-in-region)
- (undo-tree-node-clear-region-data current)
- (goto-char pos)
- ;; note: we deliberately want to store the region information in the
- ;; node *below* the now current one
- (setf (undo-tree-node-undo-beginning current) (region-beginning)
- (undo-tree-node-undo-end current) (region-end))
- (set-marker pos nil)))
-
- ;; undo deactivates mark unless undoing-in-region
- (setq deactivate-mark (not undo-in-region))))
-
-
-
-(defun undo-tree-redo (&optional arg)
- "Redo changes. A numeric ARG serves as a repeat count.
-
-In Transient Mark mode when the mark is active, only redo changes
-within the current region. Similarly, when not in Transient Mark
-mode, just \\[universal-argument] as an argument limits redo to
-changes within the current region."
- (interactive "*P")
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; throw error if undo is disabled in buffer
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- (undo-tree-redo-1 arg)
- ;; inform user if at branch point
- (when (> (undo-tree-num-branches) 1) (message "Undo branch point!")))
-
-
-(defun undo-tree-redo-1 (&optional arg preserve-undo preserve-timestamps)
- ;; Internal redo function. An active mark in `transient-mark-mode', or
- ;; non-nil ARG otherwise, enables undo-in-region. Non-nil PRESERVE-UNDO
- ;; causes the existing redo record to be preserved, rather than replacing it
- ;; with the new one generated by undoing. Non-nil PRESERVE-TIMESTAMPS
- ;; disables updating of timestamps in visited undo-tree nodes. (This latter
- ;; should *only* be used when temporarily visiting another undo state and
- ;; immediately returning to the original state afterwards. Otherwise, it
- ;; could cause history-discarding errors.)
- (let ((undo-in-progress t)
- (redo-in-region (and undo-tree-enable-undo-in-region
- (or (region-active-p)
- (and arg (not (numberp arg))))))
- pos current)
- ;; transfer entries accumulated in `buffer-undo-list' to
- ;; `buffer-undo-tree'
- (undo-list-transfer-to-tree)
-
- (dotimes (i (or (and (numberp arg) (prefix-numeric-value arg)) 1))
- ;; check if at bottom of undo tree
- (when (null (undo-tree-node-next (undo-tree-current buffer-undo-tree)))
- (user-error "No further redo information"))
-
- ;; if region is active, or a non-numeric prefix argument was supplied,
- ;; try to pull out a new branch of changes affecting the region
- (when (and redo-in-region
- (not (undo-tree-pull-redo-in-region-branch
- (region-beginning) (region-end))))
- (user-error "No further redo information for region"))
-
- ;; get next node (but DON'T advance current node in tree yet, in case
- ;; redoing fails)
- (setq current (undo-tree-current buffer-undo-tree)
- current (nth (undo-tree-node-branch current)
- (undo-tree-node-next current)))
- ;; remove any GC'd elements from node's redo list
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current)))
- (setf (undo-tree-node-redo current)
- (undo-list-clean-GCd-elts (undo-tree-node-redo current)))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-redo current)))
- ;; redo one record from undo tree
- (when redo-in-region
- (setq pos (set-marker (make-marker) (point)))
- (set-marker-insertion-type pos t))
- (primitive-undo 1 (undo-tree-copy-list (undo-tree-node-redo current)))
- (undo-boundary)
- ;; advance current node in tree
- (setf (undo-tree-current buffer-undo-tree) current)
-
- ;; if preserving old undo record, discard new undo entries that
- ;; `primitive-undo' has added to `buffer-undo-list', and remove any GC'd
- ;; elements from node's redo list
- (if preserve-undo
- (progn
- (undo-list-pop-changeset)
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current)))
- (setf (undo-tree-node-undo current)
- (undo-list-clean-GCd-elts (undo-tree-node-undo current)))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current))))
- ;; otherwise, record undo entries that `primitive-undo' has added to
- ;; `buffer-undo-list' in current node's undo record, replacing
- ;; existing entry if one already exists
- (decf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current)))
- (setf (undo-tree-node-undo current)
- (undo-list-pop-changeset 'discard-pos))
- (incf (undo-tree-size buffer-undo-tree)
- (undo-list-byte-size (undo-tree-node-undo current))))
-
- ;; update timestamp
- (unless preserve-timestamps
- (setf (undo-tree-node-timestamp current) (current-time)))
-
- ;; if redoing-in-region, record current node, region and direction so we
- ;; can tell if redo-in-region is repeated, and re-activate mark if in
- ;; `transient-mark-mode'
- (if (not redo-in-region)
- (undo-tree-node-clear-region-data current)
- (goto-char pos)
- (setf (undo-tree-node-redo-beginning current) (region-beginning)
- (undo-tree-node-redo-end current) (region-end))
- (set-marker pos nil)))
-
- ;; redo deactivates the mark unless redoing-in-region
- (setq deactivate-mark (not redo-in-region))))
-
-
-
-(defun undo-tree-switch-branch (branch)
- "Switch to a different BRANCH of the undo tree.
-This will affect which branch to descend when *redoing* changes
-using `undo-tree-redo'."
- (interactive (list (or (and prefix-arg (prefix-numeric-value prefix-arg))
- (and (not (eq buffer-undo-list t))
- (or (undo-list-transfer-to-tree) t)
- (let ((b (undo-tree-node-branch
- (undo-tree-current
- buffer-undo-tree))))
- (cond
- ;; switch to other branch if only 2
- ((= (undo-tree-num-branches) 2) (- 1 b))
- ;; prompt if more than 2
- ((> (undo-tree-num-branches) 2)
- (read-number
- (format "Branch (0-%d, on %d): "
- (1- (undo-tree-num-branches)) b)))
- ))))))
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; throw error if undo is disabled in buffer
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- ;; sanity check branch number
- (when (<= (undo-tree-num-branches) 1)
- (user-error "Not at undo branch point"))
- (when (or (< branch 0) (> branch (1- (undo-tree-num-branches))))
- (user-error "Invalid branch number"))
- ;; transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'
- (undo-list-transfer-to-tree)
- ;; switch branch
- (setf (undo-tree-node-branch (undo-tree-current buffer-undo-tree))
- branch)
- (message "Switched to branch %d" branch))
-
-
-(defun undo-tree-set (node &optional preserve-timestamps)
- ;; Set buffer to state corresponding to NODE. Returns intersection point
- ;; between path back from current node and path back from selected NODE.
- ;; Non-nil PRESERVE-TIMESTAMPS disables updating of timestamps in visited
- ;; undo-tree nodes. (This should *only* be used when temporarily visiting
- ;; another undo state and immediately returning to the original state
- ;; afterwards. Otherwise, it could cause history-discarding errors.)
- (let ((path (make-hash-table :test 'eq))
- (n node))
- (puthash (undo-tree-root buffer-undo-tree) t path)
- ;; build list of nodes leading back from selected node to root, updating
- ;; branches as we go to point down to selected node
- (while (progn
- (puthash n t path)
- (when (undo-tree-node-previous n)
- (setf (undo-tree-node-branch (undo-tree-node-previous n))
- (undo-tree-position
- n (undo-tree-node-next (undo-tree-node-previous n))))
- (setq n (undo-tree-node-previous n)))))
- ;; work backwards from current node until we intersect path back from
- ;; selected node
- (setq n (undo-tree-current buffer-undo-tree))
- (while (not (gethash n path))
- (setq n (undo-tree-node-previous n)))
- ;; ascend tree until intersection node
- (while (not (eq (undo-tree-current buffer-undo-tree) n))
- (undo-tree-undo-1 nil nil preserve-timestamps))
- ;; descend tree until selected node
- (while (not (eq (undo-tree-current buffer-undo-tree) node))
- (undo-tree-redo-1 nil nil preserve-timestamps))
- n)) ; return intersection node
-
-
-
-(defun undo-tree-save-state-to-register (register)
- "Store current undo-tree state to REGISTER.
-The saved state can be restored using
-`undo-tree-restore-state-from-register'.
-Argument is a character, naming the register."
- (interactive "cUndo-tree state to register: ")
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; throw error if undo is disabled in buffer
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- ;; transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'
- (undo-list-transfer-to-tree)
- ;; save current node to REGISTER
- (set-register
- register (registerv-make
- (undo-tree-make-register-data
- (current-buffer) (undo-tree-current buffer-undo-tree))
- :print-func 'undo-tree-register-data-print-func))
- ;; record REGISTER in current node, for visualizer
- (setf (undo-tree-node-register (undo-tree-current buffer-undo-tree))
- register))
-
-
-
-(defun undo-tree-restore-state-from-register (register)
- "Restore undo-tree state from REGISTER.
-The state must be saved using `undo-tree-save-state-to-register'.
-Argument is a character, naming the register."
- (interactive "*cRestore undo-tree state from register: ")
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; throw error if undo is disabled in buffer, or if register doesn't contain
- ;; an undo-tree node
- (let ((data (registerv-data (get-register register))))
- (cond
- ((eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- ((not (undo-tree-register-data-p data))
- (user-error "Register doesn't contain undo-tree state"))
- ((not (eq (current-buffer) (undo-tree-register-data-buffer data)))
- (user-error "Register contains undo-tree state for a different buffer")))
- ;; transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'
- (undo-list-transfer-to-tree)
- ;; restore buffer state corresponding to saved node
- (undo-tree-set (undo-tree-register-data-node data))))
-
-
-
-
-;;; =====================================================================
-;;; Persistent storage commands
-
-(defun undo-tree-make-history-save-file-name (file)
- "Create the undo history file name for FILE.
-Normally this is the file's name with \".\" prepended and
-\".~undo-tree~\" appended.
-
-A match for FILE is sought in `undo-tree-history-directory-alist'
-\(see the documentation of that variable for details\). If the
-directory for the backup doesn't exist, it is created."
- (let* ((backup-directory-alist undo-tree-history-directory-alist)
- (name (make-backup-file-name-1 file)))
- (concat (file-name-directory name) "." (file-name-nondirectory name)
- ".~undo-tree~")))
-
-
-(defun undo-tree-save-history (&optional filename overwrite)
- "Store undo-tree history to file.
-
-If optional argument FILENAME is omitted, default save file is
-\"..~undo-tree\" if buffer is visiting a file.
-Otherwise, prompt for one.
-
-If OVERWRITE is non-nil, any existing file will be overwritten
-without asking for confirmation."
- (interactive)
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- (undo-list-transfer-to-tree)
- (when (and buffer-undo-tree (not (eq buffer-undo-tree t)))
- (condition-case nil
- (undo-tree-kill-visualizer)
- (error (undo-tree-clear-visualizer-data buffer-undo-tree)))
- (let ((buff (current-buffer))
- tree)
- ;; get filename
- (unless filename
- (setq filename
- (if buffer-file-name
- (undo-tree-make-history-save-file-name buffer-file-name)
- (expand-file-name (read-file-name "File to save in: ") nil))))
- (when (or (not (file-exists-p filename))
- overwrite
- (yes-or-no-p (format "Overwrite \"%s\"? " filename)))
- (unwind-protect
- (progn
- ;; transform undo-tree into non-circular structure, and make
- ;; temporary copy
- (undo-tree-decircle buffer-undo-tree)
- (setq tree (copy-undo-tree buffer-undo-tree))
- ;; discard undo-tree object pool before saving
- (setf (undo-tree-object-pool tree) nil)
- ;; print undo-tree to file
- ;; NOTE: We use `with-temp-buffer' instead of `with-temp-file'
- ;; to allow `auto-compression-mode' to take effect, in
- ;; case user has overridden or advised the default
- ;; `undo-tree-make-history-save-file-name' to add a
- ;; compressed file extension.
- (with-auto-compression-mode
- (with-temp-buffer
- (prin1 (sha1 buff) (current-buffer))
- (terpri (current-buffer))
- (let ((print-circle t)) (prin1 tree (current-buffer)))
- (write-region nil nil filename))))
- ;; restore circular undo-tree data structure
- (undo-tree-recircle buffer-undo-tree))
- ))))
-
-
-
-(defun undo-tree-load-history (&optional filename noerror)
- "Load undo-tree history from file.
-
-If optional argument FILENAME is null, default load file is
-\"..~undo-tree\" if buffer is visiting a file.
-Otherwise, prompt for one.
-
-If optional argument NOERROR is non-nil, return nil instead of
-signaling an error if file is not found."
- (interactive)
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; get filename
- (unless filename
- (setq filename
- (if buffer-file-name
- (undo-tree-make-history-save-file-name buffer-file-name)
- (expand-file-name (read-file-name "File to load from: ") nil))))
-
- ;; attempt to read undo-tree from FILENAME
- (catch 'load-error
- (unless (file-exists-p filename)
- (if noerror
- (throw 'load-error nil)
- (error "File \"%s\" does not exist; could not load undo-tree history"
- filename)))
- (let (buff hash tree)
- (setq buff (current-buffer))
- (with-auto-compression-mode
- (with-temp-buffer
- (insert-file-contents filename)
- (goto-char (point-min))
- (condition-case nil
- (setq hash (read (current-buffer)))
- (error
- (kill-buffer nil)
- (funcall (if noerror 'message 'user-error)
- "Error reading undo-tree history from \"%s\"" filename)
- (throw 'load-error nil)))
- (unless (string= (sha1 buff) hash)
- (kill-buffer nil)
- (funcall (if noerror 'message 'user-error)
- "Buffer has been modified; could not load undo-tree history")
- (throw 'load-error nil))
- (condition-case nil
- (setq tree (read (current-buffer)))
- (error
- (kill-buffer nil)
- (funcall (if noerror 'message 'error)
- "Error reading undo-tree history from \"%s\"" filename)
- (throw 'load-error nil)))
- (kill-buffer nil)))
- ;; initialise empty undo-tree object pool
- (setf (undo-tree-object-pool tree)
- (make-hash-table :test 'eq :weakness 'value))
- ;; restore circular undo-tree data structure
- (undo-tree-recircle tree)
- (setq buffer-undo-tree tree))))
-
-
-
-;; Versions of save/load functions for use in hooks
-(defun undo-tree-save-history-hook ()
- (when (and undo-tree-mode undo-tree-auto-save-history
- (not (eq buffer-undo-list t)))
- (undo-tree-save-history nil t) nil))
-
-(defun undo-tree-load-history-hook ()
- (when (and undo-tree-mode undo-tree-auto-save-history
- (not (eq buffer-undo-list t))
- (not revert-buffer-in-progress-p))
- (undo-tree-load-history nil t)))
-
-
-
-
-;;; =====================================================================
-;;; Visualizer drawing functions
-
-(defun undo-tree-visualize ()
- "Visualize the current buffer's undo tree."
- (interactive "*")
- (unless undo-tree-mode
- (user-error "Undo-tree mode not enabled in buffer"))
- (deactivate-mark)
- ;; throw error if undo is disabled in buffer
- (when (eq buffer-undo-list t)
- (user-error "No undo information in this buffer"))
- ;; transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'
- (undo-list-transfer-to-tree)
- ;; add hook to kill visualizer buffer if original buffer is changed
- (add-hook 'before-change-functions 'undo-tree-kill-visualizer nil t)
- ;; prepare *undo-tree* buffer, then draw tree in it
- (let ((undo-tree buffer-undo-tree)
- (buff (current-buffer))
- (display-buffer-mark-dedicated 'soft))
- (switch-to-buffer-other-window
- (get-buffer-create undo-tree-visualizer-buffer-name))
- (setq undo-tree-visualizer-parent-buffer buff)
- (setq undo-tree-visualizer-parent-mtime
- (and (buffer-file-name buff)
- (nth 5 (file-attributes (buffer-file-name buff)))))
- (setq undo-tree-visualizer-initial-node (undo-tree-current undo-tree))
- (setq undo-tree-visualizer-spacing
- (undo-tree-visualizer-calculate-spacing))
- (make-local-variable 'undo-tree-visualizer-timestamps)
- (make-local-variable 'undo-tree-visualizer-diff)
- (setq buffer-undo-tree undo-tree)
- (undo-tree-visualizer-mode)
- ;; FIXME; don't know why `undo-tree-visualizer-mode' clears this
- (setq buffer-undo-tree undo-tree)
- (set (make-local-variable 'undo-tree-visualizer-lazy-drawing)
- (or (eq undo-tree-visualizer-lazy-drawing t)
- (and (numberp undo-tree-visualizer-lazy-drawing)
- (>= (undo-tree-count undo-tree)
- undo-tree-visualizer-lazy-drawing))))
- (when undo-tree-visualizer-diff (undo-tree-visualizer-show-diff))
- (let ((inhibit-read-only t)) (undo-tree-draw-tree undo-tree))))
-
-
-(defun undo-tree-kill-visualizer (&rest _dummy)
- ;; Kill visualizer. Added to `before-change-functions' hook of original
- ;; buffer when visualizer is invoked.
- (unless (or undo-tree-inhibit-kill-visualizer
- (null (get-buffer undo-tree-visualizer-buffer-name)))
- (with-current-buffer undo-tree-visualizer-buffer-name
- (undo-tree-visualizer-quit))))
-
-
-
-(defun undo-tree-draw-tree (undo-tree)
- ;; Draw undo-tree in current buffer starting from NODE (or root if nil).
- (let ((node (if undo-tree-visualizer-lazy-drawing
- (undo-tree-current undo-tree)
- (undo-tree-root undo-tree))))
- (erase-buffer)
- (setq undo-tree-visualizer-needs-extending-down nil
- undo-tree-visualizer-needs-extending-up nil)
- (undo-tree-clear-visualizer-data undo-tree)
- (undo-tree-compute-widths node)
- ;; lazy drawing starts vertically centred and displaced horizontally to
- ;; the left (window-width/4), since trees will typically grow right
- (if undo-tree-visualizer-lazy-drawing
- (progn
- (undo-tree-move-down (/ (window-height) 2))
- (undo-tree-move-forward (max 2 (/ (window-width) 4)))) ; left margin
- ;; non-lazy drawing starts in centre at top of buffer
- (undo-tree-move-down 1) ; top margin
- (undo-tree-move-forward
- (max (/ (window-width) 2)
- (+ (undo-tree-node-char-lwidth node)
- ;; add space for left part of left-most time-stamp
- (if undo-tree-visualizer-timestamps
- (/ (- undo-tree-visualizer-spacing 4) 2)
- 0)
- 2)))) ; left margin
- ;; link starting node to its representation in visualizer
- (setf (undo-tree-node-marker node) (make-marker))
- (set-marker-insertion-type (undo-tree-node-marker node) nil)
- (move-marker (undo-tree-node-marker node) (point))
- ;; draw undo-tree
- (let ((undo-tree-insert-face 'undo-tree-visualizer-default-face)
- node-list)
- (if (not undo-tree-visualizer-lazy-drawing)
- (undo-tree-extend-down node t)
- (undo-tree-extend-down node)
- (undo-tree-extend-up node)
- (setq node-list undo-tree-visualizer-needs-extending-down
- undo-tree-visualizer-needs-extending-down nil)
- (while node-list (undo-tree-extend-down (pop node-list)))))
- ;; highlight active branch
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
- (undo-tree-highlight-active-branch
- (or undo-tree-visualizer-needs-extending-up
- (undo-tree-root undo-tree))))
- ;; highlight current node
- (undo-tree-draw-node (undo-tree-current undo-tree) 'current)))
-
-
-(defun undo-tree-extend-down (node &optional bottom)
- ;; Extend tree downwards starting from NODE and point. If BOTTOM is t,
- ;; extend all the way down to the leaves. If BOTTOM is a node, extend down
- ;; as far as that node. If BOTTOM is an integer, extend down as far as that
- ;; line. Otherwise, only extend visible portion of tree. NODE is assumed to
- ;; already have a node marker. Returns non-nil if anything was actually
- ;; extended.
- (let ((extended nil)
- (cur-stack (list node))
- next-stack)
- ;; don't bother extending if BOTTOM specifies an already-drawn node
- (unless (and (undo-tree-node-p bottom) (undo-tree-node-marker bottom))
- ;; draw nodes layer by layer
- (while (or cur-stack
- (prog1 (setq cur-stack next-stack)
- (setq next-stack nil)))
- (setq node (pop cur-stack))
- ;; if node is within range being drawn...
- (if (or (eq bottom t)
- (and (undo-tree-node-p bottom)
- (not (eq (undo-tree-node-previous node) bottom)))
- (and (integerp bottom)
- (>= bottom (line-number-at-pos
- (undo-tree-node-marker node))))
- (and (null bottom)
- (pos-visible-in-window-p (undo-tree-node-marker node)
- nil t)))
- ;; ...draw one layer of node's subtree (if not already drawn)
- (progn
- (unless (and (undo-tree-node-next node)
- (undo-tree-node-marker
- (nth (undo-tree-node-branch node)
- (undo-tree-node-next node))))
- (goto-char (undo-tree-node-marker node))
- (undo-tree-draw-subtree node)
- (setq extended t))
- (setq next-stack
- (append (undo-tree-node-next node) next-stack)))
- ;; ...otherwise, postpone drawing until later
- (push node undo-tree-visualizer-needs-extending-down))))
- extended))
-
-
-(defun undo-tree-extend-up (node &optional top)
- ;; Extend tree upwards starting from NODE. If TOP is t, extend all the way
- ;; to root. If TOP is a node, extend up as far as that node. If TOP is an
- ;; integer, extend up as far as that line. Otherwise, only extend visible
- ;; portion of tree. NODE is assumed to already have a node marker. Returns
- ;; non-nil if anything was actually extended.
- (let ((extended nil) parent)
- ;; don't bother extending if TOP specifies an already-drawn node
- (unless (and (undo-tree-node-p top) (undo-tree-node-marker top))
- (while node
- (setq parent (undo-tree-node-previous node))
- ;; if we haven't reached root...
- (if parent
- ;; ...and node is within range being drawn...
- (if (or (eq top t)
- (and (undo-tree-node-p top) (not (eq node top)))
- (and (integerp top)
- (< top (line-number-at-pos
- (undo-tree-node-marker node))))
- (and (null top)
- ;; NOTE: we check point in case window-start is outdated
- (< (min (line-number-at-pos (point))
- (line-number-at-pos (window-start)))
- (line-number-at-pos
- (undo-tree-node-marker node)))))
- ;; ...and it hasn't already been drawn
- (when (not (undo-tree-node-marker parent))
- ;; link parent node to its representation in visualizer
- (undo-tree-compute-widths parent)
- (undo-tree-move-to-parent node)
- (setf (undo-tree-node-marker parent) (make-marker))
- (set-marker-insertion-type
- (undo-tree-node-marker parent) nil)
- (move-marker (undo-tree-node-marker parent) (point))
- ;; draw subtree beneath parent
- (setq undo-tree-visualizer-needs-extending-down
- (nconc (delq node (undo-tree-draw-subtree parent))
- undo-tree-visualizer-needs-extending-down))
- (setq extended t))
- ;; ...otherwise, postpone drawing for later and exit
- (setq undo-tree-visualizer-needs-extending-up (when parent node)
- parent nil))
-
- ;; if we've reached root, stop extending and add top margin
- (setq undo-tree-visualizer-needs-extending-up nil)
- (goto-char (undo-tree-node-marker node))
- (undo-tree-move-up 1) ; top margin
- (delete-region (point-min) (line-beginning-position)))
- ;; next iteration
- (setq node parent)))
- extended))
-
-
-(defun undo-tree-expand-down (from &optional to)
- ;; Expand tree downwards. FROM is the node to start expanding from. Stop
- ;; expanding at TO if specified. Otherwise, just expand visible portion of
- ;; tree and highlight active branch from FROM.
- (when undo-tree-visualizer-needs-extending-down
- (let ((inhibit-read-only t)
- node-list extended)
- ;; extend down as far as TO node
- (when to
- (setq extended (undo-tree-extend-down from to))
- (goto-char (undo-tree-node-marker to))
- (redisplay t)) ; force redisplay to scroll buffer if necessary
- ;; extend visible portion of tree downwards
- (setq node-list undo-tree-visualizer-needs-extending-down
- undo-tree-visualizer-needs-extending-down nil)
- (when node-list
- (dolist (n node-list)
- (when (undo-tree-extend-down n) (setq extended t)))
- ;; highlight active branch in newly-extended-down portion, if any
- (when extended
- (let ((undo-tree-insert-face
- 'undo-tree-visualizer-active-branch-face))
- (undo-tree-highlight-active-branch from)))))))
-
-
-(defun undo-tree-expand-up (from &optional to)
- ;; Expand tree upwards. FROM is the node to start expanding from, TO is the
- ;; node to stop expanding at. If TO node isn't specified, just expand visible
- ;; portion of tree and highlight active branch down to FROM.
- (when undo-tree-visualizer-needs-extending-up
- (let ((inhibit-read-only t)
- extended node-list)
- ;; extend up as far as TO node
- (when to
- (setq extended (undo-tree-extend-up from to))
- (goto-char (undo-tree-node-marker to))
- ;; simulate auto-scrolling if close to top of buffer
- (when (<= (line-number-at-pos (point)) scroll-margin)
- (undo-tree-move-up (if (= scroll-conservatively 0)
- (/ (window-height) 2) 3))
- (when (undo-tree-extend-up to) (setq extended t))
- (goto-char (undo-tree-node-marker to))
- (unless (= scroll-conservatively 0) (recenter scroll-margin))))
- ;; extend visible portion of tree upwards
- (and undo-tree-visualizer-needs-extending-up
- (undo-tree-extend-up undo-tree-visualizer-needs-extending-up)
- (setq extended t))
- ;; extend visible portion of tree downwards
- (setq node-list undo-tree-visualizer-needs-extending-down
- undo-tree-visualizer-needs-extending-down nil)
- (dolist (n node-list) (undo-tree-extend-down n))
- ;; highlight active branch in newly-extended-up portion, if any
- (when extended
- (let ((undo-tree-insert-face
- 'undo-tree-visualizer-active-branch-face))
- (undo-tree-highlight-active-branch
- (or undo-tree-visualizer-needs-extending-up
- (undo-tree-root buffer-undo-tree))
- from))))))
-
-
-
-(defun undo-tree-highlight-active-branch (node &optional end)
- ;; Draw highlighted active branch below NODE in current buffer. Stop
- ;; highlighting at END node if specified.
- (let ((stack (list node)))
- ;; draw active branch
- (while stack
- (setq node (pop stack))
- (unless (or (eq node end)
- (memq node undo-tree-visualizer-needs-extending-down))
- (goto-char (undo-tree-node-marker node))
- (setq node (undo-tree-draw-subtree node 'active)
- stack (nconc stack node))))))
-
-
-(defun undo-tree-draw-node (node &optional current)
- ;; Draw symbol representing NODE in visualizer. If CURRENT is non-nil, node
- ;; is current node.
- (goto-char (undo-tree-node-marker node))
- (when undo-tree-visualizer-timestamps
- (undo-tree-move-backward (/ undo-tree-visualizer-spacing 2)))
-
- (let* ((undo-tree-insert-face (and undo-tree-insert-face
- (or (and (consp undo-tree-insert-face)
- undo-tree-insert-face)
- (list undo-tree-insert-face))))
- (register (undo-tree-node-register node))
- (unmodified (if undo-tree-visualizer-parent-mtime
- (undo-tree-node-unmodified-p
- node undo-tree-visualizer-parent-mtime)
- (undo-tree-node-unmodified-p node)))
- node-string)
- ;; check node's register (if any) still stores appropriate undo-tree state
- (unless (and register
- (undo-tree-register-data-p
- (registerv-data (get-register register)))
- (eq node (undo-tree-register-data-node
- (registerv-data (get-register register)))))
- (setq register nil))
- ;; represent node by different symbols, depending on whether it's the
- ;; current node, is saved in a register, or corresponds to an unmodified
- ;; buffer
- (setq node-string
- (cond
- (undo-tree-visualizer-timestamps
- (undo-tree-timestamp-to-string
- (undo-tree-node-timestamp node)
- undo-tree-visualizer-relative-timestamps
- current register))
- (register (char-to-string register))
- (unmodified "s")
- (current "x")
- (t "o"))
- undo-tree-insert-face
- (nconc
- (cond
- (current '(undo-tree-visualizer-current-face))
- (unmodified '(undo-tree-visualizer-unmodified-face))
- (register '(undo-tree-visualizer-register-face)))
- undo-tree-insert-face))
- ;; draw node and link it to its representation in visualizer
- (undo-tree-insert node-string)
- (undo-tree-move-backward (if undo-tree-visualizer-timestamps
- (1+ (/ undo-tree-visualizer-spacing 2))
- 1))
- (move-marker (undo-tree-node-marker node) (point))
- (put-text-property (point) (1+ (point)) 'undo-tree-node node)))
-
-
-(defun undo-tree-draw-subtree (node &optional active-branch)
- ;; Draw subtree rooted at NODE. The subtree will start from point.
- ;; If ACTIVE-BRANCH is non-nil, just draw active branch below NODE. Returns
- ;; list of nodes below NODE.
- (let ((num-children (length (undo-tree-node-next node)))
- node-list pos trunk-pos n)
- ;; draw node itself
- (undo-tree-draw-node node)
-
- (cond
- ;; if we're at a leaf node, we're done
- ((= num-children 0))
-
- ;; if node has only one child, draw it (not strictly necessary to deal
- ;; with this case separately, but as it's by far the most common case
- ;; this makes the code clearer and more efficient)
- ((= num-children 1)
- (undo-tree-move-down 1)
- (undo-tree-insert ?|)
- (undo-tree-move-backward 1)
- (undo-tree-move-down 1)
- (undo-tree-insert ?|)
- (undo-tree-move-backward 1)
- (undo-tree-move-down 1)
- (setq n (car (undo-tree-node-next node)))
- ;; link next node to its representation in visualizer
- (unless (markerp (undo-tree-node-marker n))
- (setf (undo-tree-node-marker n) (make-marker))
- (set-marker-insertion-type (undo-tree-node-marker n) nil))
- (move-marker (undo-tree-node-marker n) (point))
- ;; add next node to list of nodes to draw next
- (push n node-list))
-
- ;; if node has multiple children, draw branches
- (t
- (undo-tree-move-down 1)
- (undo-tree-insert ?|)
- (undo-tree-move-backward 1)
- (move-marker (setq trunk-pos (make-marker)) (point))
- ;; left subtrees
- (undo-tree-move-backward
- (- (undo-tree-node-char-lwidth node)
- (undo-tree-node-char-lwidth
- (car (undo-tree-node-next node)))))
- (move-marker (setq pos (make-marker)) (point))
- (setq n (cons nil (undo-tree-node-next node)))
- (dotimes (i (/ num-children 2))
- (setq n (cdr n))
- (when (or (null active-branch)
- (eq (car n)
- (nth (undo-tree-node-branch node)
- (undo-tree-node-next node))))
- (undo-tree-move-forward 2)
- (undo-tree-insert ?_ (- trunk-pos pos 2))
- (goto-char pos)
- (undo-tree-move-forward 1)
- (undo-tree-move-down 1)
- (undo-tree-insert ?/)
- (undo-tree-move-backward 2)
- (undo-tree-move-down 1)
- ;; link node to its representation in visualizer
- (unless (markerp (undo-tree-node-marker (car n)))
- (setf (undo-tree-node-marker (car n)) (make-marker))
- (set-marker-insertion-type (undo-tree-node-marker (car n)) nil))
- (move-marker (undo-tree-node-marker (car n)) (point))
- ;; add node to list of nodes to draw next
- (push (car n) node-list))
- (goto-char pos)
- (undo-tree-move-forward
- (+ (undo-tree-node-char-rwidth (car n))
- (undo-tree-node-char-lwidth (cadr n))
- undo-tree-visualizer-spacing 1))
- (move-marker pos (point)))
- ;; middle subtree (only when number of children is odd)
- (when (= (mod num-children 2) 1)
- (setq n (cdr n))
- (when (or (null active-branch)
- (eq (car n)
- (nth (undo-tree-node-branch node)
- (undo-tree-node-next node))))
- (undo-tree-move-down 1)
- (undo-tree-insert ?|)
- (undo-tree-move-backward 1)
- (undo-tree-move-down 1)
- ;; link node to its representation in visualizer
- (unless (markerp (undo-tree-node-marker (car n)))
- (setf (undo-tree-node-marker (car n)) (make-marker))
- (set-marker-insertion-type (undo-tree-node-marker (car n)) nil))
- (move-marker (undo-tree-node-marker (car n)) (point))
- ;; add node to list of nodes to draw next
- (push (car n) node-list))
- (goto-char pos)
- (undo-tree-move-forward
- (+ (undo-tree-node-char-rwidth (car n))
- (if (cadr n) (undo-tree-node-char-lwidth (cadr n)) 0)
- undo-tree-visualizer-spacing 1))
- (move-marker pos (point)))
- ;; right subtrees
- (move-marker trunk-pos (1+ trunk-pos))
- (dotimes (i (/ num-children 2))
- (setq n (cdr n))
- (when (or (null active-branch)
- (eq (car n)
- (nth (undo-tree-node-branch node)
- (undo-tree-node-next node))))
- (goto-char trunk-pos)
- (undo-tree-insert ?_ (- pos trunk-pos 1))
- (goto-char pos)
- (undo-tree-move-backward 1)
- (undo-tree-move-down 1)
- (undo-tree-insert ?\\)
- (undo-tree-move-down 1)
- ;; link node to its representation in visualizer
- (unless (markerp (undo-tree-node-marker (car n)))
- (setf (undo-tree-node-marker (car n)) (make-marker))
- (set-marker-insertion-type (undo-tree-node-marker (car n)) nil))
- (move-marker (undo-tree-node-marker (car n)) (point))
- ;; add node to list of nodes to draw next
- (push (car n) node-list))
- (when (cdr n)
- (goto-char pos)
- (undo-tree-move-forward
- (+ (undo-tree-node-char-rwidth (car n))
- (if (cadr n) (undo-tree-node-char-lwidth (cadr n)) 0)
- undo-tree-visualizer-spacing 1))
- (move-marker pos (point))))
- ))
- ;; return list of nodes to draw next
- (nreverse node-list)))
-
-
-(defun undo-tree-node-char-lwidth (node)
- ;; Return left-width of NODE measured in characters.
- (if (= (length (undo-tree-node-next node)) 0) 0
- (- (* (+ undo-tree-visualizer-spacing 1) (undo-tree-node-lwidth node))
- (if (= (undo-tree-node-cwidth node) 0)
- (1+ (/ undo-tree-visualizer-spacing 2)) 0))))
-
-
-(defun undo-tree-node-char-rwidth (node)
- ;; Return right-width of NODE measured in characters.
- (if (= (length (undo-tree-node-next node)) 0) 0
- (- (* (+ undo-tree-visualizer-spacing 1) (undo-tree-node-rwidth node))
- (if (= (undo-tree-node-cwidth node) 0)
- (1+ (/ undo-tree-visualizer-spacing 2)) 0))))
-
-
-(defun undo-tree-insert (str &optional arg)
- ;; Insert character or string STR ARG times, overwriting, and using
- ;; `undo-tree-insert-face'.
- (unless arg (setq arg 1))
- (when (characterp str)
- (setq str (make-string arg str))
- (setq arg 1))
- (dotimes (i arg) (insert str))
- (setq arg (* arg (length str)))
- (undo-tree-move-forward arg)
- ;; make sure mark isn't active, otherwise `backward-delete-char' might
- ;; delete region instead of single char if transient-mark-mode is enabled
- (setq mark-active nil)
- (backward-delete-char arg)
- (when undo-tree-insert-face
- (put-text-property (- (point) arg) (point) 'face undo-tree-insert-face)))
-
-
-(defun undo-tree-move-down (&optional arg)
- ;; Move down, extending buffer if necessary.
- (let ((row (line-number-at-pos))
- (col (current-column))
- line)
- (unless arg (setq arg 1))
- (forward-line arg)
- (setq line (line-number-at-pos))
- ;; if buffer doesn't have enough lines, add some
- (when (/= line (+ row arg))
- (cond
- ((< arg 0)
- (insert (make-string (- line row arg) ?\n))
- (forward-line (+ arg (- row line))))
- (t (insert (make-string (- arg (- line row)) ?\n)))))
- (undo-tree-move-forward col)))
-
-
-(defun undo-tree-move-up (&optional arg)
- ;; Move up, extending buffer if necessary.
- (unless arg (setq arg 1))
- (undo-tree-move-down (- arg)))
-
-
-(defun undo-tree-move-forward (&optional arg)
- ;; Move forward, extending buffer if necessary.
- (unless arg (setq arg 1))
- (let (n)
- (cond
- ((>= arg 0)
- (setq n (- (line-end-position) (point)))
- (if (> n arg)
- (forward-char arg)
- (end-of-line)
- (insert (make-string (- arg n) ? ))))
- ((< arg 0)
- (setq arg (- arg))
- (setq n (- (point) (line-beginning-position)))
- (when (< (- n 2) arg) ; -2 to create left-margin
- ;; no space left - shift entire buffer contents right!
- (let ((pos (move-marker (make-marker) (point))))
- (set-marker-insertion-type pos t)
- (goto-char (point-min))
- (while (not (eobp))
- (insert-before-markers (make-string (- arg -2 n) ? ))
- (forward-line 1))
- (goto-char pos)))
- (backward-char arg)))))
-
-
-(defun undo-tree-move-backward (&optional arg)
- ;; Move backward, extending buffer if necessary.
- (unless arg (setq arg 1))
- (undo-tree-move-forward (- arg)))
-
-
-(defun undo-tree-move-to-parent (node)
- ;; Move to position of parent of NODE, extending buffer if necessary.
- (let* ((parent (undo-tree-node-previous node))
- (n (undo-tree-node-next parent))
- (l (length n)) p)
- (goto-char (undo-tree-node-marker node))
- (unless (= l 1)
- ;; move horizontally
- (setq p (undo-tree-position node n))
- (cond
- ;; node in centre subtree: no horizontal movement
- ((and (= (mod l 2) 1) (= p (/ l 2))))
- ;; node in left subtree: move right
- ((< p (/ l 2))
- (setq n (nthcdr p n))
- (undo-tree-move-forward
- (+ (undo-tree-node-char-rwidth (car n))
- (/ undo-tree-visualizer-spacing 2) 1))
- (dotimes (i (- (/ l 2) p 1))
- (setq n (cdr n))
- (undo-tree-move-forward
- (+ (undo-tree-node-char-lwidth (car n))
- (undo-tree-node-char-rwidth (car n))
- undo-tree-visualizer-spacing 1)))
- (when (= (mod l 2) 1)
- (setq n (cdr n))
- (undo-tree-move-forward
- (+ (undo-tree-node-char-lwidth (car n))
- (/ undo-tree-visualizer-spacing 2) 1))))
- (t ;; node in right subtree: move left
- (setq n (nthcdr (/ l 2) n))
- (when (= (mod l 2) 1)
- (undo-tree-move-backward
- (+ (undo-tree-node-char-rwidth (car n))
- (/ undo-tree-visualizer-spacing 2) 1))
- (setq n (cdr n)))
- (dotimes (i (- p (/ l 2) (mod l 2)))
- (undo-tree-move-backward
- (+ (undo-tree-node-char-lwidth (car n))
- (undo-tree-node-char-rwidth (car n))
- undo-tree-visualizer-spacing 1))
- (setq n (cdr n)))
- (undo-tree-move-backward
- (+ (undo-tree-node-char-lwidth (car n))
- (/ undo-tree-visualizer-spacing 2) 1)))))
- ;; move vertically
- (undo-tree-move-up 3)))
-
-
-(defun undo-tree-timestamp-to-string
- (timestamp &optional relative current register)
- ;; Convert TIMESTAMP to string (either absolute or RELATVE time), indicating
- ;; if it's the CURRENT node and/or has an associated REGISTER.
- (if relative
- ;; relative time
- (let ((time (floor (float-time
- (subtract-time (current-time) timestamp))))
- n)
- (setq time
- ;; years
- (if (> (setq n (/ time 315360000)) 0)
- (if (> n 999) "-ages" (format "-%dy" n))
- (setq time (% time 315360000))
- ;; days
- (if (> (setq n (/ time 86400)) 0)
- (format "-%dd" n)
- (setq time (% time 86400))
- ;; hours
- (if (> (setq n (/ time 3600)) 0)
- (format "-%dh" n)
- (setq time (% time 3600))
- ;; mins
- (if (> (setq n (/ time 60)) 0)
- (format "-%dm" n)
- ;; secs
- (format "-%ds" (% time 60)))))))
- (setq time (concat
- (if current "*" " ")
- time
- (if register (concat "[" (char-to-string register) "]")
- " ")))
- (setq n (length time))
- (if (< n 9)
- (concat (make-string (- 9 n) ? ) time)
- time))
- ;; absolute time
- (concat (if current " *" " ")
- (format-time-string "%H:%M:%S" timestamp)
- (if register
- (concat "[" (char-to-string register) "]")
- " "))))
-
-
-
-
-;;; =====================================================================
-;;; Visualizer commands
-
-(define-derived-mode
- undo-tree-visualizer-mode special-mode "undo-tree-visualizer"
- "Major mode used in undo-tree visualizer.
-
-The undo-tree visualizer can only be invoked from a buffer in
-which `undo-tree-mode' is enabled. The visualizer displays the
-undo history tree graphically, and allows you to browse around
-the undo history, undoing or redoing the corresponding changes in
-the parent buffer.
-
-Within the undo-tree visualizer, the following keys are available:
-
- \\{undo-tree-visualizer-mode-map}"
- :syntax-table nil
- :abbrev-table nil
- (setq truncate-lines t)
- (setq cursor-type nil)
- (setq undo-tree-visualizer-selected-node nil))
-
-
-
-(defun undo-tree-visualize-undo (&optional arg)
- "Undo changes. A numeric ARG serves as a repeat count."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((old (undo-tree-current buffer-undo-tree))
- current)
- ;; unhighlight old current node
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face)
- (inhibit-read-only t))
- (undo-tree-draw-node old))
- ;; undo in parent buffer
- (switch-to-buffer-other-window undo-tree-visualizer-parent-buffer)
- (deactivate-mark)
- (unwind-protect
- (let ((undo-tree-inhibit-kill-visualizer t)) (undo-tree-undo-1 arg))
- (setq current (undo-tree-current buffer-undo-tree))
- (switch-to-buffer-other-window undo-tree-visualizer-buffer-name)
- ;; when using lazy drawing, extend tree upwards as required
- (when undo-tree-visualizer-lazy-drawing
- (undo-tree-expand-up old current))
- ;; highlight new current node
- (let ((inhibit-read-only t)) (undo-tree-draw-node current 'current))
- ;; update diff display, if any
- (when undo-tree-visualizer-diff (undo-tree-visualizer-update-diff)))))
-
-
-(defun undo-tree-visualize-redo (&optional arg)
- "Redo changes. A numeric ARG serves as a repeat count."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((old (undo-tree-current buffer-undo-tree))
- current)
- ;; unhighlight old current node
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face)
- (inhibit-read-only t))
- (undo-tree-draw-node (undo-tree-current buffer-undo-tree)))
- ;; redo in parent buffer
- (switch-to-buffer-other-window undo-tree-visualizer-parent-buffer)
- (deactivate-mark)
- (unwind-protect
- (let ((undo-tree-inhibit-kill-visualizer t)) (undo-tree-redo-1 arg))
- (setq current (undo-tree-current buffer-undo-tree))
- (switch-to-buffer-other-window undo-tree-visualizer-buffer-name)
- ;; when using lazy drawing, extend tree downwards as required
- (when undo-tree-visualizer-lazy-drawing
- (undo-tree-expand-down old current))
- ;; highlight new current node
- (let ((inhibit-read-only t)) (undo-tree-draw-node current 'current))
- ;; update diff display, if any
- (when undo-tree-visualizer-diff (undo-tree-visualizer-update-diff)))))
-
-
-(defun undo-tree-visualize-switch-branch-right (arg)
- "Switch to next branch of the undo tree.
-This will affect which branch to descend when *redoing* changes
-using `undo-tree-redo' or `undo-tree-visualizer-redo'."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- ;; un-highlight old active branch below current node
- (goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (let ((undo-tree-insert-face 'undo-tree-visualizer-default-face)
- (inhibit-read-only t))
- (undo-tree-highlight-active-branch (undo-tree-current buffer-undo-tree)))
- ;; increment branch
- (let ((branch (undo-tree-node-branch (undo-tree-current buffer-undo-tree))))
- (setf (undo-tree-node-branch (undo-tree-current buffer-undo-tree))
- (cond
- ((>= (+ branch arg) (undo-tree-num-branches))
- (1- (undo-tree-num-branches)))
- ((<= (+ branch arg) 0) 0)
- (t (+ branch arg))))
- (let ((inhibit-read-only t))
- ;; highlight new active branch below current node
- (goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (let ((undo-tree-insert-face 'undo-tree-visualizer-active-branch-face))
- (undo-tree-highlight-active-branch (undo-tree-current buffer-undo-tree)))
- ;; re-highlight current node
- (undo-tree-draw-node (undo-tree-current buffer-undo-tree) 'current))))
-
-
-(defun undo-tree-visualize-switch-branch-left (arg)
- "Switch to previous branch of the undo tree.
-This will affect which branch to descend when *redoing* changes
-using `undo-tree-redo' or `undo-tree-visualizer-redo'."
- (interactive "p")
- (undo-tree-visualize-switch-branch-right (- arg)))
-
-
-(defun undo-tree-visualizer-quit ()
- "Quit the undo-tree visualizer."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (undo-tree-clear-visualizer-data buffer-undo-tree)
- ;; remove kill visualizer hook from parent buffer
- (unwind-protect
- (with-current-buffer undo-tree-visualizer-parent-buffer
- (remove-hook 'before-change-functions 'undo-tree-kill-visualizer t))
- ;; kill diff buffer, if any
- (when undo-tree-visualizer-diff (undo-tree-visualizer-hide-diff))
- (let ((parent undo-tree-visualizer-parent-buffer)
- window)
- ;; kill visualizer buffer
- (kill-buffer nil)
- ;; switch back to parent buffer
- (unwind-protect
- (if (setq window (get-buffer-window parent))
- (select-window window)
- (switch-to-buffer parent))))))
-
-
-(defun undo-tree-visualizer-abort ()
- "Quit the undo-tree visualizer and return buffer to original state."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((node undo-tree-visualizer-initial-node))
- (undo-tree-visualizer-quit)
- (undo-tree-set node)))
-
-
-(defun undo-tree-visualizer-set (&optional pos)
- "Set buffer to state corresponding to undo tree node
-at POS, or point if POS is nil."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (unless pos (setq pos (point)))
- (let ((node (get-text-property pos 'undo-tree-node)))
- (when node
- ;; set parent buffer to state corresponding to node at POS
- (switch-to-buffer-other-window undo-tree-visualizer-parent-buffer)
- (let ((undo-tree-inhibit-kill-visualizer t)) (undo-tree-set node))
- (switch-to-buffer-other-window undo-tree-visualizer-buffer-name)
- ;; re-draw undo tree
- (let ((inhibit-read-only t)) (undo-tree-draw-tree buffer-undo-tree))
- (when undo-tree-visualizer-diff (undo-tree-visualizer-update-diff)))))
-
-
-(defun undo-tree-visualizer-mouse-set (pos)
- "Set buffer to state corresponding to undo tree node
-at mouse event POS."
- (interactive "@e")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (undo-tree-visualizer-set (event-start (nth 1 pos))))
-
-
-(defun undo-tree-visualize-undo-to-x (&optional x)
- "Undo to last branch point, register, or saved state.
-If X is the symbol `branch', undo to last branch point. If X is
-the symbol `register', undo to last register. If X is the sumbol
-`saved', undo to last saved state. If X is null, undo to first of
-these that's encountered.
-
-Interactively, a single \\[universal-argument] specifies
-`branch', a double \\[universal-argument] \\[universal-argument]
-specifies `saved', and a negative prefix argument specifies
-`register'."
- (interactive "P")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (when (and (called-interactively-p 'any) x)
- (setq x (prefix-numeric-value x)
- x (cond
- ((< x 0) 'register)
- ((<= x 4) 'branch)
- (t 'saved))))
- (let ((current (if undo-tree-visualizer-selection-mode
- undo-tree-visualizer-selected-node
- (undo-tree-current buffer-undo-tree)))
- (diff undo-tree-visualizer-diff)
- r)
- (undo-tree-visualizer-hide-diff)
- (while (and (undo-tree-node-previous current)
- (or (if undo-tree-visualizer-selection-mode
- (progn
- (undo-tree-visualizer-select-previous)
- (setq current undo-tree-visualizer-selected-node))
- (undo-tree-visualize-undo)
- (setq current (undo-tree-current buffer-undo-tree)))
- t)
- ;; branch point
- (not (or (and (or (null x) (eq x 'branch))
- (> (undo-tree-num-branches) 1))
- ;; register
- (and (or (null x) (eq x 'register))
- (setq r (undo-tree-node-register current))
- (undo-tree-register-data-p
- (setq r (registerv-data (get-register r))))
- (eq current (undo-tree-register-data-node r)))
- ;; saved state
- (and (or (null x) (eq x 'saved))
- (undo-tree-node-unmodified-p current))
- ))))
- ;; update diff display, if any
- (when diff
- (undo-tree-visualizer-show-diff
- (when undo-tree-visualizer-selection-mode
- undo-tree-visualizer-selected-node)))))
-
-
-(defun undo-tree-visualize-redo-to-x (&optional x)
- "Redo to last branch point, register, or saved state.
-If X is the symbol `branch', redo to last branch point. If X is
-the symbol `register', redo to last register. If X is the sumbol
-`saved', redo to last saved state. If X is null, redo to first of
-these that's encountered.
-
-Interactively, a single \\[universal-argument] specifies
-`branch', a double \\[universal-argument] \\[universal-argument]
-specifies `saved', and a negative prefix argument specifies
-`register'."
- (interactive "P")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (when (and (called-interactively-p 'any) x)
- (setq x (prefix-numeric-value x)
- x (cond
- ((< x 0) 'register)
- ((<= x 4) 'branch)
- (t 'saved))))
- (let ((current (if undo-tree-visualizer-selection-mode
- undo-tree-visualizer-selected-node
- (undo-tree-current buffer-undo-tree)))
- (diff undo-tree-visualizer-diff)
- r)
- (undo-tree-visualizer-hide-diff)
- (while (and (undo-tree-node-next current)
- (or (if undo-tree-visualizer-selection-mode
- (progn
- (undo-tree-visualizer-select-next)
- (setq current undo-tree-visualizer-selected-node))
- (undo-tree-visualize-redo)
- (setq current (undo-tree-current buffer-undo-tree)))
- t)
- ;; branch point
- (not (or (and (or (null x) (eq x 'branch))
- (> (undo-tree-num-branches) 1))
- ;; register
- (and (or (null x) (eq x 'register))
- (setq r (undo-tree-node-register current))
- (undo-tree-register-data-p
- (setq r (registerv-data (get-register r))))
- (eq current (undo-tree-register-data-node r)))
- ;; saved state
- (and (or (null x) (eq x 'saved))
- (undo-tree-node-unmodified-p current))
- ))))
- ;; update diff display, if any
- (when diff
- (undo-tree-visualizer-show-diff
- (when undo-tree-visualizer-selection-mode
- undo-tree-visualizer-selected-node)))))
-
-
-(defun undo-tree-visualizer-toggle-timestamps ()
- "Toggle display of time-stamps."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (setq undo-tree-visualizer-timestamps (not undo-tree-visualizer-timestamps))
- (setq undo-tree-visualizer-spacing (undo-tree-visualizer-calculate-spacing))
- ;; redraw tree
- (let ((inhibit-read-only t)) (undo-tree-draw-tree buffer-undo-tree)))
-
-
-(defun undo-tree-visualizer-scroll-left (&optional arg)
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (scroll-left (or arg 1) t))
-
-
-(defun undo-tree-visualizer-scroll-right (&optional arg)
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (scroll-right (or arg 1) t))
-
-
-(defun undo-tree-visualizer-scroll-up (&optional arg)
- (interactive "P")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (if (or (and (numberp arg) (< arg 0)) (eq arg '-))
- (undo-tree-visualizer-scroll-down arg)
- ;; scroll up and expand newly-visible portion of tree
- (unwind-protect
- (scroll-up-command arg)
- (undo-tree-expand-down
- (nth (undo-tree-node-branch (undo-tree-current buffer-undo-tree))
- (undo-tree-node-next (undo-tree-current buffer-undo-tree)))))
- ;; signal error if at eob
- (when (and (not undo-tree-visualizer-needs-extending-down) (eobp))
- (scroll-up))))
-
-
-(defun undo-tree-visualizer-scroll-down (&optional arg)
- (interactive "P")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (if (or (and (numberp arg) (< arg 0)) (eq arg '-))
- (undo-tree-visualizer-scroll-up arg)
- ;; ensure there's enough room at top of buffer to scroll
- (let ((scroll-lines
- (or arg (- (window-height) next-screen-context-lines)))
- (window-line (1- (line-number-at-pos (window-start)))))
- (when (and undo-tree-visualizer-needs-extending-up
- (< window-line scroll-lines))
- (let ((inhibit-read-only t))
- (goto-char (point-min))
- (undo-tree-move-up (- scroll-lines window-line)))))
- ;; scroll down and expand newly-visible portion of tree
- (unwind-protect
- (scroll-down-command arg)
- (undo-tree-expand-up
- (undo-tree-node-previous (undo-tree-current buffer-undo-tree))))
- ;; signal error if at bob
- (when (and (not undo-tree-visualizer-needs-extending-down) (bobp))
- (scroll-down))))
-
-
-
-
-;;; =====================================================================
-;;; Visualizer selection mode
-
-(define-minor-mode undo-tree-visualizer-selection-mode
- "Toggle mode to select nodes in undo-tree visualizer."
- :lighter "Select"
- :keymap undo-tree-visualizer-selection-mode-map
- :group undo-tree
- (cond
- ;; enable selection mode
- (undo-tree-visualizer-selection-mode
- (setq cursor-type 'box)
- (setq undo-tree-visualizer-selected-node
- (undo-tree-current buffer-undo-tree))
- ;; erase diff (if any), as initially selected node is identical to current
- (when undo-tree-visualizer-diff
- (let ((buff (get-buffer undo-tree-diff-buffer-name))
- (inhibit-read-only t))
- (when buff (with-current-buffer buff (erase-buffer))))))
- (t ;; disable selection mode
- (setq cursor-type nil)
- (setq undo-tree-visualizer-selected-node nil)
- (goto-char (undo-tree-node-marker (undo-tree-current buffer-undo-tree)))
- (when undo-tree-visualizer-diff (undo-tree-visualizer-update-diff)))
- ))
-
-
-(defun undo-tree-visualizer-select-previous (&optional arg)
- "Move to previous node."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((node undo-tree-visualizer-selected-node))
- (catch 'top
- (dotimes (i (or arg 1))
- (unless (undo-tree-node-previous node) (throw 'top t))
- (setq node (undo-tree-node-previous node))))
- ;; when using lazy drawing, extend tree upwards as required
- (when undo-tree-visualizer-lazy-drawing
- (undo-tree-expand-up undo-tree-visualizer-selected-node node))
- ;; update diff display, if any
- (when (and undo-tree-visualizer-diff
- (not (eq node undo-tree-visualizer-selected-node)))
- (undo-tree-visualizer-update-diff node))
- ;; move to selected node
- (goto-char (undo-tree-node-marker node))
- (setq undo-tree-visualizer-selected-node node)))
-
-
-(defun undo-tree-visualizer-select-next (&optional arg)
- "Move to next node."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((node undo-tree-visualizer-selected-node))
- (catch 'bottom
- (dotimes (i (or arg 1))
- (unless (nth (undo-tree-node-branch node) (undo-tree-node-next node))
- (throw 'bottom t))
- (setq node
- (nth (undo-tree-node-branch node) (undo-tree-node-next node)))))
- ;; when using lazy drawing, extend tree downwards as required
- (when undo-tree-visualizer-lazy-drawing
- (undo-tree-expand-down undo-tree-visualizer-selected-node node))
- ;; update diff display, if any
- (when (and undo-tree-visualizer-diff
- (not (eq node undo-tree-visualizer-selected-node)))
- (undo-tree-visualizer-update-diff node))
- ;; move to selected node
- (goto-char (undo-tree-node-marker node))
- (setq undo-tree-visualizer-selected-node node)))
-
-
-(defun undo-tree-visualizer-select-right (&optional arg)
- "Move right to a sibling node."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((node undo-tree-visualizer-selected-node)
- end)
- (goto-char (undo-tree-node-marker undo-tree-visualizer-selected-node))
- (setq end (line-end-position))
- (catch 'end
- (dotimes (i arg)
- (while (or (null node) (eq node undo-tree-visualizer-selected-node))
- (forward-char)
- (setq node (get-text-property (point) 'undo-tree-node))
- (when (= (point) end) (throw 'end t)))))
- (goto-char (undo-tree-node-marker
- (or node undo-tree-visualizer-selected-node)))
- (when (and undo-tree-visualizer-diff node
- (not (eq node undo-tree-visualizer-selected-node)))
- (undo-tree-visualizer-update-diff node))
- (when node (setq undo-tree-visualizer-selected-node node))))
-
-
-(defun undo-tree-visualizer-select-left (&optional arg)
- "Move left to a sibling node."
- (interactive "p")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (let ((node (get-text-property (point) 'undo-tree-node))
- beg)
- (goto-char (undo-tree-node-marker undo-tree-visualizer-selected-node))
- (setq beg (line-beginning-position))
- (catch 'beg
- (dotimes (i arg)
- (while (or (null node) (eq node undo-tree-visualizer-selected-node))
- (backward-char)
- (setq node (get-text-property (point) 'undo-tree-node))
- (when (= (point) beg) (throw 'beg t)))))
- (goto-char (undo-tree-node-marker
- (or node undo-tree-visualizer-selected-node)))
- (when (and undo-tree-visualizer-diff node
- (not (eq node undo-tree-visualizer-selected-node)))
- (undo-tree-visualizer-update-diff node))
- (when node (setq undo-tree-visualizer-selected-node node))))
-
-
-(defun undo-tree-visualizer-select (pos)
- (let ((node (get-text-property pos 'undo-tree-node)))
- (when node
- ;; select node at POS
- (goto-char (undo-tree-node-marker node))
- ;; when using lazy drawing, extend tree up and down as required
- (when undo-tree-visualizer-lazy-drawing
- (undo-tree-expand-up undo-tree-visualizer-selected-node node)
- (undo-tree-expand-down undo-tree-visualizer-selected-node node))
- ;; update diff display, if any
- (when (and undo-tree-visualizer-diff
- (not (eq node undo-tree-visualizer-selected-node)))
- (undo-tree-visualizer-update-diff node))
- ;; update selected node
- (setq undo-tree-visualizer-selected-node node)
- )))
-
-
-(defun undo-tree-visualizer-mouse-select (pos)
- "Select undo tree node at mouse event POS."
- (interactive "@e")
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (undo-tree-visualizer-select (event-start (nth 1 pos))))
-
-
-
-
-;;; =====================================================================
-;;; Visualizer diff display
-
-(defun undo-tree-visualizer-toggle-diff ()
- "Toggle diff display in undo-tree visualizer."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (if undo-tree-visualizer-diff
- (undo-tree-visualizer-hide-diff)
- (undo-tree-visualizer-show-diff)))
-
-
-(defun undo-tree-visualizer-selection-toggle-diff ()
- "Toggle diff display in undo-tree visualizer selection mode."
- (interactive)
- (unless (eq major-mode 'undo-tree-visualizer-mode)
- (user-error "Undo-tree mode not enabled in buffer"))
- (if undo-tree-visualizer-diff
- (undo-tree-visualizer-hide-diff)
- (let ((node (get-text-property (point) 'undo-tree-node)))
- (when node (undo-tree-visualizer-show-diff node)))))
-
-
-(defun undo-tree-visualizer-show-diff (&optional node)
- ;; show visualizer diff display
- (setq undo-tree-visualizer-diff t)
- (let ((buff (with-current-buffer undo-tree-visualizer-parent-buffer
- (undo-tree-diff node)))
- (display-buffer-mark-dedicated 'soft)
- win)
- (setq win (split-window))
- (set-window-buffer win buff)
- (shrink-window-if-larger-than-buffer win)))
-
-
-(defun undo-tree-visualizer-hide-diff ()
- ;; hide visualizer diff display
- (setq undo-tree-visualizer-diff nil)
- (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
- (when win (with-selected-window win (kill-buffer-and-window)))))
-
-
-(defun undo-tree-diff (&optional node)
- ;; Create diff between NODE and current state (or previous state and current
- ;; state, if NODE is null). Returns buffer containing diff.
- (let (tmpfile buff)
- ;; generate diff
- (let ((undo-tree-inhibit-kill-visualizer t)
- (current (undo-tree-current buffer-undo-tree)))
- (undo-tree-set (or node (undo-tree-node-previous current) current)
- 'preserve-timestamps)
- (setq tmpfile (diff-file-local-copy (current-buffer)))
- (undo-tree-set current 'preserve-timestamps))
- (setq buff (diff-no-select
- tmpfile (current-buffer) nil 'noasync
- (get-buffer-create undo-tree-diff-buffer-name)))
- ;; delete process messages and useless headers from diff buffer
- (let ((inhibit-read-only t))
- (with-current-buffer buff
- (goto-char (point-min))
- (delete-region (point) (1+ (line-end-position 3)))
- (goto-char (point-max))
- (forward-line -2)
- (delete-region (point) (point-max))
- (setq cursor-type nil)
- (setq buffer-read-only t)))
- buff))
-
-
-(defun undo-tree-visualizer-update-diff (&optional node)
- ;; update visualizer diff display to show diff between current state and
- ;; NODE (or previous state, if NODE is null)
- (with-current-buffer undo-tree-visualizer-parent-buffer
- (undo-tree-diff node))
- (let ((win (get-buffer-window undo-tree-diff-buffer-name)))
- (when win
- (balance-windows)
- (shrink-window-if-larger-than-buffer win))))
-
-
-
-(provide 'undo-tree)
-
-;;; undo-tree.el ends here
diff --git a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.elc b/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.elc
deleted file mode 100644
index 1aee42f..0000000
Binary files a/emacs/.emacs.d/elpa/undo-tree-20170706.246/undo-tree.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-autoloads.el b/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-autoloads.el
deleted file mode 100644
index 08fdfe5..0000000
--- a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-autoloads.el
+++ /dev/null
@@ -1,32 +0,0 @@
-;;; volatile-highlights-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "volatile-highlights" "volatile-highlights.el"
-;;;;;; (23124 14372 692196 483000))
-;;; Generated autoloads from volatile-highlights.el
-
-(defvar volatile-highlights-mode nil "\
-Non-nil if Volatile-Highlights mode is enabled.
-See the `volatile-highlights-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 `volatile-highlights-mode'.")
-
-(custom-autoload 'volatile-highlights-mode "volatile-highlights" nil)
-
-(autoload 'volatile-highlights-mode "volatile-highlights" "\
-Minor mode for visual feedback on some operations.
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; volatile-highlights-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-pkg.el b/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-pkg.el
deleted file mode 100644
index 7442ab0..0000000
--- a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "volatile-highlights" "20160611.1855" "Minor mode for visual feedback on some operations." 'nil :commit "9a20091f0ce7fc0a6b3e641a6a46d5f3ac4d8392" :url "http://www.emacswiki.org/emacs/download/volatile-highlights.el" :keywords '("emulations" "convenience" "wp"))
diff --git a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.el b/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.el
deleted file mode 100644
index b478487..0000000
--- a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.el
+++ /dev/null
@@ -1,872 +0,0 @@
-;;; volatile-highlights.el --- Minor mode for visual feedback on some operations.
-
-;; Copyright (C) 2001, 2010-2016 K-talo Miyazaki, all rights reserved.
-
-;; Author: K-talo Miyazaki
-;; Created: 03 October 2001. (as utility functions in my `.emacs' file.)
-;; 14 March 2010. (re-written as library `volatile-highlights.el')
-;; Keywords: emulations convenience wp
-;; Package-Version: 20160611.1855
-;; Revision: $Id: cb468976642bf1d30cbb2070ee846c4736ee077d $
-;; URL: http://www.emacswiki.org/emacs/download/volatile-highlights.el
-;; GitHub: http://github.com/k-talo/volatile-highlights.el
-;; Version: 1.15
-;; Contributed by: Ryan Thompson and Le Wang.
-
-;; 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 .
-
-;;; Commentary:
-;;
-;; Overview
-;; ========
-;; This library provides minor mode `volatile-highlights-mode', which
-;; brings visual feedback to some operations by highlighting portions
-;; relating to the operations.
-;;
-;; All of highlights made by this library will be removed
-;; when any new operation is executed.
-;;
-;;
-;; INSTALLING
-;; ==========
-;; To install this library, save this file to a directory in your
-;; `load-path' (you can view the current `load-path' using "C-h v
-;; load-path" within Emacs), then add the following line to your
-;; .emacs start up file:
-;;
-;; (require 'volatile-highlights)
-;; (volatile-highlights-mode t)
-;;
-;;
-;; USING
-;; =====
-;; To toggle volatile highlighting, type `M-x volatile-highlights-mode '.
-;;
-;; While this minor mode is on, a string `VHL' will be displayed on the modeline.
-;;
-;; Currently, operations listed below will be highlighted While the minor mode
-;; `volatile-highlights-mode' is on:
-;;
-;; - `undo':
-;; Volatile highlights will be put on the text inserted by `undo'.
-;;
-;; - `yank' and `yank-pop':
-;; Volatile highlights will be put on the text inserted by `yank'
-;; or `yank-pop'.
-;;
-;; - `kill-region', `kill-line', any other killing function:
-;; Volatile highlights will be put at the positions where the
-;; killed text used to be.
-;;
-;; - `delete-region':
-;; Same as `kill-region', but not as reliable since
-;; `delete-region' is an inline function.
-;;
-;; - `find-tag':
-;; Volatile highlights will be put on the tag name which was found
-;; by `find-tag'.
-;;
-;; - `occur-mode-goto-occurrence' and `occur-mode-display-occurrence':
-;; Volatile highlights will be put on the occurrence which is selected
-;; by `occur-mode-goto-occurrence' or `occur-mode-display-occurrence'.
-;;
-;; - Non incremental search operations:
-;; Volatile highlights will be put on the the text found by
-;; commands listed below:
-;;
-;; `nonincremental-search-forward'
-;; `nonincremental-search-backward'
-;; `nonincremental-re-search-forward'
-;; `nonincremental-re-search-backward'
-;; `nonincremental-repeat-search-forward'
-;; `nonincremental-repeat-search-backwar'
-;;
-;; Highlighting support for each operations can be turned on/off individually
-;; via customization. Also check out the customization group
-;;
-;; `M-x customize-group RET volatile-highlights RET'
-;;
-;;
-;; EXAMPLE SNIPPETS FOR USING VOLATILE HIGHLIGHTS WITH OTHER PACKAGES
-;; ==================================================================
-;;
-;; - vip-mode
-;;
-;; (vhl/define-extension 'vip 'vip-yank)
-;; (vhl/install-extension 'vip)
-;;
-;; - evil-mode
-;;
-;; (vhl/define-extension 'evil 'evil-paste-after 'evil-paste-before
-;; 'evil-paste-pop 'evil-move)
-;; (vhl/install-extension 'evil)
-;;
-;; - undo-tree
-;;
-;; (vhl/define-extension 'undo-tree 'undo-tree-yank 'undo-tree-move)
-;; (vhl/install-extension 'undo-tree)
-
-
-;;; Change Log:
-;;
-;; v1.15 Sun Jun 12 10:40:31 2016 JST
-;; - Update documents, example snippets for other packages,
-;; regarding #14.
-;;
-;; v1.14 Sun Jun 12 10:12:30 2016 JST
-;; - Update documents, especially supporting `evil-mode',
-;; regarding #13.
-;; - Fixed a bug #14, an extension won't be loaded properly
-;; when it was installed by `vhl/install-extension'.
-;;
-;; v1.13 Sat May 21 11:02:36 2016 JST
-;; - Fixed a bug that highlighting was not working with nested volatile
-;; highlighting aware operations like `yak-pop'.
-;;
-;; v1.12 Sun Feb 21 19:09:29 2016 JST
-;; - Added autoload cookie.
-;;
-;; v1.11 Sun Oct 5 13:05:38 2014 JST
-;; - Fixed an error "Symbol's function definition is void: return",
-;; that occurs when highlight being created with `hideshow' commands.
-;;
-;; v1.10 Thu Mar 21 22:37:27 2013 JST
-;; - Use inherit in face definition when detected.
-;; - Suppress compiler warnings regarding to emacs/xemacs private
-;; functions by file local variable.
-;;
-;; v1.9 Tue Mar 5 00:52:35 2013 JST
-;; - Fixed errors in shell caused by dummy functions.
-;;
-;; v1.8 Wed Feb 15 00:08:14 2012 JST
-;; - Added "Contributed by: " line in header.
-;; - Added extension for hideshow.
-;;
-;; v1.7 Mon Feb 13 23:31:18 2012 JST
-;; - Fixed a bug required features are not loaded.
-;;
-;; v1.6 Thu Feb 2 06:59:48 2012 JST
-;; - Removed extensions for non standard features.
-;; - Suppress compiler warning "function `vhl/.make-list-string'
-;; defined multiple times".
-;; - Fixed compiler error "Symbol's function definition is void:
-;; vhl/.make-list-string".
-;;
-;; v1.5 Tue Jan 31 22:19:04 2012 JST
-;; - Added extension for highlighting the position where text was
-;; killed from.
-;; - Added extension for highlighting the position where text was
-;; deleted from.
-;; - Provide a macro `vhl/define-extension' for easily defining new
-;; simple extensions with a single line of code. For usage
-;; examples, see the definitions of the undo, yank, kill, and
-;; delete extensions.
-;;
-;; v1.4 Sun Jan 15 20:23:58 2012 JST
-;; - Suppress compiler warnings regarding to emacs/xemacs private
-;; functions.
-;; - Fixed bugs which occurs to xemacs.
-;;
-;; v1.3, Sat Dec 18 16:44:14 2010 JST
-;; - Added extension for non-incremental search operations.
-;; - Fixed a bug that highlights won't be appear when
-;; occurrences is in folded line.
-;;
-;; v1.2, Tue Nov 30 01:07:48 2010 JST
-;; - In `vhl/ext/occur', highlight all occurrences.
-;;
-;; v1.1, Tue Nov 9 20:36:09 2010 JST
-;; - Fixed a bug that mode toggling feature was not working.
-
-;;; Code:
-
-(defconst vhl/version "1.8")
-
-(eval-when-compile
- (require 'cl)
- (require 'easy-mmode)
- (require 'advice))
-
-(provide 'volatile-highlights)
-
-
-;;;============================================================================
-;;;
-;;; Private Variables.
-;;;
-;;;============================================================================
-
-(eval-and-compile
- (defconst vhl/.xemacsp (string-match "XEmacs" emacs-version)
- "A flag if the emacs is xemacs or not."))
-
-(defvar vhl/.hl-lst nil
- "List of volatile highlights.")
-
-
-;;;============================================================================
-;;;
-;;; Faces.
-;;;
-;;;============================================================================
-
-(defgroup volatile-highlights nil
- "Visual feedback on operations."
- :group 'editing)
-
-
-;; Borrowed from `slime.el'.
-(defun vhl/.face-inheritance-possible-p ()
- "Return true if the :inherit face attribute is supported."
- (assq :inherit custom-face-attributes))
-
-(defface vhl/default-face
- (cond
- ((or vhl/.xemacsp
- (not (vhl/.face-inheritance-possible-p)))
- '((((class color) (background light))
- (:background "yellow1"))
- (((class color) (background dark))
- (:background "SkyBlue4"))
- (t :inverse-video t)))
- (t
- '((t
- :inherit secondary-selection
- ))))
- "Face used for volatile highlights."
- :group 'volatile-highlights)
-
-
-;;;============================================================================
-;;;
-;;; Minor Mode Definition.
-;;;
-;;;============================================================================
-;;;###autoload
-(easy-mmode-define-minor-mode
- volatile-highlights-mode "Minor mode for visual feedback on some operations."
- :global t
- :init-value nil
- :lighter " VHl"
- (if volatile-highlights-mode
- (vhl/load-extensions)
- (vhl/unload-extensions)))
-
-
-(defcustom Vhl/highlight-zero-width-ranges nil
- "If t, highlight the positions of zero-width ranges.
-
-For example, if a deletion is highlighted, then the position
-where the deleted text used to be would be highlighted."
- :type 'boolean
- :group 'volatile-highlights)
-
-
-;;;============================================================================
-;;;
-;;; Public Functions/Commands.
-;;;
-;;;============================================================================
-
-;;-----------------------------------------------------------------------------
-;; (vhl/add-range BEG END &OPTIONAL BUF FACE) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/add-range (beg end &optional buf face)
- "Add a volatile highlight to the buffer `BUF' at the position
-specified by `BEG' and `END' using the face `FACE'.
-
-When the buffer `BUF' is not specified or its value is `nil',
-volatile highlight will be added to current buffer.
-
-When the face `FACE' is not specified or its value is `nil',
-the default face `vhl/default-face' will
-be used as the value."
- (let* ((face (or face 'vhl/default-face))
- (hl (vhl/.make-hl beg end buf face)))
- (setq vhl/.hl-lst
- (cons hl vhl/.hl-lst))
- (add-hook 'pre-command-hook 'vhl/clear-all)))
-(define-obsolete-function-alias 'vhl/add 'vhl/add-range "1.5")
-
-;;-----------------------------------------------------------------------------
-;; (vhl/add-position POS &OPTIONAL BUF FACE) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/add-position (pos &rest other-args)
- "Highlight buffer position POS as a change.
-
-If Vhl/highlight-zero-width-ranges is nil, do nothing.
-
-Optional args are the same as `vhl/add-range'."
- (when (and Vhl/highlight-zero-width-ranges (not (zerop (buffer-size))))
- (when (> pos (buffer-size))
- (setq pos (- pos 1)))
- (apply 'vhl/add-range pos (+ pos 1) other-args)))
-
-;;-----------------------------------------------------------------------------
-;; (vhl/clear-all) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/clear-all ()
- "Clear all volatile highlights."
- (interactive)
- (while vhl/.hl-lst
- (vhl/.clear-hl (car vhl/.hl-lst))
- (setq vhl/.hl-lst
- (cdr vhl/.hl-lst)))
- (remove-hook 'pre-command-hook 'vhl/clear-all))
-
-;;-----------------------------------------------------------------------------
-;; (vhl/force-clear-all) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/force-clear-all ()
- "Force clear all volatile highlights in current buffer."
- (interactive)
- (vhl/.force-clear-all-hl))
-
-
-;;;============================================================================
-;;;
-;;; Private Functions.
-;;;
-;;;============================================================================
-
-;;-----------------------------------------------------------------------------
-;; (vhl/.make-hl BEG END BUF FACE) => HIGHLIGHT
-;;-----------------------------------------------------------------------------
-(defun vhl/.make-hl (beg end buf face)
- "Make a volatile highlight at the position specified by `BEG' and `END'."
- (let (hl)
- (cond
- (vhl/.xemacsp
- ;; XEmacs
- (setq hl (make-extent beg end buf))
- (set-extent-face hl face)
- (highlight-extent hl t)
- (set-extent-property hl 'volatile-highlights t))
- (t
- ;; GNU Emacs
- (setq hl (make-overlay beg end buf))
- (overlay-put hl 'face face)
- (overlay-put hl 'priority 1)
- (overlay-put hl 'volatile-highlights t)))
- hl))
-
-;;-----------------------------------------------------------------------------
-;; (vhl/.clear-hl HIGHLIGHT) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/.clear-hl (hl)
- "Clear one highlight."
- (cond
- ;; XEmacs (not tested!)
- (vhl/.xemacsp
- (and (extentp hl)
- (delete-extent hl)))
- ;; GNU Emacs
- (t
- (and (overlayp hl)
- (delete-overlay hl)))))
-
-;;-----------------------------------------------------------------------------
-;; (vhl/.force-clear-all-hl) => VOID
-;;-----------------------------------------------------------------------------
-(defun vhl/.force-clear-all-hl ()
- "Force clear all volatile highlights in current buffer."
- (cond
- ;; XEmacs (not tested!)
- (vhl/.xemacsp
- (map-extents (lambda (hl maparg)
- (and (extent-property hl 'volatile-highlights)
- (vhl/.clear-hl hl)))))
- ;; GNU Emacs
- (t
- (save-restriction
- (widen)
- (mapcar (lambda (hl)
- (and (overlay-get hl 'volatile-highlights)
- (vhl/.clear-hl hl)))
- (overlays-in (point-min) (point-max)))))))
-
-
-;;;============================================================================
-;;;
-;;; Functions to manage extensions.
-;;;
-;;;============================================================================
-(defvar vhl/.installed-extensions nil)
-
-(defun vhl/install-extension (sym)
- (let ((fn-on (intern (format "vhl/ext/%s/on" sym)))
- (fn-off (intern (format "vhl/ext/%s/off" sym)))
- (cust-name (intern (format "vhl/use-%s-extension-p" sym))))
- (pushnew sym vhl/.installed-extensions)
- (eval `(defcustom ,cust-name t
- ,(format "A flag if highlighting support for `%s' is on or not." sym)
- :type 'boolean
- :group 'volatile-highlights
- :set (lambda (sym-to-set val)
- (set-default sym-to-set val)
- (if val
- (when volatile-highlights-mode
- (vhl/load-extension (quote ,sym)))
- (vhl/unload-extension (quote ,sym))))))))
-
-(defun vhl/load-extension (sym)
- (let ((fn-on (intern (format "vhl/ext/%s/on" sym)))
- (cust-name (intern (format "vhl/use-%s-extension-p" sym))))
- (if (functionp fn-on)
- (when (and (boundp cust-name)
- (eval cust-name))
- (apply fn-on nil))
- (message "[vhl] No load function for extension `%s'" sym))))
-
-(defun vhl/unload-extension (sym)
- (let ((fn-off (intern (format "vhl/ext/%s/off" sym))))
- (if (functionp fn-off)
- (apply fn-off nil)
- (message "[vhl] No unload function for extension `%s'" sym))))
-
-(defun vhl/load-extensions ()
- (dolist (sym vhl/.installed-extensions)
- (vhl/load-extension sym)))
-
-(defun vhl/unload-extensions ()
- (dolist (sym vhl/.installed-extensions)
- (vhl/unload-extension sym)))
-
-
-;;;============================================================================
-;;;
-;;; Utility functions/macros for extensions.
-;;;
-;;;============================================================================
-(defvar vhl/.after-change-hook-depth 0)
-
-(defun vhl/.push-to-after-change-hook (fn-name)
- ;; Debug
- ;; (if (zerop vhl/.after-change-hook-depth)
- ;; (message "vlh: push: %s" fn-name)
- ;; (message "vlh: skip push: %s" fn-name))
- (when (zerop vhl/.after-change-hook-depth)
- (add-hook 'after-change-functions
- 'vhl/.make-vhl-on-change))
- (setq vhl/.after-change-hook-depth
- (1+ vhl/.after-change-hook-depth)))
-
-(defun vhl/.pop-from-after-change-hook (fn-name)
- (setq vhl/.after-change-hook-depth
- (1- vhl/.after-change-hook-depth))
- ;; Debug
- ;; (if (zerop vhl/.after-change-hook-depth)
- ;; (message "vlh: pop: %s" fn-name)
- ;; (message "vlh: skip pop: %s" fn-name))
- (when (zerop vhl/.after-change-hook-depth)
- (remove-hook 'after-change-functions
- 'vhl/.make-vhl-on-change)))
-
-(defun vhl/advice-defined-p (fn-name class ad-name)
- (and (ad-is-advised fn-name)
- (assq ad-name
- (ad-get-advice-info-field fn-name class))))
-
-(defun vhl/disable-advice-if-defined (fn-name class ad-name)
- (when (vhl/advice-defined-p fn-name class ad-name)
- (ad-disable-advice fn-name class ad-name)
- (ad-activate fn-name)))
-
-(defun vhl/.make-vhl-on-change (beg end len-removed)
- (let ((insert-p (zerop len-removed)))
- (if insert-p
- ;; Highlight the insertion
- (vhl/add-range beg end)
- ;; Highlight the position of the deletion
- (vhl/add-position beg))))
-
-(defmacro vhl/give-advice-to-make-vhl-on-changes (fn-name)
- (let* ((ad-name (intern (concat "vhl/make-vhl-on-"
- (format "%s" fn-name)))))
- (or (symbolp fn-name)
- (error "vhl/give-advice-to-make-vhl-on-changes: `%s' is not type of symbol." fn-name))
- `(progn
- (defadvice ,fn-name (around
- ,ad-name
- (&rest args))
- (vhl/.push-to-after-change-hook (quote ,fn-name))
- (unwind-protect
- ad-do-it
- (vhl/.pop-from-after-change-hook (quote ,fn-name))))
- ;; Enable advice.
- (ad-enable-advice (quote ,fn-name) 'around (quote ,ad-name))
- (ad-activate (quote ,fn-name)))))
-
-(defmacro vhl/cancel-advice-to-make-vhl-on-changes (fn-name)
- (let ((ad-name (intern (concat "vhl/make-vhl-on-"
- (format "%s" fn-name)))))
- `(vhl/disable-advice-if-defined (quote ,fn-name) 'around (quote ,ad-name))))
-
-(defun vhl/require-noerror (feature &optional filename)
- (condition-case c
- (require feature)
- (file-error nil)))
-
-(eval-and-compile
-;; Utility function by Ryan Thompson.
-(defun vhl/.make-list-string (items)
- "Makes an English-style list from a list of strings.
-
-Converts a list of strings into a string that lists the items
-separated by commas, as well as the word `and' before the last
-item. In other words, returns a string of the way those items
-would be listed in english.
-
-This is included as a private support function for generating
-lists of symbols to be included docstrings of auto-generated
-extensions."
- (assert (listp items))
- (cond ((null items)
- ;; Zero items
- "")
- ((null (cdr items))
- ;; One item
- (assert (stringp (first items)))
- (format "%s" (first items)))
- ((null (cddr items))
- ;; Two items
- (assert (stringp (first items)))
- (assert (stringp (second items)))
- (apply 'format "%s and %s" items))
- ((null (cdddr items))
- ;; Three items
- (assert (stringp (first items)))
- (assert (stringp (second items)))
- (assert (stringp (third items)))
- (apply 'format "%s, %s, and %s" items))
- (t
- ;; 4 or more items
- (format "%s, %s" (first items) (vhl/.make-list-string (rest items)))))))
-
-;; The following makes it trivial to define simple vhl extensions
-(defmacro vhl/define-extension (name &rest functions)
- "Define a VHL extension called NAME that applies standard VHL
- advice to each of FUNCTIONS."
- (assert (first functions))
- (let* ((name-string (symbol-name (eval name)))
- (function-list-string (vhl/.make-list-string
- (mapcar (lambda (f) (format "`%s'" (symbol-name (eval f))))
- functions)))
- (on-function-name (intern (format "vhl/ext/%s/on" name-string)))
- (on-body-form (cons
- 'progn
- (mapcar (lambda (f)
- `(vhl/give-advice-to-make-vhl-on-changes ,(eval f)))
- functions)))
- (on-doc-string (format "Turn on volatile highlighting for %s." function-list-string))
-
- (off-function-name (intern (format "vhl/ext/%s/off" name-string)))
- (off-body-form (cons
- 'progn
- (mapcar (lambda (f)
- `(vhl/cancel-advice-to-make-vhl-on-changes ,(eval f)))
- functions)))
- (off-doc-string (format "Turn off volatile highlighting for %s." function-list-string)))
- `(progn
- (defun ,on-function-name ()
- ,on-doc-string
- (interactive)
- ,on-body-form)
- (defun ,off-function-name ()
- ,off-doc-string
- (interactive)
- ,off-body-form)
- nil)))
-
-
-;;;============================================================================
-;;;
-;;; Extensions.
-;;;
-;;;============================================================================
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting undo.
-;; -- Put volatile highlights on the text inserted by `undo'.
-;; (and may be `redo'...)
-;;-----------------------------------------------------------------------------
-
-(vhl/define-extension 'undo 'primitive-undo)
-(vhl/install-extension 'undo)
-
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting yank/yank-pop.
-;; -- Put volatile highlights on the text inserted by `yank' or `yank-pop'.
-;;-----------------------------------------------------------------------------
-
-(vhl/define-extension 'yank 'yank 'yank-pop)
-(vhl/install-extension 'yank)
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting kill.
-;; -- Put volatile highlights on the positions where killed text
-;; used to be.
-;;-----------------------------------------------------------------------------
-
-(vhl/define-extension 'kill 'kill-region)
-(vhl/install-extension 'kill)
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting `delete-region'.
-;; -- Put volatile highlights on the positions where deleted text
-;; used to be. This is not so reliable since `delete-region' is
-;; an inline function and is pre-compiled sans advice into many
-;; other deletion functions.
-;;-----------------------------------------------------------------------------
-
-(vhl/define-extension 'delete 'delete-region)
-(vhl/install-extension 'delete)
-
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting etags.
-;; -- Put volatile highlights on the tag name which was found by `find-tag'.
-;;-----------------------------------------------------------------------------
-(defun vhl/ext/etags/on ()
- "Turn on volatile highlighting for `etags'."
- (interactive)
- (require 'etags)
-
- (defadvice find-tag (after vhl/ext/etags/make-vhl-after-find-tag (tagname &optional next-p regexp-p))
- (let ((pos (point))
- (len (length tagname)))
- (save-excursion
- (search-forward tagname)
- (vhl/add-range (- (point) len) (point)))))
- (ad-activate 'find-tag))
-
-(defun vhl/ext/etags/off ()
- "Turn off volatile highlighting for `etags'."
- (interactive)
- (vhl/disable-advice-if-defined
- 'find-tag 'after 'vhl/ext/etags/make-vhl-after-find-tag))
-
-(vhl/install-extension 'etags)
-
-
-;;-----------------------------------------------------------------------------
-;; Extension for supporting occur.
-;; -- Put volatile highlights on occurrence which is selected by
-;; `occur-mode-goto-occurrence' or `occur-mode-display-occurrence'.
-;;-----------------------------------------------------------------------------
-(defun vhl/ext/occur/on ()
- "Turn on volatile highlighting for `occur'."
- (interactive)
-
- (lexical-let ((*occur-str* nil)) ;; Text in current line.
- (defun vhl/ext/occur/.pre-hook-fn ()
- (save-excursion
- (let* ((bol (progn (beginning-of-line) (point)))
- (eol (progn (end-of-line) (point)))
- (bos (text-property-any bol eol 'occur-match t)))
- (setq *occur-str* (and bos eol
- (buffer-substring bos eol))))))
-
- (defun vhl/ext/occur/.post-hook-fn ()
- (let ((marker (and *occur-str*
- (get-text-property 0 'occur-target *occur-str*)))
- (len (length *occur-str*))
- (ptr 0)
- (be-lst nil))
- (when marker
- ;; Detect position of each occurrence by scanning face
- ;; `list-matching-lines-face' put on them.
- (while (and ptr
- (setq ptr (text-property-any ptr len
- 'face
- list-matching-lines-face
- *occur-str*)))
- (let ((beg ptr)
- (end (or (setq ptr
- (next-single-property-change
- ptr 'face *occur-str*))
- ;; Occurrence ends at eol.
- len)))
- (push (list beg end)
- be-lst)))
- ;; Put volatile highlights on occurrences.
- (with-current-buffer (marker-buffer marker)
- (let* ((bol (marker-position marker)))
- (dolist (be be-lst)
- (let ((pt-beg (+ bol (nth 0 be)))
- (pt-end (+ bol (nth 1 be))))
- ;; When the occurrence is in folded line,
- ;; put highlight over whole line which
- ;; contains folded part.
- (dolist (ov (overlays-at pt-beg))
- (when (overlay-get ov 'invisible)
- ;;(message "INVISIBLE: %s" ov)
- (save-excursion
- (goto-char (overlay-start ov))
- (beginning-of-line)
- (setq pt-beg (min pt-beg (point)))
- (goto-char (overlay-end ov))
- (end-of-line)
- (setq pt-end (max pt-end (point))))))
-
- (vhl/add-range pt-beg
- pt-end
- nil
- list-matching-lines-face))))))))
-
-
- (defadvice occur-mode-goto-occurrence (before vhl/ext/occur/pre-hook (&optional event))
- (vhl/ext/occur/.pre-hook-fn))
- (defadvice occur-mode-goto-occurrence (after vhl/ext/occur/post-hook (&optional event))
- (vhl/ext/occur/.post-hook-fn))
-
- (defadvice occur-mode-display-occurrence (before vhl/ext/occur/pre-hook ())
- (vhl/ext/occur/.pre-hook-fn))
- (defadvice occur-mode-display-occurrence (after vhl/ext/occur/post-hook ())
- (vhl/ext/occur/.post-hook-fn))
-
- (defadvice occur-mode-goto-occurrence-other-window (before vhl/ext/occur/pre-hook ())
- (vhl/ext/occur/.pre-hook-fn))
- (defadvice occur-mode-goto-occurrence-other-window (after vhl/ext/occur/post-hook ())
- (vhl/ext/occur/.post-hook-fn))
-
- (ad-activate 'occur-mode-goto-occurrence)
- (ad-activate 'occur-mode-display-occurrence)
- (ad-activate 'occur-mode-goto-occurrence-other-window)))
-
-(defun vhl/ext/occur/off ()
- "Turn off volatile highlighting for `occur'."
- (interactive)
-
- (vhl/disable-advice-if-defined
- 'occur-mode-goto-occurrence 'before 'vhl/ext/occur/pre-hook)
- (vhl/disable-advice-if-defined
- 'occur-mode-goto-occurrence 'after 'vhl/ext/occur/post-hook)
-
- (vhl/disable-advice-if-defined
- 'occur-mode-display-occurrence 'before 'vhl/ext/occur/pre-hook)
- (vhl/disable-advice-if-defined
- 'occur-mode-display-occurrence 'after 'vhl/ext/occur/post-hook)
-
- (vhl/disable-advice-if-defined
- 'occur-mode-goto-occurrence-other-window 'before 'vhl/ext/occur/pre-hook)
- (vhl/disable-advice-if-defined
- 'occur-mode-goto-occurrence-other-window 'after 'vhl/ext/occur/post-hook))
-
-(vhl/install-extension 'occur)
-
-
-;;-----------------------------------------------------------------------------
-;; Extension for non-incremental search operations.
-;; -- Put volatile highlights on the text found by non-incremental search
-;; operations.
-;;-----------------------------------------------------------------------------
-
-(defmacro vhl/ext/nonincremental-search/.advice-to-vhl (fn)
- `(when (fboundp (quote ,fn))
- (defadvice ,fn (after
- ,(intern (format "vhl/ext/nonincremental-search/%s"
- fn))
- (&rest args))
- (when ad-return-value
- (vhl/add-range (match-beginning 0) (match-end 0) nil 'match)))
- (ad-activate (quote ,fn))))
-
-(defmacro vhl/ext/nonincremental-search/.disable-advice-to-vhl (fn)
- `(vhl/disable-advice-if-defined
- (quote ,fn)
- 'after
- (quote ,(intern (format "vhl/ext/nonincremental-search/%s" fn)))))
-
-(defun vhl/ext/nonincremental-search/on ()
- "Turn on volatile highlighting for non-incremental search operations."
- (interactive)
- (when (vhl/require-noerror 'menu-bar nil)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-search-forward)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-search-backward)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-re-search-forward)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-re-search-backward)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-repeat-search-forward)
- (vhl/ext/nonincremental-search/.advice-to-vhl nonincremental-repeat-search-backward)))
-
-(defun vhl/ext/nonincremental-search/off ()
- "Turn off volatile highlighting for non-incremental search operations."
- (interactive)
- (when (vhl/require-noerror 'menu-bar nil)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-search-forward)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-search-backward)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-re-search-forward)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-re-search-backward)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-repeat-search-forward)
- (vhl/ext/nonincremental-search/.disable-advice-to-vhl nonincremental-repeat-search-backward)))
-
-(vhl/install-extension 'nonincremental-search)
-
-
-;;-----------------------------------------------------------------------------
-;; Extension for hideshow.
-;; -- Put volatile highlights on the text blocks which are shown/hidden
-;; by hideshow.
-;;-----------------------------------------------------------------------------
-
-(defun vhl/ext/hideshow/.activate ()
- (defadvice hs-show-block (around vhl/ext/hideshow/vhl/around-hook (&optional end))
- (let* ((bol (save-excursion (progn (beginning-of-line) (point))))
- (eol (save-excursion (progn (end-of-line) (point))))
- (ov-folded (car (delq nil
- (mapcar #'(lambda (ov)
- (and (overlay-get ov 'hs)
- ov))
- (overlays-in bol (1+ eol))))))
- (boov (and ov-folded (overlay-start ov-folded)))
- (eoov (and ov-folded (overlay-end ov-folded))))
-
- ad-do-it
-
- (when (and boov eoov)
- (vhl/add-range boov eoov))))
- (ad-activate 'hs-show-block))
-
-(defun vhl/ext/hideshow/on ()
- "Turn on volatile highlighting for `hideshow'."
- (interactive)
-
- (cond
- ((featurep 'hideshow)
- (vhl/ext/hideshow/.activate))
- (t
- (eval-after-load "hideshow" '(vhl/ext/hideshow/.activate)))))
-
-(defun vhl/ext/hideshow/off ()
- (vhl/disable-advice-if-defined 'hs-show-block
- 'after
- 'vhl/ext/hideshow/vhl/around-hook))
-
-(vhl/install-extension 'hideshow)
-
-
-;;;============================================================================
-;;;
-;;; Suppress compiler warnings regarding to emacs/xemacs private functions.
-;;;
-;;;============================================================================
-
-;; Local variables:
-;; byte-compile-warnings: (not unresolved)
-;; End:
-
-;;; volatile-highlights.el ends here
diff --git a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.elc b/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.elc
deleted file mode 100644
index 2853281..0000000
Binary files a/emacs/.emacs.d/elpa/volatile-highlights-20160611.1855/volatile-highlights.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/dir b/emacs/.emacs.d/elpa/with-editor-20171217.1239/dir
deleted file mode 100644
index 93a7ef7..0000000
--- a/emacs/.emacs.d/elpa/with-editor-20171217.1239/dir
+++ /dev/null
@@ -1,18 +0,0 @@
-This is the file .../info/dir, which contains the
-topmost node of the Info hierarchy, called (dir)Top.
-The first time you invoke Info you start off looking at this node.
-
-File: dir, Node: Top This is the top of the INFO tree
-
- This (the Directory node) gives a menu of major topics.
- Typing "q" exits, "?" lists all Info commands, "d" returns here,
- "h" gives a primer for first-timers,
- "mEmacs" visits the Emacs manual, etc.
-
- In Emacs, you can click mouse button 2 on a menu item or cross reference
- to select it.
-
-* Menu:
-
-Emacs
-* With-Editor: (with-editor). Using the Emacsclient as $EDITOR.
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-autoloads.el b/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-autoloads.el
deleted file mode 100644
index e1da532..0000000
--- a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-autoloads.el
+++ /dev/null
@@ -1,16 +0,0 @@
-;;; with-editor-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil nil ("with-editor-pkg.el" "with-editor.el")
-;;;;;; (23124 14362 578815 245000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; with-editor-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-pkg.el b/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-pkg.el
deleted file mode 100644
index 95e03cf..0000000
--- a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor-pkg.el
+++ /dev/null
@@ -1,8 +0,0 @@
-(define-package "with-editor" "20171217.1239" "Use the Emacsclient as $EDITOR"
- '((emacs "24.4")
- (async "1.9"))
- :url "https://github.com/magit/with-editor" :keywords
- '("tools"))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.el b/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.el
deleted file mode 100644
index 45cb724..0000000
--- a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.el
+++ /dev/null
@@ -1,814 +0,0 @@
-;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding: t -*-
-
-;; Copyright (C) 2014-2017 The Magit Project Contributors
-;;
-;; You should have received a copy of the AUTHORS.md file. If not,
-;; see https://github.com/magit/with-editor/blob/master/AUTHORS.md.
-
-;; Author: Jonas Bernoulli
-;; Maintainer: Jonas Bernoulli
-
-;; Package-Requires: ((emacs "24.4") (async "1.9"))
-;; Keywords: tools
-;; Homepage: https://github.com/magit/with-editor
-
-;; This file is not part of GNU Emacs.
-
-;; This file 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, or (at your option)
-;; any later version.
-
-;; This file 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 Magit. If not, see http://www.gnu.org/licenses.
-
-;;; Commentary:
-
-;; This library makes it possible to reliably use the Emacsclient as
-;; the `$EDITOR' of child processes. It makes sure that they know how
-;; to call home. For remote processes a substitute is provided, which
-;; communicates with Emacs on standard output/input instead of using a
-;; socket as the Emacsclient does.
-
-;; It provides the commands `with-editor-async-shell-command' and
-;; `with-editor-shell-command', which are intended as replacements
-;; for `async-shell-command' and `shell-command'. They automatically
-;; export `$EDITOR' making sure the executed command uses the current
-;; Emacs instance as "the editor". With a prefix argument these
-;; commands prompt for an alternative environment variable such as
-;; `$GIT_EDITOR'. To always use these variants add this to your init
-;; file:
-;;
-;; (define-key (current-global-map)
-;; [remap async-shell-command] 'with-editor-async-shell-command)
-;; (define-key (current-global-map)
-;; [remap shell-command] 'with-editor-shell-command)
-
-;; Alternatively use the global `shell-command-with-editor-mode',
-;; which always sets `$EDITOR' for all Emacs commands which ultimately
-;; use `shell-command' to asynchronously run some shell command.
-
-;; The command `with-editor-export-editor' exports `$EDITOR' or
-;; another such environment variable in `shell-mode', `term-mode' and
-;; `eshell-mode' buffers. Use this Emacs command before executing a
-;; shell command which needs the editor set, or always arrange for the
-;; current Emacs instance to be used as editor by adding it to the
-;; appropriate mode hooks:
-;;
-;; (add-hook 'shell-mode-hook 'with-editor-export-editor)
-;; (add-hook 'term-exec-hook 'with-editor-export-editor)
-;; (add-hook 'eshell-mode-hook 'with-editor-export-editor)
-
-;; Some variants of this function exist, these two forms are
-;; equivalent:
-;;
-;; (add-hook 'shell-mode-hook
-;; (apply-partially 'with-editor-export-editor "GIT_EDITOR"))
-;; (add-hook 'shell-mode-hook 'with-editor-export-git-editor)
-
-;; This library can also be used by other packages which need to use
-;; the current Emacs instance as editor. In fact this library was
-;; written for Magit and its `git-commit-mode' and `git-rebase-mode'.
-;; Consult `git-rebase.el' and the related code in `magit-sequence.el'
-;; for a simple example.
-
-;;; Code:
-
-(require 'cl-lib)
-;; `pcase-dolist' is not autoloaded on Emacs 24.
-(eval-when-compile (require 'pcase))
-(require 'server)
-(require 'shell)
-
-(and (require 'async-bytecomp nil t)
- (memq 'magit (bound-and-true-p async-bytecomp-allowed-packages))
- (fboundp 'async-bytecomp-package-mode)
- (async-bytecomp-package-mode 1))
-
-(eval-when-compile
- (progn (require 'dired nil t)
- (require 'eshell nil t)
- (require 'term nil t)
- (require 'warnings nil t)))
-(declare-function dired-get-filename 'dired)
-(declare-function term-emulate-terminal 'term)
-(defvar eshell-preoutput-filter-functions)
-
-;;; Options
-
-(defgroup with-editor nil
- "Use the Emacsclient as $EDITOR."
- :group 'external
- :group 'server)
-
-(defun with-editor-locate-emacsclient ()
- "Search for a suitable Emacsclient executable."
- (or (with-editor-locate-emacsclient-1
- (with-editor-emacsclient-path)
- (length (split-string emacs-version "\\.")))
- (prog1 nil (display-warning 'with-editor "\
-Cannot determine a suitable Emacsclient
-
-Determining an Emacsclient executable suitable for the
-current Emacs instance failed. For more information
-please see https://github.com/magit/magit/wiki/Emacsclient."))))
-
-(defun with-editor-locate-emacsclient-1 (path depth)
- (let* ((version-lst (cl-subseq (split-string emacs-version "\\.") 0 depth))
- (version-reg (concat "^" (mapconcat #'identity version-lst "\\."))))
- (or (locate-file-internal
- (if (equal invocation-name "remacs") "remacsclient" "emacsclient")
- path
- (cl-mapcan
- (lambda (v) (cl-mapcar (lambda (e) (concat v e)) exec-suffixes))
- (nconc (and (boundp 'debian-emacs-flavor)
- (list (format ".%s" debian-emacs-flavor)))
- (cl-mapcon (lambda (v)
- (setq v (mapconcat #'identity (reverse v) "."))
- (list v (concat "-" v) (concat ".emacs" v)))
- (reverse version-lst))
- (list "" "-snapshot" ".emacs-snapshot")))
- (lambda (exec)
- (ignore-errors
- (string-match-p version-reg
- (with-editor-emacsclient-version exec)))))
- (and (> depth 1)
- (with-editor-locate-emacsclient-1 path (1- depth))))))
-
-(defun with-editor-emacsclient-version (exec)
- (let ((default-directory (file-name-directory exec)))
- (ignore-errors
- (cadr (split-string (car (process-lines exec "--version")))))))
-
-(defun with-editor-emacsclient-path ()
- (let ((path exec-path))
- (when invocation-directory
- (push (directory-file-name invocation-directory) path)
- (let* ((linkname (expand-file-name invocation-name invocation-directory))
- (truename (file-chase-links linkname)))
- (unless (equal truename linkname)
- (push (directory-file-name (file-name-directory truename)) path)))
- (when (eq system-type 'darwin)
- (let ((dir (expand-file-name "bin" invocation-directory)))
- (when (file-directory-p dir)
- (push dir path)))
- (when (string-match-p "Cellar" invocation-directory)
- (let ((dir (expand-file-name "../../../bin" invocation-directory)))
- (when (file-directory-p dir)
- (push dir path))))))
- (cl-remove-duplicates path :test 'equal)))
-
-(defcustom with-editor-emacsclient-executable (with-editor-locate-emacsclient)
- "The Emacsclient executable used by the `with-editor' macro."
- :group 'with-editor
- :type '(choice (string :tag "Executable")
- (const :tag "Don't use Emacsclient" nil)))
-
-(defcustom with-editor-sleeping-editor "\
-sh -c '\
-echo \"WITH-EDITOR: $$ OPEN $0\"; \
-sleep 604800 & sleep=$!; \
-trap \"kill $sleep; exit 0\" USR1; \
-trap \"kill $sleep; exit 1\" USR2; \
-wait $sleep'"
- "The sleeping editor, used when the Emacsclient cannot be used.
-
-This fallback is used for asynchronous processes started inside
-the macro `with-editor', when the process runs on a remote machine
-or for local processes when `with-editor-emacsclient-executable'
-is nil (i.e. when no suitable Emacsclient was found, or the user
-decided not to use it).
-
-Where the latter uses a socket to communicate with Emacs' server,
-this substitute prints edit requests to its standard output on
-which a process filter listens for such requests. As such it is
-not a complete substitute for a proper Emacsclient, it can only
-be used as $EDITOR of child process of the current Emacs instance.
-
-Some shells do not execute traps immediately when waiting for a
-child process, but by default we do use such a blocking child
-process.
-
-If you use such a shell (e.g. `csh' on FreeBSD, but not Debian),
-then you have to edit this option. You can either replace \"sh\"
-with \"bash\" (and install that), or you can use the older, less
-performant implementation:
-
- \"sh -c '\\
- echo \\\"WITH-EDITOR: $$ OPEN $0\\\"; \\
- trap \\\"exit 0\\\" USR1; \\
- trap \\\"exit 1\" USR2; \\
- while true; do sleep 1; done'\"
-
-Note that this leads to a delay of up to a second. The delay can
-be shortened by replacing \"sleep 1\" with \"sleep 0.01\", or if your
-implementation does not support floats, then by using `nanosleep'
-instead."
- :group 'with-editor
- :type 'string)
-
-(defcustom with-editor-finish-query-functions nil
- "List of functions called to query before finishing session.
-
-The buffer in question is current while the functions are called.
-If any of them returns nil, then the session is not finished and
-the buffer is not killed. The user should then fix the issue and
-try again. The functions are called with one argument. If it is
-non-nil then that indicates that the user used a prefix argument
-to force finishing the session despite issues. Functions should
-usually honor that and return non-nil."
- :group 'with-editor
- :type 'hook)
-(put 'with-editor-finish-query-functions 'permanent-local t)
-
-(defcustom with-editor-cancel-query-functions nil
- "List of functions called to query before canceling session.
-
-The buffer in question is current while the functions are called.
-If any of them returns nil, then the session is not canceled and
-the buffer is not killed. The user should then fix the issue and
-try again. The functions are called with one argument. If it is
-non-nil then that indicates that the user used a prefix argument
-to force canceling the session despite issues. Functions should
-usually honor that and return non-nil."
- :group 'with-editor
- :type 'hook)
-(put 'with-editor-cancel-query-functions 'permanent-local t)
-
-(defcustom with-editor-mode-lighter " WE"
- "The mode-line lighter of the With-Editor mode."
- :group 'with-editor
- :type '(choice (const :tag "No lighter" "") string))
-
-(defvar with-editor-server-window-alist nil
- "Alist of filename patterns vs corresponding `server-window'.
-
-Each element looks like (REGEXP . FUNCTION). Files matching
-REGEXP are selected using FUNCTION instead of the default in
-`server-window'.
-
-Note that when a package adds an entry here then it probably
-has a reason to disrespect `server-window' and it likely is
-not a good idea to change such entries.")
-
-(defvar with-editor-file-name-history-exclude nil
- "List of regexps for filenames `server-visit' should not remember.
-When a filename matches any of the regexps, then `server-visit'
-does not add it to the variable `file-name-history', which is
-used when reading a filename in the minibuffer.")
-
-(defcustom with-editor-shell-command-use-emacsclient t
- "Whether to use the emacsclient when running shell commands.
-
-This affects `with-editor-shell-command-async' and, if the input
-ends with \"&\" `with-editor-shell-command' .
-
-If `shell-command-with-editor-mode' is enabled, then it also
-affects `shell-command-async' and, if the input ends with \"&\"
-`shell-command'.
-
-This is a temporary kludge that lets you choose between two
-possible defects, the ones described in the issues #23 and #40.
-
-When t, then use the emacsclient. This has the disadvantage that
-`with-editor-mode' won't be enabled because we don't know whether
-this package was involved at all in the call to the emacsclient,
-and when it is not, then we really should. The problem is that
-the emacsclient doesn't pass a long any environment variables to
-the server. This will hopefully be fixed in Emacs eventually.
-
-When nil, then use the sleeping editor. Because in this case we
-know that this package is involved, we can enable the mode. But
-this makes it necessary that you invoke $EDITOR in shell scripts
-like so:
-
- eval \"$EDITOR\" file
-
-And some tools that do not handle $EDITOR properly also break."
- :package-version '(with-editor . "2.8.0")
- :group 'with-editor
- :type 'boolean)
-
-;;; Mode Commands
-
-(defvar with-editor-pre-finish-hook nil)
-(defvar with-editor-pre-cancel-hook nil)
-(defvar with-editor-post-finish-hook nil)
-(defvar with-editor-post-finish-hook-1 nil)
-(defvar with-editor-post-cancel-hook nil)
-(defvar with-editor-post-cancel-hook-1 nil)
-(defvar with-editor-cancel-alist nil)
-(put 'with-editor-pre-finish-hook 'permanent-local t)
-(put 'with-editor-pre-cancel-hook 'permanent-local t)
-(put 'with-editor-post-finish-hook 'permanent-local t)
-(put 'with-editor-post-cancel-hook 'permanent-local t)
-
-(defvar with-editor-show-usage t)
-(defvar with-editor-cancel-message nil)
-(defvar with-editor-previous-winconf nil)
-(make-variable-buffer-local 'with-editor-show-usage)
-(make-variable-buffer-local 'with-editor-cancel-message)
-(make-variable-buffer-local 'with-editor-previous-winconf)
-(put 'with-editor-cancel-message 'permanent-local t)
-(put 'with-editor-previous-winconf 'permanent-local t)
-
-(defvar-local with-editor--pid nil "For internal use.")
-(put 'with-editor--pid 'permanent-local t)
-
-(defun with-editor-finish (force)
- "Finish the current edit session."
- (interactive "P")
- (when (run-hook-with-args-until-failure
- 'with-editor-finish-query-functions force)
- (let ((with-editor-post-finish-hook-1
- (ignore-errors (delq t with-editor-post-finish-hook))))
- (run-hooks 'with-editor-pre-finish-hook)
- (with-editor-return nil)
- (accept-process-output nil 0.1)
- (run-hooks 'with-editor-post-finish-hook-1))))
-
-(defun with-editor-cancel (force)
- "Cancel the current edit session."
- (interactive "P")
- (when (run-hook-with-args-until-failure
- 'with-editor-cancel-query-functions force)
- (let ((message with-editor-cancel-message))
- (when (functionp message)
- (setq message (funcall message)))
- (let ((with-editor-post-cancel-hook-1
- (ignore-errors (delq t with-editor-post-cancel-hook)))
- (with-editor-cancel-alist nil))
- (run-hooks 'with-editor-pre-cancel-hook)
- (with-editor-return t)
- (accept-process-output nil 0.1)
- (run-hooks 'with-editor-post-cancel-hook-1))
- (message (or message "Canceled by user")))))
-
-(defun with-editor-return (cancel)
- (let ((winconf with-editor-previous-winconf)
- (clients server-buffer-clients)
- (dir default-directory)
- (pid with-editor--pid))
- (remove-hook 'kill-buffer-query-functions
- 'with-editor-kill-buffer-noop t)
- (cond (cancel
- (save-buffer)
- (if clients
- (dolist (client clients)
- (ignore-errors
- (server-send-string client "-error Canceled by user"))
- (delete-process client))
- ;; Fallback for when emacs was used as $EDITOR
- ;; instead of emacsclient or the sleeping editor.
- ;; See https://github.com/magit/magit/issues/2258.
- (ignore-errors (delete-file buffer-file-name))
- (kill-buffer)))
- (t
- (save-buffer)
- (if clients
- ;; Don't use `server-edit' because we do not want to
- ;; show another buffer belonging to another client.
- ;; See https://github.com/magit/magit/issues/2197.
- (server-done)
- (kill-buffer))))
- (when pid
- (let ((default-directory dir))
- (process-file "kill" nil nil nil
- "-s" (if cancel "USR2" "USR1") pid)))
- (when (and winconf (eq (window-configuration-frame winconf)
- (selected-frame)))
- (set-window-configuration winconf))))
-
-;;; Mode
-
-(defvar with-editor-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-c" 'with-editor-finish)
- (define-key map [remap server-edit] 'with-editor-finish)
- (define-key map [remap evil-save-and-close] 'with-editor-finish)
- (define-key map [remap evil-save-modified-and-close] 'with-editor-finish)
- (define-key map "\C-c\C-k" 'with-editor-cancel)
- (define-key map [remap kill-buffer] 'with-editor-cancel)
- (define-key map [remap ido-kill-buffer] 'with-editor-cancel)
- (define-key map [remap iswitchb-kill-buffer] 'with-editor-cancel)
- (define-key map [remap evil-quit] 'with-editor-cancel)
- map))
-
-(define-minor-mode with-editor-mode
- "Edit a file as the $EDITOR of an external process."
- :lighter with-editor-mode-lighter
- ;; Protect the user from killing the buffer without using
- ;; either `with-editor-finish' or `with-editor-cancel',
- ;; and from removing the key bindings for these commands.
- (unless with-editor-mode
- (user-error "With-Editor mode cannot be turned off"))
- (add-hook 'kill-buffer-query-functions
- 'with-editor-kill-buffer-noop nil t)
- ;; `server-execute' displays a message which is not
- ;; correct when using this mode.
- (when with-editor-show-usage
- (with-editor-usage-message)))
-
-(put 'with-editor-mode 'permanent-local t)
-
-(defun with-editor-kill-buffer-noop ()
- (user-error (substitute-command-keys "\
-Don't kill this buffer. Instead cancel using \\[with-editor-cancel]")))
-
-(defun with-editor-usage-message ()
- ;; Run after `server-execute', which is run using
- ;; a timer which starts immediately.
- (run-with-timer
- 0.01 nil `(lambda ()
- (with-current-buffer ,(current-buffer)
- (message (substitute-command-keys "\
-Type \\[with-editor-finish] to finish, \
-or \\[with-editor-cancel] to cancel"))))))
-
-;;; Wrappers
-
-(defvar with-editor--envvar nil "For internal use.")
-
-(defmacro with-editor (&rest body)
- "Use the Emacsclient as $EDITOR while evaluating BODY.
-Modify the `process-environment' for processes started in BODY,
-instructing them to use the Emacsclient as $EDITOR. If optional
-ENVVAR is provided then bind that environment variable instead.
-\n(fn [ENVVAR] BODY...)"
- (declare (indent defun) (debug (body)))
- `(let ((with-editor--envvar ,(if (stringp (car body))
- (pop body)
- '(or with-editor--envvar "EDITOR")))
- (process-environment process-environment))
- (with-editor--setup)
- ,@body))
-
-(defun with-editor--setup ()
- (if (or (not with-editor-emacsclient-executable)
- (file-remote-p default-directory))
- (push (concat with-editor--envvar "=" with-editor-sleeping-editor)
- process-environment)
- ;; Make sure server-use-tcp's value is valid.
- (unless (featurep 'make-network-process '(:family local))
- (setq server-use-tcp t))
- ;; Make sure the server is running.
- (unless server-process
- (when (server-running-p server-name)
- (setq server-name (format "server%s" (emacs-pid)))
- (when (server-running-p server-name)
- (server-force-delete server-name)))
- (server-start))
- ;; Tell $EDITOR to use the Emacsclient.
- (push (concat with-editor--envvar "="
- (shell-quote-argument with-editor-emacsclient-executable)
- ;; Tell the process where the server file is.
- (and (not server-use-tcp)
- (concat " --socket-name="
- (shell-quote-argument
- (expand-file-name server-name
- server-socket-dir)))))
- process-environment)
- (when server-use-tcp
- (push (concat "EMACS_SERVER_FILE="
- (expand-file-name server-name server-auth-dir))
- process-environment))
- ;; As last resort fallback to the sleeping editor.
- (push (concat "ALTERNATE_EDITOR=" with-editor-sleeping-editor)
- process-environment)))
-
-(defun with-editor-server-window ()
- (or (and buffer-file-name
- (cdr (cl-find-if (lambda (cons)
- (string-match-p (car cons) buffer-file-name))
- with-editor-server-window-alist)))
- server-window))
-
-(defun server-switch-buffer--with-editor-server-window-alist
- (fn &optional next-buffer killed-one filepos)
- "Honor `with-editor-server-window-alist' (which see)."
- (let ((server-window (with-current-buffer
- (or next-buffer (current-buffer))
- (when with-editor-mode
- (setq with-editor-previous-winconf
- (current-window-configuration)))
- (with-editor-server-window))))
- (funcall fn next-buffer killed-one filepos)))
-
-(advice-add 'server-switch-buffer :around
- 'server-switch-buffer--with-editor-server-window-alist)
-
-(defun start-file-process--with-editor-process-filter
- (fn name buffer program &rest program-args)
- "When called inside a `with-editor' form and the Emacsclient
-cannot be used, then give the process the filter function
-`with-editor-process-filter'. To avoid overriding the filter
-being added here you should use `with-editor-set-process-filter'
-instead of `set-process-filter' inside `with-editor' forms.
-
-When the `default-directory' is located on a remote machine,
-then also manipulate PROGRAM and PROGRAM-ARGS in order to set
-the appropriate editor environment variable."
- (if (not with-editor--envvar)
- (apply fn name buffer program program-args)
- (when (file-remote-p default-directory)
- (unless (equal program "env")
- (push program program-args)
- (setq program "env"))
- (push (concat with-editor--envvar "=" with-editor-sleeping-editor)
- program-args))
- (let ((process (apply fn name buffer program program-args)))
- (set-process-filter process 'with-editor-process-filter)
- (process-put process 'default-dir default-directory)
- process)))
-
-(advice-add 'start-file-process :around
- 'start-file-process--with-editor-process-filter)
-
-(defun with-editor-set-process-filter (process filter)
- "Like `set-process-filter' but keep `with-editor-process-filter'.
-Give PROCESS the new FILTER but keep `with-editor-process-filter'
-if that was added earlier by the adviced `start-file-process'.
-
-Do so by wrapping the two filter functions using a lambda, which
-becomes the actual filter. It calls `with-editor-process-filter'
-first, passing t as NO-STANDARD-FILTER. Then it calls FILTER,
-which may or may not insert the text into the PROCESS' buffer."
- (set-process-filter
- process
- (if (eq (process-filter process) 'with-editor-process-filter)
- `(lambda (proc str)
- (,filter proc str)
- (with-editor-process-filter proc str t))
- filter)))
-
-(defvar with-editor-filter-visit-hook nil)
-
-(defun with-editor-output-filter (string)
- (save-match-data
- (if (string-match "^WITH-EDITOR: \\([0-9]+\\) OPEN \\(.+?\\)\r?$" string)
- (let ((pid (match-string 1 string))
- (file (match-string 2 string)))
- (with-current-buffer
- (find-file-noselect
- (if (and (file-name-absolute-p file) default-directory)
- (concat (file-remote-p default-directory) file)
- (expand-file-name file)))
- (with-editor-mode 1)
- (setq with-editor--pid pid)
- (run-hooks 'with-editor-filter-visit-hook)
- (funcall (or (with-editor-server-window) 'switch-to-buffer)
- (current-buffer))
- (kill-local-variable 'server-window))
- nil)
- string)))
-
-(defun with-editor-process-filter
- (process string &optional no-default-filter)
- "Listen for edit requests by child processes."
- (let ((default-directory (process-get process 'default-dir)))
- (with-editor-output-filter string))
- (unless no-default-filter
- (internal-default-process-filter process string)))
-
-(advice-add 'server-visit-files :after
- 'server-visit-files--with-editor-file-name-history-exclude)
-
-(defun server-visit-files--with-editor-file-name-history-exclude
- (files _proc &optional _nowait)
- (pcase-dolist (`(,file . ,_) files)
- (when (cl-find-if (lambda (regexp)
- (string-match-p regexp file))
- with-editor-file-name-history-exclude)
- (setq file-name-history (delete file file-name-history)))))
-
-;;; Augmentations
-
-(cl-defun with-editor-export-editor (&optional (envvar "EDITOR"))
- "Teach subsequent commands to use current Emacs instance as editor.
-
-Set and export the environment variable ENVVAR, by default
-\"EDITOR\". The value is automatically generated to teach
-commands to use the current Emacs instance as \"the editor\".
-
-This works in `shell-mode', `term-mode' and `eshell-mode'."
- (interactive (list (with-editor-read-envvar)))
- (cond
- ((derived-mode-p 'comint-mode 'term-mode)
- (let ((process (get-buffer-process (current-buffer))))
- (goto-char (process-mark process))
- (process-send-string
- process (format " export %s=%s\n" envvar
- (shell-quote-argument with-editor-sleeping-editor)))
- (while (accept-process-output process 0.1))
- (if (derived-mode-p 'term-mode)
- (with-editor-set-process-filter process 'with-editor-emulate-terminal)
- (add-hook 'comint-output-filter-functions 'with-editor-output-filter
- nil t))))
- ((derived-mode-p 'eshell-mode)
- (add-to-list 'eshell-preoutput-filter-functions
- 'with-editor-output-filter)
- (setenv envvar with-editor-sleeping-editor))
- (t
- (error "Cannot export environment variables in this buffer")))
- (message "Successfully exported %s" envvar))
-
-(defun with-editor-export-git-editor ()
- "Like `with-editor-export-editor' but always set `$GIT_EDITOR'."
- (interactive)
- (with-editor-export-editor "GIT_EDITOR"))
-
-(defun with-editor-export-hg-editor ()
- "Like `with-editor-export-editor' but always set `$HG_EDITOR'."
- (interactive)
- (with-editor-export-editor "HG_EDITOR"))
-
-(defun with-editor-emulate-terminal (process string)
- "Like `term-emulate-terminal' but also handle edit requests."
- (when (with-editor-output-filter string)
- (term-emulate-terminal process string)))
-
-(defvar with-editor-envvars '("EDITOR" "GIT_EDITOR" "HG_EDITOR"))
-
-(cl-defun with-editor-read-envvar
- (&optional (prompt "Set environment variable")
- (default "EDITOR"))
- (let ((reply (completing-read (if default
- (format "%s (%s): " prompt default)
- (concat prompt ": "))
- with-editor-envvars nil nil nil nil default)))
- (if (string= reply "") (user-error "Nothing selected") reply)))
-
-(define-minor-mode shell-command-with-editor-mode
- "Teach `shell-command' to use current Emacs instance as editor.
-
-Teach `shell-command', and all commands that ultimately call that
-command, to use the current Emacs instance as editor by executing
-\"EDITOR=CLIENT COMMAND&\" instead of just \"COMMAND&\".
-
-CLIENT is automatically generated; EDITOR=CLIENT instructs
-COMMAND to use to the current Emacs instance as \"the editor\",
-assuming no other variable overrides the effect of \"$EDITOR\".
-CLIENT may be the path to an appropriate emacsclient executable
-with arguments, or a script which also works over Tramp.
-
-Alternatively you can use the `with-editor-async-shell-command',
-which also allows the use of another variable instead of
-\"EDITOR\"."
- :global t)
-
-(defun with-editor-async-shell-command
- (command &optional output-buffer error-buffer envvar)
- "Like `async-shell-command' but with `$EDITOR' set.
-
-Execute string \"ENVVAR=CLIENT COMMAND\" in an inferior shell;
-display output, if any. With a prefix argument prompt for an
-environment variable, otherwise the default \"EDITOR\" variable
-is used. With a negative prefix argument additionally insert
-the COMMAND's output at point.
-
-CLIENT is automatically generated; ENVVAR=CLIENT instructs
-COMMAND to use to the current Emacs instance as \"the editor\",
-assuming it respects ENVVAR as an \"EDITOR\"-like variable.
-CLIENT may be the path to an appropriate emacsclient executable
-with arguments, or a script which also works over Tramp.
-
-Also see `async-shell-command' and `shell-command'."
- (interactive (with-editor-shell-command-read-args "Async shell command: " t))
- (let ((with-editor--envvar envvar))
- (with-editor
- (async-shell-command command output-buffer error-buffer))))
-
-(defun with-editor-shell-command
- (command &optional output-buffer error-buffer envvar)
- "Like `shell-command' or `with-editor-async-shell-command'.
-If COMMAND ends with \"&\" behave like the latter,
-else like the former."
- (interactive (with-editor-shell-command-read-args "Shell command: "))
- (if (string-match "&[ \t]*\\'" command)
- (with-editor-async-shell-command
- command output-buffer error-buffer envvar)
- (shell-command command output-buffer error-buffer)))
-
-(defun with-editor-shell-command-read-args (prompt &optional async)
- (let ((command (read-shell-command
- prompt nil nil
- (let ((filename (or buffer-file-name
- (and (eq major-mode 'dired-mode)
- (dired-get-filename nil t)))))
- (and filename (file-relative-name filename))))))
- (list command
- (if (or async (setq async (string-match-p "&[ \t]*\\'" command)))
- (< (prefix-numeric-value current-prefix-arg) 0)
- current-prefix-arg)
- shell-command-default-error-buffer
- (and async current-prefix-arg (with-editor-read-envvar)))))
-
-(defun shell-command--shell-command-with-editor-mode
- (fn command &optional output-buffer error-buffer)
- ;; `shell-mode' and its hook are intended for buffers in which an
- ;; interactive shell is running, but `shell-command' also turns on
- ;; that mode, even though it only runs the shell to run a single
- ;; command. The `with-editor-export-editor' hook function is only
- ;; intended to be used in buffers in which an interactive shell is
- ;; running, so it has to be remove here.
- (let ((shell-mode-hook (remove 'with-editor-export-editor shell-mode-hook)))
- (cond ((or (not (or with-editor--envvar shell-command-with-editor-mode))
- (not (string-match-p "&\\'" command)))
- (funcall fn command output-buffer error-buffer))
- ((and with-editor-shell-command-use-emacsclient
- with-editor-emacsclient-executable
- (not (file-remote-p default-directory)))
- (with-editor (funcall fn command output-buffer error-buffer)))
- (t
- (apply fn (format "%s=%s %s"
- (or with-editor--envvar "EDITOR")
- (shell-quote-argument with-editor-sleeping-editor)
- command)
- output-buffer error-buffer)
- (ignore-errors
- (let ((process (get-buffer-process
- (or output-buffer
- (get-buffer "*Async Shell Command*")))))
- (set-process-filter
- process (lambda (proc str)
- (comint-output-filter proc str)
- (with-editor-process-filter proc str t)))
- process))))))
-
-(advice-add 'shell-command :around
- 'shell-command--shell-command-with-editor-mode)
-
-;;; with-editor.el ends soon
-
-(defun with-editor-debug ()
- "Debug configuration issues.
-See info node `(with-editor)Debugging' for instructions."
- (interactive)
- (with-current-buffer (get-buffer-create "*with-editor-debug*")
- (pop-to-buffer (current-buffer))
- (erase-buffer)
- (ignore-errors (with-editor))
- (insert
- (format "with-editor: %s\n" (locate-library "with-editor.el"))
- (format "emacs: %s (%s)\n"
- (expand-file-name invocation-name invocation-directory)
- emacs-version)
- "system:\n"
- (format " system-type: %s\n" system-type)
- (format " system-configuration: %s\n" system-configuration)
- (format " system-configuration-options: %s\n" system-configuration-options)
- "server:\n"
- (format " server-running-p: %s\n" (server-running-p))
- (format " server-process: %S\n" server-process)
- (format " server-use-tcp: %s\n" server-use-tcp)
- (format " server-name: %s\n" server-name)
- (format " server-socket-dir: %s\n" server-socket-dir))
- (if (and server-socket-dir (file-accessible-directory-p server-socket-dir))
- (dolist (file (directory-files server-socket-dir nil "^[^.]"))
- (insert (format " %s\n" file)))
- (insert (format " %s: not an accessible directory\n"
- (if server-use-tcp "WARNING" "ERROR"))))
- (insert (format " server-auth-dir: %s\n" server-auth-dir))
- (if (file-accessible-directory-p server-auth-dir)
- (dolist (file (directory-files server-auth-dir nil "^[^.]"))
- (insert (format " %s\n" file)))
- (insert (format " %s: not an accessible directory\n"
- (if server-use-tcp "ERROR" "WARNING"))))
- (let ((val with-editor-emacsclient-executable)
- (def (default-value 'with-editor-emacsclient-executable))
- (fun (let ((warning-minimum-level :error)
- (warning-minimum-log-level :error))
- (with-editor-locate-emacsclient))))
- (insert "with-editor-emacsclient-executable:\n"
- (format " value: %s (%s)\n" val
- (and val (with-editor-emacsclient-version val)))
- (format " default: %s (%s)\n" def
- (and def (with-editor-emacsclient-version def)))
- (format " funcall: %s (%s)\n" fun
- (and fun (with-editor-emacsclient-version fun)))))
- (insert "path:\n"
- (format " $PATH: %S\n" (getenv "PATH"))
- (format " exec-path: %s\n" exec-path))
- (insert (format " with-editor-emacsclient-path:\n"))
- (dolist (dir (with-editor-emacsclient-path))
- (insert (format " %s (%s)\n" dir (car (file-attributes dir))))
- (when (file-directory-p dir)
- ;; Don't match emacsclientw.exe, it makes popup windows.
- (dolist (exec (directory-files dir t "emacsclient\\(?:[^w]\\|\\'\\)"))
- (insert (format " %s (%s)\n" exec
- (with-editor-emacsclient-version exec))))))))
-
-(defconst with-editor-font-lock-keywords
- '(("(\\(with-\\(?:git-\\)?editor\\)\\_>" (1 'font-lock-keyword-face))))
-(font-lock-add-keywords 'emacs-lisp-mode with-editor-font-lock-keywords)
-
-(provide 'with-editor)
-;; Local Variables:
-;; indent-tabs-mode: nil
-;; End:
-;;; with-editor.el ends here
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.elc b/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.elc
deleted file mode 100644
index 37b79da..0000000
Binary files a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.elc and /dev/null differ
diff --git a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.info b/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.info
deleted file mode 100644
index 36a7982..0000000
--- a/emacs/.emacs.d/elpa/with-editor-20171217.1239/with-editor.info
+++ /dev/null
@@ -1,331 +0,0 @@
-This is with-editor.info, produced by makeinfo version 5.2 from
-with-editor.texi.
-
- Copyright (C) 2015-2017 Jonas Bernoulli
-
- You can redistribute this document 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 document 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.
-INFO-DIR-SECTION Emacs
-START-INFO-DIR-ENTRY
-* With-Editor: (with-editor). Using the Emacsclient as $EDITOR.
-END-INFO-DIR-ENTRY
-
-
-File: with-editor.info, Node: Top, Next: Using the With-Editor package, Up: (dir)
-
-With-Editor User Manual
-***********************
-
-The library ‘with-editor’ makes it easy to use the Emacsclient as the
-‘$EDITOR’ of child processes, making sure they know how to call home.
-For remote processes a substitute is provided, which communicates with
-Emacs on standard output instead of using a socket as the Emacsclient
-does.
-
- This library was written because Magit has to be able to do the above
-to allow the user to edit commit messages gracefully and to edit rebase
-sequences, which wouldn’t be possible at all otherwise.
-
- Because other packages can benefit from such functionality, this
-library is made available as a separate package. It also defines some
-additional functionality which makes it useful even for end-users, who
-don’t use Magit or another package which uses it internally.
-
-This manual is for With-Editor version 2.7.0 (v2.7.0-10-g93876b6+1).
-
- Copyright (C) 2015-2017 Jonas Bernoulli
-
- You can redistribute this document 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 document 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.
-
-* Menu:
-
-* Using the With-Editor package::
-* Using With-Editor as a library::
-* Debugging::
-
-— The Detailed Node Listing —
-
-Using the With-Editor package
-
-* Configuring With-Editor::
-* Using With-Editor commands::
-
-
-
-File: with-editor.info, Node: Using the With-Editor package, Next: Using With-Editor as a library, Prev: Top, Up: Top
-
-1 Using the With-Editor package
-*******************************
-
-The ‘With-Editor’ package is used internally by Magit when editing
-commit messages and rebase sequences. It also provides some commands
-and features which are useful by themselves, even if you don’t use
-Magit.
-
- For information about using this library in you own package, see
-*note Using With-Editor as a library::.
-
-* Menu:
-
-* Configuring With-Editor::
-* Using With-Editor commands::
-
-
-File: with-editor.info, Node: Configuring With-Editor, Next: Using With-Editor commands, Up: Using the With-Editor package
-
-1.1 Configuring With-Editor
-===========================
-
-With-Editor tries very hard to locate a suitable ‘emacsclient’
-executable, so ideally you should never have to customize the option
-‘with-editor-emacsclient-executable’. When it fails to do so, then the
-most likely reason is that someone found yet another way to package
-Emacs (most likely on macOS) without putting the executable on ‘$PATH’,
-and we have to add another kludge to find it anyway.
-
- -- User Option: with-editor-emacsclient-executable
-
- The ‘emacsclient’ executable used as the editor by child process of
- this Emacs instance. By using this executable, child processes can
- call home to their parent process.
-
- This option is automatically set at startup by looking in
- ‘exec-path’, and other places where the executable could be
- installed, to find the ‘emacsclient’ executable most suitable for
- the current Emacs instance.
-
- You should *not* customize this option permanently. If you have to
- do it, then you should consider that a temporary kludge and inform
- the Magit maintainer as described in *note Debugging::.
-
- If With-Editor fails to find a suitable ‘emacsclient’ on you
- system, then this should be fixed for all users at once, by
- teaching ‘with-editor-locate-emacsclient’ how to do so on your
- system and system like yours. Doing it this way has the advantage,
- that you won’t have do it again every time you update Emacs, and
- that other users who have installed Emacs the same way as you have,
- won’t have to go through the same trouble.
-
- Note that there also is a nuclear option; setting this variable to
- ‘nil’ causes the "sleeping editor" described below to be used even
- for local child processes. Obviously we don’t recommend that you
- use this except in "emergencies", i.e. before we had a change to
- add a kludge appropriate for you setup.
-
- -- Function: with-editor-locate-emacsclient
-
- The function used to set the initial value of the option
- ‘with-editor-emacsclient-executable’. There’s a lot of voodoo
- here.
-
- The ‘emacsclient’ cannot be used when using Tramp to run a process on
-a remote machine. (Theoretically it could, but that would be hard to
-setup, very fragile, and rather insecure).
-
- With-Editor provides an alternative "editor" which can be used by
-remote processes in much the same way as local processes use an
-‘emacsclient’ executable. This alternative is known as the "sleeping
-editor" because it is implemented as a shell script which sleeps until
-it receives a signal.
-
- -- User Option: with-editor-sleeping-editor
-
- The sleeping editor is a shell script used as the editor of child
- processes when the ‘emacsclient’ executable cannot be used.
-
- This fallback is used for asynchronous process started inside the
- macro ‘with-editor’, when the process runs on a remote machine or
- for local processes when ‘with-editor-emacsclient-executable’ is
- ‘nil’.
-
- Where the latter uses a socket to communicate with Emacs’ server,
- this substitute prints edit requests to its standard output on
- which a process filter listens for such requests. As such it is
- not a complete substitute for a proper ‘emacsclient’, it can only
- be used as ‘$EDITOR’ of child process of the current Emacs
- instance.
-
- Some shells do not execute traps immediately when waiting for a
- child process, but by default we do use such a blocking child
- process.
-
- If you use such a shell (e.g. ‘csh’ on FreeBSD, but not Debian),
- then you have to edit this option. You can either replace ‘sh’
- with ‘bash’ (and install that), or you can use the older, less
- performant implementation:
-
- "sh -c '\
- echo \"WITH-EDITOR: $$ OPEN $0\"; \
- trap \"exit 0\" USR1; \
- trap \"exit 1\" USR2; \
- while true; do sleep 1; done'"
-
- This leads to a delay of up to a second. The delay can be
- shortened by replacing ‘sleep 1’ with ‘sleep 0.01’, or if your
- implementation does not support floats, then by using ‘nanosleep
- 0.01’ instead.
-
-
-File: with-editor.info, Node: Using With-Editor commands, Prev: Configuring With-Editor, Up: Using the With-Editor package
-
-1.2 Using With-Editor commands
-==============================
-
-This section describes how to use the ‘with-editor’ library _outside_ of
-Magit. You don’t need to know any of this just to create commits using
-Magit.
-
- The commands ‘with-editor-async-shell-command’ and
-‘with-editor-shell-command’ are intended as drop in replacements for
-‘async-shell-command’ and ‘shell-command’. They automatically export
-‘$EDITOR’ making sure the executed command uses the current Emacs
-instance as "the editor". With a prefix argument these commands prompt
-for an alternative environment variable such as ‘$GIT_EDITOR’.
-
- -- Command: with-editor-async-shell-command
-
- This command is like ‘async-shell-command’, but it runs the shell
- command with the current Emacs instance exported as ‘$EDITOR’.
-
- -- Command: with-editor-shell-command
-
- This command is like ‘async-shell-command’, but it runs the shell
- command with the current Emacs instance exported as ‘$EDITOR’.
- This only has an effect if the shell command is run asynchronously,
- i.e. when the command ends with ‘&’.
-
- To always use these variants add this to you init file:
-
- (define-key (current-global-map)
- [remap async-shell-command] 'with-editor-async-shell-command)
- (define-key (current-global-map)
- [remap shell-command] 'with-editor-shell-command)
-
- Alternatively use the global ‘shell-command-with-editor-mode’.
-
- -- Variable: shell-command-with-editor-mode
-
- When this mode is active, then ‘$EDITOR’ is exported whenever
- ultimately ‘shell-command’ is called to asynchronously run some
- shell command. This affects most variants of that command, whether
- they are defined in Emacs or in some third-party package.
-
- The command ‘with-editor-export-editor’ exports ‘$EDITOR’ or another
-such environment variable in ‘shell-mode’, ‘term-mode’ and ‘eshell-mode’
-buffers. Use this Emacs command before executing a shell command which
-needs the editor set, or always arrange for the current Emacs instance
-to be used as editor by adding it to the appropriate mode hooks:
-
- (add-hook 'shell-mode-hook 'with-editor-export-editor)
- (add-hook 'term-exec-hook 'with-editor-export-editor)
- (add-hook 'eshell-mode-hook 'with-editor-export-editor)
-
- Some variants of this function exist; these two forms are equivalent:
-
- (add-hook 'shell-mode-hook
- (apply-partially 'with-editor-export-editor "GIT_EDITOR"))
- (add-hook 'shell-mode-hook 'with-editor-export-git-editor)
-
- -- Command: with-editor-export-editor
-
- When invoked in a ‘shell-mode’, ‘term-mode’, or ‘eshell-mode’
- buffer, this command teaches shell commands to use the current
- Emacs instance as the editor, by exporting ‘$EDITOR’.
-
- -- Command: with-editor-export-git-editor
-
- This command is like ‘with-editor-export-editor’ but exports
- ‘$GIT_EDITOR’.
-
- -- Command: with-editor-export-hg-editor
-
- This command is like ‘with-editor-export-editor’ but exports
- ‘$HG_EDITOR’.
-
-
-File: with-editor.info, Node: Using With-Editor as a library, Next: Debugging, Prev: Using the With-Editor package, Up: Top
-
-2 Using With-Editor as a library
-********************************
-
-This section describes how to use the ‘with-editor’ library _outside_ of
-Magit to teach another package how to have its child processes call
-home, just like Magit does. You don’t need to know any of this just to
-create commits using Magit. You can also ignore this if you use
-‘with-editor’ outside of Magit, but only as an end-user.
-
- For information about interactive use and options that affect both
-interactive and non-interactive use, see *note Using the With-Editor
-package::.
-
- -- Macro: with-editor &rest body
-
- This macro arranges for the ‘emacsclient’ or the sleeping editor to
- be used as the editor of child processes, effectively teaching them
- to call home to the current Emacs instance when they require that
- the user edits a file.
-
- This is essentially done by establishing a local binding for
- ‘process-environment’ and changing the value of the ‘$EDITOR’
- environment variable in that scope. This affects all asynchronous
- processes started by forms (dynamically) inside BODY.
-
- -- Function: with-editor-set-process-filter process filter
-
- This function is like ‘set-process-filter’ but ensures that adding
- the new FILTER does not remove the ‘with-editor-process-filter’.
- This is done by wrapping the two filter functions using a lambda,
- which becomes the actual filter. It calls
- ‘with-editor-process-filter’ first, passing ‘t’ as
- NO-STANDARD-FILTER. Then it calls FILTER.
-
-
-File: with-editor.info, Node: Debugging, Prev: Using With-Editor as a library, Up: Top
-
-3 Debugging
-***********
-
-With-Editor tries very hard to locate a suitable ‘emacsclient’
-executable, and then sets option ‘with-editor-emacsclient-executable’
-accordingly. In very rare cases this fails. When it does fail, then
-the most likely reason is that someone found yet another way to package
-Emacs (most likely on macOS) without putting the executable on ‘$PATH’,
-and we have to add another kludge to find it anyway.
-
- If you are having problems using ‘with-editor’, e.g. you cannot
-commit in Magit, then please open a new issue at
- and provide information
-about your Emacs installation. Most importantly how did you install
-Emacs and what is the output of ‘M-x with-editor-debug RET’.
-
-
-
-Tag Table:
-Node: Top771
-Node: Using the With-Editor package2533
-Node: Configuring With-Editor3119
-Node: Using With-Editor commands7516
-Node: Using With-Editor as a library10779
-Node: Debugging12474
-
-End Tag Table
-
-
-Local Variables:
-coding: utf-8
-End:
diff --git a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-autoloads.el b/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-autoloads.el
deleted file mode 100644
index b2ea5b4..0000000
--- a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-autoloads.el
+++ /dev/null
@@ -1,19 +0,0 @@
-;;; zenburn-theme-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "zenburn-theme" "zenburn-theme.el" (23124 14373
-;;;;;; 725534 779000))
-;;; Generated autoloads from zenburn-theme.el
-
-(and load-file-name (boundp 'custom-theme-load-path) (add-to-list 'custom-theme-load-path (file-name-as-directory (file-name-directory load-file-name))))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; zenburn-theme-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-pkg.el b/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-pkg.el
deleted file mode 100644
index 8374a98..0000000
--- a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "zenburn-theme" "20171216.1027" "A low contrast color theme for Emacs." 'nil :commit "62d91fd7c054b0747f1309c012976deb471d4608" :url "http://github.com/bbatsov/zenburn-emacs")
diff --git a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme.el b/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme.el
deleted file mode 100644
index 26c3737..0000000
--- a/emacs/.emacs.d/elpa/zenburn-theme-20171216.1027/zenburn-theme.el
+++ /dev/null
@@ -1,1461 +0,0 @@
-;;; zenburn-theme.el --- A low contrast color theme for Emacs.
-
-;; Copyright (C) 2011-2017 Bozhidar Batsov
-
-;; Author: Bozhidar Batsov
-;; URL: http://github.com/bbatsov/zenburn-emacs
-;; Package-Version: 20171216.1027
-;; Version: 2.5
-
-;; 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 .
-
-;;; Commentary:
-
-;; A port of the popular Vim theme Zenburn for Emacs 24+, built on top
-;; of the new built-in theme support in Emacs 24.
-
-;;; Credits:
-
-;; Jani Nurminen created the original theme for vim on which this port
-;; is based.
-
-;;; Code:
-
-(deftheme zenburn "The Zenburn color theme")
-
-;;; Color Palette
-
-(defvar zenburn-default-colors-alist
- '(("zenburn-fg+1" . "#FFFFEF")
- ("zenburn-fg" . "#DCDCCC")
- ("zenburn-fg-1" . "#656555")
- ("zenburn-bg-2" . "#000000")
- ("zenburn-bg-1" . "#2B2B2B")
- ("zenburn-bg-05" . "#383838")
- ("zenburn-bg" . "#3F3F3F")
- ("zenburn-bg+05" . "#494949")
- ("zenburn-bg+1" . "#4F4F4F")
- ("zenburn-bg+2" . "#5F5F5F")
- ("zenburn-bg+3" . "#6F6F6F")
- ("zenburn-red+1" . "#DCA3A3")
- ("zenburn-red" . "#CC9393")
- ("zenburn-red-1" . "#BC8383")
- ("zenburn-red-2" . "#AC7373")
- ("zenburn-red-3" . "#9C6363")
- ("zenburn-red-4" . "#8C5353")
- ("zenburn-orange" . "#DFAF8F")
- ("zenburn-yellow" . "#F0DFAF")
- ("zenburn-yellow-1" . "#E0CF9F")
- ("zenburn-yellow-2" . "#D0BF8F")
- ("zenburn-green-1" . "#5F7F5F")
- ("zenburn-green" . "#7F9F7F")
- ("zenburn-green+1" . "#8FB28F")
- ("zenburn-green+2" . "#9FC59F")
- ("zenburn-green+3" . "#AFD8AF")
- ("zenburn-green+4" . "#BFEBBF")
- ("zenburn-cyan" . "#93E0E3")
- ("zenburn-blue+1" . "#94BFF3")
- ("zenburn-blue" . "#8CD0D3")
- ("zenburn-blue-1" . "#7CB8BB")
- ("zenburn-blue-2" . "#6CA0A3")
- ("zenburn-blue-3" . "#5C888B")
- ("zenburn-blue-4" . "#4C7073")
- ("zenburn-blue-5" . "#366060")
- ("zenburn-magenta" . "#DC8CC3"))
- "List of Zenburn colors.
-Each element has the form (NAME . HEX).
-
-`+N' suffixes indicate a color is lighter.
-`-N' suffixes indicate a color is darker.")
-
-(defvar zenburn-override-colors-alist
- '()
- "Place to override default theme colors.
-
-You can override a subset of the theme's default colors by
-defining them in this alist before loading the theme.")
-
-(defvar zenburn-colors-alist
- (append zenburn-default-colors-alist zenburn-override-colors-alist))
-
-(defmacro zenburn-with-color-variables (&rest body)
- "`let' bind all colors defined in `zenburn-colors-alist' around BODY.
-Also bind `class' to ((class color) (min-colors 89))."
- (declare (indent 0))
- `(let ((class '((class color) (min-colors 89)))
- ,@(mapcar (lambda (cons)
- (list (intern (car cons)) (cdr cons)))
- zenburn-colors-alist))
- ,@body))
-
-;;; Theme Faces
-(zenburn-with-color-variables
- (custom-theme-set-faces
- 'zenburn
-;;;; Built-in
-;;;;; basic coloring
- '(button ((t (:underline t))))
- `(link ((t (:foreground ,zenburn-yellow :underline t :weight bold))))
- `(link-visited ((t (:foreground ,zenburn-yellow-2 :underline t :weight normal))))
- `(default ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))
- `(cursor ((t (:foreground ,zenburn-fg :background ,zenburn-fg+1))))
- `(escape-glyph ((t (:foreground ,zenburn-yellow :weight bold))))
- `(fringe ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
- `(header-line ((t (:foreground ,zenburn-yellow
- :background ,zenburn-bg-1
- :box (:line-width -1 :style released-button)))))
- `(highlight ((t (:background ,zenburn-bg-05))))
- `(success ((t (:foreground ,zenburn-green :weight bold))))
- `(warning ((t (:foreground ,zenburn-orange :weight bold))))
- `(tooltip ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
-;;;;; compilation
- `(compilation-column-face ((t (:foreground ,zenburn-yellow))))
- `(compilation-enter-directory-face ((t (:foreground ,zenburn-green))))
- `(compilation-error-face ((t (:foreground ,zenburn-red-1 :weight bold :underline t))))
- `(compilation-face ((t (:foreground ,zenburn-fg))))
- `(compilation-info-face ((t (:foreground ,zenburn-blue))))
- `(compilation-info ((t (:foreground ,zenburn-green+4 :underline t))))
- `(compilation-leave-directory-face ((t (:foreground ,zenburn-green))))
- `(compilation-line-face ((t (:foreground ,zenburn-yellow))))
- `(compilation-line-number ((t (:foreground ,zenburn-yellow))))
- `(compilation-message-face ((t (:foreground ,zenburn-blue))))
- `(compilation-warning-face ((t (:foreground ,zenburn-orange :weight bold :underline t))))
- `(compilation-mode-line-exit ((t (:foreground ,zenburn-green+2 :weight bold))))
- `(compilation-mode-line-fail ((t (:foreground ,zenburn-red :weight bold))))
- `(compilation-mode-line-run ((t (:foreground ,zenburn-yellow :weight bold))))
-;;;;; completions
- `(completions-annotations ((t (:foreground ,zenburn-fg-1))))
-;;;;; eww
- '(eww-invalid-certificate ((t (:inherit error))))
- '(eww-valid-certificate ((t (:inherit success))))
-;;;;; grep
- `(grep-context-face ((t (:foreground ,zenburn-fg))))
- `(grep-error-face ((t (:foreground ,zenburn-red-1 :weight bold :underline t))))
- `(grep-hit-face ((t (:foreground ,zenburn-blue))))
- `(grep-match-face ((t (:foreground ,zenburn-orange :weight bold))))
- `(match ((t (:background ,zenburn-bg-1 :foreground ,zenburn-orange :weight bold))))
-;;;;; hi-lock
- `(hi-blue ((t (:background ,zenburn-cyan :foreground ,zenburn-bg-1))))
- `(hi-green ((t (:background ,zenburn-green+4 :foreground ,zenburn-bg-1))))
- `(hi-pink ((t (:background ,zenburn-magenta :foreground ,zenburn-bg-1))))
- `(hi-yellow ((t (:background ,zenburn-yellow :foreground ,zenburn-bg-1))))
- `(hi-blue-b ((t (:foreground ,zenburn-blue :weight bold))))
- `(hi-green-b ((t (:foreground ,zenburn-green+2 :weight bold))))
- `(hi-red-b ((t (:foreground ,zenburn-red :weight bold))))
-;;;;; info
- `(Info-quoted ((t (:inherit font-lock-constant-face))))
-;;;;; isearch
- `(isearch ((t (:foreground ,zenburn-yellow-2 :weight bold :background ,zenburn-bg+2))))
- `(isearch-fail ((t (:foreground ,zenburn-fg :background ,zenburn-red-4))))
- `(lazy-highlight ((t (:foreground ,zenburn-yellow-2 :weight bold :background ,zenburn-bg-05))))
-
- `(menu ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))
- `(minibuffer-prompt ((t (:foreground ,zenburn-yellow))))
- `(mode-line
- ((,class (:foreground ,zenburn-green+1
- :background ,zenburn-bg-1
- :box (:line-width -1 :style released-button)))
- (t :inverse-video t)))
- `(mode-line-buffer-id ((t (:foreground ,zenburn-yellow :weight bold))))
- `(mode-line-inactive
- ((t (:foreground ,zenburn-green-1
- :background ,zenburn-bg-05
- :box (:line-width -1 :style released-button)))))
- `(region ((,class (:background ,zenburn-bg-1))
- (t :inverse-video t)))
- `(secondary-selection ((t (:background ,zenburn-bg+2))))
- `(trailing-whitespace ((t (:background ,zenburn-red))))
- `(vertical-border ((t (:foreground ,zenburn-fg))))
-;;;;; font lock
- `(font-lock-builtin-face ((t (:foreground ,zenburn-fg :weight bold))))
- `(font-lock-comment-face ((t (:foreground ,zenburn-green))))
- `(font-lock-comment-delimiter-face ((t (:foreground ,zenburn-green-1))))
- `(font-lock-constant-face ((t (:foreground ,zenburn-green+4))))
- `(font-lock-doc-face ((t (:foreground ,zenburn-green+2))))
- `(font-lock-function-name-face ((t (:foreground ,zenburn-cyan))))
- `(font-lock-keyword-face ((t (:foreground ,zenburn-yellow :weight bold))))
- `(font-lock-negation-char-face ((t (:foreground ,zenburn-yellow :weight bold))))
- `(font-lock-preprocessor-face ((t (:foreground ,zenburn-blue+1))))
- `(font-lock-regexp-grouping-construct ((t (:foreground ,zenburn-yellow :weight bold))))
- `(font-lock-regexp-grouping-backslash ((t (:foreground ,zenburn-green :weight bold))))
- `(font-lock-string-face ((t (:foreground ,zenburn-red))))
- `(font-lock-type-face ((t (:foreground ,zenburn-blue-1))))
- `(font-lock-variable-name-face ((t (:foreground ,zenburn-orange))))
- `(font-lock-warning-face ((t (:foreground ,zenburn-yellow-2 :weight bold))))
-
- `(c-annotation-face ((t (:inherit font-lock-constant-face))))
-;;;;; man
- '(Man-overstrike ((t (:inherit font-lock-keyword-face))))
- '(Man-underline ((t (:inherit (font-lock-string-face underline)))))
-;;;;; newsticker
- `(newsticker-date-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-default-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-enclosure-face ((t (:foreground ,zenburn-green+3))))
- `(newsticker-extra-face ((t (:foreground ,zenburn-bg+2 :height 0.8))))
- `(newsticker-feed-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-immortal-item-face ((t (:foreground ,zenburn-green))))
- `(newsticker-new-item-face ((t (:foreground ,zenburn-blue))))
- `(newsticker-obsolete-item-face ((t (:foreground ,zenburn-red))))
- `(newsticker-old-item-face ((t (:foreground ,zenburn-bg+3))))
- `(newsticker-statistics-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-treeview-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-treeview-immortal-face ((t (:foreground ,zenburn-green))))
- `(newsticker-treeview-listwindow-face ((t (:foreground ,zenburn-fg))))
- `(newsticker-treeview-new-face ((t (:foreground ,zenburn-blue :weight bold))))
- `(newsticker-treeview-obsolete-face ((t (:foreground ,zenburn-red))))
- `(newsticker-treeview-old-face ((t (:foreground ,zenburn-bg+3))))
- `(newsticker-treeview-selection-face ((t (:background ,zenburn-bg-1 :foreground ,zenburn-yellow))))
-;;;;; woman
- '(woman-bold ((t (:inherit font-lock-keyword-face))))
- '(woman-italic ((t (:inherit (font-lock-string-face italic)))))
-;;;; Third-party
-;;;;; ace-jump
- `(ace-jump-face-background
- ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg :inverse-video nil))))
- `(ace-jump-face-foreground
- ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg :inverse-video nil))))
-;;;;; ace-window
- `(aw-background-face
- ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg :inverse-video nil))))
- `(aw-leading-char-face ((t (:inherit aw-mode-line-face))))
-;;;;; android mode
- `(android-mode-debug-face ((t (:foreground ,zenburn-green+1))))
- `(android-mode-error-face ((t (:foreground ,zenburn-orange :weight bold))))
- `(android-mode-info-face ((t (:foreground ,zenburn-fg))))
- `(android-mode-verbose-face ((t (:foreground ,zenburn-green))))
- `(android-mode-warning-face ((t (:foreground ,zenburn-yellow))))
-;;;;; anzu
- `(anzu-mode-line ((t (:foreground ,zenburn-cyan :weight bold))))
- `(anzu-mode-line-no-match ((t (:foreground ,zenburn-red :weight bold))))
- `(anzu-match-1 ((t (:foreground ,zenburn-bg :background ,zenburn-green))))
- `(anzu-match-2 ((t (:foreground ,zenburn-bg :background ,zenburn-orange))))
- `(anzu-match-3 ((t (:foreground ,zenburn-bg :background ,zenburn-blue))))
- `(anzu-replace-to ((t (:inherit anzu-replace-highlight :foreground ,zenburn-yellow))))
-;;;;; auctex
- `(font-latex-bold-face ((t (:inherit bold))))
- `(font-latex-warning-face ((t (:foreground nil :inherit font-lock-warning-face))))
- `(font-latex-sectioning-5-face ((t (:foreground ,zenburn-red :weight bold ))))
- `(font-latex-sedate-face ((t (:foreground ,zenburn-yellow))))
- `(font-latex-italic-face ((t (:foreground ,zenburn-cyan :slant italic))))
- `(font-latex-string-face ((t (:inherit ,font-lock-string-face))))
- `(font-latex-math-face ((t (:foreground ,zenburn-orange))))
- `(font-latex-script-char-face ((t (:foreground ,zenburn-orange))))
-;;;;; agda-mode
- `(agda2-highlight-keyword-face ((t (:foreground ,zenburn-yellow :weight bold))))
- `(agda2-highlight-string-face ((t (:foreground ,zenburn-red))))
- `(agda2-highlight-symbol-face ((t (:foreground ,zenburn-orange))))
- `(agda2-highlight-primitive-type-face ((t (:foreground ,zenburn-blue-1))))
- `(agda2-highlight-inductive-constructor-face ((t (:foreground ,zenburn-fg))))
- `(agda2-highlight-coinductive-constructor-face ((t (:foreground ,zenburn-fg))))
- `(agda2-highlight-datatype-face ((t (:foreground ,zenburn-blue))))
- `(agda2-highlight-function-face ((t (:foreground ,zenburn-blue))))
- `(agda2-highlight-module-face ((t (:foreground ,zenburn-blue-1))))
- `(agda2-highlight-error-face ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(agda2-highlight-unsolved-meta-face ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(agda2-highlight-unsolved-constraint-face ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(agda2-highlight-termination-problem-face ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(agda2-highlight-incomplete-pattern-face ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(agda2-highlight-typechecks-face ((t (:background ,zenburn-red-4))))
-;;;;; auto-complete
- `(ac-candidate-face ((t (:background ,zenburn-bg+3 :foreground ,zenburn-bg-2))))
- `(ac-selection-face ((t (:background ,zenburn-blue-4 :foreground ,zenburn-fg))))
- `(popup-tip-face ((t (:background ,zenburn-yellow-2 :foreground ,zenburn-bg-2))))
- `(popup-menu-mouse-face ((t (:background ,zenburn-yellow-2 :foreground ,zenburn-bg-2))))
- `(popup-summary-face ((t (:background ,zenburn-bg+3 :foreground ,zenburn-bg-2))))
- `(popup-scroll-bar-foreground-face ((t (:background ,zenburn-blue-5))))
- `(popup-scroll-bar-background-face ((t (:background ,zenburn-bg-1))))
- `(popup-isearch-match ((t (:background ,zenburn-bg :foreground ,zenburn-fg))))
-;;;;; avy
- `(avy-background-face
- ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg :inverse-video nil))))
- `(avy-lead-face-0
- ((t (:foreground ,zenburn-green+3 :background ,zenburn-bg :inverse-video nil :weight bold))))
- `(avy-lead-face-1
- ((t (:foreground ,zenburn-yellow :background ,zenburn-bg :inverse-video nil :weight bold))))
- `(avy-lead-face-2
- ((t (:foreground ,zenburn-red+1 :background ,zenburn-bg :inverse-video nil :weight bold))))
- `(avy-lead-face
- ((t (:foreground ,zenburn-cyan :background ,zenburn-bg :inverse-video nil :weight bold))))
-;;;;; company-mode
- `(company-tooltip ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
- `(company-tooltip-annotation ((t (:foreground ,zenburn-orange :background ,zenburn-bg+1))))
- `(company-tooltip-annotation-selection ((t (:foreground ,zenburn-orange :background ,zenburn-bg-1))))
- `(company-tooltip-selection ((t (:foreground ,zenburn-fg :background ,zenburn-bg-1))))
- `(company-tooltip-mouse ((t (:background ,zenburn-bg-1))))
- `(company-tooltip-common ((t (:foreground ,zenburn-green+2))))
- `(company-tooltip-common-selection ((t (:foreground ,zenburn-green+2))))
- `(company-scrollbar-fg ((t (:background ,zenburn-bg-1))))
- `(company-scrollbar-bg ((t (:background ,zenburn-bg+2))))
- `(company-preview ((t (:background ,zenburn-green+2))))
- `(company-preview-common ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg-1))))
-;;;;; bm
- `(bm-face ((t (:background ,zenburn-yellow-1 :foreground ,zenburn-bg))))
- `(bm-fringe-face ((t (:background ,zenburn-yellow-1 :foreground ,zenburn-bg))))
- `(bm-fringe-persistent-face ((t (:background ,zenburn-green-1 :foreground ,zenburn-bg))))
- `(bm-persistent-face ((t (:background ,zenburn-green-1 :foreground ,zenburn-bg))))
-;;;;; calfw
- `(cfw:face-annotation ((t (:foreground ,zenburn-red :inherit cfw:face-day-title))))
- `(cfw:face-day-title ((t nil)))
- `(cfw:face-default-content ((t (:foreground ,zenburn-green))))
- `(cfw:face-default-day ((t (:weight bold))))
- `(cfw:face-disable ((t (:foreground ,zenburn-fg-1))))
- `(cfw:face-grid ((t (:inherit shadow))))
- `(cfw:face-header ((t (:inherit font-lock-keyword-face))))
- `(cfw:face-holiday ((t (:inherit cfw:face-sunday))))
- `(cfw:face-periods ((t (:foreground ,zenburn-cyan))))
- `(cfw:face-saturday ((t (:foreground ,zenburn-blue :weight bold))))
- `(cfw:face-select ((t (:background ,zenburn-blue-5))))
- `(cfw:face-sunday ((t (:foreground ,zenburn-red :weight bold))))
- `(cfw:face-title ((t (:height 2.0 :inherit (variable-pitch font-lock-keyword-face)))))
- `(cfw:face-today ((t (:foreground ,zenburn-cyan :weight bold))))
- `(cfw:face-today-title ((t (:inherit highlight bold))))
- `(cfw:face-toolbar ((t (:background ,zenburn-blue-5))))
- `(cfw:face-toolbar-button-off ((t (:underline nil :inherit link))))
- `(cfw:face-toolbar-button-on ((t (:underline nil :inherit link-visited))))
-;;;;; cider
- `(cider-result-overlay-face ((t (:background unspecified))))
- `(cider-enlightened-face ((t (:box (:color ,zenburn-orange :line-width -1)))))
- `(cider-enlightened-local-face ((t (:weight bold :foreground ,zenburn-green+1))))
- `(cider-deprecated-face ((t (:background ,zenburn-yellow-2))))
- `(cider-instrumented-face ((t (:box (:color ,zenburn-red :line-width -1)))))
- `(cider-traced-face ((t (:box (:color ,zenburn-cyan :line-width -1)))))
- `(cider-test-failure-face ((t (:background ,zenburn-red-4))))
- `(cider-test-error-face ((t (:background ,zenburn-magenta))))
- `(cider-test-success-face ((t (:background ,zenburn-green-1))))
- `(cider-fringe-good-face ((t (:foreground ,zenburn-green+4))))
-;;;;; circe
- `(circe-highlight-nick-face ((t (:foreground ,zenburn-cyan))))
- `(circe-my-message-face ((t (:foreground ,zenburn-fg))))
- `(circe-fool-face ((t (:foreground ,zenburn-red+1))))
- `(circe-topic-diff-removed-face ((t (:foreground ,zenburn-red :weight bold))))
- `(circe-originator-face ((t (:foreground ,zenburn-fg))))
- `(circe-server-face ((t (:foreground ,zenburn-green))))
- `(circe-topic-diff-new-face ((t (:foreground ,zenburn-orange :weight bold))))
- `(circe-prompt-face ((t (:foreground ,zenburn-orange :background ,zenburn-bg :weight bold))))
-;;;;; context-coloring
- `(context-coloring-level-0-face ((t :foreground ,zenburn-fg)))
- `(context-coloring-level-1-face ((t :foreground ,zenburn-cyan)))
- `(context-coloring-level-2-face ((t :foreground ,zenburn-green+4)))
- `(context-coloring-level-3-face ((t :foreground ,zenburn-yellow)))
- `(context-coloring-level-4-face ((t :foreground ,zenburn-orange)))
- `(context-coloring-level-5-face ((t :foreground ,zenburn-magenta)))
- `(context-coloring-level-6-face ((t :foreground ,zenburn-blue+1)))
- `(context-coloring-level-7-face ((t :foreground ,zenburn-green+2)))
- `(context-coloring-level-8-face ((t :foreground ,zenburn-yellow-2)))
- `(context-coloring-level-9-face ((t :foreground ,zenburn-red+1)))
-;;;;; coq
- `(coq-solve-tactics-face ((t (:foreground nil :inherit font-lock-constant-face))))
-;;;;; ctable
- `(ctbl:face-cell-select ((t (:background ,zenburn-blue :foreground ,zenburn-bg))))
- `(ctbl:face-continue-bar ((t (:background ,zenburn-bg-05 :foreground ,zenburn-bg))))
- `(ctbl:face-row-select ((t (:background ,zenburn-cyan :foreground ,zenburn-bg))))
-;;;;; debbugs
- `(debbugs-gnu-done ((t (:foreground ,zenburn-fg-1))))
- `(debbugs-gnu-handled ((t (:foreground ,zenburn-green))))
- `(debbugs-gnu-new ((t (:foreground ,zenburn-red))))
- `(debbugs-gnu-pending ((t (:foreground ,zenburn-blue))))
- `(debbugs-gnu-stale ((t (:foreground ,zenburn-orange))))
- `(debbugs-gnu-tagged ((t (:foreground ,zenburn-red))))
-;;;;; diff
- `(diff-added ((t (:background "#335533" :foreground ,zenburn-green))))
- `(diff-changed ((t (:background "#555511" :foreground ,zenburn-yellow-1))))
- `(diff-removed ((t (:background "#553333" :foreground ,zenburn-red-2))))
- `(diff-refine-added ((t (:background "#338833" :foreground ,zenburn-green+4))))
- `(diff-refine-change ((t (:background "#888811" :foreground ,zenburn-yellow))))
- `(diff-refine-removed ((t (:background "#883333" :foreground ,zenburn-red))))
- `(diff-header ((,class (:background ,zenburn-bg+2))
- (t (:background ,zenburn-fg :foreground ,zenburn-bg))))
- `(diff-file-header
- ((,class (:background ,zenburn-bg+2 :foreground ,zenburn-fg :weight bold))
- (t (:background ,zenburn-fg :foreground ,zenburn-bg :weight bold))))
-;;;;; diff-hl
- `(diff-hl-change ((,class (:foreground ,zenburn-blue :background ,zenburn-blue-2))))
- `(diff-hl-delete ((,class (:foreground ,zenburn-red+1 :background ,zenburn-red-1))))
- `(diff-hl-insert ((,class (:foreground ,zenburn-green+1 :background ,zenburn-green-1))))
-;;;;; dim-autoload
- `(dim-autoload-cookie-line ((t :foreground ,zenburn-bg+1)))
-;;;;; dired+
- `(diredp-display-msg ((t (:foreground ,zenburn-blue))))
- `(diredp-compressed-file-suffix ((t (:foreground ,zenburn-orange))))
- `(diredp-date-time ((t (:foreground ,zenburn-magenta))))
- `(diredp-deletion ((t (:foreground ,zenburn-yellow))))
- `(diredp-deletion-file-name ((t (:foreground ,zenburn-red))))
- `(diredp-dir-heading ((t (:foreground ,zenburn-blue :background ,zenburn-bg-1))))
- `(diredp-dir-priv ((t (:foreground ,zenburn-cyan))))
- `(diredp-exec-priv ((t (:foreground ,zenburn-red))))
- `(diredp-executable-tag ((t (:foreground ,zenburn-green+1))))
- `(diredp-file-name ((t (:foreground ,zenburn-blue))))
- `(diredp-file-suffix ((t (:foreground ,zenburn-green))))
- `(diredp-flag-mark ((t (:foreground ,zenburn-yellow))))
- `(diredp-flag-mark-line ((t (:foreground ,zenburn-orange))))
- `(diredp-ignored-file-name ((t (:foreground ,zenburn-red))))
- `(diredp-link-priv ((t (:foreground ,zenburn-yellow))))
- `(diredp-mode-line-flagged ((t (:foreground ,zenburn-yellow))))
- `(diredp-mode-line-marked ((t (:foreground ,zenburn-orange))))
- `(diredp-no-priv ((t (:foreground ,zenburn-fg))))
- `(diredp-number ((t (:foreground ,zenburn-green+1))))
- `(diredp-other-priv ((t (:foreground ,zenburn-yellow-1))))
- `(diredp-rare-priv ((t (:foreground ,zenburn-red-1))))
- `(diredp-read-priv ((t (:foreground ,zenburn-green-1))))
- `(diredp-symlink ((t (:foreground ,zenburn-yellow))))
- `(diredp-write-priv ((t (:foreground ,zenburn-magenta))))
-;;;;; dired-async
- `(dired-async-failures ((t (:foreground ,zenburn-red :weight bold))))
- `(dired-async-message ((t (:foreground ,zenburn-yellow :weight bold))))
- `(dired-async-mode-message ((t (:foreground ,zenburn-yellow))))
-;;;;; ediff
- `(ediff-current-diff-A ((t (:foreground ,zenburn-fg :background ,zenburn-red-4))))
- `(ediff-current-diff-Ancestor ((t (:foreground ,zenburn-fg :background ,zenburn-red-4))))
- `(ediff-current-diff-B ((t (:foreground ,zenburn-fg :background ,zenburn-green-1))))
- `(ediff-current-diff-C ((t (:foreground ,zenburn-fg :background ,zenburn-blue-5))))
- `(ediff-even-diff-A ((t (:background ,zenburn-bg+1))))
- `(ediff-even-diff-Ancestor ((t (:background ,zenburn-bg+1))))
- `(ediff-even-diff-B ((t (:background ,zenburn-bg+1))))
- `(ediff-even-diff-C ((t (:background ,zenburn-bg+1))))
- `(ediff-fine-diff-A ((t (:foreground ,zenburn-fg :background ,zenburn-red-2 :weight bold))))
- `(ediff-fine-diff-Ancestor ((t (:foreground ,zenburn-fg :background ,zenburn-red-2 weight bold))))
- `(ediff-fine-diff-B ((t (:foreground ,zenburn-fg :background ,zenburn-green :weight bold))))
- `(ediff-fine-diff-C ((t (:foreground ,zenburn-fg :background ,zenburn-blue-3 :weight bold ))))
- `(ediff-odd-diff-A ((t (:background ,zenburn-bg+2))))
- `(ediff-odd-diff-Ancestor ((t (:background ,zenburn-bg+2))))
- `(ediff-odd-diff-B ((t (:background ,zenburn-bg+2))))
- `(ediff-odd-diff-C ((t (:background ,zenburn-bg+2))))
-;;;;; egg
- `(egg-text-base ((t (:foreground ,zenburn-fg))))
- `(egg-help-header-1 ((t (:foreground ,zenburn-yellow))))
- `(egg-help-header-2 ((t (:foreground ,zenburn-green+3))))
- `(egg-branch ((t (:foreground ,zenburn-yellow))))
- `(egg-branch-mono ((t (:foreground ,zenburn-yellow))))
- `(egg-term ((t (:foreground ,zenburn-yellow))))
- `(egg-diff-add ((t (:foreground ,zenburn-green+4))))
- `(egg-diff-del ((t (:foreground ,zenburn-red+1))))
- `(egg-diff-file-header ((t (:foreground ,zenburn-yellow-2))))
- `(egg-section-title ((t (:foreground ,zenburn-yellow))))
- `(egg-stash-mono ((t (:foreground ,zenburn-green+4))))
-;;;;; elfeed
- `(elfeed-log-error-level-face ((t (:foreground ,zenburn-red))))
- `(elfeed-log-info-level-face ((t (:foreground ,zenburn-blue))))
- `(elfeed-log-warn-level-face ((t (:foreground ,zenburn-yellow))))
- `(elfeed-search-date-face ((t (:foreground ,zenburn-yellow-1 :underline t
- :weight bold))))
- `(elfeed-search-tag-face ((t (:foreground ,zenburn-green))))
- `(elfeed-search-feed-face ((t (:foreground ,zenburn-cyan))))
-;;;;; emacs-w3m
- `(w3m-anchor ((t (:foreground ,zenburn-yellow :underline t
- :weight bold))))
- `(w3m-arrived-anchor ((t (:foreground ,zenburn-yellow-2
- :underline t :weight normal))))
- `(w3m-form ((t (:foreground ,zenburn-red-1 :underline t))))
- `(w3m-header-line-location-title ((t (:foreground ,zenburn-yellow
- :underline t :weight bold))))
- '(w3m-history-current-url ((t (:inherit match))))
- `(w3m-lnum ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
- `(w3m-lnum-match ((t (:background ,zenburn-bg-1
- :foreground ,zenburn-orange
- :weight bold))))
- `(w3m-lnum-minibuffer-prompt ((t (:foreground ,zenburn-yellow))))
-;;;;; erc
- `(erc-action-face ((t (:inherit erc-default-face))))
- `(erc-bold-face ((t (:weight bold))))
- `(erc-current-nick-face ((t (:foreground ,zenburn-blue :weight bold))))
- `(erc-dangerous-host-face ((t (:inherit font-lock-warning-face))))
- `(erc-default-face ((t (:foreground ,zenburn-fg))))
- `(erc-direct-msg-face ((t (:inherit erc-default-face))))
- `(erc-error-face ((t (:inherit font-lock-warning-face))))
- `(erc-fool-face ((t (:inherit erc-default-face))))
- `(erc-highlight-face ((t (:inherit hover-highlight))))
- `(erc-input-face ((t (:foreground ,zenburn-yellow))))
- `(erc-keyword-face ((t (:foreground ,zenburn-blue :weight bold))))
- `(erc-nick-default-face ((t (:foreground ,zenburn-yellow :weight bold))))
- `(erc-my-nick-face ((t (:foreground ,zenburn-red :weight bold))))
- `(erc-nick-msg-face ((t (:inherit erc-default-face))))
- `(erc-notice-face ((t (:foreground ,zenburn-green))))
- `(erc-pal-face ((t (:foreground ,zenburn-orange :weight bold))))
- `(erc-prompt-face ((t (:foreground ,zenburn-orange :background ,zenburn-bg :weight bold))))
- `(erc-timestamp-face ((t (:foreground ,zenburn-green+4))))
- `(erc-underline-face ((t (:underline t))))
-;;;;; eros
- `(eros-result-overlay-face ((t (:background unspecified))))
-;;;;; ert
- `(ert-test-result-expected ((t (:foreground ,zenburn-green+4 :background ,zenburn-bg))))
- `(ert-test-result-unexpected ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
-;;;;; eshell
- `(eshell-prompt ((t (:foreground ,zenburn-yellow :weight bold))))
- `(eshell-ls-archive ((t (:foreground ,zenburn-red-1 :weight bold))))
- `(eshell-ls-backup ((t (:inherit font-lock-comment-face))))
- `(eshell-ls-clutter ((t (:inherit font-lock-comment-face))))
- `(eshell-ls-directory ((t (:foreground ,zenburn-blue+1 :weight bold))))
- `(eshell-ls-executable ((t (:foreground ,zenburn-red+1 :weight bold))))
- `(eshell-ls-unreadable ((t (:foreground ,zenburn-fg))))
- `(eshell-ls-missing ((t (:inherit font-lock-warning-face))))
- `(eshell-ls-product ((t (:inherit font-lock-doc-face))))
- `(eshell-ls-special ((t (:foreground ,zenburn-yellow :weight bold))))
- `(eshell-ls-symlink ((t (:foreground ,zenburn-cyan :weight bold))))
-;;;;; flx
- `(flx-highlight-face ((t (:foreground ,zenburn-green+2 :weight bold))))
-;;;;; flycheck
- `(flycheck-error
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-red-1) :inherit unspecified))
- (t (:foreground ,zenburn-red-1 :weight bold :underline t))))
- `(flycheck-warning
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-yellow) :inherit unspecified))
- (t (:foreground ,zenburn-yellow :weight bold :underline t))))
- `(flycheck-info
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-cyan) :inherit unspecified))
- (t (:foreground ,zenburn-cyan :weight bold :underline t))))
- `(flycheck-fringe-error ((t (:foreground ,zenburn-red-1 :weight bold))))
- `(flycheck-fringe-warning ((t (:foreground ,zenburn-yellow :weight bold))))
- `(flycheck-fringe-info ((t (:foreground ,zenburn-cyan :weight bold))))
-;;;;; flymake
- `(flymake-errline
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-red)
- :inherit unspecified :foreground unspecified :background unspecified))
- (t (:foreground ,zenburn-red-1 :weight bold :underline t))))
- `(flymake-warnline
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-orange)
- :inherit unspecified :foreground unspecified :background unspecified))
- (t (:foreground ,zenburn-orange :weight bold :underline t))))
- `(flymake-infoline
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-green)
- :inherit unspecified :foreground unspecified :background unspecified))
- (t (:foreground ,zenburn-green-1 :weight bold :underline t))))
-;;;;; flyspell
- `(flyspell-duplicate
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-orange) :inherit unspecified))
- (t (:foreground ,zenburn-orange :weight bold :underline t))))
- `(flyspell-incorrect
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-red) :inherit unspecified))
- (t (:foreground ,zenburn-red-1 :weight bold :underline t))))
-;;;;; full-ack
- `(ack-separator ((t (:foreground ,zenburn-fg))))
- `(ack-file ((t (:foreground ,zenburn-blue))))
- `(ack-line ((t (:foreground ,zenburn-yellow))))
- `(ack-match ((t (:foreground ,zenburn-orange :background ,zenburn-bg-1 :weight bold))))
-;;;;; git-annex
- '(git-annex-dired-annexed-available ((t (:inherit success :weight normal))))
- '(git-annex-dired-annexed-unavailable ((t (:inherit error :weight normal))))
-;;;;; git-commit
- `(git-commit-comment-action ((,class (:foreground ,zenburn-green+1 :weight bold))))
- `(git-commit-comment-branch ((,class (:foreground ,zenburn-blue+1 :weight bold)))) ; obsolete
- `(git-commit-comment-branch-local ((,class (:foreground ,zenburn-blue+1 :weight bold))))
- `(git-commit-comment-branch-remote ((,class (:foreground ,zenburn-green :weight bold))))
- `(git-commit-comment-heading ((,class (:foreground ,zenburn-yellow :weight bold))))
-;;;;; git-gutter
- `(git-gutter:added ((t (:foreground ,zenburn-green :weight bold :inverse-video t))))
- `(git-gutter:deleted ((t (:foreground ,zenburn-red :weight bold :inverse-video t))))
- `(git-gutter:modified ((t (:foreground ,zenburn-magenta :weight bold :inverse-video t))))
- `(git-gutter:unchanged ((t (:foreground ,zenburn-fg :weight bold :inverse-video t))))
-;;;;; git-gutter-fr
- `(git-gutter-fr:added ((t (:foreground ,zenburn-green :weight bold))))
- `(git-gutter-fr:deleted ((t (:foreground ,zenburn-red :weight bold))))
- `(git-gutter-fr:modified ((t (:foreground ,zenburn-magenta :weight bold))))
-;;;;; git-rebase
- `(git-rebase-hash ((t (:foreground, zenburn-orange))))
-;;;;; gnus
- `(gnus-group-mail-1 ((t (:weight bold :inherit gnus-group-mail-1-empty))))
- `(gnus-group-mail-1-empty ((t (:inherit gnus-group-news-1-empty))))
- `(gnus-group-mail-2 ((t (:weight bold :inherit gnus-group-mail-2-empty))))
- `(gnus-group-mail-2-empty ((t (:inherit gnus-group-news-2-empty))))
- `(gnus-group-mail-3 ((t (:weight bold :inherit gnus-group-mail-3-empty))))
- `(gnus-group-mail-3-empty ((t (:inherit gnus-group-news-3-empty))))
- `(gnus-group-mail-4 ((t (:weight bold :inherit gnus-group-mail-4-empty))))
- `(gnus-group-mail-4-empty ((t (:inherit gnus-group-news-4-empty))))
- `(gnus-group-mail-5 ((t (:weight bold :inherit gnus-group-mail-5-empty))))
- `(gnus-group-mail-5-empty ((t (:inherit gnus-group-news-5-empty))))
- `(gnus-group-mail-6 ((t (:weight bold :inherit gnus-group-mail-6-empty))))
- `(gnus-group-mail-6-empty ((t (:inherit gnus-group-news-6-empty))))
- `(gnus-group-mail-low ((t (:weight bold :inherit gnus-group-mail-low-empty))))
- `(gnus-group-mail-low-empty ((t (:inherit gnus-group-news-low-empty))))
- `(gnus-group-news-1 ((t (:weight bold :inherit gnus-group-news-1-empty))))
- `(gnus-group-news-2 ((t (:weight bold :inherit gnus-group-news-2-empty))))
- `(gnus-group-news-3 ((t (:weight bold :inherit gnus-group-news-3-empty))))
- `(gnus-group-news-4 ((t (:weight bold :inherit gnus-group-news-4-empty))))
- `(gnus-group-news-5 ((t (:weight bold :inherit gnus-group-news-5-empty))))
- `(gnus-group-news-6 ((t (:weight bold :inherit gnus-group-news-6-empty))))
- `(gnus-group-news-low ((t (:weight bold :inherit gnus-group-news-low-empty))))
- `(gnus-header-content ((t (:inherit message-header-other))))
- `(gnus-header-from ((t (:inherit message-header-to))))
- `(gnus-header-name ((t (:inherit message-header-name))))
- `(gnus-header-newsgroups ((t (:inherit message-header-other))))
- `(gnus-header-subject ((t (:inherit message-header-subject))))
- `(gnus-server-opened ((t (:foreground ,zenburn-green+2 :weight bold))))
- `(gnus-server-denied ((t (:foreground ,zenburn-red+1 :weight bold))))
- `(gnus-server-closed ((t (:foreground ,zenburn-blue :slant italic))))
- `(gnus-server-offline ((t (:foreground ,zenburn-yellow :weight bold))))
- `(gnus-server-agent ((t (:foreground ,zenburn-blue :weight bold))))
- `(gnus-summary-cancelled ((t (:foreground ,zenburn-orange))))
- `(gnus-summary-high-ancient ((t (:foreground ,zenburn-blue))))
- `(gnus-summary-high-read ((t (:foreground ,zenburn-green :weight bold))))
- `(gnus-summary-high-ticked ((t (:foreground ,zenburn-orange :weight bold))))
- `(gnus-summary-high-unread ((t (:foreground ,zenburn-fg :weight bold))))
- `(gnus-summary-low-ancient ((t (:foreground ,zenburn-blue))))
- `(gnus-summary-low-read ((t (:foreground ,zenburn-green))))
- `(gnus-summary-low-ticked ((t (:foreground ,zenburn-orange :weight bold))))
- `(gnus-summary-low-unread ((t (:foreground ,zenburn-fg))))
- `(gnus-summary-normal-ancient ((t (:foreground ,zenburn-blue))))
- `(gnus-summary-normal-read ((t (:foreground ,zenburn-green))))
- `(gnus-summary-normal-ticked ((t (:foreground ,zenburn-orange :weight bold))))
- `(gnus-summary-normal-unread ((t (:foreground ,zenburn-fg))))
- `(gnus-summary-selected ((t (:foreground ,zenburn-yellow :weight bold))))
- `(gnus-cite-1 ((t (:foreground ,zenburn-blue))))
- `(gnus-cite-10 ((t (:foreground ,zenburn-yellow-1))))
- `(gnus-cite-11 ((t (:foreground ,zenburn-yellow))))
- `(gnus-cite-2 ((t (:foreground ,zenburn-blue-1))))
- `(gnus-cite-3 ((t (:foreground ,zenburn-blue-2))))
- `(gnus-cite-4 ((t (:foreground ,zenburn-green+2))))
- `(gnus-cite-5 ((t (:foreground ,zenburn-green+1))))
- `(gnus-cite-6 ((t (:foreground ,zenburn-green))))
- `(gnus-cite-7 ((t (:foreground ,zenburn-red))))
- `(gnus-cite-8 ((t (:foreground ,zenburn-red-1))))
- `(gnus-cite-9 ((t (:foreground ,zenburn-red-2))))
- `(gnus-group-news-1-empty ((t (:foreground ,zenburn-yellow))))
- `(gnus-group-news-2-empty ((t (:foreground ,zenburn-green+3))))
- `(gnus-group-news-3-empty ((t (:foreground ,zenburn-green+1))))
- `(gnus-group-news-4-empty ((t (:foreground ,zenburn-blue-2))))
- `(gnus-group-news-5-empty ((t (:foreground ,zenburn-blue-3))))
- `(gnus-group-news-6-empty ((t (:foreground ,zenburn-bg+2))))
- `(gnus-group-news-low-empty ((t (:foreground ,zenburn-bg+2))))
- `(gnus-signature ((t (:foreground ,zenburn-yellow))))
- `(gnus-x ((t (:background ,zenburn-fg :foreground ,zenburn-bg))))
- `(mm-uu-extract ((t (:background ,zenburn-bg-05 :foreground ,zenburn-green+1))))
-;;;;; go-guru
- `(go-guru-hl-identifier-face ((t (:foreground ,zenburn-bg-1 :background ,zenburn-green+1))))
-;;;;; guide-key
- `(guide-key/highlight-command-face ((t (:foreground ,zenburn-blue))))
- `(guide-key/key-face ((t (:foreground ,zenburn-green))))
- `(guide-key/prefix-command-face ((t (:foreground ,zenburn-green+1))))
-;;;;; hackernews
- '(hackernews-comment-count ((t (:inherit link-visited :underline nil))))
- '(hackernews-link ((t (:inherit link :underline nil))))
-;;;;; helm
- `(helm-header
- ((t (:foreground ,zenburn-green
- :background ,zenburn-bg
- :underline nil
- :box nil))))
- `(helm-source-header
- ((t (:foreground ,zenburn-yellow
- :background ,zenburn-bg-1
- :underline nil
- :weight bold
- :box (:line-width -1 :style released-button)))))
- `(helm-selection ((t (:background ,zenburn-bg+1 :underline nil))))
- `(helm-selection-line ((t (:background ,zenburn-bg+1))))
- `(helm-visible-mark ((t (:foreground ,zenburn-bg :background ,zenburn-yellow-2))))
- `(helm-candidate-number ((t (:foreground ,zenburn-green+4 :background ,zenburn-bg-1))))
- `(helm-separator ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
- `(helm-time-zone-current ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
- `(helm-time-zone-home ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
- `(helm-bookmark-addressbook ((t (:foreground ,zenburn-orange :background ,zenburn-bg))))
- `(helm-bookmark-directory ((t (:foreground nil :background nil :inherit helm-ff-directory))))
- `(helm-bookmark-file ((t (:foreground nil :background nil :inherit helm-ff-file))))
- `(helm-bookmark-gnus ((t (:foreground ,zenburn-magenta :background ,zenburn-bg))))
- `(helm-bookmark-info ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
- `(helm-bookmark-man ((t (:foreground ,zenburn-yellow :background ,zenburn-bg))))
- `(helm-bookmark-w3m ((t (:foreground ,zenburn-magenta :background ,zenburn-bg))))
- `(helm-buffer-not-saved ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
- `(helm-buffer-process ((t (:foreground ,zenburn-cyan :background ,zenburn-bg))))
- `(helm-buffer-saved-out ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))
- `(helm-buffer-size ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg))))
- `(helm-ff-directory ((t (:foreground ,zenburn-cyan :background ,zenburn-bg :weight bold))))
- `(helm-ff-file ((t (:foreground ,zenburn-fg :background ,zenburn-bg :weight normal))))
- `(helm-ff-executable ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg :weight normal))))
- `(helm-ff-invalid-symlink ((t (:foreground ,zenburn-red :background ,zenburn-bg :weight bold))))
- `(helm-ff-symlink ((t (:foreground ,zenburn-yellow :background ,zenburn-bg :weight bold))))
- `(helm-ff-prefix ((t (:foreground ,zenburn-bg :background ,zenburn-yellow :weight normal))))
- `(helm-grep-cmd-line ((t (:foreground ,zenburn-cyan :background ,zenburn-bg))))
- `(helm-grep-file ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))
- `(helm-grep-finish ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
- `(helm-grep-lineno ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg))))
- `(helm-grep-match ((t (:foreground nil :background nil :inherit helm-match))))
- `(helm-grep-running ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
- `(helm-match ((t (:foreground ,zenburn-orange :background ,zenburn-bg-1 :weight bold))))
- `(helm-moccur-buffer ((t (:foreground ,zenburn-cyan :background ,zenburn-bg))))
- `(helm-mu-contacts-address-face ((t (:foreground ,zenburn-fg-1 :background ,zenburn-bg))))
- `(helm-mu-contacts-name-face ((t (:foreground ,zenburn-fg :background ,zenburn-bg))))
-;;;;; helm-swoop
- `(helm-swoop-target-line-face ((t (:foreground ,zenburn-fg :background ,zenburn-bg+1))))
- `(helm-swoop-target-word-face ((t (:foreground ,zenburn-yellow :background ,zenburn-bg+2 :weight bold))))
-;;;;; hl-line-mode
- `(hl-line-face ((,class (:background ,zenburn-bg-05))
- (t :weight bold)))
- `(hl-line ((,class (:background ,zenburn-bg-05)) ; old emacsen
- (t :weight bold)))
-;;;;; hl-sexp
- `(hl-sexp-face ((,class (:background ,zenburn-bg+1))
- (t :weight bold)))
-;;;;; hydra
- `(hydra-face-red ((t (:foreground ,zenburn-red-1 :background ,zenburn-bg))))
- `(hydra-face-amaranth ((t (:foreground ,zenburn-red-3 :background ,zenburn-bg))))
- `(hydra-face-blue ((t (:foreground ,zenburn-blue :background ,zenburn-bg))))
- `(hydra-face-pink ((t (:foreground ,zenburn-magenta :background ,zenburn-bg))))
- `(hydra-face-teal ((t (:foreground ,zenburn-cyan :background ,zenburn-bg))))
-;;;;; info+
- `(info-command-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-orange))))
- `(info-constant-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-magenta))))
- `(info-double-quoted-name ((t (:inherit font-lock-comment-face))))
- `(info-file ((t (:background ,zenburn-bg-1 :foreground ,zenburn-yellow))))
- `(info-function-ref-item ((t (:background ,zenburn-bg-1 :inherit font-lock-function-name-face))))
- `(info-macro-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-yellow))))
- `(info-menu ((t (:foreground ,zenburn-yellow))))
- `(info-quoted-name ((t (:inherit font-lock-constant-face))))
- `(info-reference-item ((t (:background ,zenburn-bg-1))))
- `(info-single-quote ((t (:inherit font-lock-keyword-face))))
- `(info-special-form-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-yellow))))
- `(info-string ((t (:inherit font-lock-string-face))))
- `(info-syntax-class-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-blue+1))))
- `(info-user-option-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-red))))
- `(info-variable-ref-item ((t (:background ,zenburn-bg-1 :foreground ,zenburn-orange))))
-;;;;; irfc
- `(irfc-head-name-face ((t (:foreground ,zenburn-red :weight bold))))
- `(irfc-head-number-face ((t (:foreground ,zenburn-red :weight bold))))
- `(irfc-reference-face ((t (:foreground ,zenburn-blue-1 :weight bold))))
- `(irfc-requirement-keyword-face ((t (:inherit font-lock-keyword-face))))
- `(irfc-rfc-link-face ((t (:inherit link))))
- `(irfc-rfc-number-face ((t (:foreground ,zenburn-cyan :weight bold))))
- `(irfc-std-number-face ((t (:foreground ,zenburn-green+4 :weight bold))))
- `(irfc-table-item-face ((t (:foreground ,zenburn-green+3))))
- `(irfc-title-face ((t (:foreground ,zenburn-yellow
- :underline t :weight bold))))
-;;;;; ivy
- `(ivy-confirm-face ((t (:foreground ,zenburn-green :background ,zenburn-bg))))
- `(ivy-current-match ((t (:foreground ,zenburn-yellow :weight bold :underline t))))
- `(ivy-cursor ((t (:foreground ,zenburn-bg :background ,zenburn-fg))))
- `(ivy-match-required-face ((t (:foreground ,zenburn-red :background ,zenburn-bg))))
- `(ivy-minibuffer-match-face-1 ((t (:background ,zenburn-bg+1))))
- `(ivy-minibuffer-match-face-2 ((t (:background ,zenburn-green-1))))
- `(ivy-minibuffer-match-face-3 ((t (:background ,zenburn-green))))
- `(ivy-minibuffer-match-face-4 ((t (:background ,zenburn-green+1))))
- `(ivy-remote ((t (:foreground ,zenburn-blue :background ,zenburn-bg))))
- `(ivy-subdir ((t (:foreground ,zenburn-yellow :background ,zenburn-bg))))
-;;;;; ido-mode
- `(ido-first-match ((t (:foreground ,zenburn-yellow :weight bold))))
- `(ido-only-match ((t (:foreground ,zenburn-orange :weight bold))))
- `(ido-subdir ((t (:foreground ,zenburn-yellow))))
- `(ido-indicator ((t (:foreground ,zenburn-yellow :background ,zenburn-red-4))))
-;;;;; iedit-mode
- `(iedit-occurrence ((t (:background ,zenburn-bg+2 :weight bold))))
-;;;;; jabber-mode
- `(jabber-roster-user-away ((t (:foreground ,zenburn-green+2))))
- `(jabber-roster-user-online ((t (:foreground ,zenburn-blue-1))))
- `(jabber-roster-user-dnd ((t (:foreground ,zenburn-red+1))))
- `(jabber-roster-user-xa ((t (:foreground ,zenburn-magenta))))
- `(jabber-roster-user-chatty ((t (:foreground ,zenburn-orange))))
- `(jabber-roster-user-error ((t (:foreground ,zenburn-red+1))))
- `(jabber-rare-time-face ((t (:foreground ,zenburn-green+1))))
- `(jabber-chat-prompt-local ((t (:foreground ,zenburn-blue-1))))
- `(jabber-chat-prompt-foreign ((t (:foreground ,zenburn-red+1))))
- `(jabber-chat-prompt-system ((t (:foreground ,zenburn-green+3))))
- `(jabber-activity-face((t (:foreground ,zenburn-red+1))))
- `(jabber-activity-personal-face ((t (:foreground ,zenburn-blue+1))))
- `(jabber-title-small ((t (:height 1.1 :weight bold))))
- `(jabber-title-medium ((t (:height 1.2 :weight bold))))
- `(jabber-title-large ((t (:height 1.3 :weight bold))))
-;;;;; js2-mode
- `(js2-warning ((t (:underline ,zenburn-orange))))
- `(js2-error ((t (:foreground ,zenburn-red :weight bold))))
- `(js2-jsdoc-tag ((t (:foreground ,zenburn-green-1))))
- `(js2-jsdoc-type ((t (:foreground ,zenburn-green+2))))
- `(js2-jsdoc-value ((t (:foreground ,zenburn-green+3))))
- `(js2-function-param ((t (:foreground, zenburn-orange))))
- `(js2-external-variable ((t (:foreground ,zenburn-orange))))
-;;;;; additional js2 mode attributes for better syntax highlighting
- `(js2-instance-member ((t (:foreground ,zenburn-green-1))))
- `(js2-jsdoc-html-tag-delimiter ((t (:foreground ,zenburn-orange))))
- `(js2-jsdoc-html-tag-name ((t (:foreground ,zenburn-red-1))))
- `(js2-object-property ((t (:foreground ,zenburn-blue+1))))
- `(js2-magic-paren ((t (:foreground ,zenburn-blue-5))))
- `(js2-private-function-call ((t (:foreground ,zenburn-cyan))))
- `(js2-function-call ((t (:foreground ,zenburn-cyan))))
- `(js2-private-member ((t (:foreground ,zenburn-blue-1))))
- `(js2-keywords ((t (:foreground ,zenburn-magenta))))
-;;;;; ledger-mode
- `(ledger-font-payee-uncleared-face ((t (:foreground ,zenburn-red-1 :weight bold))))
- `(ledger-font-payee-cleared-face ((t (:foreground ,zenburn-fg :weight normal))))
- `(ledger-font-payee-pending-face ((t (:foreground ,zenburn-red :weight normal))))
- `(ledger-font-xact-highlight-face ((t (:background ,zenburn-bg+1))))
- `(ledger-font-auto-xact-face ((t (:foreground ,zenburn-yellow-1 :weight normal))))
- `(ledger-font-periodic-xact-face ((t (:foreground ,zenburn-green :weight normal))))
- `(ledger-font-pending-face ((t (:foreground ,zenburn-orange weight: normal))))
- `(ledger-font-other-face ((t (:foreground ,zenburn-fg))))
- `(ledger-font-posting-date-face ((t (:foreground ,zenburn-orange :weight normal))))
- `(ledger-font-posting-account-face ((t (:foreground ,zenburn-blue-1))))
- `(ledger-font-posting-account-cleared-face ((t (:foreground ,zenburn-fg))))
- `(ledger-font-posting-account-pending-face ((t (:foreground ,zenburn-orange))))
- `(ledger-font-posting-amount-face ((t (:foreground ,zenburn-orange))))
- `(ledger-occur-narrowed-face ((t (:foreground ,zenburn-fg-1 :invisible t))))
- `(ledger-occur-xact-face ((t (:background ,zenburn-bg+1))))
- `(ledger-font-comment-face ((t (:foreground ,zenburn-green))))
- `(ledger-font-reconciler-uncleared-face ((t (:foreground ,zenburn-red-1 :weight bold))))
- `(ledger-font-reconciler-cleared-face ((t (:foreground ,zenburn-fg :weight normal))))
- `(ledger-font-reconciler-pending-face ((t (:foreground ,zenburn-orange :weight normal))))
- `(ledger-font-report-clickable-face ((t (:foreground ,zenburn-orange :weight normal))))
-;;;;; linum-mode
- `(linum ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
-;;;;; lispy
- `(lispy-command-name-face ((t (:background ,zenburn-bg-05 :inherit font-lock-function-name-face))))
- `(lispy-cursor-face ((t (:foreground ,zenburn-bg :background ,zenburn-fg))))
- `(lispy-face-hint ((t (:inherit highlight :foreground ,zenburn-yellow))))
-;;;;; ruler-mode
- `(ruler-mode-column-number ((t (:inherit 'ruler-mode-default :foreground ,zenburn-fg))))
- `(ruler-mode-fill-column ((t (:inherit 'ruler-mode-default :foreground ,zenburn-yellow))))
- `(ruler-mode-goal-column ((t (:inherit 'ruler-mode-fill-column))))
- `(ruler-mode-comment-column ((t (:inherit 'ruler-mode-fill-column))))
- `(ruler-mode-tab-stop ((t (:inherit 'ruler-mode-fill-column))))
- `(ruler-mode-current-column ((t (:foreground ,zenburn-yellow :box t))))
- `(ruler-mode-default ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
-
-;;;;; lui
- `(lui-time-stamp-face ((t (:foreground ,zenburn-blue-1))))
- `(lui-hilight-face ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg))))
- `(lui-button-face ((t (:inherit hover-highlight))))
-;;;;; macrostep
- `(macrostep-gensym-1
- ((t (:foreground ,zenburn-green+2 :background ,zenburn-bg-1))))
- `(macrostep-gensym-2
- ((t (:foreground ,zenburn-red+1 :background ,zenburn-bg-1))))
- `(macrostep-gensym-3
- ((t (:foreground ,zenburn-blue+1 :background ,zenburn-bg-1))))
- `(macrostep-gensym-4
- ((t (:foreground ,zenburn-magenta :background ,zenburn-bg-1))))
- `(macrostep-gensym-5
- ((t (:foreground ,zenburn-yellow :background ,zenburn-bg-1))))
- `(macrostep-expansion-highlight-face
- ((t (:inherit highlight))))
- `(macrostep-macro-face
- ((t (:underline t))))
-;;;;; magit
-;;;;;; headings and diffs
- `(magit-section-highlight ((t (:background ,zenburn-bg+05))))
- `(magit-section-heading ((t (:foreground ,zenburn-yellow :weight bold))))
- `(magit-section-heading-selection ((t (:foreground ,zenburn-orange :weight bold))))
- `(magit-diff-file-heading ((t (:weight bold))))
- `(magit-diff-file-heading-highlight ((t (:background ,zenburn-bg+05 :weight bold))))
- `(magit-diff-file-heading-selection ((t (:background ,zenburn-bg+05
- :foreground ,zenburn-orange :weight bold))))
- `(magit-diff-hunk-heading ((t (:background ,zenburn-bg+1))))
- `(magit-diff-hunk-heading-highlight ((t (:background ,zenburn-bg+2))))
- `(magit-diff-hunk-heading-selection ((t (:background ,zenburn-bg+2
- :foreground ,zenburn-orange))))
- `(magit-diff-lines-heading ((t (:background ,zenburn-orange
- :foreground ,zenburn-bg+2))))
- `(magit-diff-context-highlight ((t (:background ,zenburn-bg+05
- :foreground "grey70"))))
- `(magit-diffstat-added ((t (:foreground ,zenburn-green+4))))
- `(magit-diffstat-removed ((t (:foreground ,zenburn-red))))
-;;;;;; popup
- `(magit-popup-heading ((t (:foreground ,zenburn-yellow :weight bold))))
- `(magit-popup-key ((t (:foreground ,zenburn-green-1 :weight bold))))
- `(magit-popup-argument ((t (:foreground ,zenburn-green :weight bold))))
- `(magit-popup-disabled-argument ((t (:foreground ,zenburn-fg-1 :weight normal))))
- `(magit-popup-option-value ((t (:foreground ,zenburn-blue-2 :weight bold))))
-;;;;;; process
- `(magit-process-ok ((t (:foreground ,zenburn-green :weight bold))))
- `(magit-process-ng ((t (:foreground ,zenburn-red :weight bold))))
-;;;;;; log
- `(magit-log-author ((t (:foreground ,zenburn-orange))))
- `(magit-log-date ((t (:foreground ,zenburn-fg-1))))
- `(magit-log-graph ((t (:foreground ,zenburn-fg+1))))
-;;;;;; sequence
- `(magit-sequence-pick ((t (:foreground ,zenburn-yellow-2))))
- `(magit-sequence-stop ((t (:foreground ,zenburn-green))))
- `(magit-sequence-part ((t (:foreground ,zenburn-yellow))))
- `(magit-sequence-head ((t (:foreground ,zenburn-blue))))
- `(magit-sequence-drop ((t (:foreground ,zenburn-red))))
- `(magit-sequence-done ((t (:foreground ,zenburn-fg-1))))
- `(magit-sequence-onto ((t (:foreground ,zenburn-fg-1))))
-;;;;;; bisect
- `(magit-bisect-good ((t (:foreground ,zenburn-green))))
- `(magit-bisect-skip ((t (:foreground ,zenburn-yellow))))
- `(magit-bisect-bad ((t (:foreground ,zenburn-red))))
-;;;;;; blame
- `(magit-blame-heading ((t (:background ,zenburn-bg-1 :foreground ,zenburn-blue-2))))
- `(magit-blame-hash ((t (:background ,zenburn-bg-1 :foreground ,zenburn-blue-2))))
- `(magit-blame-name ((t (:background ,zenburn-bg-1 :foreground ,zenburn-orange))))
- `(magit-blame-date ((t (:background ,zenburn-bg-1 :foreground ,zenburn-orange))))
- `(magit-blame-summary ((t (:background ,zenburn-bg-1 :foreground ,zenburn-blue-2
- :weight bold))))
-;;;;;; references etc
- `(magit-dimmed ((t (:foreground ,zenburn-bg+3))))
- `(magit-hash ((t (:foreground ,zenburn-bg+3))))
- `(magit-tag ((t (:foreground ,zenburn-orange :weight bold))))
- `(magit-branch-remote ((t (:foreground ,zenburn-green :weight bold))))
- `(magit-branch-local ((t (:foreground ,zenburn-blue :weight bold))))
- `(magit-branch-current ((t (:foreground ,zenburn-blue :weight bold :box t))))
- `(magit-head ((t (:foreground ,zenburn-blue :weight bold))))
- `(magit-refname ((t (:background ,zenburn-bg+2 :foreground ,zenburn-fg :weight bold))))
- `(magit-refname-stash ((t (:background ,zenburn-bg+2 :foreground ,zenburn-fg :weight bold))))
- `(magit-refname-wip ((t (:background ,zenburn-bg+2 :foreground ,zenburn-fg :weight bold))))
- `(magit-signature-good ((t (:foreground ,zenburn-green))))
- `(magit-signature-bad ((t (:foreground ,zenburn-red))))
- `(magit-signature-untrusted ((t (:foreground ,zenburn-yellow))))
- `(magit-signature-expired ((t (:foreground ,zenburn-orange))))
- `(magit-signature-revoked ((t (:foreground ,zenburn-magenta))))
- '(magit-signature-error ((t (:inherit magit-signature-bad))))
- `(magit-cherry-unmatched ((t (:foreground ,zenburn-cyan))))
- `(magit-cherry-equivalent ((t (:foreground ,zenburn-magenta))))
- `(magit-reflog-commit ((t (:foreground ,zenburn-green))))
- `(magit-reflog-amend ((t (:foreground ,zenburn-magenta))))
- `(magit-reflog-merge ((t (:foreground ,zenburn-green))))
- `(magit-reflog-checkout ((t (:foreground ,zenburn-blue))))
- `(magit-reflog-reset ((t (:foreground ,zenburn-red))))
- `(magit-reflog-rebase ((t (:foreground ,zenburn-magenta))))
- `(magit-reflog-cherry-pick ((t (:foreground ,zenburn-green))))
- `(magit-reflog-remote ((t (:foreground ,zenburn-cyan))))
- `(magit-reflog-other ((t (:foreground ,zenburn-cyan))))
-;;;;; message-mode
- `(message-cited-text ((t (:inherit font-lock-comment-face))))
- `(message-header-name ((t (:foreground ,zenburn-green+1))))
- `(message-header-other ((t (:foreground ,zenburn-green))))
- `(message-header-to ((t (:foreground ,zenburn-yellow :weight bold))))
- `(message-header-cc ((t (:foreground ,zenburn-yellow :weight bold))))
- `(message-header-newsgroups ((t (:foreground ,zenburn-yellow :weight bold))))
- `(message-header-subject ((t (:foreground ,zenburn-orange :weight bold))))
- `(message-header-xheader ((t (:foreground ,zenburn-green))))
- `(message-mml ((t (:foreground ,zenburn-yellow :weight bold))))
- `(message-separator ((t (:inherit font-lock-comment-face))))
-;;;;; mew
- `(mew-face-header-subject ((t (:foreground ,zenburn-orange))))
- `(mew-face-header-from ((t (:foreground ,zenburn-yellow))))
- `(mew-face-header-date ((t (:foreground ,zenburn-green))))
- `(mew-face-header-to ((t (:foreground ,zenburn-red))))
- `(mew-face-header-key ((t (:foreground ,zenburn-green))))
- `(mew-face-header-private ((t (:foreground ,zenburn-green))))
- `(mew-face-header-important ((t (:foreground ,zenburn-blue))))
- `(mew-face-header-marginal ((t (:foreground ,zenburn-fg :weight bold))))
- `(mew-face-header-warning ((t (:foreground ,zenburn-red))))
- `(mew-face-header-xmew ((t (:foreground ,zenburn-green))))
- `(mew-face-header-xmew-bad ((t (:foreground ,zenburn-red))))
- `(mew-face-body-url ((t (:foreground ,zenburn-orange))))
- `(mew-face-body-comment ((t (:foreground ,zenburn-fg :slant italic))))
- `(mew-face-body-cite1 ((t (:foreground ,zenburn-green))))
- `(mew-face-body-cite2 ((t (:foreground ,zenburn-blue))))
- `(mew-face-body-cite3 ((t (:foreground ,zenburn-orange))))
- `(mew-face-body-cite4 ((t (:foreground ,zenburn-yellow))))
- `(mew-face-body-cite5 ((t (:foreground ,zenburn-red))))
- `(mew-face-mark-review ((t (:foreground ,zenburn-blue))))
- `(mew-face-mark-escape ((t (:foreground ,zenburn-green))))
- `(mew-face-mark-delete ((t (:foreground ,zenburn-red))))
- `(mew-face-mark-unlink ((t (:foreground ,zenburn-yellow))))
- `(mew-face-mark-refile ((t (:foreground ,zenburn-green))))
- `(mew-face-mark-unread ((t (:foreground ,zenburn-red-2))))
- `(mew-face-eof-message ((t (:foreground ,zenburn-green))))
- `(mew-face-eof-part ((t (:foreground ,zenburn-yellow))))
-;;;;; mic-paren
- `(paren-face-match ((t (:foreground ,zenburn-cyan :background ,zenburn-bg :weight bold))))
- `(paren-face-mismatch ((t (:foreground ,zenburn-bg :background ,zenburn-magenta :weight bold))))
- `(paren-face-no-match ((t (:foreground ,zenburn-bg :background ,zenburn-red :weight bold))))
-;;;;; mingus
- `(mingus-directory-face ((t (:foreground ,zenburn-blue))))
- `(mingus-pausing-face ((t (:foreground ,zenburn-magenta))))
- `(mingus-playing-face ((t (:foreground ,zenburn-cyan))))
- `(mingus-playlist-face ((t (:foreground ,zenburn-cyan ))))
- `(mingus-mark-face ((t (:bold t :foreground ,zenburn-magenta))))
- `(mingus-song-file-face ((t (:foreground ,zenburn-yellow))))
- `(mingus-artist-face ((t (:foreground ,zenburn-cyan))))
- `(mingus-album-face ((t (:underline t :foreground ,zenburn-red+1))))
- `(mingus-album-stale-face ((t (:foreground ,zenburn-red+1))))
- `(mingus-stopped-face ((t (:foreground ,zenburn-red))))
-;;;;; nav
- `(nav-face-heading ((t (:foreground ,zenburn-yellow))))
- `(nav-face-button-num ((t (:foreground ,zenburn-cyan))))
- `(nav-face-dir ((t (:foreground ,zenburn-green))))
- `(nav-face-hdir ((t (:foreground ,zenburn-red))))
- `(nav-face-file ((t (:foreground ,zenburn-fg))))
- `(nav-face-hfile ((t (:foreground ,zenburn-red-4))))
-;;;;; merlin
- `(merlin-type-face ((t (:inherit highlight))))
- `(merlin-compilation-warning-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-orange)))
- (t
- (:underline ,zenburn-orange))))
- `(merlin-compilation-error-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-red)))
- (t
- (:underline ,zenburn-red))))
-;;;;; mu4e
- `(mu4e-cited-1-face ((t (:foreground ,zenburn-blue :slant italic))))
- `(mu4e-cited-2-face ((t (:foreground ,zenburn-green+2 :slant italic))))
- `(mu4e-cited-3-face ((t (:foreground ,zenburn-blue-2 :slant italic))))
- `(mu4e-cited-4-face ((t (:foreground ,zenburn-green :slant italic))))
- `(mu4e-cited-5-face ((t (:foreground ,zenburn-blue-4 :slant italic))))
- `(mu4e-cited-6-face ((t (:foreground ,zenburn-green-1 :slant italic))))
- `(mu4e-cited-7-face ((t (:foreground ,zenburn-blue :slant italic))))
- `(mu4e-replied-face ((t (:foreground ,zenburn-bg+3))))
- `(mu4e-trashed-face ((t (:foreground ,zenburn-bg+3 :strike-through t))))
-;;;;; mumamo
- `(mumamo-background-chunk-major ((t (:background nil))))
- `(mumamo-background-chunk-submode1 ((t (:background ,zenburn-bg-1))))
- `(mumamo-background-chunk-submode2 ((t (:background ,zenburn-bg+2))))
- `(mumamo-background-chunk-submode3 ((t (:background ,zenburn-bg+3))))
- `(mumamo-background-chunk-submode4 ((t (:background ,zenburn-bg+1))))
-;;;;; neotree
- `(neo-banner-face ((t (:foreground ,zenburn-blue+1 :weight bold))))
- `(neo-header-face ((t (:foreground ,zenburn-fg))))
- `(neo-root-dir-face ((t (:foreground ,zenburn-blue+1 :weight bold))))
- `(neo-dir-link-face ((t (:foreground ,zenburn-blue))))
- `(neo-file-link-face ((t (:foreground ,zenburn-fg))))
- `(neo-expand-btn-face ((t (:foreground ,zenburn-blue))))
- `(neo-vc-default-face ((t (:foreground ,zenburn-fg+1))))
- `(neo-vc-user-face ((t (:foreground ,zenburn-red :slant italic))))
- `(neo-vc-up-to-date-face ((t (:foreground ,zenburn-fg))))
- `(neo-vc-edited-face ((t (:foreground ,zenburn-magenta))))
- `(neo-vc-needs-merge-face ((t (:foreground ,zenburn-red+1))))
- `(neo-vc-unlocked-changes-face ((t (:foreground ,zenburn-red :background ,zenburn-blue-5))))
- `(neo-vc-added-face ((t (:foreground ,zenburn-green+1))))
- `(neo-vc-conflict-face ((t (:foreground ,zenburn-red+1))))
- `(neo-vc-missing-face ((t (:foreground ,zenburn-red+1))))
- `(neo-vc-ignored-face ((t (:foreground ,zenburn-fg-1))))
-;;;;; org-mode
- `(org-agenda-date-today
- ((t (:foreground ,zenburn-fg+1 :slant italic :weight bold))) t)
- `(org-agenda-structure
- ((t (:inherit font-lock-comment-face))))
- `(org-archived ((t (:foreground ,zenburn-fg :weight bold))))
- `(org-checkbox ((t (:background ,zenburn-bg+2 :foreground ,zenburn-fg+1
- :box (:line-width 1 :style released-button)))))
- `(org-date ((t (:foreground ,zenburn-blue :underline t))))
- `(org-deadline-announce ((t (:foreground ,zenburn-red-1))))
- `(org-done ((t (:weight bold :weight bold :foreground ,zenburn-green+3))))
- `(org-formula ((t (:foreground ,zenburn-yellow-2))))
- `(org-headline-done ((t (:foreground ,zenburn-green+3))))
- `(org-hide ((t (:foreground ,zenburn-bg-1))))
- `(org-level-1 ((t (:foreground ,zenburn-orange))))
- `(org-level-2 ((t (:foreground ,zenburn-green+4))))
- `(org-level-3 ((t (:foreground ,zenburn-blue-1))))
- `(org-level-4 ((t (:foreground ,zenburn-yellow-2))))
- `(org-level-5 ((t (:foreground ,zenburn-cyan))))
- `(org-level-6 ((t (:foreground ,zenburn-green+2))))
- `(org-level-7 ((t (:foreground ,zenburn-red-4))))
- `(org-level-8 ((t (:foreground ,zenburn-blue-4))))
- `(org-link ((t (:foreground ,zenburn-yellow-2 :underline t))))
- `(org-scheduled ((t (:foreground ,zenburn-green+4))))
- `(org-scheduled-previously ((t (:foreground ,zenburn-red))))
- `(org-scheduled-today ((t (:foreground ,zenburn-blue+1))))
- `(org-sexp-date ((t (:foreground ,zenburn-blue+1 :underline t))))
- `(org-special-keyword ((t (:inherit font-lock-comment-face))))
- `(org-table ((t (:foreground ,zenburn-green+2))))
- `(org-tag ((t (:weight bold :weight bold))))
- `(org-time-grid ((t (:foreground ,zenburn-orange))))
- `(org-todo ((t (:weight bold :foreground ,zenburn-red :weight bold))))
- `(org-upcoming-deadline ((t (:inherit font-lock-keyword-face))))
- `(org-warning ((t (:weight bold :foreground ,zenburn-red :weight bold :underline nil))))
- `(org-column ((t (:background ,zenburn-bg-1))))
- `(org-column-title ((t (:background ,zenburn-bg-1 :underline t :weight bold))))
- `(org-mode-line-clock ((t (:foreground ,zenburn-fg :background ,zenburn-bg-1))))
- `(org-mode-line-clock-overrun ((t (:foreground ,zenburn-bg :background ,zenburn-red-1))))
- `(org-ellipsis ((t (:foreground ,zenburn-yellow-1 :underline t))))
- `(org-footnote ((t (:foreground ,zenburn-cyan :underline t))))
- `(org-document-title ((t (:foreground ,zenburn-blue))))
- `(org-document-info ((t (:foreground ,zenburn-blue))))
- `(org-habit-ready-face ((t :background ,zenburn-green)))
- `(org-habit-alert-face ((t :background ,zenburn-yellow-1 :foreground ,zenburn-bg)))
- `(org-habit-clear-face ((t :background ,zenburn-blue-3)))
- `(org-habit-overdue-face ((t :background ,zenburn-red-3)))
- `(org-habit-clear-future-face ((t :background ,zenburn-blue-4)))
- `(org-habit-ready-future-face ((t :background ,zenburn-green-1)))
- `(org-habit-alert-future-face ((t :background ,zenburn-yellow-2 :foreground ,zenburn-bg)))
- `(org-habit-overdue-future-face ((t :background ,zenburn-red-4)))
-;;;;; outline
- `(outline-1 ((t (:foreground ,zenburn-orange))))
- `(outline-2 ((t (:foreground ,zenburn-green+4))))
- `(outline-3 ((t (:foreground ,zenburn-blue-1))))
- `(outline-4 ((t (:foreground ,zenburn-yellow-2))))
- `(outline-5 ((t (:foreground ,zenburn-cyan))))
- `(outline-6 ((t (:foreground ,zenburn-green+2))))
- `(outline-7 ((t (:foreground ,zenburn-red-4))))
- `(outline-8 ((t (:foreground ,zenburn-blue-4))))
-;;;;; p4
- `(p4-depot-added-face ((t :inherit diff-added)))
- `(p4-depot-branch-op-face ((t :inherit diff-changed)))
- `(p4-depot-deleted-face ((t :inherit diff-removed)))
- `(p4-depot-unmapped-face ((t :inherit diff-changed)))
- `(p4-diff-change-face ((t :inherit diff-changed)))
- `(p4-diff-del-face ((t :inherit diff-removed)))
- `(p4-diff-file-face ((t :inherit diff-file-header)))
- `(p4-diff-head-face ((t :inherit diff-header)))
- `(p4-diff-ins-face ((t :inherit diff-added)))
-;;;;; perspective
- `(persp-selected-face ((t (:foreground ,zenburn-yellow-2 :inherit mode-line))))
-;;;;; powerline
- `(powerline-active1 ((t (:background ,zenburn-bg-05 :inherit mode-line))))
- `(powerline-active2 ((t (:background ,zenburn-bg+2 :inherit mode-line))))
- `(powerline-inactive1 ((t (:background ,zenburn-bg+1 :inherit mode-line-inactive))))
- `(powerline-inactive2 ((t (:background ,zenburn-bg+3 :inherit mode-line-inactive))))
-;;;;; proofgeneral
- `(proof-active-area-face ((t (:underline t))))
- `(proof-boring-face ((t (:foreground ,zenburn-fg :background ,zenburn-bg+2))))
- `(proof-command-mouse-highlight-face ((t (:inherit proof-mouse-highlight-face))))
- `(proof-debug-message-face ((t (:inherit proof-boring-face))))
- `(proof-declaration-name-face ((t (:inherit font-lock-keyword-face :foreground nil))))
- `(proof-eager-annotation-face ((t (:foreground ,zenburn-bg :background ,zenburn-orange))))
- `(proof-error-face ((t (:foreground ,zenburn-fg :background ,zenburn-red-4))))
- `(proof-highlight-dependency-face ((t (:foreground ,zenburn-bg :background ,zenburn-yellow-1))))
- `(proof-highlight-dependent-face ((t (:foreground ,zenburn-bg :background ,zenburn-orange))))
- `(proof-locked-face ((t (:background ,zenburn-blue-5))))
- `(proof-mouse-highlight-face ((t (:foreground ,zenburn-bg :background ,zenburn-orange))))
- `(proof-queue-face ((t (:background ,zenburn-red-4))))
- `(proof-region-mouse-highlight-face ((t (:inherit proof-mouse-highlight-face))))
- `(proof-script-highlight-error-face ((t (:background ,zenburn-red-2))))
- `(proof-tacticals-name-face ((t (:inherit font-lock-constant-face :foreground nil :background ,zenburn-bg))))
- `(proof-tactics-name-face ((t (:inherit font-lock-constant-face :foreground nil :background ,zenburn-bg))))
- `(proof-warning-face ((t (:foreground ,zenburn-bg :background ,zenburn-yellow-1))))
-;;;;; racket-mode
- `(racket-keyword-argument-face ((t (:inherit font-lock-constant-face))))
- `(racket-selfeval-face ((t (:inherit font-lock-type-face))))
-;;;;; rainbow-delimiters
- `(rainbow-delimiters-depth-1-face ((t (:foreground ,zenburn-fg))))
- `(rainbow-delimiters-depth-2-face ((t (:foreground ,zenburn-green+4))))
- `(rainbow-delimiters-depth-3-face ((t (:foreground ,zenburn-yellow-2))))
- `(rainbow-delimiters-depth-4-face ((t (:foreground ,zenburn-cyan))))
- `(rainbow-delimiters-depth-5-face ((t (:foreground ,zenburn-green+2))))
- `(rainbow-delimiters-depth-6-face ((t (:foreground ,zenburn-blue+1))))
- `(rainbow-delimiters-depth-7-face ((t (:foreground ,zenburn-yellow-1))))
- `(rainbow-delimiters-depth-8-face ((t (:foreground ,zenburn-green+1))))
- `(rainbow-delimiters-depth-9-face ((t (:foreground ,zenburn-blue-2))))
- `(rainbow-delimiters-depth-10-face ((t (:foreground ,zenburn-orange))))
- `(rainbow-delimiters-depth-11-face ((t (:foreground ,zenburn-green))))
- `(rainbow-delimiters-depth-12-face ((t (:foreground ,zenburn-blue-5))))
-;;;;; rcirc
- `(rcirc-my-nick ((t (:foreground ,zenburn-blue))))
- `(rcirc-other-nick ((t (:foreground ,zenburn-orange))))
- `(rcirc-bright-nick ((t (:foreground ,zenburn-blue+1))))
- `(rcirc-dim-nick ((t (:foreground ,zenburn-blue-2))))
- `(rcirc-server ((t (:foreground ,zenburn-green))))
- `(rcirc-server-prefix ((t (:foreground ,zenburn-green+1))))
- `(rcirc-timestamp ((t (:foreground ,zenburn-green+2))))
- `(rcirc-nick-in-message ((t (:foreground ,zenburn-yellow))))
- `(rcirc-nick-in-message-full-line ((t (:weight bold))))
- `(rcirc-prompt ((t (:foreground ,zenburn-yellow :weight bold))))
- `(rcirc-track-nick ((t (:inverse-video t))))
- `(rcirc-track-keyword ((t (:weight bold))))
- `(rcirc-url ((t (:weight bold))))
- `(rcirc-keyword ((t (:foreground ,zenburn-yellow :weight bold))))
-;;;;; re-builder
- `(reb-match-0 ((t (:foreground ,zenburn-bg :background ,zenburn-magenta))))
- `(reb-match-1 ((t (:foreground ,zenburn-bg :background ,zenburn-blue))))
- `(reb-match-2 ((t (:foreground ,zenburn-bg :background ,zenburn-orange))))
- `(reb-match-3 ((t (:foreground ,zenburn-bg :background ,zenburn-red))))
-;;;;; regex-tool
- `(regex-tool-matched-face ((t (:background ,zenburn-blue-4 :weight bold))))
-;;;;; rpm-mode
- `(rpm-spec-dir-face ((t (:foreground ,zenburn-green))))
- `(rpm-spec-doc-face ((t (:foreground ,zenburn-green))))
- `(rpm-spec-ghost-face ((t (:foreground ,zenburn-red))))
- `(rpm-spec-macro-face ((t (:foreground ,zenburn-yellow))))
- `(rpm-spec-obsolete-tag-face ((t (:foreground ,zenburn-red))))
- `(rpm-spec-package-face ((t (:foreground ,zenburn-red))))
- `(rpm-spec-section-face ((t (:foreground ,zenburn-yellow))))
- `(rpm-spec-tag-face ((t (:foreground ,zenburn-blue))))
- `(rpm-spec-var-face ((t (:foreground ,zenburn-red))))
-;;;;; rst-mode
- `(rst-level-1-face ((t (:foreground ,zenburn-orange))))
- `(rst-level-2-face ((t (:foreground ,zenburn-green+1))))
- `(rst-level-3-face ((t (:foreground ,zenburn-blue-1))))
- `(rst-level-4-face ((t (:foreground ,zenburn-yellow-2))))
- `(rst-level-5-face ((t (:foreground ,zenburn-cyan))))
- `(rst-level-6-face ((t (:foreground ,zenburn-green-1))))
-;;;;; sh-mode
- `(sh-heredoc ((t (:foreground ,zenburn-yellow :weight bold))))
- `(sh-quoted-exec ((t (:foreground ,zenburn-red))))
-;;;;; show-paren
- `(show-paren-mismatch ((t (:foreground ,zenburn-red+1 :background ,zenburn-bg+3 :weight bold))))
- `(show-paren-match ((t (:background ,zenburn-bg+3 :weight bold))))
-;;;;; smart-mode-line
- ;; use (setq sml/theme nil) to enable Zenburn for sml
- `(sml/global ((,class (:foreground ,zenburn-fg :weight bold))))
- `(sml/modes ((,class (:foreground ,zenburn-yellow :weight bold))))
- `(sml/minor-modes ((,class (:foreground ,zenburn-fg-1 :weight bold))))
- `(sml/filename ((,class (:foreground ,zenburn-yellow :weight bold))))
- `(sml/line-number ((,class (:foreground ,zenburn-blue :weight bold))))
- `(sml/col-number ((,class (:foreground ,zenburn-blue+1 :weight bold))))
- `(sml/position-percentage ((,class (:foreground ,zenburn-blue-1 :weight bold))))
- `(sml/prefix ((,class (:foreground ,zenburn-orange))))
- `(sml/git ((,class (:foreground ,zenburn-green+3))))
- `(sml/process ((,class (:weight bold))))
- `(sml/sudo ((,class (:foreground ,zenburn-orange :weight bold))))
- `(sml/read-only ((,class (:foreground ,zenburn-red-2))))
- `(sml/outside-modified ((,class (:foreground ,zenburn-orange))))
- `(sml/modified ((,class (:foreground ,zenburn-red))))
- `(sml/vc-edited ((,class (:foreground ,zenburn-green+2))))
- `(sml/charging ((,class (:foreground ,zenburn-green+4))))
- `(sml/discharging ((,class (:foreground ,zenburn-red+1))))
-;;;;; smartparens
- `(sp-show-pair-mismatch-face ((t (:foreground ,zenburn-red+1 :background ,zenburn-bg+3 :weight bold))))
- `(sp-show-pair-match-face ((t (:background ,zenburn-bg+3 :weight bold))))
-;;;;; sml-mode-line
- '(sml-modeline-end-face ((t :inherit default :width condensed)))
-;;;;; SLIME
- `(slime-repl-output-face ((t (:foreground ,zenburn-red))))
- `(slime-repl-inputed-output-face ((t (:foreground ,zenburn-green))))
- `(slime-error-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-red)))
- (t
- (:underline ,zenburn-red))))
- `(slime-warning-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-orange)))
- (t
- (:underline ,zenburn-orange))))
- `(slime-style-warning-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-yellow)))
- (t
- (:underline ,zenburn-yellow))))
- `(slime-note-face
- ((((supports :underline (:style wave)))
- (:underline (:style wave :color ,zenburn-green)))
- (t
- (:underline ,zenburn-green))))
- `(slime-highlight-face ((t (:inherit highlight))))
-;;;;; speedbar
- `(speedbar-button-face ((t (:foreground ,zenburn-green+2))))
- `(speedbar-directory-face ((t (:foreground ,zenburn-cyan))))
- `(speedbar-file-face ((t (:foreground ,zenburn-fg))))
- `(speedbar-highlight-face ((t (:foreground ,zenburn-bg :background ,zenburn-green+2))))
- `(speedbar-selected-face ((t (:foreground ,zenburn-red))))
- `(speedbar-separator-face ((t (:foreground ,zenburn-bg :background ,zenburn-blue-1))))
- `(speedbar-tag-face ((t (:foreground ,zenburn-yellow))))
-;;;;; sx
- `(sx-custom-button
- ((t (:background ,zenburn-fg :foreground ,zenburn-bg-1
- :box (:line-width 3 :style released-button) :height 0.9))))
- `(sx-question-list-answers
- ((t (:foreground ,zenburn-green+3
- :height 1.0 :inherit sx-question-list-parent))))
- `(sx-question-mode-accepted
- ((t (:foreground ,zenburn-green+3
- :height 1.3 :inherit sx-question-mode-title))))
- '(sx-question-mode-content-face ((t (:inherit highlight))))
- `(sx-question-mode-kbd-tag
- ((t (:box (:color ,zenburn-bg-1 :line-width 3 :style released-button)
- :height 0.9 :weight semi-bold))))
-;;;;; tabbar
- `(tabbar-button ((t (:foreground ,zenburn-fg
- :background ,zenburn-bg))))
- `(tabbar-selected ((t (:foreground ,zenburn-fg
- :background ,zenburn-bg
- :box (:line-width -1 :style pressed-button)))))
- `(tabbar-unselected ((t (:foreground ,zenburn-fg
- :background ,zenburn-bg+1
- :box (:line-width -1 :style released-button)))))
-;;;;; term
- `(term-color-black ((t (:foreground ,zenburn-bg
- :background ,zenburn-bg-1))))
- `(term-color-red ((t (:foreground ,zenburn-red-2
- :background ,zenburn-red-4))))
- `(term-color-green ((t (:foreground ,zenburn-green
- :background ,zenburn-green+2))))
- `(term-color-yellow ((t (:foreground ,zenburn-orange
- :background ,zenburn-yellow))))
- `(term-color-blue ((t (:foreground ,zenburn-blue-1
- :background ,zenburn-blue-4))))
- `(term-color-magenta ((t (:foreground ,zenburn-magenta
- :background ,zenburn-red))))
- `(term-color-cyan ((t (:foreground ,zenburn-cyan
- :background ,zenburn-blue))))
- `(term-color-white ((t (:foreground ,zenburn-fg
- :background ,zenburn-fg-1))))
- '(term-default-fg-color ((t (:inherit term-color-white))))
- '(term-default-bg-color ((t (:inherit term-color-black))))
-;;;;; undo-tree
- `(undo-tree-visualizer-active-branch-face ((t (:foreground ,zenburn-fg+1 :weight bold))))
- `(undo-tree-visualizer-current-face ((t (:foreground ,zenburn-red-1 :weight bold))))
- `(undo-tree-visualizer-default-face ((t (:foreground ,zenburn-fg))))
- `(undo-tree-visualizer-register-face ((t (:foreground ,zenburn-yellow))))
- `(undo-tree-visualizer-unmodified-face ((t (:foreground ,zenburn-cyan))))
-;;;;; visual-regexp
- `(vr/group-0 ((t (:foreground ,zenburn-bg :background ,zenburn-green :weight bold))))
- `(vr/group-1 ((t (:foreground ,zenburn-bg :background ,zenburn-orange :weight bold))))
- `(vr/group-2 ((t (:foreground ,zenburn-bg :background ,zenburn-blue :weight bold))))
- `(vr/match-0 ((t (:inherit isearch))))
- `(vr/match-1 ((t (:foreground ,zenburn-yellow-2 :background ,zenburn-bg-1 :weight bold))))
- `(vr/match-separator-face ((t (:foreground ,zenburn-red :weight bold))))
-;;;;; volatile-highlights
- `(vhl/default-face ((t (:background ,zenburn-bg-05))))
-;;;;; web-mode
- `(web-mode-builtin-face ((t (:inherit ,font-lock-builtin-face))))
- `(web-mode-comment-face ((t (:inherit ,font-lock-comment-face))))
- `(web-mode-constant-face ((t (:inherit ,font-lock-constant-face))))
- `(web-mode-css-at-rule-face ((t (:foreground ,zenburn-orange ))))
- `(web-mode-css-prop-face ((t (:foreground ,zenburn-orange))))
- `(web-mode-css-pseudo-class-face ((t (:foreground ,zenburn-green+3 :weight bold))))
- `(web-mode-css-rule-face ((t (:foreground ,zenburn-blue))))
- `(web-mode-doctype-face ((t (:inherit ,font-lock-comment-face))))
- `(web-mode-folded-face ((t (:underline t))))
- `(web-mode-function-name-face ((t (:foreground ,zenburn-blue))))
- `(web-mode-html-attr-name-face ((t (:foreground ,zenburn-orange))))
- `(web-mode-html-attr-value-face ((t (:inherit ,font-lock-string-face))))
- `(web-mode-html-tag-face ((t (:foreground ,zenburn-cyan))))
- `(web-mode-keyword-face ((t (:inherit ,font-lock-keyword-face))))
- `(web-mode-preprocessor-face ((t (:inherit ,font-lock-preprocessor-face))))
- `(web-mode-string-face ((t (:inherit ,font-lock-string-face))))
- `(web-mode-type-face ((t (:inherit ,font-lock-type-face))))
- `(web-mode-variable-name-face ((t (:inherit ,font-lock-variable-name-face))))
- `(web-mode-server-background-face ((t (:background ,zenburn-bg))))
- `(web-mode-server-comment-face ((t (:inherit web-mode-comment-face))))
- `(web-mode-server-string-face ((t (:inherit web-mode-string-face))))
- `(web-mode-symbol-face ((t (:inherit font-lock-constant-face))))
- `(web-mode-warning-face ((t (:inherit font-lock-warning-face))))
- `(web-mode-whitespaces-face ((t (:background ,zenburn-red))))
-;;;;; whitespace-mode
- `(whitespace-space ((t (:background ,zenburn-bg+1 :foreground ,zenburn-bg+1))))
- `(whitespace-hspace ((t (:background ,zenburn-bg+1 :foreground ,zenburn-bg+1))))
- `(whitespace-tab ((t (:background ,zenburn-red-1))))
- `(whitespace-newline ((t (:foreground ,zenburn-bg+1))))
- `(whitespace-trailing ((t (:background ,zenburn-red))))
- `(whitespace-line ((t (:background ,zenburn-bg :foreground ,zenburn-magenta))))
- `(whitespace-space-before-tab ((t (:background ,zenburn-orange :foreground ,zenburn-orange))))
- `(whitespace-indentation ((t (:background ,zenburn-yellow :foreground ,zenburn-red))))
- `(whitespace-empty ((t (:background ,zenburn-yellow))))
- `(whitespace-space-after-tab ((t (:background ,zenburn-yellow :foreground ,zenburn-red))))
-;;;;; wanderlust
- `(wl-highlight-folder-few-face ((t (:foreground ,zenburn-red-2))))
- `(wl-highlight-folder-many-face ((t (:foreground ,zenburn-red-1))))
- `(wl-highlight-folder-path-face ((t (:foreground ,zenburn-orange))))
- `(wl-highlight-folder-unread-face ((t (:foreground ,zenburn-blue))))
- `(wl-highlight-folder-zero-face ((t (:foreground ,zenburn-fg))))
- `(wl-highlight-folder-unknown-face ((t (:foreground ,zenburn-blue))))
- `(wl-highlight-message-citation-header ((t (:foreground ,zenburn-red-1))))
- `(wl-highlight-message-cited-text-1 ((t (:foreground ,zenburn-red))))
- `(wl-highlight-message-cited-text-2 ((t (:foreground ,zenburn-green+2))))
- `(wl-highlight-message-cited-text-3 ((t (:foreground ,zenburn-blue))))
- `(wl-highlight-message-cited-text-4 ((t (:foreground ,zenburn-blue+1))))
- `(wl-highlight-message-header-contents-face ((t (:foreground ,zenburn-green))))
- `(wl-highlight-message-headers-face ((t (:foreground ,zenburn-red+1))))
- `(wl-highlight-message-important-header-contents ((t (:foreground ,zenburn-green+2))))
- `(wl-highlight-message-header-contents ((t (:foreground ,zenburn-green+1))))
- `(wl-highlight-message-important-header-contents2 ((t (:foreground ,zenburn-green+2))))
- `(wl-highlight-message-signature ((t (:foreground ,zenburn-green))))
- `(wl-highlight-message-unimportant-header-contents ((t (:foreground ,zenburn-fg))))
- `(wl-highlight-summary-answered-face ((t (:foreground ,zenburn-blue))))
- `(wl-highlight-summary-disposed-face ((t (:foreground ,zenburn-fg
- :slant italic))))
- `(wl-highlight-summary-new-face ((t (:foreground ,zenburn-blue))))
- `(wl-highlight-summary-normal-face ((t (:foreground ,zenburn-fg))))
- `(wl-highlight-summary-thread-top-face ((t (:foreground ,zenburn-yellow))))
- `(wl-highlight-thread-indent-face ((t (:foreground ,zenburn-magenta))))
- `(wl-highlight-summary-refiled-face ((t (:foreground ,zenburn-fg))))
- `(wl-highlight-summary-displaying-face ((t (:underline t :weight bold))))
-;;;;; which-func-mode
- `(which-func ((t (:foreground ,zenburn-green+4))))
-;;;;; xcscope
- `(cscope-file-face ((t (:foreground ,zenburn-yellow :weight bold))))
- `(cscope-function-face ((t (:foreground ,zenburn-cyan :weight bold))))
- `(cscope-line-number-face ((t (:foreground ,zenburn-red :weight bold))))
- `(cscope-mouse-face ((t (:foreground ,zenburn-bg :background ,zenburn-blue+1))))
- `(cscope-separator-face ((t (:foreground ,zenburn-red :weight bold
- :underline t :overline t))))
-;;;;; yascroll
- `(yascroll:thumb-text-area ((t (:background ,zenburn-bg-1))))
- `(yascroll:thumb-fringe ((t (:background ,zenburn-bg-1 :foreground ,zenburn-bg-1))))
- ))
-
-;;; Theme Variables
-(zenburn-with-color-variables
- (custom-theme-set-variables
- 'zenburn
-;;;;; ansi-color
- `(ansi-color-names-vector [,zenburn-bg ,zenburn-red ,zenburn-green ,zenburn-yellow
- ,zenburn-blue ,zenburn-magenta ,zenburn-cyan ,zenburn-fg])
-;;;;; fill-column-indicator
- `(fci-rule-color ,zenburn-bg-05)
-;;;;; nrepl-client
- `(nrepl-message-colors
- '(,zenburn-red ,zenburn-orange ,zenburn-yellow ,zenburn-green ,zenburn-green+4
- ,zenburn-cyan ,zenburn-blue+1 ,zenburn-magenta))
-;;;;; pdf-tools
- `(pdf-view-midnight-colors '(,zenburn-fg . ,zenburn-bg-05))
-;;;;; vc-annotate
- `(vc-annotate-color-map
- '(( 20. . ,zenburn-red-1)
- ( 40. . ,zenburn-red)
- ( 60. . ,zenburn-orange)
- ( 80. . ,zenburn-yellow-2)
- (100. . ,zenburn-yellow-1)
- (120. . ,zenburn-yellow)
- (140. . ,zenburn-green-1)
- (160. . ,zenburn-green)
- (180. . ,zenburn-green+1)
- (200. . ,zenburn-green+2)
- (220. . ,zenburn-green+3)
- (240. . ,zenburn-green+4)
- (260. . ,zenburn-cyan)
- (280. . ,zenburn-blue-2)
- (300. . ,zenburn-blue-1)
- (320. . ,zenburn-blue)
- (340. . ,zenburn-blue+1)
- (360. . ,zenburn-magenta)))
- `(vc-annotate-very-old-color ,zenburn-magenta)
- `(vc-annotate-background ,zenburn-bg-1)
- ))
-
-;;; Rainbow Support
-
-(declare-function rainbow-mode 'rainbow-mode)
-(declare-function rainbow-colorize-by-assoc 'rainbow-mode)
-
-(defvar zenburn-add-font-lock-keywords nil
- "Whether to add font-lock keywords for zenburn color names.
-In buffers visiting library `zenburn-theme.el' the zenburn
-specific keywords are always added. In all other Emacs-Lisp
-buffers this variable controls whether this should be done.
-This requires library `rainbow-mode'.")
-
-(defvar zenburn-colors-font-lock-keywords nil)
-
-;; (defadvice rainbow-turn-on (after zenburn activate)
-;; "Maybe also add font-lock keywords for zenburn colors."
-;; (when (and (derived-mode-p 'emacs-lisp-mode)
-;; (or zenburn-add-font-lock-keywords
-;; (equal (file-name-nondirectory (buffer-file-name))
-;; "zenburn-theme.el")))
-;; (unless zenburn-colors-font-lock-keywords
-;; (setq zenburn-colors-font-lock-keywords
-;; `((,(regexp-opt (mapcar 'car zenburn-colors-alist) 'words)
-;; (0 (rainbow-colorize-by-assoc zenburn-colors-alist))))))
-;; (font-lock-add-keywords nil zenburn-colors-font-lock-keywords)))
-
-;; (defadvice rainbow-turn-off (after zenburn activate)
-;; "Also remove font-lock keywords for zenburn colors."
-;; (font-lock-remove-keywords nil zenburn-colors-font-lock-keywords))
-
-;;; Footer
-
-;;;###autoload
-(and load-file-name
- (boundp 'custom-theme-load-path)
- (add-to-list 'custom-theme-load-path
- (file-name-as-directory
- (file-name-directory load-file-name))))
-
-(provide-theme 'zenburn)
-
-;; Local Variables:
-;; no-byte-compile: t
-;; indent-tabs-mode: nil
-;; eval: (when (require 'rainbow-mode nil t) (rainbow-mode 1))
-;; End:
-;;; zenburn-theme.el ends here
diff --git a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-autoloads.el b/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-autoloads.el
deleted file mode 100644
index 3473cd7..0000000
--- a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-autoloads.el
+++ /dev/null
@@ -1,36 +0,0 @@
-;;; zop-to-char-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "zop-to-char" "zop-to-char.el" (23124 14374
-;;;;;; 505538 525000))
-;;; Generated autoloads from zop-to-char.el
-
-(autoload 'zop-to-char "zop-to-char" "\
-An enhanced version of `zap-to-char'.
-
-Argument ARG, when given is index of occurrence to jump to. For
-example, if ARG is 2, `zop-to-char' will jump to second occurrence
-of given character. If ARG is negative, jump in backward direction.
-
-\(fn ARG)" t nil)
-
-(autoload 'zop-up-to-char "zop-to-char" "\
-An enhanced version of `zap-up-to-char'.
-
-Argument ARG, when given is index of occurrence to jump to. For
-example, if ARG is 2, `zop-up-to-char' will jump to second
-occurrence of given character. If ARG is negative, jump in
-backward direction.
-
-\(fn ARG)" t nil)
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; zop-to-char-autoloads.el ends here
diff --git a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-pkg.el b/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-pkg.el
deleted file mode 100644
index ff39944..0000000
--- a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char-pkg.el
+++ /dev/null
@@ -1,2 +0,0 @@
-;;; -*- no-byte-compile: t -*-
-(define-package "zop-to-char" "20160212.754" "A replacement of zap-to-char." '((cl-lib "0.5")) :commit "816ea90337db0545a2f0a5079f4d7b3a2822af7d" :url "https://github.com/thierryvolpiatto/zop-to-char")
diff --git a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.el b/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.el
deleted file mode 100644
index 6b912c3..0000000
--- a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.el
+++ /dev/null
@@ -1,285 +0,0 @@
-;;; zop-to-char.el --- A replacement of zap-to-char. -*- lexical-binding: t -*-
-
-;; Author: Thierry Volpiatto
-;; Copyright (C) 2010~2014 Thierry Volpiatto, all rights reserved.
-;; X-URL: https://github.com/thierryvolpiatto/zop-to-char
-;; Package-Requires: ((cl-lib "0.5"))
-;; Package-Version: 20160212.754
-;; Version: 1.0
-
-;; Compatibility: GNU Emacs 23.1+
-
-;; 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, 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; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
-;; Floor, Boston, MA 02110-1301, USA.
-
-;;; Commentary:
-
-;; (require 'zop-to-char)
-;; To replace `zap-to-char':
-;; (global-set-key (kbd "M-z") 'zop-to-char)
-
-;;; Code:
-
-(require 'cl-lib)
-
-(declare-function eldoc-run-in-minibuffer "ext:eldoc-eval.el")
-(defvar eldoc-idle-delay)
-
-
-(defgroup zop-to-char nil
- "An enhanced `zap-to-char'."
- :group 'convenience)
-
-(defconst zop-to-char-help-format-string
- " [%s:kill, %s:delete, %s:copy, %s:next, %s:prec, %s:abort, %s:quit, %s:erase %s:mark]"
- "Help format text to display near the prompt.
-This text is displayed in mode-line if minibuffer is in use.")
-
-(defcustom zop-to-char-case-fold-search 'smart
- "Add 'smart' option to `case-fold-search'.
-When smart is enabled, ignore case in the search
-if input character is not uppercase.
-Otherwise, with a nil or t value, the behavior is same as
-`case-fold-search'.
-Default value is smart, other possible values are nil and t."
- :group 'zop-to-char
- :type '(choice (const :tag "Ignore case" t)
- (const :tag "Respect case" nil)
- (other :tag "Smart" 'smart)))
-
-(defcustom zop-to-char-kill-keys '(?\r ?\C-k)
- "Keys to kill the region text."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-delete-keys '(?\C-l nil)
- "Keys to delete the region text."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-copy-keys '(?\C-c ?\M-w)
- "Keys to copy the region text to the kill ring."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-next-keys '(right ?\C-f)
- "Keys to move point to the next match."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-prec-keys '(left ?\C-b)
- "Keys to move point to the preceding match."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-erase-keys '(?\d ?\C-d)
- "Keys to delete the current input."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-quit-at-point-keys '(?\C-q nil)
- "Keys to quit and leave point at its current location."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-quit-at-pos-keys '(?\C-g ?\e)
- "Keys to quit and leave point at its original location."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-mark-region-keys '(?\C- )
- "Keys to quit and mark region."
- :group 'zop-to-char
- :type '(repeat (choice character symbol integer)))
-
-(defcustom zop-to-char-mode-line-idle-delay 120
- "Display help string in mode-line that many time."
- :group 'zop-to-char
- :type 'integer)
-
-(defun zop-to-char--mapconcat-help-keys (seq)
- (cl-loop for k in seq
- when k concat (single-key-description k t) into str
- and concat "/" into str
- finally return (substring str 0 (1- (length str)))))
-
-(defun zop-to-char-help-string ()
- (format zop-to-char-help-format-string
- (zop-to-char--mapconcat-help-keys
- zop-to-char-kill-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-delete-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-copy-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-next-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-prec-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-quit-at-pos-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-quit-at-point-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-erase-keys)
- (zop-to-char--mapconcat-help-keys
- zop-to-char-mark-region-keys)))
-
-;; Internal
-(defvar zop-to-char--delete-up-to-char nil)
-(defvar zop-to-char--last-input nil)
-
-(defun zop-to-char-info-in-mode-line (prompt doc)
- "Display PROMPT and DOC in mode-line."
- (with-current-buffer
- (window-buffer (with-selected-window (minibuffer-window)
- (minibuffer-selected-window)))
- (let ((mode-line-format
- (concat " " (concat prompt zop-to-char--last-input doc))))
- (force-mode-line-update)
- (sit-for zop-to-char-mode-line-idle-delay))
- (force-mode-line-update)))
-
-(defun zop-to-char--set-case-fold-search (str)
- (cl-case zop-to-char-case-fold-search
- (smart (let ((case-fold-search nil))
- (if (string-match "[[:upper:]]" str) nil t)))
- (t zop-to-char-case-fold-search)))
-
-(defun zop-to-char--beg-end (arg beg end)
- (if zop-to-char--delete-up-to-char
- (if (< arg 0)
- (list (1+ beg) end)
- (list beg (1- end)))
- (list beg end)))
-
-
-;;;###autoload
-(defun zop-to-char (arg)
- "An enhanced version of `zap-to-char'.
-
-Argument ARG, when given is index of occurrence to jump to. For
-example, if ARG is 2, `zop-to-char' will jump to second occurrence
-of given character. If ARG is negative, jump in backward direction."
- (interactive "p")
- (let* ((pos (point))
- (ov (make-overlay pos (1+ pos)))
- (char "")
- timer
- mini-p
- (bstr (if (> arg 0) "-> " "<- "))
- (prompt (propertize (if zop-to-char--delete-up-to-char
- "Zap up to char: " "Zap to char: ")
- 'face 'minibuffer-prompt))
- (doc (propertize (zop-to-char-help-string) 'face 'minibuffer-prompt)))
- (overlay-put ov 'face 'region)
- (when (eobp) (setq arg -1))
- (setq zop-to-char--last-input char)
- (when (setq mini-p (minibufferp (current-buffer)))
- (when (and (boundp 'eldoc-in-minibuffer-mode)
- eldoc-in-minibuffer-mode)
- (cancel-function-timers #'eldoc-run-in-minibuffer))
- (setq timer (run-with-idle-timer
- 0.1 t
- 'zop-to-char-info-in-mode-line
- prompt doc)))
- (unwind-protect
- (while (let ((input (read-key (unless (minibufferp (current-buffer))
- (concat prompt bstr char doc))))
- (beg (overlay-start ov))
- (end (overlay-end ov)))
- (cond
- ((memq input zop-to-char-kill-keys)
- (apply #'kill-region
- (zop-to-char--beg-end arg beg end))
- nil)
- ((memq input zop-to-char-copy-keys)
- (apply #'copy-region-as-kill
- (zop-to-char--beg-end arg beg end))
- (goto-char pos) nil)
- ((memq input zop-to-char-next-keys)
- (setq arg 1) (setq bstr "-> ")
- t)
- ((memq input zop-to-char-prec-keys)
- (setq arg -1) (setq bstr "<- ")
- t)
- ((memq input zop-to-char-erase-keys)
- (setq char ""
- zop-to-char--last-input "")
- (goto-char pos)
- (delete-overlay ov)
- t)
- ((memq input zop-to-char-delete-keys)
- (apply #'delete-region
- (zop-to-char--beg-end arg beg end))
- nil)
- ((memq input zop-to-char-quit-at-point-keys)
- nil)
- ((memq input zop-to-char-quit-at-pos-keys)
- (goto-char pos)
- nil)
- ((memq input zop-to-char-mark-region-keys)
- (unless zop-to-char--delete-up-to-char
- (forward-char arg))
- (push-mark pos nil t)
- nil)
- (t
- ;; Input string
- (when (characterp input)
- (setq char (string input))
- (setq zop-to-char--last-input char)))))
- (condition-case _err
- (let ((case-fold-search (zop-to-char--set-case-fold-search char)))
- (if (< arg 0)
- (search-backward
- char (and mini-p (field-beginning)) t (- arg))
- (forward-char 1)
- (search-forward char nil t arg)
- (forward-char -1))
- (if (<= (point) pos)
- (move-overlay ov (1+ pos) (point))
- (move-overlay ov pos (1+ (point)))))
- (scan-error nil)
- (end-of-buffer nil)
- (beginning-of-buffer nil)))
- (message nil)
- (when timer
- (cancel-timer timer)
- (setq timer nil))
- (when (and mini-p
- (boundp 'eldoc-in-minibuffer-mode)
- eldoc-in-minibuffer-mode)
- (run-with-idle-timer
- eldoc-idle-delay
- 'repeat #'eldoc-run-in-minibuffer))
- (force-mode-line-update)
- (delete-overlay ov))))
-
-;;;###autoload
-(defun zop-up-to-char (arg)
- "An enhanced version of `zap-up-to-char'.
-
-Argument ARG, when given is index of occurrence to jump to. For
-example, if ARG is 2, `zop-up-to-char' will jump to second
-occurrence of given character. If ARG is negative, jump in
-backward direction."
- (interactive "p")
- (let ((zop-to-char--delete-up-to-char t))
- (zop-to-char arg)))
-
-(provide 'zop-to-char)
-
-;;; zop-to-char.el ends here
diff --git a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.elc b/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.elc
deleted file mode 100644
index a5c4eeb..0000000
Binary files a/emacs/.emacs.d/elpa/zop-to-char-20160212.754/zop-to-char.elc and /dev/null differ
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
deleted file mode 100644
index c77a359..0000000
--- a/emacs/.emacs.d/init.el
+++ /dev/null
@@ -1,148 +0,0 @@
-;;; init.el --- Prelude's configuration entry point.
-;;
-;; Copyright (c) 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: http://batsov.com/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; This file simply sets up the default load path and requires
-;; the various modules defined within Emacs Prelude.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-;; Added by Package.el. This must come before configurations of
-;; installed packages. Don't delete this line. If you don't want it,
-;; just comment it out by adding a semicolon to the start of the line.
-;; You may delete these explanatory comments.
-;(package-initialize)
-
-(defvar current-user
- (getenv
- (if (equal system-type 'windows-nt) "USERNAME" "USER")))
-
-(message "Prelude is powering up... Be patient, Master %s!" current-user)
-
-(when (version< emacs-version "24.4")
- (error "Prelude requires at least GNU Emacs 24.4, but you're running %s" emacs-version))
-
-;; Always load newest byte code
-(setq load-prefer-newer t)
-
-(defvar prelude-dir (file-name-directory load-file-name)
- "The root dir of the Emacs Prelude distribution.")
-(defvar prelude-core-dir (expand-file-name "core" prelude-dir)
- "The home of Prelude's core functionality.")
-(defvar prelude-modules-dir (expand-file-name "modules" prelude-dir)
- "This directory houses all of the built-in Prelude modules.")
-(defvar prelude-personal-dir (expand-file-name "personal" prelude-dir)
- "This directory is for your personal configuration.
-
-Users of Emacs Prelude are encouraged to keep their personal configuration
-changes in this directory. All Emacs Lisp files there are loaded automatically
-by Prelude.")
-(defvar prelude-personal-preload-dir (expand-file-name "preload" prelude-personal-dir)
- "This directory is for your personal configuration, that you want loaded before Prelude.")
-(defvar prelude-vendor-dir (expand-file-name "vendor" prelude-dir)
- "This directory houses packages that are not yet available in ELPA (or MELPA).")
-(defvar prelude-savefile-dir (expand-file-name "savefile" prelude-dir)
- "This folder stores all the automatically generated save/history-files.")
-(defvar prelude-modules-file (expand-file-name "prelude-modules.el" prelude-dir)
- "This files contains a list of modules that will be loaded by Prelude.")
-
-(unless (file-exists-p prelude-savefile-dir)
- (make-directory prelude-savefile-dir))
-
-(defun prelude-add-subfolders-to-load-path (parent-dir)
- "Add all level PARENT-DIR subdirs to the `load-path'."
- (dolist (f (directory-files parent-dir))
- (let ((name (expand-file-name f parent-dir)))
- (when (and (file-directory-p name)
- (not (string-prefix-p "." f)))
- (add-to-list 'load-path name)
- (prelude-add-subfolders-to-load-path name)))))
-
-;; add Prelude's directories to Emacs's `load-path'
-(add-to-list 'load-path prelude-core-dir)
-(add-to-list 'load-path prelude-modules-dir)
-(add-to-list 'load-path prelude-vendor-dir)
-(prelude-add-subfolders-to-load-path prelude-vendor-dir)
-
-;; reduce the frequency of garbage collection by making it happen on
-;; each 50MB of allocated data (the default is on every 0.76MB)
-(setq gc-cons-threshold 50000000)
-
-;; warn when opening files bigger than 100MB
-(setq large-file-warning-threshold 100000000)
-
-;; preload the personal settings from `prelude-personal-preload-dir'
-(when (file-exists-p prelude-personal-preload-dir)
- (message "Loading personal configuration files in %s..." prelude-personal-preload-dir)
- (mapc 'load (directory-files prelude-personal-preload-dir 't "^[^#\.].*el$")))
-
-(message "Loading Prelude's core...")
-
-;; the core stuff
-(require 'prelude-packages)
-(require 'prelude-custom) ;; Needs to be loaded before core, editor and ui
-(require 'prelude-ui)
-(require 'prelude-core)
-(require 'prelude-mode)
-(require 'prelude-editor)
-(require 'prelude-global-keybindings)
-
-;; OSX specific settings
-(when (eq system-type 'darwin)
- (require 'prelude-osx))
-
-(message "Loading Prelude's modules...")
-
-;; the modules
-(if (file-exists-p prelude-modules-file)
- (load prelude-modules-file)
- (message "Missing modules file %s" prelude-modules-file)
- (message "You can get started by copying the bundled example file from sample/prelude-modules.el"))
-
-;; config changes made through the customize UI will be stored here
-(setq custom-file (expand-file-name "custom.el" prelude-personal-dir))
-
-;; load the personal settings (this includes `custom-file')
-(when (file-exists-p prelude-personal-dir)
- (message "Loading personal configuration files in %s..." prelude-personal-dir)
- (mapc 'load (directory-files prelude-personal-dir 't "^[^#\.].*el$")))
-
-(message "Prelude is ready to do thy bidding, Master %s!" current-user)
-
-;; Patch security vulnerability in Emacs versions older than 25.3
-(when (version< emacs-version "25.3")
- (eval-after-load "enriched"
- '(defun enriched-decode-display-prop (start end &optional param)
- (list start end))))
-
-(prelude-eval-after-init
- ;; greet the use with some useful tip
- (run-at-time 5 nil 'prelude-tip-of-the-day))
-
-;;; init.el ends here
diff --git a/emacs/.emacs.d/modules/doc/README.md b/emacs/.emacs.d/modules/doc/README.md
deleted file mode 100644
index d1025e5..0000000
--- a/emacs/.emacs.d/modules/doc/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Emacs Prelude Modules
-
-Prelude provides extra functionality through modules. Some modules may
-require extra steps to enable all functionality. These steps and the
-functionality provided by these modules are documented on the
-following links.
-
-- C
-- Clojure
-- Coffee
-- Common-Lisp
-- CSS
-- Emacs-Lisp
-- [ERC](prelude-erc.md)
-- Erlang
-- Elixir
-- Haskell
-- JS
-- Latex
-- Lisp
-- Markdown
-- MediaWiki
-- Org
-- Perl
-- [Python](prelude-python.md)
-- Ruby
-- Scala
-- Scheme
-- Scss
-- Web
diff --git a/emacs/.emacs.d/modules/doc/prelude-erc.md b/emacs/.emacs.d/modules/doc/prelude-erc.md
deleted file mode 100644
index 5f61069..0000000
--- a/emacs/.emacs.d/modules/doc/prelude-erc.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Prelude ERC Quickstart
-
-## Customizing Server list
-
-If you want to join a list of servers on `M-x start-irc`, other than
-the default list, please redefine the variable `my-fav-irc` as follows
-in your personal config
-
-``` emacs-lisp
-(setq my-fav-irc '("irc.freenode.net"
- "irc.oftc.net"
- "irc.mozilla.org"
- "irc.gnome.org"))
-```
-
-## Customizing Last Quit Message
-
-If you want to customize your IRC Last Quit Message from *Asta la
-vista* to something more funkier, please redefine `bye-irc-message` as
-follows
-
-``` emacs-lisp
-(setq bye-erc-message "adios")
-```
-
-## Reading NickServ passwords from auth-source plugin
-
-If you want to automatically authenticate while logging into IRC
-servers set the `erc-prompt-for-password` to nil as follows
-
-``` emacs-lisp
-(setq erc-prompt-for-password nil)
-```
-
-Now you can set password in plaintext in .authinfo file in the netRC
-format or you it encrypted in .authinfo.gpg file after setting up gpg
-in emacs
-
-## Opening all ERC buffers in a new perspective
-Many a time when we start IRC with the `start-irc` command, all the
-channels open in our existing workspace, which can be annoying to
-some; especially to those who like to organize their buffers into
-separate groups (perspectives). To avoid this scenario, it is better
-to group all the ERC buffers into one perspective called `IRC` when
-`start-irc` is called. To enable this set the `prelude-new-irc-persp`
-variable to true as follows
-
-``` emacs-lisp
-(setq prelude-new-irc-persp t)
-```
diff --git a/emacs/.emacs.d/modules/doc/prelude-python.md b/emacs/.emacs.d/modules/doc/prelude-python.md
deleted file mode 100644
index 8de3ff6..0000000
--- a/emacs/.emacs.d/modules/doc/prelude-python.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Prelude Python Quickstart
-
-## Python Mode
-
-Emacs comes with Python programming support through the built-in
-Python-mode. Whenever you are editing Python code run `C-h m` to
-look at the Python mode key bindings. Alternatively look at the
-menu bar entries under Python. To toggle the menu bar press `F12`.
-
-## Syntax checking
-
-Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
-an on the fly syntax checker. Flycheck has support for two Python
-syntax checkers, [Pylint](http://www.pylint.org/) and
-[Flake8](http://flake8.readthedocs.org/en/latest/). In
-order to have Flycheck support on the fly syntax checking for
-Python you need to have either of these installed and accessible to
-Emacs. In order to manually choose a checker run `C-c ! s`.
diff --git a/emacs/.emacs.d/modules/prelude-c.el b/emacs/.emacs.d/modules/prelude-c.el
deleted file mode 100644
index f71bf36..0000000
--- a/emacs/.emacs.d/modules/prelude-c.el
+++ /dev/null
@@ -1,59 +0,0 @@
-;;; prelude-c.el --- Emacs Prelude: cc-mode configuration.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for cc-mode and the modes derived from it.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-
-(defun prelude-c-mode-common-defaults ()
- (setq c-default-style "k&r"
- c-basic-offset 4)
- (c-set-offset 'substatement-open 0))
-
-(setq prelude-c-mode-common-hook 'prelude-c-mode-common-defaults)
-
-;; this will affect all modes derived from cc-mode, like
-;; java-mode, php-mode, etc
-(add-hook 'c-mode-common-hook (lambda ()
- (run-hooks 'prelude-c-mode-common-hook)))
-
-(defun prelude-makefile-mode-defaults ()
- (whitespace-toggle-options '(tabs))
- (setq indent-tabs-mode t ))
-
-(setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
-
-(add-hook 'makefile-mode-hook (lambda ()
- (run-hooks 'prelude-makefile-mode-hook)))
-(provide 'prelude-c)
-
-;;; prelude-c.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-clojure.el b/emacs/.emacs.d/modules/prelude-clojure.el
deleted file mode 100644
index f15481c..0000000
--- a/emacs/.emacs.d/modules/prelude-clojure.el
+++ /dev/null
@@ -1,66 +0,0 @@
-;;; prelude-clojure.el --- Emacs Prelude: Clojure programming configuration.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: http://batsov.com/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for clojure-mode.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-lisp)
-(prelude-require-packages '(clojure-mode cider))
-
-(eval-after-load 'clojure-mode
- '(progn
- (defun prelude-clojure-mode-defaults ()
- (subword-mode +1)
- (run-hooks 'prelude-lisp-coding-hook))
-
- (setq prelude-clojure-mode-hook 'prelude-clojure-mode-defaults)
-
- (add-hook 'clojure-mode-hook (lambda ()
- (run-hooks 'prelude-clojure-mode-hook)))))
-
-(eval-after-load 'cider
- '(progn
- (setq nrepl-log-messages t)
-
- (add-hook 'cider-mode-hook 'eldoc-mode)
-
- (defun prelude-cider-repl-mode-defaults ()
- (subword-mode +1)
- (run-hooks 'prelude-interactive-lisp-coding-hook))
-
- (setq prelude-cider-repl-mode-hook 'prelude-cider-repl-mode-defaults)
-
- (add-hook 'cider-repl-mode-hook (lambda ()
- (run-hooks 'prelude-cider-repl-mode-hook)))))
-
-(provide 'prelude-clojure)
-
-;;; prelude-clojure.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-coffee.el b/emacs/.emacs.d/modules/prelude-coffee.el
deleted file mode 100644
index 71353de..0000000
--- a/emacs/.emacs.d/modules/prelude-coffee.el
+++ /dev/null
@@ -1,60 +0,0 @@
-;;; prelude-coffee.el --- Emacs Prelude: CoffeeScript programming support.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; CoffeeScript is a nice little language that comples to JavaScript.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-(prelude-require-package 'coffee-mode)
-
-(eval-after-load 'coffee-mode
- '(progn
- ;; CoffeeScript uses two spaces.
- (setq coffee-tab-width 2)
-
- ;; remove the "Generated by CoffeeScript" header
- (add-to-list 'coffee-args-compile "--no-header")
-
- (defun prelude-coffee-mode-defaults ()
- ;; Update the already compiled js on save
- (and (buffer-file-name)
- (file-exists-p (buffer-file-name))
- (file-exists-p (coffee-compiled-file-name (buffer-file-name)))
- (coffee-cos-mode t))
- (subword-mode +1))
-
- (setq prelude-coffee-mode-hook 'prelude-coffee-mode-defaults)
-
- (add-hook 'coffee-mode-hook (lambda ()
- (run-hooks 'prelude-coffee-mode-hook)))))
-(provide 'prelude-coffee)
-
-;;; prelude-coffee.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-common-lisp.el b/emacs/.emacs.d/modules/prelude-common-lisp.el
deleted file mode 100644
index 4829f02..0000000
--- a/emacs/.emacs.d/modules/prelude-common-lisp.el
+++ /dev/null
@@ -1,85 +0,0 @@
-;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Configuration for lisp-mode and SLIME.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-lisp)
-
-(prelude-require-package 'slime)
-
-;; the SBCL configuration file is in Common Lisp
-(add-to-list 'auto-mode-alist '("\\.sbclrc\\'" . lisp-mode))
-
-;; Open files with .cl extension in lisp-mode
-(add-to-list 'auto-mode-alist '("\\.cl\\'" . lisp-mode))
-
-;; a list of alternative Common Lisp implementations that can be
-;; used with SLIME. Note that their presence render
-;; inferior-lisp-program useless. This variable holds a list of
-;; programs and if you invoke SLIME with a negative prefix
-;; argument, M-- M-x slime, you can select a program from that list.
-(setq slime-lisp-implementations
- '((ccl ("ccl"))
- (clisp ("clisp" "-q"))
- (cmucl ("cmucl" "-quiet"))
- (sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
-
-;; select the default value from slime-lisp-implementations
-(if (and (eq system-type 'darwin)
- (executable-find "ccl"))
- ;; default to Clozure CL on OS X
- (setq slime-default-lisp 'ccl)
- ;; default to SBCL on Linux and Windows
- (setq slime-default-lisp 'sbcl))
-
-;; Add fancy slime contribs
-(setq slime-contribs '(slime-fancy slime-cl-indent))
-
-(add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
-;; rainbow-delimeters messes up colors in slime-repl, and doesn't seem to work
-;; anyway, so we won't use prelude-lisp-coding-defaults.
-(add-hook 'slime-repl-mode-hook (lambda ()
- (smartparens-strict-mode +1)
- (whitespace-mode -1)))
-
-(eval-after-load "slime"
- '(progn
- (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
- slime-fuzzy-completion-in-place t
- slime-enable-evaluate-in-emacs t
- slime-autodoc-use-multiline-p t
- slime-auto-start 'always)
- (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
-
-(provide 'prelude-common-lisp)
-
-;;; prelude-common-lisp.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-company.el b/emacs/.emacs.d/modules/prelude-company.el
deleted file mode 100644
index 8b10441..0000000
--- a/emacs/.emacs.d/modules/prelude-company.el
+++ /dev/null
@@ -1,48 +0,0 @@
-;;; prelude-company.el --- company-mode setup
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; company-mode config.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-(prelude-require-packages '(company))
-
-(require 'company)
-
-(setq company-idle-delay 0.5)
-(setq company-tooltip-limit 10)
-(setq company-minimum-prefix-length 2)
-;; invert the navigation direction if the the completion popup-isearch-match
-;; is displayed on top (happens near the bottom of windows)
-(setq company-tooltip-flip-when-above t)
-
-(global-company-mode 1)
-
-(provide 'prelude-company)
-;;; prelude-company.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-css.el b/emacs/.emacs.d/modules/prelude-css.el
deleted file mode 100644
index aa90063..0000000
--- a/emacs/.emacs.d/modules/prelude-css.el
+++ /dev/null
@@ -1,51 +0,0 @@
-;;; prelude-css.el --- Emacs Prelude: css support
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: http://www.batsov.com/emacs-prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for css-mode.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(eval-after-load 'css-mode
- '(progn
- (prelude-require-packages '(rainbow-mode))
-
- (setq css-indent-offset 2)
-
- (defun prelude-css-mode-defaults ()
- (rainbow-mode +1)
- (run-hooks 'prelude-prog-mode-hook))
-
- (setq prelude-css-mode-hook 'prelude-css-mode-defaults)
-
- (add-hook 'css-mode-hook (lambda ()
- (run-hooks 'prelude-css-mode-hook)))))
-
-(provide 'prelude-css)
-;;; prelude-css.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-elixir.el b/emacs/.emacs.d/modules/prelude-elixir.el
deleted file mode 100644
index 6e09dec..0000000
--- a/emacs/.emacs.d/modules/prelude-elixir.el
+++ /dev/null
@@ -1,40 +0,0 @@
-;;; prelude-elixir.el --- Emacs Prelude: Elixir programming support.
-;;
-;; Copyright © 2014-2017 Samuel Tonini
-;;
-;; Author: Samuel Tonini
-;; Version: 1.0.0
-;; Keywords: convenience elixir
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for Elixir development.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-
-(prelude-require-packages '(elixir-mode alchemist))
-
-(provide 'prelude-elixir)
-
-;;; prelude-elixir.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-emacs-lisp.el b/emacs/.emacs.d/modules/prelude-emacs-lisp.el
deleted file mode 100644
index f80a02f..0000000
--- a/emacs/.emacs.d/modules/prelude-emacs-lisp.el
+++ /dev/null
@@ -1,120 +0,0 @@
-;;; prelude-emacs-lisp.el --- Emacs Prelude: Nice config for Elisp programming.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-;; Package-Requires: ((prelude-lisp "1.0.0"))
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Nice config for Elisp Programming.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-lisp)
-(require 'crux)
-
-(prelude-require-packages '(elisp-slime-nav rainbow-mode))
-
-(defun prelude-recompile-elc-on-save ()
- "Recompile your elc when saving an elisp file."
- (add-hook 'after-save-hook
- (lambda ()
- (when (and
- (string-prefix-p prelude-dir (file-truename buffer-file-name))
- (file-exists-p (byte-compile-dest-file buffer-file-name)))
- (emacs-lisp-byte-compile)))
- nil
- t))
-
-(defun prelude-visit-ielm ()
- "Switch to default `ielm' buffer.
-Start `ielm' if it's not already running."
- (interactive)
- (crux-start-or-switch-to 'ielm "*ielm*"))
-
-(define-key emacs-lisp-mode-map (kbd "C-c C-z") 'prelude-visit-ielm)
-(define-key emacs-lisp-mode-map (kbd "C-c C-c") 'eval-defun)
-(define-key emacs-lisp-mode-map (kbd "C-c C-b") 'eval-buffer)
-
-(defun prelude-conditional-emacs-lisp-checker ()
- "Don't check doc style in Emacs Lisp test files."
- (let ((file-name (buffer-file-name)))
- (when (and file-name (string-match-p ".*-tests?\\.el\\'" file-name))
- (setq-local flycheck-checkers '(emacs-lisp)))))
-
-(defun prelude-emacs-lisp-mode-defaults ()
- "Sensible defaults for `emacs-lisp-mode'."
- (run-hooks 'prelude-lisp-coding-hook)
- (eldoc-mode +1)
- (prelude-recompile-elc-on-save)
- (rainbow-mode +1)
- (setq mode-name "EL")
- (prelude-conditional-emacs-lisp-checker))
-
-(setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
-
-(add-hook 'emacs-lisp-mode-hook (lambda ()
- (run-hooks 'prelude-emacs-lisp-mode-hook)))
-
-(add-to-list 'auto-mode-alist '("Cask\\'" . emacs-lisp-mode))
-
-;; ielm is an interactive Emacs Lisp shell
-(defun prelude-ielm-mode-defaults ()
- "Sensible defaults for `ielm'."
- (run-hooks 'prelude-interactive-lisp-coding-hook)
- (eldoc-mode +1))
-
-(setq prelude-ielm-mode-hook 'prelude-ielm-mode-defaults)
-
-(add-hook 'ielm-mode-hook (lambda ()
- (run-hooks 'prelude-ielm-mode-hook)))
-
-(eval-after-load "elisp-slime-nav"
- '(diminish 'elisp-slime-nav-mode))
-(eval-after-load "rainbow-mode"
- '(diminish 'rainbow-mode))
-(eval-after-load "eldoc"
- '(diminish 'eldoc-mode))
-
-(eval-after-load "ielm"
- '(progn
- (define-key ielm-map (kbd "M-(") (prelude-wrap-with "("))
- (define-key ielm-map (kbd "M-\"") (prelude-wrap-with "\""))))
-
-;; enable elisp-slime-nav-mode
-(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
- (add-hook hook 'elisp-slime-nav-mode))
-
-(defun conditionally-enable-smartparens-mode ()
- "Enable `smartparens-mode' in the minibuffer, during `eval-expression'."
- (if (eq this-command 'eval-expression)
- (smartparens-mode 1)))
-
-(add-hook 'minibuffer-setup-hook 'conditionally-enable-smartparens-mode)
-
-(provide 'prelude-emacs-lisp)
-
-;;; prelude-emacs-lisp.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-erc.el b/emacs/.emacs.d/modules/prelude-erc.el
deleted file mode 100644
index 701009c..0000000
--- a/emacs/.emacs.d/modules/prelude-erc.el
+++ /dev/null
@@ -1,162 +0,0 @@
-;;; prelude-erc.el --- Emacs Prelude: ERC mode configuration.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for ERC mode, which should make your
-;; IRC experience a bit more pleasant.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'erc)
-(require 'erc-log)
-(require 'erc-notify)
-(require 'erc-spelling)
-(require 'erc-autoaway)
-
-;; Interpret mIRC-style color commands in IRC chats
-(setq erc-interpret-mirc-color t)
-
-;; The following are commented out by default, but users of other
-;; non-Emacs IRC clients might find them useful.
-;; Kill buffers for channels after /part
-(setq erc-kill-buffer-on-part t)
-;; Kill buffers for private queries after quitting the server
-(setq erc-kill-queries-on-quit t)
-;; Kill buffers for server messages after quitting the server
-(setq erc-kill-server-buffer-on-quit t)
-
-;; open query buffers in the current window
-(setq erc-query-display 'buffer)
-
-;; exclude boring stuff from tracking
-(erc-track-mode t)
-(setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
- "324" "329" "332" "333" "353" "477"))
-
-;; logging
-(setq erc-log-channels-directory "~/.erc/logs/")
-
-(if (not (file-exists-p erc-log-channels-directory))
- (mkdir erc-log-channels-directory t))
-
-(setq erc-save-buffer-on-part t)
-;; FIXME - this advice is wrong and is causing problems on Emacs exit
-;; (defadvice save-buffers-kill-emacs (before save-logs (arg) activate)
-;; (save-some-buffers t (lambda () (when (eq major-mode 'erc-mode) t))))
-
-;; truncate long irc buffers
-(erc-truncate-mode +1)
-
-;; enable spell checking
-(when prelude-flyspell
- (erc-spelling-mode 1))
-;; set different dictionaries by different servers/channels
-;;(setq erc-spelling-dictionaries '(("#emacs" "american")))
-
-(defvar erc-notify-nick-alist nil
- "Alist of nicks and the last time they tried to trigger a
-notification")
-
-(defvar erc-notify-timeout 10
- "Number of seconds that must elapse between notifications from
-the same person.")
-
-(defun erc-notify-allowed-p (nick &optional delay)
- "Return non-nil if a notification should be made for NICK.
-If DELAY is specified, it will be the minimum time in seconds
-that can occur between two notifications. The default is
-`erc-notify-timeout'."
- (unless delay (setq delay erc-notify-timeout))
- (let ((cur-time (time-to-seconds (current-time)))
- (cur-assoc (assoc nick erc-notify-nick-alist))
- (last-time nil))
- (if cur-assoc
- (progn
- (setq last-time (cdr cur-assoc))
- (setcdr cur-assoc cur-time)
- (> (abs (- cur-time last-time)) delay))
- (push (cons nick cur-time) erc-notify-nick-alist)
- t)))
-
-;; autoaway setup
-(setq erc-auto-discard-away t)
-(setq erc-autoaway-idle-seconds 600)
-(setq erc-autoaway-use-emacs-idle t)
-
-;; utf-8 always and forever
-(setq erc-server-coding-system '(utf-8 . utf-8))
-
-
-(defvar my-fav-irc '( "irc.freenode.net" )
- "Stores the list of IRC servers that you want to connect to with start-irc.")
-
-(defvar bye-irc-message "Asta la vista"
- "Message string to be sent while quitting IRC.")
-
-(defcustom prelude-new-irc-persp nil
- "True (t) means start IRC in new perspective."
- :type 'boolean
- :require 'prelude-erc
- :group 'prelude)
-
-(defun connect-to-erc (server)
- "Connects securely to IRC SERVER over TLS at port 6697."
- (erc-tls :server server
- :port 6697
- :nick erc-nick ))
-
-(defun start-irc ()
- "Connect to IRC?"
- (interactive)
- (when (y-or-n-p "Do you want to start IRC? ")
- (when prelude-new-irc-persp
- (persp-switch "IRC"))
- (mapcar 'connect-to-erc my-fav-irc)))
-
-(defun filter-server-buffers ()
- (delq nil
- (mapcar
- (lambda (x) (and (erc-server-buffer-p x) x))
- (buffer-list))))
-
-(defun stop-irc ()
- "Disconnects from all irc servers."
- (interactive)
- (when prelude-new-irc-persp
- (persp-switch "IRC"))
- (dolist (buffer (filter-server-buffers))
- (message "Server buffer: %s" (buffer-name buffer))
- (with-current-buffer buffer
- (erc-quit-server bye-irc-message)))
- (when prelude-new-irc-persp
- (persp-kill "IRC")))
-
-(provide 'prelude-erc)
-
-;;; prelude-erc.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-erlang.el b/emacs/.emacs.d/modules/prelude-erlang.el
deleted file mode 100644
index edc4a7d..0000000
--- a/emacs/.emacs.d/modules/prelude-erlang.el
+++ /dev/null
@@ -1,60 +0,0 @@
-;;; prelude-erlang.el --- Emacs Prelude: Erlang programming support.
-;;
-;; Copyright © 2011-2017 Gleb Peregud
-;;
-;; Author: Gleb Peregud
-;; Version: 1.0.0
-;; Keywords: convenience erlang
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Erlang is a concurrent functional language.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-(prelude-require-packages '(erlang))
-
-(defcustom wrangler-path nil
- "The location of wrangler elisp directory."
- :group 'prelude-erlang
- :type 'string
- :safe 'stringp)
-
-(require 'projectile)
-
-(when (require 'erlang-start nil t)
-
- (eval-after-load 'erlang-mode
- '(progn
- (flymake-mode)))
-
- (when (not (null wrangler-path))
- (add-to-list 'load-path wrangler-path)
- (require 'wrangler)))
-
-(add-hook 'erlang-mode-hook (lambda ()
- (setq erlang-compile-function 'projectile-compile-project)))
-
-(provide 'prelude-erlang)
-
-;;; prelude-erlang.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-evil.el b/emacs/.emacs.d/modules/prelude-evil.el
deleted file mode 100644
index 0f8bd7c..0000000
--- a/emacs/.emacs.d/modules/prelude-evil.el
+++ /dev/null
@@ -1,152 +0,0 @@
-;;; prelude-evil.el --- Emacs Prelude: evil-mode configuration.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: http://batsov.com/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some basic configuration for evil-mode.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-;;; goto-chg lets you use the g-; and g-, to go to recent changes
-;;; evil-visualstar enables searching visual selection with *
-;;; evil-numbers enables vim style numeric incrementing and decrementing
-
-(prelude-require-packages '(evil goto-chg evil-surround evil-visualstar evil-numbers))
-
-(require 'evil-visualstar)
-
-(setq evil-mode-line-format 'before)
-
-(setq evil-emacs-state-cursor '("red" box))
-(setq evil-normal-state-cursor '("gray" box))
-(setq evil-visual-state-cursor '("gray" box))
-(setq evil-insert-state-cursor '("gray" bar))
-(setq evil-motion-state-cursor '("gray" box))
-
-;; prevent esc-key from translating to meta-key in terminal mode
-(setq evil-esc-delay 0)
-
-(evil-mode 1)
-(global-evil-surround-mode 1)
-
-(define-key evil-normal-state-map (kbd "C-A")
- 'evil-numbers/inc-at-pt)
-(define-key evil-normal-state-map (kbd "C-S-A")
- 'evil-numbers/dec-at-pt)
-
-;;
-;; Other useful Commands
-;;
-(evil-ex-define-cmd "W" 'evil-write-all)
-(evil-ex-define-cmd "Tree" 'speedbar-get-focus)
-(evil-ex-define-cmd "linum" 'linum-mode)
-(evil-ex-define-cmd "Align" 'align-regexp)
-
-(defun prelude-yank-to-end-of-line ()
- "Yank to end of line."
- (interactive)
- (evil-yank (point) (point-at-eol)))
-
-(define-key evil-normal-state-map
- (kbd "Y") 'prelude-yank-to-end-of-line)
-
-(defun prelude-shift-left-visual ()
- "Shift left and restore visual selection."
- (interactive)
- (evil-shift-left (region-beginning) (region-end))
- (evil-normal-state)
- (evil-visual-restore))
-
-(defun prelude-shift-right-visual ()
- "Shift right and restore visual selection."
- (interactive)
- (evil-shift-right (region-beginning) (region-end))
- (evil-normal-state)
- (evil-visual-restore))
-
-(define-key evil-visual-state-map (kbd ">") 'prelude-shift-right-visual)
-(define-key evil-visual-state-map (kbd "<") 'prelude-shift-left-visual)
-
-;; Scrolling
-(defun prelude-evil-scroll-down-other-window ()
- (interactive)
- (scroll-other-window))
-
-(defun prelude-evil-scroll-up-other-window ()
- (interactive)
- (scroll-other-window '-))
-
-(define-key evil-normal-state-map
- (kbd "C-S-d") 'prelude-evil-scroll-down-other-window)
-
-(define-key evil-normal-state-map
- (kbd "C-S-u") 'prelude-evil-scroll-up-other-window)
-
-;;
-;; Magit from avsej
-;;
-(evil-add-hjkl-bindings magit-log-mode-map 'emacs)
-(evil-add-hjkl-bindings magit-commit-mode-map 'emacs)
-(evil-add-hjkl-bindings magit-branch-manager-mode-map 'emacs
- "K" 'magit-discard
- "L" 'magit-log-popup)
-(evil-add-hjkl-bindings magit-status-mode-map 'emacs
- "K" 'magit-discard
- "l" 'magit-log-popup
- "h" 'magit-diff-toggle-refine-hunk)
-
-(setq evil-shift-width 2)
-
-;;; enable avy with evil-mode
-(define-key evil-normal-state-map (kbd "SPC") 'avy-goto-word-1)
-
-;;; snagged from Eric S. Fraga
-;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html
-(defun prelude-evil-key-bindings-for-org ()
- ;;(message "Defining evil key bindings for org")
- (evil-declare-key 'normal org-mode-map
- "gk" 'outline-up-heading
- "gj" 'outline-next-visible-heading
- "H" 'org-beginning-of-line ; smarter behaviour on headlines etc.
- "L" 'org-end-of-line ; smarter behaviour on headlines etc.
- "t" 'org-todo ; mark a TODO item as DONE
- ",c" 'org-cycle
- (kbd "TAB") 'org-cycle
- ",e" 'org-export-dispatch
- ",n" 'outline-next-visible-heading
- ",p" 'outline-previous-visible-heading
- ",t" 'org-set-tags-command
- ",u" 'outline-up-heading
- "$" 'org-end-of-line ; smarter behaviour on headlines etc.
- "^" 'org-beginning-of-line ; ditto
- "-" 'org-ctrl-c-minus ; change bullet style
- "<" 'org-metaleft ; out-dent
- ">" 'org-metaright ; indent
- ))
-(prelude-evil-key-bindings-for-org)
-(provide 'prelude-evil)
diff --git a/emacs/.emacs.d/modules/prelude-go.el b/emacs/.emacs.d/modules/prelude-go.el
deleted file mode 100644
index d711445..0000000
--- a/emacs/.emacs.d/modules/prelude-go.el
+++ /dev/null
@@ -1,84 +0,0 @@
-;;; prelude-go.el --- Emacs Prelude: Go programming support.
-;;
-;; Author: Doug MacEachern
-;; Version: 1.0.0
-;; Keywords: convenience go
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Prelude configuration for Go
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-
-(prelude-require-packages '(go-mode
- company-go
- go-eldoc
- go-projectile
- gotest))
-
-(require 'go-projectile)
-
-;; Ignore go test -c output files
-(add-to-list 'completion-ignored-extensions ".test")
-
-(define-key 'help-command (kbd "G") 'godoc)
-
-(eval-after-load 'go-mode
- '(progn
- (defun prelude-go-mode-defaults ()
- ;; Add to default go-mode key bindings
- (let ((map go-mode-map))
- (define-key map (kbd "C-c a") 'go-test-current-project) ;; current package, really
- (define-key map (kbd "C-c m") 'go-test-current-file)
- (define-key map (kbd "C-c .") 'go-test-current-test)
- (define-key map (kbd "C-c b") 'go-run)
- (define-key map (kbd "C-h f") 'godoc-at-point))
-
- ;; Prefer goimports to gofmt if installed
- (let ((goimports (executable-find "goimports")))
- (when goimports
- (setq gofmt-command goimports)))
-
- ;; gofmt on save
- (add-hook 'before-save-hook 'gofmt-before-save nil t)
-
- ;; stop whitespace being highlighted
- (whitespace-toggle-options '(tabs))
-
- ;; Company mode settings
- (set (make-local-variable 'company-backends) '(company-go))
-
- ;; El-doc for Go
- (go-eldoc-setup)
-
- ;; CamelCase aware editing operations
- (subword-mode +1))
-
- (setq prelude-go-mode-hook 'prelude-go-mode-defaults)
-
- (add-hook 'go-mode-hook (lambda ()
- (run-hooks 'prelude-go-mode-hook)))))
-
-(provide 'prelude-go)
-;;; prelude-go.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-haskell.el b/emacs/.emacs.d/modules/prelude-haskell.el
deleted file mode 100644
index d3f3b65..0000000
--- a/emacs/.emacs.d/modules/prelude-haskell.el
+++ /dev/null
@@ -1,53 +0,0 @@
-;;; prelude-haskell.el --- Emacs Prelude: Nice config for Haskell programming.
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Nice config for Haskell programming.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(require 'prelude-programming)
-(prelude-require-packages '(haskell-mode))
-
-(eval-after-load 'haskell-mode
- '(progn
- (defun prelude-haskell-mode-defaults ()
- (subword-mode +1)
- (eldoc-mode +1)
- (haskell-indentation-mode +1)
- (interactive-haskell-mode +1))
-
- (setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults)
-
- (add-hook 'haskell-mode-hook (lambda ()
- (run-hooks 'prelude-haskell-mode-hook)))))
-
-(provide 'prelude-haskell)
-
-;;; prelude-haskell.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-helm-everywhere.el b/emacs/.emacs.d/modules/prelude-helm-everywhere.el
deleted file mode 100644
index 49c739d..0000000
--- a/emacs/.emacs.d/modules/prelude-helm-everywhere.el
+++ /dev/null
@@ -1,72 +0,0 @@
-;;; prelude-helm-everywhere.el --- Enable Helm everywhere
-;;
-;; Copyright © 2014-2017 Tu, Do Hoang
-;;
-;; Author: Tu, Do Hoang (tuhdo1710@gmail.com)
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Enable Helm everywhere with global key bindings to replace common
-;; global bindings and `helm-mode' is activated to replace `completing-read'
-;; with `helm-completing-read-default', so users can use Helm with every prompt.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-(require 'prelude-helm)
-(prelude-require-packages '(helm-descbinds helm-ag))
-(require 'helm-eshell)
-
-(global-set-key (kbd "M-x") 'helm-M-x)
-(global-set-key (kbd "C-x C-m") 'helm-M-x)
-(global-set-key (kbd "M-y") 'helm-show-kill-ring)
-(global-set-key (kbd "C-x b") 'helm-mini)
-(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
-(global-set-key (kbd "C-x C-f") 'helm-find-files)
-(global-set-key (kbd "C-h f") 'helm-apropos)
-(global-set-key (kbd "C-h r") 'helm-info-emacs)
-(global-set-key (kbd "C-h C-l") 'helm-locate-library)
-(define-key prelude-mode-map (kbd "C-c f") 'helm-recentf)
-
-(define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
-
-(define-key isearch-mode-map (kbd "C-o") 'helm-occur-from-isearch)
-
-;; shell history.
-(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
-
-;; use helm to list eshell history
-(add-hook 'eshell-mode-hook
- #'(lambda ()
- (substitute-key-definition 'eshell-list-history 'helm-eshell-history eshell-mode-map)))
-
-(substitute-key-definition 'find-tag 'helm-etags-select global-map)
-(setq projectile-completion-system 'helm)
-(helm-descbinds-mode)
-(helm-mode 1)
-
-;; enable Helm version of Projectile with replacment commands
-(helm-projectile-on)
-
-(provide 'prelude-helm-everywhere)
-;; prelude-helm-everywhere.el ends here.
diff --git a/emacs/.emacs.d/modules/prelude-helm.el b/emacs/.emacs.d/modules/prelude-helm.el
deleted file mode 100644
index 253484e..0000000
--- a/emacs/.emacs.d/modules/prelude-helm.el
+++ /dev/null
@@ -1,67 +0,0 @@
-;;; prelude-helm.el --- Helm setup
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Some configuration for Helm following this guide:
-;; http://tuhdo.github.io/helm-intro.html
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-
-(prelude-require-packages '(helm helm-projectile))
-
-(require 'helm-config)
-(require 'helm-projectile)
-
-(when (executable-find "curl")
- (setq helm-google-suggest-use-curl-p t))
-
-;; See https://github.com/bbatsov/prelude/pull/670 for a detailed
-;; discussion of these options.
-(setq helm-split-window-in-side-p t
- helm-buffers-fuzzy-matching t
- helm-move-to-line-cycle-in-source t
- helm-ff-search-library-in-sexp t
- helm-ff-file-name-history-use-recentf t)
-
-;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
-;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
-;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
-(global-set-key (kbd "C-c h") 'helm-command-prefix)
-(global-unset-key (kbd "C-x c"))
-
-(define-key helm-command-map (kbd "o") 'helm-occur)
-(define-key helm-command-map (kbd "g") 'helm-do-grep)
-(define-key helm-command-map (kbd "C-c w") 'helm-wikipedia-suggest)
-(define-key helm-command-map (kbd "SPC") 'helm-all-mark-rings)
-
-(push "Press to navigate a project in Helm." prelude-tips)
-
-(provide 'prelude-helm)
-
-;;; prelude-helm.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-ido.el b/emacs/.emacs.d/modules/prelude-ido.el
deleted file mode 100644
index 768bf74..0000000
--- a/emacs/.emacs.d/modules/prelude-ido.el
+++ /dev/null
@@ -1,64 +0,0 @@
-;;; prelude-ido.el --- Ido setup
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov
-;; URL: https://github.com/bbatsov/prelude
-;; Version: 1.0.0
-;; Keywords: convenience
-
-;; This file is not part of GNU Emacs.
-
-;;; Commentary:
-
-;; Ido-related config.
-
-;;; License:
-
-;; 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 GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
-
-;;; Code:
-(prelude-require-packages '(flx-ido ido-completing-read+ smex))
-
-(require 'ido)
-(require 'ido-completing-read+)
-(require 'flx-ido)
-
-(setq ido-enable-prefix nil
- ido-enable-flex-matching t
- ido-create-new-buffer 'always
- ido-use-filename-at-point 'guess
- ido-max-prospects 10
- ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
- ido-default-file-method 'selected-window
- ido-auto-merge-work-directories-length -1)
-(ido-mode +1)
-(ido-ubiquitous-mode +1)
-
-;;; smarter fuzzy matching for ido
-(flx-ido-mode +1)
-;; disable ido faces to see flx highlights
-(setq ido-use-faces nil)
-
-;;; smex, remember recently and most frequently used commands
-(require 'smex)
-(setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
-(smex-initialize)
-(global-set-key (kbd "M-x") 'smex)
-(global-set-key (kbd "M-X") 'smex-major-mode-commands)
-
-(provide 'prelude-ido)
-;;; prelude-ido.el ends here
diff --git a/emacs/.emacs.d/modules/prelude-ivy.el b/emacs/.emacs.d/modules/prelude-ivy.el
deleted file mode 100644
index 8ecea2f..0000000
--- a/emacs/.emacs.d/modules/prelude-ivy.el
+++ /dev/null
@@ -1,70 +0,0 @@
-;;; prelude-ivy.el --- Ivy setup
-;;
-;; Copyright © 2011-2017 Bozhidar Batsov
-;;
-;; Author: Bozhidar Batsov