mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-06-20 09:48:12 +02:00
Boxes.el: Resolve packaging feedback.
● Added some more package metadata. ● Defer getting the list of boxes types until needed to avoid errors in the middle of loading a user's config, which can be inconvenient and lead to a partially setup Emacs.
This commit is contained in:
parent
6490205df9
commit
d62637e6fa
21
doc/boxes.el
21
doc/boxes.el
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
;; Author: Jason L. Shiffer <jshiffer@zerotao.com>
|
;; Author: Jason L. Shiffer <jshiffer@zerotao.com>
|
||||||
;; Maintainer: Jason L. Shiffer <jshiffer@zerotao.com>
|
;; Maintainer: Jason L. Shiffer <jshiffer@zerotao.com>
|
||||||
|
;; Version: 0.0
|
||||||
|
;; Package-Requires: ((emacs "24.3"))
|
||||||
;; Keywords: extensions
|
;; Keywords: extensions
|
||||||
;; URL: https://boxes.thomasjensen.com
|
;; URL: https://boxes.thomasjensen.com
|
||||||
;; Created: 1999-10-30
|
;; Created: 1999-10-30
|
||||||
@ -53,6 +55,7 @@
|
|||||||
|
|
||||||
(defgroup boxes nil
|
(defgroup boxes nil
|
||||||
"ASCII boxes unlimited!"
|
"ASCII boxes unlimited!"
|
||||||
|
:prefix "boxes-"
|
||||||
:group 'convenience)
|
:group 'convenience)
|
||||||
|
|
||||||
(defcustom boxes-command "boxes"
|
(defcustom boxes-command "boxes"
|
||||||
@ -74,17 +77,23 @@
|
|||||||
:type '(alist :key-type symbol :value-type string)
|
:type '(alist :key-type symbol :value-type string)
|
||||||
:group 'boxes)
|
:group 'boxes)
|
||||||
|
|
||||||
(defconst boxes-types-list
|
|
||||||
(let ((types (process-lines boxes-command "-q" "(all)")))
|
|
||||||
(mapcar (lambda(type) (replace-regexp-in-string " *\(alias\) *$" "" type)) types))
|
|
||||||
"List of types available to the current boxes implementation.")
|
|
||||||
|
|
||||||
(defvar boxes-history nil
|
(defvar boxes-history nil
|
||||||
"Boxes types history.")
|
"Boxes types history.")
|
||||||
|
|
||||||
(defvar-local boxes-default-type nil
|
(defvar-local boxes-default-type nil
|
||||||
"The default type of box.")
|
"The default type of box.")
|
||||||
|
|
||||||
|
(defvar boxes-types-list nil
|
||||||
|
"List of types available to the current boxes implementation, nil if not set yet.")
|
||||||
|
|
||||||
|
(defun boxes-types ()
|
||||||
|
"Return the list of types available to the current boxes implementation."
|
||||||
|
(or boxes-types-list
|
||||||
|
(setq boxes-types-list
|
||||||
|
(let ((types (process-lines boxes-command "-q" "(all)")))
|
||||||
|
(mapcar (lambda(type) (replace-regexp-in-string " *\(alias\) *$" "" type))
|
||||||
|
types)))))
|
||||||
|
|
||||||
(defun boxes-default-type (mode)
|
(defun boxes-default-type (mode)
|
||||||
"Get the default box type for the given buffer major MODE."
|
"Get the default box type for the given buffer major MODE."
|
||||||
(or (cdr (assoc mode boxes-known-modes)) "c-cmt2"))
|
(or (cdr (assoc mode boxes-known-modes)) "c-cmt2"))
|
||||||
@ -112,7 +121,7 @@ When calling from Lisp, supply the region START & END and the box TYPE to
|
|||||||
create a box. Specifying a non-nil value for REMOVE, removes the box."
|
create a box. Specifying a non-nil value for REMOVE, removes the box."
|
||||||
(interactive (let ((string
|
(interactive (let ((string
|
||||||
(completing-read (format "Box type (%s): " boxes-default-type)
|
(completing-read (format "Box type (%s): " boxes-default-type)
|
||||||
boxes-types-list nil t nil 'boxes-history boxes-default-type)))
|
(boxes-types) nil t nil 'boxes-history boxes-default-type)))
|
||||||
(list (region-beginning) (region-end)
|
(list (region-beginning) (region-end)
|
||||||
string
|
string
|
||||||
current-prefix-arg)))
|
current-prefix-arg)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user