[elpa] externals/consult f154d6b: Call compilation-find-file from the correct directory (#423)

2021-09-15 Thread ELPA Syncer
branch: externals/consult
commit f154d6bd800d8d12e88cb9abdc3b24c3c30a455f
Author: Augusto Stoffel 
Commit: GitHub 

Call compilation-find-file from the correct directory (#423)

Fixes #301
---
 consult-compile.el | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/consult-compile.el b/consult-compile.el
index 5dbc4cb..a53b75b 100644
--- a/consult-compile.el
+++ b/consult-compile.el
@@ -67,20 +67,21 @@
 
 (defun consult-compile--error-lookup (_ candidates cand)
   "Lookup marker of CAND by accessing CANDIDATES list."
-  (when-let (cand (car (member cand candidates)))
-(let ((marker (get-text-property 0 'consult-compile--marker cand))
-  (loc (get-text-property 0 'consult-compile--loc cand)))
-  (when (buffer-live-p (marker-buffer marker))
-(consult--position-marker
- ;; taken from compile.el
- (apply #'compilation-find-file
-marker
-(caar (compilation--loc->file-struct loc))
-(cadar (compilation--loc->file-struct loc))
-(compilation--file-struct->formats
- (compilation--loc->file-struct loc)))
- (compilation--loc->line loc)
- (compilation--loc->col loc))
+  (when-let ((cand (car (member cand candidates)))
+ (marker (get-text-property 0 'consult-compile--marker cand))
+ (loc (get-text-property 0 'consult-compile--loc cand))
+ (buffer (marker-buffer marker))
+ (default-directory (buffer-local-value 'default-directory 
buffer)))
+(consult--position-marker
+ ;; taken from compile.el
+ (apply #'compilation-find-file
+marker
+(caar (compilation--loc->file-struct loc))
+(cadar (compilation--loc->file-struct loc))
+(compilation--file-struct->formats
+ (compilation--loc->file-struct loc)))
+ (compilation--loc->line loc)
+ (compilation--loc->col loc
 
 (defun consult-compile--compilation-buffers (file)
   "Return a list of compilation buffers relevant to FILE."



[elpa] externals/crdt d5fd2bf: Squashed commit of the following:

2021-09-15 Thread ELPA Syncer
branch: externals/crdt
commit d5fd2bf9762520d0ceee8d8ca37222ac1df5a28d
Author: Qiantan Hong 
Commit: Qiantan Hong 

Squashed commit of the following:

commit f66d88195884490cb5606a8d520e300d266df7b0
Author: Qiantan Hong 
Date:   Wed Sep 15 08:50:22 2021 -0700

bump version number

commit 92eac26b57cf4b852f4faf1c182c802930064208
Author: Qiantan Hong 
Date:   Wed Sep 15 08:49:51 2021 -0700

ergonomics improvements

commit a7fc622923b79c40d8f056feb0f412aa5acbdba9
Author: Qiantan Hong 
Date:   Mon Sep 13 22:20:10 2021 -0700

Don't perform CRDT client clean-up for non-clients

commit 9b48ee961aa6aafac63e42ec5c5f0c07461e07f0
Merge: 10962c7 c8cb0e4
Author: Qiantan Hong 
Date:   Mon Sep 13 22:16:56 2021 -0700

Merge branch 'master' into fix

commit 10962c78ac217ba1ea6b6e333db16c63713c25ca
Author: Qiantan Hong 
Date:   Sun Sep 12 07:29:04 2021 -0700

add comint-send-eof

commit df9cbdf34e1477f679188999734caabf257634a5
Merge: 46b015f af43adb
Author: Qiantan Hong 
Date:   Sun Sep 12 07:28:28 2021 -0700

Merge branch 'development' into fix

commit af43adb8e0cc8e072ae540a3ca5adabd3f733dbd
Author: Qiantan Hong 
Date:   Sat Sep 11 02:09:30 2021 -0700

reorder sections

commit 77be6cded0e2d24fc9c132032ae3bf7ae8ed2cf9
Author: Qiantan Hong 
Date:   Sat Sep 11 00:32:26 2021 -0700

bump version number
---
 crdt.el | 362 +---
 1 file changed, 207 insertions(+), 155 deletions(-)

diff --git a/crdt.el b/crdt.el
index 0e15150..c2122d7 100644
--- a/crdt.el
+++ b/crdt.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Qiantan Hong 
 ;; URL: https://code.librehq.com/qhong/crdt.el
 ;; Keywords: collaboration crdt
-;; Version: 0.2.2
+;; Version: 0.2.3
 
 ;; This file is part of GNU Emacs.
 
@@ -291,7 +291,7 @@ Must be used inside CRDT--WITH-INSERTION-INFORMATION."
   network-process
   network-clients
   next-client-id
-  buffer-table
+  buffer-table ; maps buffer network name to buffer
   follow-site-id)
 
 (defvar crdt--inhibit-update nil "When set, don't call CRDT--LOCAL-* on change.
@@ -463,6 +463,14 @@ Also set CRDT--PSEUDO-CURSOR-TABLE to NIL."
 
 (define-error 'crdt-sync-error "CRDT synchronization error")
 
+(defsubst crdt--server-p (&optional session)
+  "Tell if SESSION is running as a server.
+If SESSION is nil, use current CRDT--SESSION."
+  (process-contact
+   (crdt--session-network-process
+(or session crdt--session))
+   :server))
+
 (defmacro crdt--with-recover (&rest body)
   "When any error in BODY occur, signal a CRDT-SYNC-ERROR instead.
 This will hopefully trigger error recovery mechanism when further unwinding 
the stack."
@@ -505,14 +513,6 @@ If we are the server, ERR is the error we shall report to 
client."
 
 ;;; Shared buffer utils
 
-(defsubst crdt--server-p (&optional session)
-  "Tell if SESSION is running as a server.
-If SESSION is nil, use current CRDT--SESSION."
-  (process-contact
-   (crdt--session-network-process
-(or session crdt--session))
-   :server))
-
 (defmacro crdt--with-buffer-name (name &rest body)
   "Find CRDT shared buffer associated with NAME and evaluate BODY in it.
 Any narrowing is temporarily disabled during evaluation of BODY.
@@ -560,22 +560,61 @@ after synchronization is completed."
 
 ;;; Session menu
 
-(defun crdt--session-menu-goto ()
-  "Open the buffer menu for the session under point in CRDT session menu."
-  (interactive)
-  (let ((crdt--session (tabulated-list-get-id)))
-(crdt-list-buffers)))
+(defsubst crdt--get-session-names (server)
+  "Get session names for CRDT sessions (as in CRDT--SESSION-LIST).
+If SERVER is non-NIL, return the list of names for server sessions.
+Otherwise, return the list of names for client sessions."
+  (let (session-names)
+(dolist (session crdt--session-list)
+  (when (eq (crdt--server-p session) server)
+(push (crdt--session-name session) session-names)))
+(nreverse session-names)))
 
-(defun crdt--session-menu-kill ()
-  "Kill the session under point in CRDT session menu."
-  (interactive)
-  (crdt--stop-session (tabulated-list-get-id)))
+(defsubst crdt--get-session (name)
+  "Get the CRDT session object with NAME."
+  (cl-find name crdt--session-list
+   :test 'equal :key #'crdt--session-name))
+
+(defun crdt--read-session (&optional filter)
+  "Prompt for a session name and return the corresponding session.
+FILTER can be nil, 'server or 'client."
+  (crdt--get-session
+   (completing-read (format "Choose a%s session: "
+(cl-ecase filter
+  ((server) " server")
+  ((client) " client")
+  ((nil) "")))
+(cl-ecase filter
+  ((server) (crdt--get-session-names t))
+   

[elpa] externals/taxy 7ecc461 15/42: Fix: (taxy-magit-section-define-column-definer) Use defcustoms

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 7ecc461c7f540ad76b91b9c81b19016184ca0f39
Author: Adam Porter 
Commit: Adam Porter 

Fix: (taxy-magit-section-define-column-definer) Use defcustoms
---
 taxy-magit-section.el | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 4c05b31..9455d7c 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -213,10 +213,12 @@ PLIST may be a plist setting the following options:
 ;; TODO: Add defined columns to customization type for the 
columns-variable.
 `(let ((columns-variable ',columns-variable-name)
   (column-formatters-variable ',column-formatters-variable-name))
-   (defvar ,level-indent-variable-name 0
-,level-indent-docstring)
-   (defvar ,item-indent-variable-name 0
-,item-indent-docstring)
+   (defcustom ,level-indent-variable-name 2
+,level-indent-docstring
+:type 'integer)
+   (defcustom ,item-indent-variable-name 2
+,item-indent-docstring
+:type 'integer)
(defvar ,columns-variable-name nil
 ,columns-variable-docstring)
(defvar ,column-formatters-variable-name nil



[elpa] externals/taxy ac9bc63 16/42: WIP: elispy changes

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit ac9bc63e15a4662a31eaa8b79cdc232594377677
Author: Adam Porter 
Commit: Adam Porter 

WIP: elispy changes
---
 examples/elispy.el | 53 -
 1 file changed, 40 insertions(+), 13 deletions(-)

diff --git a/examples/elispy.el b/examples/elispy.el
index 704f82c..f2e74c0 100644
--- a/examples/elispy.el
+++ b/examples/elispy.el
@@ -103,8 +103,12 @@
 (defvar-local elispy-files nil
   "Files shown in the current Elispy buffer.")
 
+(defvar-local elispy-display-buffer-action nil
+  "Last-used display-buffer-action in the current Elispy buffer.")
+
  Commands
 
+;;;###autoload
 (cl-defun elispy (&key (project (or (project-current)
(cons 'transient default-directory)))
   (keys elispy-taxy-default-keys)
@@ -127,13 +131,14 @@ buffer."
 (cl-labels (;; (heading-face
;;  (depth) (list :inherit (list 'bufler-group 
(bufler-level-face depth
(elisp-file-p (file) (string-match-p (rx ".el" (optional ".gz") 
eos) file))
-   (file-visible-p (file) (not (string-match-p (rx bos ".") file)))
+   (file-visible-p
+(file) (not (string-match-p (rx bos ".") 
(file-name-nondirectory file
(format-item (item) (gethash item format-table))
(make-fn (&rest args)
 (apply #'make-taxy-magit-section
:make #'make-fn
:format-fn #'format-item
-   :heading-indent elispy-taxy-level-indent
+   :heading-indent elispy-level-indent
:visibility-fn visibility-fn
;; :heading-face-fn #'heading-face
args))
@@ -146,6 +151,7 @@ buffer."
(setq-local elispy-taxy-default-keys keys
elispy-directory (project-root project)
elispy-files files
+   elispy-display-buffer-action display-buffer-action
default-directory elispy-directory)
(setf files (cl-reduce #'cl-remove-if-not (list #'elisp-file-p 
#'file-visible-p)
   :initial-value (or files (project-files project))
@@ -165,32 +171,53 @@ buffer."
   (taxy-sort* #'string< #'taxy-name)
   (taxy-sort #'string< #'form-name)))
   (taxy-magit-section-insert-indent-items nil)
+  (inhibit-read-only t)
   format-cons)
  (setf format-cons (taxy-magit-section-format-items
 elispy-columns elispy-column-formatters taxy)
format-table (car format-cons)
column-sizes (cdr format-cons)
-   ;; NOTE: The first column is handled differently.
-   header-line-format (taxy-magit-section-format-header 
column-sizes elispy-column-formatters))
- (let ((inhibit-read-only t))
-   (save-excursion
- (taxy-magit-section-insert taxy :items 'last
-   ;; :initial-depth bufler-taxy-initial-depth
-   ;; :blank-between-depth bufler-taxy-blank-between-depth
-   )
+   header-line-format (taxy-magit-section-format-header
+   column-sizes elispy-column-formatters))
+ (save-excursion
+   (taxy-magit-section-insert taxy :items 'last
+ ;; :blank-between-depth bufler-taxy-blank-between-depth
+ :initial-depth bufler-taxy-initial-depth
   (pop-to-buffer buffer-name display-buffer-action
 
+;;;###autoload
+(cl-defun elispy-buffer (&optional (buffer (current-buffer))
+  &key (display-buffer-action
+(when current-prefix-arg
+  '(display-buffer-in-side-window
+(side . right)
+(window-parameters
+ (window-side . right)
+ (no-delete-other-windows . t))
+  "Show an Elispy view for BUFFER.
+Interactively, with prefix, display in dedicated side window."
+  (interactive)
+  (elispy :files (list (buffer-file-name buffer))
+ :keys (remove 'file elispy-taxy-default-keys)
+ :display-buffer-action display-buffer-action))
+
 (defun elispy-revert (_ignore-auto _noconfirm)
   "Revert current Elispy buffer."
   (interactive)
-  (elispy :display-buffer-action '((display-buffer-same-window
+  (elispy :display-buffer-action (or elispy-display-buffer-action
+'((display-buffer-same-window)
 
 (defun elispy-goto-form ()
   "Go to form at point."
   (interactive)
   (pcase-let* (((map :file :pos) (oref (magit-curren

[elpa] externals/taxy fe190c2 09/42: Add: (taxy-magit-section-define-column-definer)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit fe190c28cb2a176584e0ddd70bca17a32f52c08c
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-magit-section-define-column-definer)
---
 taxy-magit-section.el | 76 +++
 1 file changed, 76 insertions(+)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 5a8e48c..85af4d3 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -168,6 +168,82 @@ Default visibility function for
(_ 'show)))
 (_ nil)))
 
+ Column-based formatting
+
+;; Column-based, or "table"?
+
+;; TODO: Probably, this belongs in a separate library, since it's not
+;; directly related to using taxy or magit-section.  Maybe it could be
+;; called something like `flextab' (or, keeping with the theme,
+;; `tabley').
+
+; Macros
+
+(cl-defmacro taxy-magit-section-define-column-definer (prefix &key 
columns-variable-docstring)
+  "FIXME: Docstring."
+  (let* ((definer-name (intern (format "%s-define-column" prefix)))
+(definer-docstring (format "Define a column formatting function with 
NAME.
+NAME should be a string.  BODY should return a string or nil.  In
+the BODY, `item' is bound to the item being formatted, and `depth' is
+bound to the item's depth in the hierarchy.
+
+PLIST may be a plist setting the following options:
+
+  `:face' is a face applied to the string.
+
+  `:max-width' defines a customization option for the column's
+  maximum width with the specified value as its default: an
+  integer limits the width, while nil does not."))
+(columns-variable-name (intern (format "%s-columns" prefix)))
+(columns-variable-docstring (or columns-variable-docstring
+(format "Columns defined by `%s'."
+definer-name)))
+(column-formatters-variable-name (intern (format 
"%s-column-formatters" prefix)))
+(column-formatters-variable-docstring (format "Column formatters 
defined by `%s'."
+  definer-name)))
+;; TODO: Add defined columns to customization type for the 
columns-variable.
+`(let ((columns-variable ',columns-variable-name)
+  (column-formatters-variable ',column-formatters-variable-name))
+   (defvar ,columns-variable-name nil
+,columns-variable-docstring)
+   (defvar ,column-formatters-variable-name nil
+,column-formatters-variable-docstring)
+   (defmacro ,definer-name (name plist &rest body)
+,definer-docstring
+(declare (indent defun))
+(cl-check-type name string)
+(pcase-let* ((fn-name (intern (concat ,prefix "-column-format-" 
(downcase name
+ ((map (:face face) (:max-width max-width)) plist)
+ (max-width-variable (intern (concat ,prefix "-" name 
"-max-width")))
+ (max-width-docstring (format "Maximum width of the %s 
column." name)))
+  `(progn
+ ,(when (plist-member plist :max-width)
+`(defcustom ,max-width-variable
+   ,max-width
+   ,max-width-docstring
+   :type '(choice (integer :tag "Maximum width")
+  (const :tag "Unlimited width" nil
+ (defun ,fn-name (item depth)
+   (if-let ((string (progn ,@body)))
+   (progn
+ ,(when max-width
+`(when ,max-width-variable
+   (setf string (truncate-string-to-width string 
,max-width-variable nil nil "…"
+ ,(when face
+;; Faces are not defined until load time, while this 
checks type at expansion
+;; time, so we can only test that the argument is a 
symbol, not a face.
+(cl-check-type face symbol ":face must be a face 
symbol")
+`(setf string (propertize string 'face ',face)))
+ string)
+ ""))
+ (setf (map-elt ,column-formatters-variable ,name) #',fn-name)
+ (unless (member ,name (get ',columns-variable 'standard-value))
+   (setf (get ',columns-variable 'standard-value)
+ (append (get ',columns-variable 'standard-value)
+ (list ,name))
+
+; Functions
+
 ;; MAYBE: Consider using spaces with `:align-to', rather than formatting 
strings with indentation, as used by `epkg'
 ;; (see 
).
 ;; I'm not sure which would perform better; I guess that with many lines, 
redisplay might take longer to use the



[elpa] externals/taxy b37dd39 17/42: WIP: Tidy

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit b37dd39fc779bf520b5a5840151505a7dd73d2c8
Author: Adam Porter 
Commit: Adam Porter 

WIP: Tidy
---
 examples/elispy.el | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/examples/elispy.el b/examples/elispy.el
index f2e74c0..5dcd527 100644
--- a/examples/elispy.el
+++ b/examples/elispy.el
@@ -20,14 +20,16 @@
 
 ;;; Commentary:
 
-;; 
+;; This library provides commands that show top-level forms and
+;; definitions found in an Emacs Lisp project or buffer, organized by
+;; file and type.
 
 ;;; Code:
 
 (require 'taxy-magit-section)
 
 (defgroup elispy nil
-  "Show an overview of symbols defined in an Emacs Lisp project."
+  "Show an overview of definitions in an Emacs Lisp project or buffer."
   :group 'emacs-lisp-mode)
 
  Keys
@@ -172,10 +174,9 @@ buffer."
   (taxy-sort #'string< #'form-name)))
   (taxy-magit-section-insert-indent-items nil)
   (inhibit-read-only t)
-  format-cons)
- (setf format-cons (taxy-magit-section-format-items
-elispy-columns elispy-column-formatters taxy)
-   format-table (car format-cons)
+  (format-cons (taxy-magit-section-format-items
+elispy-columns elispy-column-formatters taxy)))
+ (setf format-table (car format-cons)
column-sizes (cdr format-cons)
header-line-format (taxy-magit-section-format-header
column-sizes elispy-column-formatters))



[elpa] externals/taxy 8757b52 10/42: Add: (taxy-magit-section-format-header)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 8757b529025eb0eee876889620da36214c61b6b0
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-magit-section-format-header)
---
 taxy-magit-section.el | 21 +
 1 file changed, 21 insertions(+)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 85af4d3..3e7c57a 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -291,6 +291,27 @@ the items' values for each column."
  table)
 (cons table column-sizes)
 
+(defun taxy-magit-section-format-header (column-sizes formatters)
+  "Return header string for COLUMN-SIZES and FORMATTERS.
+COLUMN-SIZES should be the CDR of the cell returned by
+`taxy-magit-section-format-items'.  FORMATTERS should be the
+variable passed to that function, which see."
+  (let* ((first-column-name (caar column-sizes))
+(first-column-alist (alist-get first-column-name formatters nil nil 
#'equal))
+(first-column-align (pcase-exhaustive (alist-get 'align 
first-column-alist)
+  ((or `nil 'left) "-")
+  ('right ""
+(concat (format (format " %%%s%ss"
+   first-column-align (cdar column-sizes))
+   (caar column-sizes))
+   (cl-loop for (name . size) in (cdr column-sizes)
+for column-alist = (alist-get name formatters nil nil 
#'equal)
+for align = (pcase-exhaustive (alist-get 'align 
column-alist)
+  ((or `nil 'left) "-")
+  ('right ""))
+for spec = (format " %%%s%ss" align size)
+concat (format spec name)
+
  Footer
 
 (provide 'taxy-magit-section)



[elpa] externals/taxy e92ef13 22/42: Comment: Add FIXME

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit e92ef1349d2a7b04960bfd2e74ea78e5e6f9ba47
Author: Adam Porter 
Commit: Adam Porter 

Comment: Add FIXME
---
 examples/deffy.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/examples/deffy.el b/examples/deffy.el
index 9c1668b..1457473 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -259,6 +259,8 @@ Interactively, with prefix, display in dedicated side 
window."
 
 (defvar bookmark-make-record-function)
 
+;; FIXME: Also save and use files list.
+
 (defun deffy--bookmark-make-record ()
   "Return a bookmark record for current Deffy buffer."
   (list (concat "Deffy: %s" deffy-directory)



[elpa] externals/taxy 43b8504 36/42: Docs: Update changelog

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 43b850452bc5d228454e525a235fd793125947a8
Author: Adam Porter 
Commit: Adam Porter 

Docs: Update changelog
---
 README.org |  3 +++
 taxy.info  | 38 ++
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index 075f8dd..995e88e 100644
--- a/README.org
+++ b/README.org
@@ -886,6 +886,9 @@ Note that while =taxy-magit-section.el= is installed with 
the =taxy= package, th
 + Sorting functions:
   + ~taxy-sort-items~ (alias: ~taxy-sort~) sorts the items in a taxy and its 
sub-taxys.
   + ~taxy-sort-taxys~ (alias: ~taxy-sort*~) sorts a taxy's sub-taxys.
++ Defining classification domain-specific languages:
+  + Macro ~taxy-define-key-definer~ defines a key-function-defining macro.
+  + Function ~taxy-make-take-function~ makes a ~:take~ function using a list 
of key functions and a set of classification keys.
 + Table-like, column-based formatting system for ~taxy-magit-section~:
   + Function ~taxy-magit-section-format-items~, which formats items by columns.
   + Variable ~taxy-magit-section-insert-indent-items~, which controls whether 
~taxy-magit-section-insert~ applies indentation to each item.  (Used to disable 
that behavior when items are pre-indented strings, e.g. as formatted by 
~taxy-magit-section-format-items~.)
diff --git a/taxy.info b/taxy.info
index be025f3..2e6dbea 100644
--- a/taxy.info
+++ b/taxy.info
@@ -1047,6 +1047,12 @@ File: README.info,  Node: Additions,  Up: 06-pre
   taxy and its sub-taxys.
 • ‘taxy-sort-taxys’ (alias: ‘taxy-sort*’) sorts a taxy’s
   sub-taxys.
+   • Defining classification domain-specific languages:
+• Macro ‘taxy-define-key-definer’ defines a
+  key-function-defining macro.
+• Function ‘taxy-make-take-function’ makes a ‘:take’ function
+  using a list of key functions and a set of classification
+  keys.
• Table-like, column-based formatting system for
  ‘taxy-magit-section’:
 • Function ‘taxy-magit-section-format-items’, which formats
@@ -1264,22 +1270,22 @@ Node: Magit section36693
 Node: Changelog37372
 Node: 06-pre37564
 Node: Additions37676
-Node: 0538514
-Node: Additions (1)38653
-Node: Fixes39759
-Node: 0439913
-Node: 0340135
-Node: Changes40264
-Node: Fixes (1)40627
-Node: 0241062
-Node: Changes (1)41231
-Node: Additions (2)41523
-Node: Fixes (2)42382
-Node: 0142636
-Node: Development42735
-Node: Copyright assignment42941
-Node: Credits43529
-Node: License43719
+Node: 0538833
+Node: Additions (1)38972
+Node: Fixes40078
+Node: 0440232
+Node: 0340454
+Node: Changes40583
+Node: Fixes (1)40946
+Node: 0241381
+Node: Changes (1)41550
+Node: Additions (2)41842
+Node: Fixes (2)42701
+Node: 0142955
+Node: Development43054
+Node: Copyright assignment43260
+Node: Credits43848
+Node: License44038
 
 End Tag Table
 



[elpa] externals/taxy 0cda29a 38/42: Add: (taxy-magit-section-define-column-definer) Custom-type

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 0cda29accb2c883b25ef48aa02001cd59e4b90ae
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-magit-section-define-column-definer) Custom-type
---
 taxy-magit-section.el | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 4152b90..1c54376 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -212,7 +212,6 @@ PLIST may be a plist setting the following options:
 (column-formatters-variable-name (intern (format 
"%s-column-formatters" prefix)))
 (column-formatters-variable-docstring (format "Column formatters 
defined by `%s'."
   definer-name)))
-;; TODO: Add defined columns to customization type for the 
columns-variable.
 `(let ((columns-variable ',columns-variable-name)
   (column-formatters-variable ',column-formatters-variable-name))
(defcustom ,level-indent-variable-name 2
@@ -266,10 +265,14 @@ PLIST may be a plist setting the following options:
#',fn-name)
  (setf (alist-get 'align (alist-get ,name 
,column-formatters-variable nil nil #'equal))
,(plist-get plist :align))
+ ;; Add column to the columns-variable's standard value.
  (unless (member ,name (get ',columns-variable 'standard-value))
(setf (get ',columns-variable 'standard-value)
  (append (get ',columns-variable 'standard-value)
- (list ,name))
+ (list ,name
+ ;; Add column to the columns-variable's custom type.
+ (cl-pushnew ,name (get ',columns-variable 'custom-type)
+ :test #'equal)))
 
 ; Functions
 



[elpa] externals/taxy updated (233f94c -> ade9a02)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/taxy.

  from  233f94c   Docs: Encromulate examples
   new  468e9b9   Meta: Add .dir-locals.el
   new  0826a47   WIP: taxy-magit-section column/table formatting
   new  5589f50   Comment: Add note
   new  a14fa15   Change: (taxy-magit-section) format-fn = #'prin1-to-string
   new  2f4d9c3   Add: (taxy-magit-section-insert-indent-items)
   new  69872e4   Docs: Update readme
   new  e5b6429   Change: (taxy-magit-section-insert) Use format-fn from 
taxy
   new  7a63677   Add: (taxy-define-key-definer)
   new  fe190c2   Add: (taxy-magit-section-define-column-definer)
   new  8757b52   Add: (taxy-magit-section-format-header)
   new  ae7456f   Add: (taxy-magit-section-define-column-definer) 
Indentation/align
   new  01b9cac   Change/Fix: (taxy-magit-section-define-column-definer) 
Variables
   new  d682c37   Add: (taxy-make-take-function)
   new  ad1cea3   Examples: Add elispy.el
   new  7ecc461   Fix: (taxy-magit-section-define-column-definer) Use 
defcustoms
   new  ac9bc63   WIP: elispy changes
   new  b37dd39   WIP: Tidy
   new  8d108ef   WIP: Rename elispy to deffy
   new  fb11a4f   WIP: (cl-defstruct deffy-def)
   new  2430282   Tidy: Indentation
   new  6703d8b   WIP: Use deffy-def in -RET
   new  e92ef13   Comment: Add FIXME
   new  16d4e50   Fix/Tidy: (deffy-buffer)
   new  d456f88   Add: (deffy-side-window-action)
   new  3787f4f   Fix: (deffy-buffer) Ensure file name
   new  421cfbf   Add: (deffy-project)
   new  45372f6   Fix: (taxy-magit-section-format-items) Width
   new  f8558ab   Fix: (deffy-project) Arguments
   new  a1f9081   Comment: Add TODOs
   new  4fd9565   Fix: (deffy) Bookmarking deffy-files
   new  5020b43   Change: (deffy-goto-form) Bug #50576 is fixed.
   new  a672c8e   Fix: (taxy-make-take-function) Allow symbol args to 
functions
   new  a7ff557   Docs: Document new things
   new  9f9cfef   Docs: Reorder sections
   new  8b7a95a   Docs: Clarify
   new  43b8504   Docs: Update changelog
   new  956efdd   Comment: Update TODO
   new  0cda29a   Add: (taxy-magit-section-define-column-definer) 
Custom-type
   new  5a16dd0   Comment: Add TODO
   new  5227980   Docs: (taxy-magit-section-define-column-definer) Add 
docstring
   new  45cdf29   Docs: Mention deffy in changelog
   new  ade9a02   Merge branch 'wip/magit-section-column-formatting'


Summary of changes:
 .dir-locals.el|   4 +
 README.org| 352 
 examples/deffy.el | 300 +++
 taxy-magit-section.el | 258 ---
 taxy.el   |  86 +
 taxy.info | 480 --
 6 files changed, 1172 insertions(+), 308 deletions(-)
 create mode 100644 .dir-locals.el
 create mode 100644 examples/deffy.el



[elpa] externals/taxy 5589f50 03/42: Comment: Add note

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 5589f509f64d8ee2b9ad2f915bc4ceb867fee087
Author: Adam Porter 
Commit: Adam Porter 

Comment: Add note
---
 taxy-magit-section.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 1532918..02542b0 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -164,6 +164,11 @@ Default visibility function for
(_ 'show)))
 (_ nil)))
 
+;; MAYBE: Consider using spaces with `:align-to', rather than formatting 
strings with indentation, as used by `epkg'
+;; (see 
).
+;; I'm not sure which would perform better; I guess that with many lines, 
redisplay might take longer to use the
+;; display properties for alignment than just having pre-aligned lines of text.
+
 (defun taxy-magit-section-format-items (columns formatters taxy)
   "Return a cons (table . column-sizes) for COLUMNS, FORMATTERS, and TAXY.
 COLUMNS is a list of column names, each of which should have an



[elpa] externals/taxy e5b6429 07/42: Change: (taxy-magit-section-insert) Use format-fn from taxy

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit e5b6429a9e32a7cb70177a6ea317b587ec48d6ba
Author: Adam Porter 
Commit: Adam Porter 

Change: (taxy-magit-section-insert) Use format-fn from taxy
---
 taxy-magit-section.el | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index f25f5af..5a8e48c 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -93,7 +93,7 @@ which blank lines are inserted between sections at that 
level."
   (let* ((magit-section-set-visibility-hook
   (cons #'taxy-magit-section-visibility 
magit-section-set-visibility-hook)))
 (cl-labels ((insert-item
- (item taxy format-fn depth)
+ (item taxy depth)
  (magit-insert-section (magit-section item)
(magit-insert-section-body
 ;; This is a tedious way to give the indent
@@ -103,8 +103,7 @@ which blank lines are inserted between sections at that 
level."
 ;; something was wrong about the properties, and
 ;; `magit-section' didn't navigate the sections
 ;; properly anymore.
-(let* (
-(formatted (funcall format-fn item))
+(let* ((formatted (funcall (taxy-magit-section-format-fn 
taxy) item))
(indent-size (if (or (not 
taxy-magit-section-insert-indent-items)
 (< depth 0))
 0
@@ -117,10 +116,6 @@ which blank lines are inserted between sections at that 
level."
   (insert indent-string formatted "\n")
 (insert-taxy
  (taxy depth) (let ((magit-section-set-visibility-hook 
magit-section-set-visibility-hook)
-(format-fn (cl-typecase taxy
- (taxy-magit-section
-  
(taxy-magit-section-format-fn taxy))
- (t (lambda (o) (format "%s" 
o)
 (taxy-magit-section-heading-indent 
(taxy-magit-section-heading-indent taxy))
 (taxy-magit-section-item-indent 
(taxy-magit-section-item-indent taxy)))
 (cl-typecase taxy
@@ -142,12 +137,12 @@ which blank lines are inserted between sections at that 
level."
   (magit-insert-section-body
 (when (eq 'first items)
   (dolist (item (taxy-items taxy))
-(insert-item item taxy format-fn 
depth)))
+(insert-item item taxy depth)))
 (dolist (taxy (taxy-taxys taxy))
   (insert-taxy taxy (1+ depth)))
 (when (eq 'last items)
   (dolist (item (taxy-items taxy))
-(insert-item item taxy format-fn 
depth
+(insert-item item taxy depth
   (when (<= depth blank-between-depth)
 (insert "\n"))
   (magit-insert-section (magit-section)



[elpa] externals/taxy 01b9cac 12/42: Change/Fix: (taxy-magit-section-define-column-definer) Variables

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 01b9cacf910b77c2ac532ff9cb8419c5f856ec8b
Author: Adam Porter 
Commit: Adam Porter 

Change/Fix: (taxy-magit-section-define-column-definer) Variables
---
 taxy-magit-section.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 1bf7e26..e1c1cfe 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -213,9 +213,9 @@ PLIST may be a plist setting the following options:
 ;; TODO: Add defined columns to customization type for the 
columns-variable.
 `(let ((columns-variable ',columns-variable-name)
   (column-formatters-variable ',column-formatters-variable-name))
-   (defvar ,level-indent-variable-name nil
+   (defvar ,level-indent-variable-name 0
 ,level-indent-docstring)
-   (defvar ,item-indent-variable-name nil
+   (defvar ,item-indent-variable-name 0
 ,item-indent-docstring)
(defvar ,columns-variable-name nil
 ,columns-variable-docstring)
@@ -230,7 +230,7 @@ PLIST may be a plist setting the following options:
  (level-indent-variable-name ',level-indent-variable-name)
  (item-indent-variable-name ',item-indent-variable-name)
  ((map (:face face) (:max-width max-width)) plist)
- (max-width-variable (intern (concat ,prefix "-" name 
"-max-width")))
+ (max-width-variable (intern (concat ,prefix "-column-" 
name "-max-width")))
  (max-width-docstring (format "Maximum width of the %s 
column." name)))
   `(progn
  ,(when (plist-member plist :max-width)



[elpa] externals/taxy ad1cea3 14/42: Examples: Add elispy.el

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit ad1cea3383dd1d4aa38b5e47a212f882cc8d7eb3
Author: Adam Porter 
Commit: Adam Porter 

Examples: Add elispy.el
---
 examples/elispy.el| 244 ++
 taxy-magit-section.el |   4 +-
 taxy.el   |   5 +-
 3 files changed, 249 insertions(+), 4 deletions(-)

diff --git a/examples/elispy.el b/examples/elispy.el
new file mode 100644
index 000..704f82c
--- /dev/null
+++ b/examples/elispy.el
@@ -0,0 +1,244 @@
+;;; elispy.el --- Show symbols defined in an Elisp project  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Free Software Foundation, Inc.
+
+;; Author: Adam Porter 
+;; Keywords: convenience, lisp
+
+;; 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 'taxy-magit-section)
+
+(defgroup elispy nil
+  "Show an overview of symbols defined in an Emacs Lisp project."
+  :group 'emacs-lisp-mode)
+
+ Keys
+
+(taxy-define-key-definer elispy-define-key elispy-keys "elispy"
+  "FIXME: Docstring.")
+
+(elispy-define-key file ()
+  (file-relative-name (plist-get item :file) elispy-directory))
+
+(elispy-define-key type ()
+  (let* ((form (plist-get item :form))
+(type (pcase form
+(`(,(or 'defun 'cl-defun) . ,_)
+ (if (cl-find-if (lambda (form)
+   (pcase form
+ (`(interactive . ,_) t)))
+ form)
+ 'command
+   'function))
+(`(,(or 'defmacro 'cl-defmacro) . ,_)
+ 'macro)
+(`(,car . ,_) car
+(when type
+  (format "%s" type
+
+(defvar elispy-taxy-default-keys
+  '(type file))
+
+ Columns
+
+(taxy-magit-section-define-column-definer "elispy")
+
+(elispy-define-column "Definition" (:max-width 45 :face 
font-lock-function-name-face)
+  (let ((form-defines (pcase-exhaustive (cadr (plist-get item :form))
+   ((and (pred atom) it) it)
+   (`(quote ,it) it)
+   (`(,it . ,_) it
+(format "%s" form-defines)))
+
+(elispy-define-column "Type" (:max-width 25 :face font-lock-type-face)
+  (format "%s" (car (plist-get item :form
+
+(elispy-define-column "Docstring" (:max-width nil :face font-lock-doc-face)
+  (when-let ((docstring
+ (pcase (plist-get item :form)
+   (`(,(or 'defun 'cl-defun 'defmacro 'cl-defmacro) ,_name ,_args
+  ,(and (pred stringp) docstring) . ,_)
+docstring)
+   (`(,(or 'defvar 'defvar-local 'defcustom) ,_name ,_value
+  ,(and (pred stringp) docstring) . ,_)
+docstring)
+   (_ ;; Use the first string found, if any.
+(cl-find-if #'stringp (plist-get item :form))
+(replace-regexp-in-string "\n" "  " docstring)))
+
+(unless elispy-columns
+  ;; TODO: Automate this or document it
+  (setq-default elispy-columns
+   (get 'elispy-columns 'standard-value)))
+
+ Variables
+
+(defvar elispy-mode-map
+  (let ((map (make-sparse-keymap)))
+(define-key map (kbd "RET") #'elispy-RET)
+(define-key map [mouse-1] #'elispy-mouse-1)
+map))
+
+(defvar-local elispy-directory nil
+  "Directory relative to which filenames should be expanded.")
+
+(defvar-local elispy-files nil
+  "Files shown in the current Elispy buffer.")
+
+ Commands
+
+(cl-defun elispy (&key (project (or (project-current)
+   (cons 'transient default-directory)))
+  (keys elispy-taxy-default-keys)
+  (files elispy-files)
+  (buffer-name (format "*Elispy: %s*"
+   (if files
+   (string-join (mapcar 
#'file-relative-name files) ", ")
+ (file-name-nondirectory
+  (directory-file-name 
(project-root project))
+  visibility-fn display-buffer-action)
+  "Show definitions defined in PROJECT or FILES.
+Interactively, with PREFIX, show only definitions in current
+buffer."
+  (interactive (list :files (when current-prefix-arg
+ (list (buffer-file-name)

[elpa] externals/taxy 45372f6 27/42: Fix: (taxy-magit-section-format-items) Width

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 45372f6ece954d153e7c35883da89561a190b8b2
Author: Adam Porter 
Commit: Adam Porter 

Fix: (taxy-magit-section-format-items) Width

+ Use string-width instead of length.
+ Don't format again, because the value should be a string.
+ Don't add 1 to the column size.  (Not sure why that was done before,
  but it's not needed now.)
---
 taxy-magit-section.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 9455d7c..ce07245 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -295,7 +295,7 @@ the items' values for each column."
(value (funcall fn item depth))
(current-column-size (or (map-elt column-sizes 
column-name) 0)))
   (setf (map-elt column-sizes column-name)
-(max current-column-size (1+ (length (format "%s" 
value)
+(max current-column-size (string-width value)))
   (setf (map-elt column-aligns column-name)
 (or (alist-get 'align column-alist)
 'left))



[elpa] externals/taxy 9f9cfef 34/42: Docs: Reorder sections

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 9f9cfef1677e2e3fc5d9288f07271ee1566d37c3
Author: Adam Porter 
Commit: Adam Porter 

Docs: Reorder sections
---
 README.org | 238 +--
 taxy.info  | 340 ++---
 2 files changed, 289 insertions(+), 289 deletions(-)

diff --git a/README.org b/README.org
index 529f475..b1988f9 100644
--- a/README.org
+++ b/README.org
@@ -424,10 +424,10 @@ Some example applications may be found in the 
[[file:examples/README.org][exampl
 :TOC:  :include descendants :depth 1 :ignore (descendants)
 :END:
 :CONTENTS:
-- [[#dynamic-taxys][Dynamic taxys]]
 - [[#reusable-taxys][Reusable taxys]]
 - [[#threading-macros][Threading macros]]
 - [[#modifying-filled-taxys][Modifying filled taxys]]
+- [[#dynamic-taxys][Dynamic taxys]]
 - [[#magit-section][Magit section]]
 :END:
 
@@ -449,6 +449,124 @@ After defining a taxy, call ~taxy-fill~ with it and a 
list of objects to fill th
 
 To return a taxy in a more human-readable format (with only relevant fields 
included), use ~taxy-plain~.  You may also use ~taxy-mapcar~ to replace items 
in a taxy with, e.g. a more useful representation.
 
+** Reusable taxys
+
+Since taxys are structs, they may be stored in variables and used in other 
structs (being sure to copy the root taxy with ~taxy-emptied~ before filling).  
For example, this shows using =taxy= to classify Matrix rooms in 
[[https://github.com/alphapapa/ement.el][Ement.el]]:
+
+#+BEGIN_SRC elisp
+  (defun ement-roomy-buffer (room)
+(alist-get 'buffer (ement-room-local room)))
+
+  (defvar ement-roomy-unread
+(make-taxy :name "Unread"
+   :predicate (lambda (room)
+(buffer-modified-p (ement-roomy-buffer room)
+
+  (defvar ement-roomy-opened
+(make-taxy :name "Opened"
+   :description "Rooms with buffers"
+   :predicate #'ement-roomy-buffer
+   :taxys (list ement-roomy-unread
+(make-taxy
+
+  (defvar ement-roomy-closed
+(make-taxy :name "Closed"
+   :description "Rooms without buffers"
+   :predicate (lambda (room)
+(not (ement-roomy-buffer room)
+
+  (defvar ement-roomy
+(make-taxy
+ :name "Ement Rooms"
+ :taxys (list (make-taxy
+   :name "Direct"
+   :description "Direct messaging rooms"
+   :predicate (lambda (room)
+(ement-room--direct-p room ement-session))
+   :taxys (list ement-roomy-opened
+ement-roomy-closed))
+  (make-taxy
+   :name "Non-direct"
+   :description "Group chat rooms"
+   :taxys (list ement-roomy-opened
+ement-roomy-closed)
+#+END_SRC
+
+Note how the taxys defined in the first three variables are used in subsequent 
taxys.  As well, the ~ement-roomy-opened~ taxy has an "anonymous" taxy, which 
collects any rooms that aren't collected by its sibling taxy (otherwise those 
objects would be collected into the parent, "Opened" taxy, which may not always 
be the most useful way to present the objects).
+
+Using those defined taxys, we then fill the ~ement-roomy~ taxy with all of the 
rooms in the user's session, and then use ~taxy-mapcar~ to replace the room 
structs with useful representations for display:
+
+#+BEGIN_SRC elisp
+  (taxy-plain
+   (taxy-mapcar (lambda (room)
+  (list (ement-room--room-display-name room)
+(ement-room-id room)))
+ (taxy-fill (ement-session-rooms ement-session)
+(taxy-emptied ement-roomy
+#+END_SRC
+
+This produces:
+
+#+BEGIN_SRC elisp
+  ("Ement Rooms"
+   (("Direct" "Direct messaging rooms"
+ (("Opened" "Rooms with buffers"
+   (("Unread"
+ (("Lars Ingebrigtsen" "!nope:gnus.org")
+  ("Closed" "Rooms without buffers"
+   (("John Wiegley" "!not-really:newartisans.com")
+("Eli Zaretskii" "!im-afraid-not:gnu.org")
+("Non-direct" "Group chat rooms"
+ (("Opened" "Rooms with buffers"
+   (("Unread"
+ (("Emacs" "!WfZsmtnxbxTdoYPkaT:greyface.org")
+  ("#emacs" "!KuaCUVGoCiunYyKEpm:libera.chat")))
+;; The non-unread buffers in the "anonymous" taxy.
+((("magit/magit" "!HZYimOcmEAsAxOcgpE:gitter.im")
+  ("Ement.el" "!NicAJNwJawmHrEhqZs:matrix.org")
+  ("#emacsconf" "!UjTTDnYmSAslLTtMCF:libera.chat")
+  ("Emacs Matrix Client" "!ZrZoyXEyFrzcBZKNis:matrix.org")
+  ("org-mode" "!rUhEinythPhVTdddsb:matrix.org")
+  ("This Week in Matrix (TWIM)" "!xYvNcQPhnkrdUmYczI:matrix.org")
+  ("Closed" "Rooms without buffers"
+   (("#matrix-spec" "!NasysSDfxKxZBzJJoE:matrix.org")
+("#commonlisp" "!IiGsrmKRHzpupHRaKS:libera.chat")
+("Matrix HQ" "!OGEhHVWSdvArJ

[elpa] externals/taxy ade9a02 42/42: Merge branch 'wip/magit-section-column-formatting'

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit ade9a02b25dd100c41c6d96332a829e498f86da1
Merge: 468e9b9 45cdf29
Author: Adam Porter 
Commit: Adam Porter 

Merge branch 'wip/magit-section-column-formatting'
---
 README.org| 352 
 examples/deffy.el | 300 +++
 taxy-magit-section.el | 258 ---
 taxy.el   |  86 +
 taxy.info | 480 --
 5 files changed, 1168 insertions(+), 308 deletions(-)

diff --git a/README.org b/README.org
index c5ed5f3..53d9683 100644
--- a/README.org
+++ b/README.org
@@ -424,10 +424,10 @@ Some example applications may be found in the 
[[file:examples/README.org][exampl
 :TOC:  :include descendants :depth 1 :ignore (descendants)
 :END:
 :CONTENTS:
-- [[#dynamic-taxys][Dynamic taxys]]
 - [[#reusable-taxys][Reusable taxys]]
 - [[#threading-macros][Threading macros]]
 - [[#modifying-filled-taxys][Modifying filled taxys]]
+- [[#dynamic-taxys][Dynamic taxys]]
 - [[#magit-section][Magit section]]
 :END:
 
@@ -449,6 +449,124 @@ After defining a taxy, call ~taxy-fill~ with it and a 
list of objects to fill th
 
 To return a taxy in a more human-readable format (with only relevant fields 
included), use ~taxy-plain~.  You may also use ~taxy-mapcar~ to replace items 
in a taxy with, e.g. a more useful representation.
 
+** Reusable taxys
+
+Since taxys are structs, they may be stored in variables and used in other 
structs (being sure to copy the root taxy with ~taxy-emptied~ before filling).  
For example, this shows using =taxy= to classify Matrix rooms in 
[[https://github.com/alphapapa/ement.el][Ement.el]]:
+
+#+BEGIN_SRC elisp
+  (defun ement-roomy-buffer (room)
+(alist-get 'buffer (ement-room-local room)))
+
+  (defvar ement-roomy-unread
+(make-taxy :name "Unread"
+   :predicate (lambda (room)
+(buffer-modified-p (ement-roomy-buffer room)
+
+  (defvar ement-roomy-opened
+(make-taxy :name "Opened"
+   :description "Rooms with buffers"
+   :predicate #'ement-roomy-buffer
+   :taxys (list ement-roomy-unread
+(make-taxy
+
+  (defvar ement-roomy-closed
+(make-taxy :name "Closed"
+   :description "Rooms without buffers"
+   :predicate (lambda (room)
+(not (ement-roomy-buffer room)
+
+  (defvar ement-roomy
+(make-taxy
+ :name "Ement Rooms"
+ :taxys (list (make-taxy
+   :name "Direct"
+   :description "Direct messaging rooms"
+   :predicate (lambda (room)
+(ement-room--direct-p room ement-session))
+   :taxys (list ement-roomy-opened
+ement-roomy-closed))
+  (make-taxy
+   :name "Non-direct"
+   :description "Group chat rooms"
+   :taxys (list ement-roomy-opened
+ement-roomy-closed)
+#+END_SRC
+
+Note how the taxys defined in the first three variables are used in subsequent 
taxys.  As well, the ~ement-roomy-opened~ taxy has an "anonymous" taxy, which 
collects any rooms that aren't collected by its sibling taxy (otherwise those 
objects would be collected into the parent, "Opened" taxy, which may not always 
be the most useful way to present the objects).
+
+Using those defined taxys, we then fill the ~ement-roomy~ taxy with all of the 
rooms in the user's session, and then use ~taxy-mapcar~ to replace the room 
structs with useful representations for display:
+
+#+BEGIN_SRC elisp
+  (taxy-plain
+   (taxy-mapcar (lambda (room)
+  (list (ement-room--room-display-name room)
+(ement-room-id room)))
+ (taxy-fill (ement-session-rooms ement-session)
+(taxy-emptied ement-roomy
+#+END_SRC
+
+This produces:
+
+#+BEGIN_SRC elisp
+  ("Ement Rooms"
+   (("Direct" "Direct messaging rooms"
+ (("Opened" "Rooms with buffers"
+   (("Unread"
+ (("Lars Ingebrigtsen" "!nope:gnus.org")
+  ("Closed" "Rooms without buffers"
+   (("John Wiegley" "!not-really:newartisans.com")
+("Eli Zaretskii" "!im-afraid-not:gnu.org")
+("Non-direct" "Group chat rooms"
+ (("Opened" "Rooms with buffers"
+   (("Unread"
+ (("Emacs" "!WfZsmtnxbxTdoYPkaT:greyface.org")
+  ("#emacs" "!KuaCUVGoCiunYyKEpm:libera.chat")))
+;; The non-unread buffers in the "anonymous" taxy.
+((("magit/magit" "!HZYimOcmEAsAxOcgpE:gitter.im")
+  ("Ement.el" "!NicAJNwJawmHrEhqZs:matrix.org")
+  ("#emacsconf" "!UjTTDnYmSAslLTtMCF:libera.chat")
+  ("Emacs Matrix Client" "!ZrZoyXEyFrzcBZKNis:matrix.org")
+  ("org-mode" "!rUhEinythPhVTdddsb:matrix.org")
+  ("This Week in Matrix (TWIM)" "!xYvNcQPhnkrdUmYczI:

[elpa] externals/taxy a672c8e 32/42: Fix: (taxy-make-take-function) Allow symbol args to functions

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit a672c8e347b405a14928c4bda12cada95221c12c
Author: Adam Porter 
Commit: Adam Porter 

Fix: (taxy-make-take-function) Allow symbol args to functions
---
 taxy.el | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/taxy.el b/taxy.el
index 231fa27..0bd2160 100644
--- a/taxy.el
+++ b/taxy.el
@@ -336,8 +336,11 @@ defined with a definer defined by 
`taxy-define-key-definer')."
(funcall fn buffer))
   (or ,name ""
 (`(,(and (pred symbolp) fn)
-   . ,(and args (guard (cl-typecase (car args)
- ((or keyword (and atom (not 
symbol)))
+   . ,(and args (guard (pcase (car args)
+ ((or (pred keywordp)
+  (and (pred atom)
+   (pred (not 
symbolp)))
+ `(quote ,_))
   t)
  ;; Key with args: replace with a lambda that
  ;; calls that key's function with given args.



[elpa] externals/taxy a7ff557 33/42: Docs: Document new things

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit a7ff5573aead56286177038d2b37aba4489afc59
Author: Adam Porter 
Commit: Adam Porter 

Docs: Document new things
---
 README.org | 113 
 taxy.el|   2 -
 taxy.info  | 192 ++---
 3 files changed, 270 insertions(+), 37 deletions(-)

diff --git a/README.org b/README.org
index 8eebebe..529f475 100644
--- a/README.org
+++ b/README.org
@@ -456,6 +456,7 @@ To return a taxy in a more human-readable format (with only 
relevant fields incl
 :CONTENTS:
 - [[#multi-level-dynamic-taxys][Multi-level dynamic taxys]]
 - [[#chains-of-independent-multi-level-dynamic-taxys]["Chains" of independent, 
multi-level dynamic taxys]]
+- [[#defining-a-classification-domain-specific-language][Defining a 
classification domain-specific language]]
 :END:
 
 You may not always know in advance what taxonomy a set of objects fits into, 
so =taxy= lets you add taxys dynamically by using the ~:take~ function to add a 
taxy when an object is "taken into" a parent taxy's items.  For example, you 
could dynamically classify buffers by their major mode like so:
@@ -623,6 +624,118 @@ Now let's fill the taxy with the sports and format it:
("Soccer" "Tennis" "Football" "Baseball"))
 #+END_SRC
 
+*** Defining a classification domain-specific language
+
+When writing a larger Taxy-based application, it may be necessary to define a 
number of key functions that would be unwieldy to manage in a ~cl-labels~ form. 
 For this case, Taxy provides the macro ~taxy-define-key-definer~ to easily 
define Taxy key functions in an application library.  Those functions are then 
passed to the function ~taxy-make-take-function~ at runtime, along with a list 
of keys being used to classify items.  Using these allows key functions to be 
defined in top-level f [...]
+
+Extending the previous ~sporty~ example, let's redefine its key functions 
using ~taxy-define-key-definer~:
+
+#+begin_src elisp :exports code :results silent :lexical t
+  (taxy-define-key-definer sporty-define-key
+sporty-keys "sporty"
+"Define a `sporty' key function.")
+
+  (sporty-define-key disc-based ()
+(if (member 'disc (sport-uses item))
+"Disc-based"
+  "Non-disc-based"))
+
+  (sporty-define-key uses (&optional thing)
+(pcase thing
+  (`nil (sport-uses item))
+  (_ (when (cl-typecase (sport-uses item)
+ (symbol (equal thing (sport-uses item)))
+ (list (member thing (sport-uses item
+   thing
+
+  (sporty-define-key venue (&optional place)
+(pcase place
+  (`nil (sport-venue item))
+  (_ (when (equal place (sport-venue item))
+   (sport-venue item)
+#+end_src
+
+Now we'll define the default keys to use when classifying items.  This list is 
equivalent to the one passed to ~taxy-take-keyed~ in the previous, "Chains" 
example.
+
+#+begin_src elisp :exports code :results silent :lexical t
+  (defvar sporty-default-keys
+'(
+  ((venue 'outdoor)
+   disc-based)
+
+  ((venue 'indoor)
+   (uses 'ball)
+   (uses 'disc)
+   (uses 'glove)
+   (uses 'racket
+#+end_src
+
+Finally, rather than using a pre-made taxy struct, we make one at runtime, 
making the ~:take~ function with ~taxy-make-take-function~.
+
+#+begin_src elisp :exports both :results code :lexical t
+  (let ((taxy (make-taxy
+   :name "Sporty (DSL)"
+   :take (taxy-make-take-function sporty-default-keys
+  sporty-keys
+(thread-last taxy
+  (taxy-fill sports)
+  (taxy-mapcar #'sport-name)
+  taxy-plain))
+#+end_src
+
+Which gives us:
+
+#+RESULTS:
+#+begin_src elisp
+  ("Sporty (DSL)"
+   ((indoor
+ ((ball
+   ("Volleyball" "Basketball")
+   ((glove
+ ("Handball"))
+(racket
+ ("Racquetball"))
+(outdoor
+ (("Disc-based"
+   ("Ultimate" "Disc golf"))
+  ("Non-disc-based"
+   ("Soccer" "Tennis" "Football" "Baseball"))
+#+end_src
+
+As you can see, the result is the same as that in the previous example, but 
we've defined a kind of DSL for grouping sports in a modular, extendable way.
+
+This also allows the grouping keys to be easily changed at runtime, producing 
a different result.  For example, we could group sports by, first, whether they 
use a ball, and then by venue.  Let's do this in a function so that users can 
pass their own list of keys:
+
+#+begin_src elisp :exports both :results code :lexical t
+  (cl-defun sporty-classify (sports &key (keys sporty-default-keys))
+(declare (indent defun))
+(let* ((taxy (make-taxy
+  :name "Sporty (DSL)"
+  :take (taxy-make-take-function keys
+ sporty-keys
+  (thread-last taxy
+(taxy-fill sports)
+(taxy-mapcar #'sport-name)
+taxy-plain)))
+
+  (sporty-c

[elpa] externals/taxy 0826a47 02/42: WIP: taxy-magit-section column/table formatting

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 0826a47a19a05c556881a10c3067167accb0a1b8
Author: Adam Porter 
Commit: Adam Porter 

WIP: taxy-magit-section column/table formatting
---
 taxy-magit-section.el | 73 +++
 1 file changed, 62 insertions(+), 11 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 49a573a..1532918 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -32,8 +32,14 @@
 
  Variables
 
-(defvar taxy-magit-section-indent 2
-  "Default indentation per level.")
+(defvar taxy-magit-section-heading-indent 2
+  "Default heading indentation per level.")
+
+(defvar taxy-magit-section-item-indent 2
+  "Default item indentation per level.")
+
+(defvar taxy-magit-section-depth nil
+  "Bound to current depth around calls to a taxy's format-fn.")
 
  Customization
 
@@ -58,8 +64,9 @@
   ;; inheritance easier (and/or use EIEIO, but that would reduce
   ;; performance, since slot accessors can't be optimized).
   (visibility-fn #'taxy-magit-section-visibility)
-  (heading-face (lambda (_depth) 'magit-section-heading))
-  (indent 2)
+  (heading-face-fn (lambda (_depth) 'magit-section-heading))
+  (heading-indent 2)
+  (item-indent 2)
   format-fn)
 
  Commands
@@ -88,10 +95,11 @@ which blank lines are inserted between sections at that 
level."
 ;; something was wrong about the properties, and
 ;; `magit-section' didn't navigate the sections
 ;; properly anymore.
-(let* ((formatted (funcall format-fn item))
+(let* ((taxy-magit-section-depth depth)
+(formatted (funcall format-fn item))
(indent-size (pcase depth
((pred (> 0)) 0)
-   (_ (* depth 
taxy-magit-section-indent
+   (_ (* depth 
taxy-magit-section-item-indent
 (indent-string (make-string indent-size ? )))
   (add-text-properties 0 (length indent-string)
(text-properties-at 0 formatted)
@@ -103,7 +111,8 @@ which blank lines are inserted between sections at that 
level."
  (taxy-magit-section
   
(taxy-magit-section-format-fn taxy))
  (t (lambda (o) (format "%s" 
o)
-(taxy-magit-section-indent 
(taxy-magit-section-indent taxy)))
+(taxy-magit-section-heading-indent 
(taxy-magit-section-heading-indent taxy))
+(taxy-magit-section-item-indent 
(taxy-magit-section-item-indent taxy)))
 (cl-typecase taxy
   (taxy-magit-section
(when (taxy-magit-section-visibility-fn 
taxy)
@@ -113,9 +122,9 @@ which blank lines are inserted between sections at that 
level."
 (make-string (* (pcase depth
   ((pred (> 0)) 0)
   (_ depth))
-(taxy-magit-section-indent 
taxy)) ? )
+
(taxy-magit-section-heading-indent taxy)) ? )
 (propertize (taxy-name taxy)
-'face (funcall 
(taxy-magit-section-heading-face taxy) depth))
+'face (funcall 
(taxy-magit-section-heading-face-fn taxy) depth))
 (format " (%s%s)"
 (if (taxy-description taxy)
 (concat (taxy-description 
taxy) " ")
@@ -124,12 +133,12 @@ which blank lines are inserted between sections at that 
level."
   (magit-insert-section-body
 (when (eq 'first items)
   (dolist (item (taxy-items taxy))
-(insert-item item format-fn depth)))
+(insert-item item format-fn (1+ 
depth
 (dolist (taxy (taxy-taxys taxy))
   (insert-taxy taxy (1+ depth)))
 (when (eq 'last items)
   (dolist (item (taxy-items taxy))
-(insert-item item format-fn depth
+(insert-item item format-fn (1+ 
depth)
   (when (<= 

[elpa] externals/taxy 468e9b9 01/42: Meta: Add .dir-locals.el

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 468e9b9f168efe9328823d59fdd999075ff2f4d5
Author: Adam Porter 
Commit: Adam Porter 

Meta: Add .dir-locals.el
---
 .dir-locals.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 000..1f7c4b7
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,4 @@
+;;; Directory Local Variables
+;;; For more information see (info "(emacs) Directory Variables")
+
+((emacs-lisp-mode . ((indent-tabs-mode . nil



[elpa] externals/taxy a14fa15 04/42: Change: (taxy-magit-section) format-fn = #'prin1-to-string

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit a14fa15e534a626ad9cec2edec6de033662ec42c
Author: Adam Porter 
Commit: Adam Porter 

Change: (taxy-magit-section) format-fn = #'prin1-to-string

Helpful as a default when items are already strings.
---
 taxy-magit-section.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 02542b0..b592ecb 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -67,7 +67,7 @@
   (heading-face-fn (lambda (_depth) 'magit-section-heading))
   (heading-indent 2)
   (item-indent 2)
-  format-fn)
+  (format-fn #'prin1-to-string))
 
  Commands
 



[elpa] externals/taxy 2f4d9c3 05/42: Add: (taxy-magit-section-insert-indent-items)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 2f4d9c3cc1140c2077d2a06e9cd5daf1e31a48d1
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-magit-section-insert-indent-items)
---
 taxy-magit-section.el | 31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index b592ecb..f25f5af 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -41,6 +41,14 @@
 (defvar taxy-magit-section-depth nil
   "Bound to current depth around calls to a taxy's format-fn.")
 
+(defvar taxy-magit-section-insert-indent-items t
+  ;; NOTE: I hate to use a variable to control this, but it seems like
+  ;; the cleanest way for now.
+  "Whether to indent items in `taxy-magit-section-insert'.
+May be disabled when `taxy-magit-section-insert' should not
+indent items itself, e.g. if items are pre-indented.  Note that
+this does not disable indentation of section headings.")
+
  Customization
 
 
@@ -85,7 +93,7 @@ which blank lines are inserted between sections at that 
level."
   (let* ((magit-section-set-visibility-hook
   (cons #'taxy-magit-section-visibility 
magit-section-set-visibility-hook)))
 (cl-labels ((insert-item
- (item format-fn depth)
+ (item taxy format-fn depth)
  (magit-insert-section (magit-section item)
(magit-insert-section-body
 ;; This is a tedious way to give the indent
@@ -95,11 +103,13 @@ which blank lines are inserted between sections at that 
level."
 ;; something was wrong about the properties, and
 ;; `magit-section' didn't navigate the sections
 ;; properly anymore.
-(let* ((taxy-magit-section-depth depth)
+(let* (
 (formatted (funcall format-fn item))
-   (indent-size (pcase depth
-   ((pred (> 0)) 0)
-   (_ (* depth 
taxy-magit-section-item-indent
+   (indent-size (if (or (not 
taxy-magit-section-insert-indent-items)
+(< depth 0))
+0
+  (+ (* depth 
(taxy-magit-section-heading-indent taxy))
+ (taxy-magit-section-item-indent 
taxy
 (indent-string (make-string indent-size ? )))
   (add-text-properties 0 (length indent-string)
(text-properties-at 0 formatted)
@@ -119,10 +129,9 @@ which blank lines are inserted between sections at that 
level."
  (push (taxy-magit-section-visibility-fn 
taxy) magit-section-set-visibility-hook
 (magit-insert-section (magit-section taxy)
   (magit-insert-heading
-(make-string (* (pcase depth
-  ((pred (> 0)) 0)
-  (_ depth))
-
(taxy-magit-section-heading-indent taxy)) ? )
+(make-string (* (if (< depth 0) 0 depth)
+
(taxy-magit-section-heading-indent taxy))
+? )
 (propertize (taxy-name taxy)
 'face (funcall 
(taxy-magit-section-heading-face-fn taxy) depth))
 (format " (%s%s)"
@@ -133,12 +142,12 @@ which blank lines are inserted between sections at that 
level."
   (magit-insert-section-body
 (when (eq 'first items)
   (dolist (item (taxy-items taxy))
-(insert-item item format-fn (1+ 
depth
+(insert-item item taxy format-fn 
depth)))
 (dolist (taxy (taxy-taxys taxy))
   (insert-taxy taxy (1+ depth)))
 (when (eq 'last items)
   (dolist (item (taxy-items taxy))
-(insert-item item format-fn (1+ 
depth)
+(insert-item item taxy format-fn 
depth
   (when (<= depth blank-between-depth)
 (insert "\n"))
   (magit-insert-section (magit-section)



[elpa] externals/taxy d682c37 13/42: Add: (taxy-make-take-function)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit d682c3727521db91d7c517bf56a91b38d8f7855d
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-make-take-function)
---
 taxy.el | 47 +--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/taxy.el b/taxy.el
index 3fbbb5d..40b66e3 100644
--- a/taxy.el
+++ b/taxy.el
@@ -263,9 +263,11 @@ KEY is passed to `cl-sort', which see."
 
 (defalias 'taxy-sort* #'taxy-sort-taxys)
 
- Defining key functions
+ Key functions
 
-;; Utilities to define key functions and helpers in a standard way.
+;; Utilities to define key and take functions in a standard way.
+
+;; TODO: Document these.
 
 (defmacro taxy-define-key-definer (name variable prefix docstring)
   "Define a macro NAME that defines a key-function-defining macro.
@@ -304,6 +306,47 @@ item being tested, bound within the function to `item'."
(fset ',fn-symbol ,fn)
(setf (map-elt ,variable ',name) ',fn-symbol))
 
+(defun taxy-make-take-function (keys aliases)
+  "Return a `taxy' \"take\" function for KEYS.
+Each of KEYS should be a function alias defined in ALIASES, or a
+list of such KEY-FNS (recursively, ad infinitum, approximately).
+ALIASES should be an alist mapping aliases to functions (such as
+defined with a definer defined by `taxy-define-key-definer')."
+  (let ((macrolets (cl-loop for (name . fn) in aliases
+collect `(,name ',fn
+(cl-labels ((expand-form
+ ;; Is using (cadr (macroexpand-all ...)) really better than 
`eval'?
+ (form) (cadr (macroexpand-all
+   `(cl-symbol-macrolet (,@macrolets)
+  ,form
+(quote-fn
+ (fn) (pcase fn
+((pred symbolp) (expand-form fn))
+(`(,(and (or 'and 'or 'not) boolean) . ,(and args (map 
:name :keys)))
+ ;; Well, that pcase expression isn't confusing at 
all...  ;)
+ ;;  (cl-assert name t "Boolean key functions require 
a NAME")
+ ;;  (cl-assert keys t "Boolean key functions require 
KEYS")
+ `(lambda (buffer)
+(when (cl-loop for fn in ',(mapcar #'quote-fn (or 
keys args))
+   ,(pcase boolean
+  ('and 'always)
+  ('or 'thereis)
+  ('not 'never))
+   (funcall fn buffer))
+  (or ,name ""
+(`(,(and (pred symbolp) fn)
+   . ,(and args (guard (cl-typecase (car args)
+ ((or keyword (and atom (not 
symbol)))
+  t)
+ ;; Key with args: replace with a lambda that
+ ;; calls that key's function with given args.
+ `(lambda (element)
+(,(expand-form fn) element ,@args)))
+((pred listp) (mapcar #'quote-fn fn)
+  (setf keys (mapcar #'quote-fn keys))
+  `(lambda (item taxy)
+ (taxy-take-keyed ',keys item taxy)
+
  Footer
 
 (provide 'taxy)



[elpa] externals/taxy fb11a4f 19/42: WIP: (cl-defstruct deffy-def)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit fb11a4f0704680a9bc6cb919f701bfb80bfb5297
Author: Adam Porter 
Commit: Adam Porter 

WIP: (cl-defstruct deffy-def)
---
 examples/deffy.el | 67 +--
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index a30ba0d..03fb40e 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -28,6 +28,10 @@
 
 (require 'taxy-magit-section)
 
+(cl-defstruct deffy-def
+  ;; Okay, the name of this struct is silly, but at least it's concise.
+  file pos form)
+
 (defgroup deffy nil
   "Show an overview of definitions in an Emacs Lisp project or buffer."
   :group 'emacs-lisp-mode)
@@ -38,21 +42,21 @@
   "FIXME: Docstring.")
 
 (deffy-define-key file ()
-  (file-relative-name (plist-get item :file) deffy-directory))
+  (file-relative-name (deffy-def-file item) deffy-directory))
 
 (deffy-define-key type ()
-  (let* ((form (plist-get item :form))
-(type (pcase form
-(`(,(or 'defun 'cl-defun) . ,_)
- (if (cl-find-if (lambda (form)
-   (pcase form
- (`(interactive . ,_) t)))
- form)
- 'command
-   'function))
-(`(,(or 'defmacro 'cl-defmacro) . ,_)
- 'macro)
-(`(,car . ,_) car
+  (pcase-let* (((cl-struct deffy-def form) item)
+  (type (pcase form
+  (`(,(or 'defun 'cl-defun) . ,_)
+   (if (cl-find-if (lambda (form)
+ (pcase form
+   (`(interactive . ,_) t)))
+   form)
+   'command
+ 'function))
+  (`(,(or 'defmacro 'cl-defmacro) . ,_)
+   'macro)
+  (`(,car . ,_) car
 (when type
   (format "%s" type
 
@@ -64,18 +68,18 @@
 (taxy-magit-section-define-column-definer "deffy")
 
 (deffy-define-column "Definition" (:max-width 45 :face 
font-lock-function-name-face)
-  (let ((form-defines (pcase-exhaustive (cadr (plist-get item :form))
+  (let ((form-defines (pcase-exhaustive (cadr (deffy-def-form item))
((and (pred atom) it) it)
(`(quote ,it) it)
(`(,it . ,_) it
 (format "%s" form-defines)))
 
 (deffy-define-column "Type" (:max-width 25 :face font-lock-type-face)
-  (format "%s" (car (plist-get item :form
+  (format "%s" (car (deffy-def-form item
 
 (deffy-define-column "Docstring" (:max-width nil :face font-lock-doc-face)
   (when-let ((docstring
- (pcase (plist-get item :form)
+ (pcase (deffy-def-form item)
(`(,(or 'defun 'cl-defun 'defmacro 'cl-defmacro) ,_name ,_args
   ,(and (pred stringp) docstring) . ,_)
 docstring)
@@ -83,7 +87,7 @@
   ,(and (pred stringp) docstring) . ,_)
 docstring)
(_ ;; Use the first string found, if any.
-(cl-find-if #'stringp (plist-get item :form))
+(cl-find-if #'stringp (deffy-def-form item))
 (replace-regexp-in-string "\n" "  " docstring)))
 
 (unless deffy-columns
@@ -112,15 +116,15 @@
 
 ;;;###autoload
 (cl-defun deffy (&key (project (or (project-current)
-   (cons 'transient default-directory)))
-  (keys deffy-taxy-default-keys)
-  (files deffy-files)
-  (buffer-name (format "*Deffy: %s*"
-   (if files
-   (string-join (mapcar 
#'file-relative-name files) ", ")
- (file-name-nondirectory
-  (directory-file-name 
(project-root project))
-  visibility-fn display-buffer-action)
+  (cons 'transient default-directory)))
+ (keys deffy-taxy-default-keys)
+ (files deffy-files)
+ (buffer-name (format "*Deffy: %s*"
+  (if files
+  (string-join (mapcar 
#'file-relative-name files) ", ")
+(file-name-nondirectory
+ (directory-file-name 
(project-root project))
+ visibility-fn display-buffer-action)
   "Show definitions defined in PROJECT or FILES.
 Interactively, with PREFIX, show only definitions in current
 buffer."
@@ -144,8 +148,7 @@ buffer."
:visibility-fn visibility-fn
;; :heading-face-f

[elpa] externals/taxy 8d108ef 18/42: WIP: Rename elispy to deffy

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 8d108efa4ac73e7c28f5c128f9700a672bd5b5c6
Author: Adam Porter 
Commit: Adam Porter 

WIP: Rename elispy to deffy

It ought to work for, e.g. CL buffers, and abo-abo's Lispy package
already uses that name, and hopefully this can be generalized for
other languages someday.
---
 examples/{elispy.el => deffy.el} | 133 ---
 1 file changed, 67 insertions(+), 66 deletions(-)

diff --git a/examples/elispy.el b/examples/deffy.el
similarity index 68%
rename from examples/elispy.el
rename to examples/deffy.el
index 5dcd527..a30ba0d 100644
--- a/examples/elispy.el
+++ b/examples/deffy.el
@@ -1,4 +1,4 @@
-;;; elispy.el --- Show symbols defined in an Elisp project  -*- 
lexical-binding: t; -*-
+;;; deffy.el --- Show definitions in an Elisp project/buffer  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 
@@ -28,19 +28,19 @@
 
 (require 'taxy-magit-section)
 
-(defgroup elispy nil
+(defgroup deffy nil
   "Show an overview of definitions in an Emacs Lisp project or buffer."
   :group 'emacs-lisp-mode)
 
  Keys
 
-(taxy-define-key-definer elispy-define-key elispy-keys "elispy"
+(taxy-define-key-definer deffy-define-key deffy-keys "deffy"
   "FIXME: Docstring.")
 
-(elispy-define-key file ()
-  (file-relative-name (plist-get item :file) elispy-directory))
+(deffy-define-key file ()
+  (file-relative-name (plist-get item :file) deffy-directory))
 
-(elispy-define-key type ()
+(deffy-define-key type ()
   (let* ((form (plist-get item :form))
 (type (pcase form
 (`(,(or 'defun 'cl-defun) . ,_)
@@ -56,24 +56,24 @@
 (when type
   (format "%s" type
 
-(defvar elispy-taxy-default-keys
+(defvar deffy-taxy-default-keys
   '(type file))
 
  Columns
 
-(taxy-magit-section-define-column-definer "elispy")
+(taxy-magit-section-define-column-definer "deffy")
 
-(elispy-define-column "Definition" (:max-width 45 :face 
font-lock-function-name-face)
+(deffy-define-column "Definition" (:max-width 45 :face 
font-lock-function-name-face)
   (let ((form-defines (pcase-exhaustive (cadr (plist-get item :form))
((and (pred atom) it) it)
(`(quote ,it) it)
(`(,it . ,_) it
 (format "%s" form-defines)))
 
-(elispy-define-column "Type" (:max-width 25 :face font-lock-type-face)
+(deffy-define-column "Type" (:max-width 25 :face font-lock-type-face)
   (format "%s" (car (plist-get item :form
 
-(elispy-define-column "Docstring" (:max-width nil :face font-lock-doc-face)
+(deffy-define-column "Docstring" (:max-width nil :face font-lock-doc-face)
   (when-let ((docstring
  (pcase (plist-get item :form)
(`(,(or 'defun 'cl-defun 'defmacro 'cl-defmacro) ,_name ,_args
@@ -86,36 +86,36 @@
 (cl-find-if #'stringp (plist-get item :form))
 (replace-regexp-in-string "\n" "  " docstring)))
 
-(unless elispy-columns
+(unless deffy-columns
   ;; TODO: Automate this or document it
-  (setq-default elispy-columns
-   (get 'elispy-columns 'standard-value)))
+  (setq-default deffy-columns
+   (get 'deffy-columns 'standard-value)))
 
  Variables
 
-(defvar elispy-mode-map
+(defvar deffy-mode-map
   (let ((map (make-sparse-keymap)))
-(define-key map (kbd "RET") #'elispy-RET)
-(define-key map [mouse-1] #'elispy-mouse-1)
+(define-key map (kbd "RET") #'deffy-RET)
+(define-key map [mouse-1] #'deffy-mouse-1)
 map))
 
-(defvar-local elispy-directory nil
+(defvar-local deffy-directory nil
   "Directory relative to which filenames should be expanded.")
 
-(defvar-local elispy-files nil
-  "Files shown in the current Elispy buffer.")
+(defvar-local deffy-files nil
+  "Files shown in the current Deffy buffer.")
 
-(defvar-local elispy-display-buffer-action nil
-  "Last-used display-buffer-action in the current Elispy buffer.")
+(defvar-local deffy-display-buffer-action nil
+  "Last-used display-buffer-action in the current Deffy buffer.")
 
  Commands
 
 ;;;###autoload
-(cl-defun elispy (&key (project (or (project-current)
+(cl-defun deffy (&key (project (or (project-current)
(cons 'transient default-directory)))
-  (keys elispy-taxy-default-keys)
-  (files elispy-files)
-  (buffer-name (format "*Elispy: %s*"
+  (keys deffy-taxy-default-keys)
+  (files deffy-files)
+  (buffer-name (format "*Deffy: %s*"
(if files
(string-join (mapcar 
#'file-relative-name files) ", ")
  (file-name-nondirectory
@@ -127,8 +127,8 @@ buffer."
   (interactive (list :files (when current-prefix-arg
  (list (buffer-file-name)))
 :k

[elpa] externals/taxy 6703d8b 21/42: WIP: Use deffy-def in -RET

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 6703d8bba03c94d9711d0871e74739e5eda4cc8f
Author: Adam Porter 
Commit: Adam Porter 

WIP: Use deffy-def in -RET
---
 examples/deffy.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index 16c2b88..9c1668b 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -232,10 +232,10 @@ Interactively, with prefix, display in dedicated side 
window."
 
 (defun deffy-RET ()
   (interactive)
-  (cl-typecase (oref (magit-current-section) value)
+  (cl-etypecase (oref (magit-current-section) value)
+(deffy-def (call-interactively #'deffy-goto-form))
 (taxy-magit-section (call-interactively #'magit-section-cycle))
-(null nil)
-(t (call-interactively #'deffy-goto-form
+(null nil)))
 
 (define-derived-mode deffy-mode magit-section-mode "Deffy"
   :global nil



[elpa] externals/taxy d456f88 24/42: Add: (deffy-side-window-action)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit d456f88e3454e6b45dfcb6140a29b2fdb1058bec
Author: Adam Porter 
Commit: Adam Porter 

Add: (deffy-side-window-action)
---
 examples/deffy.el | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index a3190cd..67fb454 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -112,6 +112,18 @@
 (defvar-local deffy-display-buffer-action nil
   "Last-used display-buffer-action in the current Deffy buffer.")
 
+ Options
+
+(defcustom deffy-side-window-action
+  '(display-buffer-in-side-window
+(side . right)
+(window-parameters
+ (window-side . right)
+ (no-delete-other-windows . t)))
+  "`display-buffer' action used when displaying Deffy buffer in a side window.
+See Info node `(elisp)Displaying Buffers in Side Windows'."
+  :type 'sexp)
+
  Commands
 
 ;;;###autoload
@@ -190,17 +202,15 @@ buffer."
   (pop-to-buffer buffer-name display-buffer-action
 
 ;;;###autoload
-(cl-defun deffy-buffer (&optional (buffer (current-buffer))
- &key (display-buffer-action
-   (when current-prefix-arg
- '(display-buffer-in-side-window
-   (side . right)
-   (window-parameters
-(window-side . right)
-(no-delete-other-windows . t))
+(cl-defun deffy-buffer
+(&optional (buffer (current-buffer))
+  &key display-buffer-action)
   "Show an Deffy view for BUFFER.
 Interactively, with prefix, display in dedicated side window."
-  (interactive)
+  (interactive
+   (list (current-buffer)
+:display-buffer-action (when current-prefix-arg
+ deffy-side-window-action)))
   (deffy :files (list (buffer-file-name buffer))
 :keys (remove 'file deffy-taxy-default-keys)
 :display-buffer-action display-buffer-action))



[elpa] externals/taxy 5227980 40/42: Docs: (taxy-magit-section-define-column-definer) Add docstring

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 5227980693d421618c3a15705bc57758f3829532
Author: Adam Porter 
Commit: Adam Porter 

Docs: (taxy-magit-section-define-column-definer) Add docstring
---
 taxy-magit-section.el | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 62990d0..00dd217 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -180,10 +180,23 @@ Default visibility function for
 
 ; Macros
 
-;; TODO: Document this.
-
 (cl-defmacro taxy-magit-section-define-column-definer (prefix &key 
columns-variable-docstring)
-  "FIXME: Docstring."
+  "Define a column-defining macro.
+The macro is named \"PREFIX-define-column\".
+
+These customization options are defined, which are to be used in
+a `taxy-magit-section' in its `:heading-indent' and
+`:item-indent' slots, respectively:
+
+  - PREFIX-level-indent
+  - PREFIX-item-indent
+
+As well as these variables, which are to be passed to
+`taxy-magit-section-format-items':
+
+  - PREFIX-columns
+  - PREFIX-column-formatters"
+  ;; TODO: Document this.
   (let* ((definer-name (intern (format "%s-define-column" prefix)))
 (definer-docstring (format "Define a column formatting function with 
NAME.
 NAME should be a string.  BODY should return a string or nil.  In



[elpa] externals/taxy 4fd9565 30/42: Fix: (deffy) Bookmarking deffy-files

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 4fd9565bab7b8a1f3fdf669e444774ba1730c737
Author: Adam Porter 
Commit: Adam Porter 

Fix: (deffy) Bookmarking deffy-files
---
 examples/deffy.el | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index c5f4295..83ac121 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -284,18 +284,17 @@ Interactively, with prefix, display in dedicated side 
window."
 
 (defvar bookmark-make-record-function)
 
-;; FIXME: Also save and use files list.
-
 (defun deffy--bookmark-make-record ()
   "Return a bookmark record for current Deffy buffer."
   (list (concat "Deffy: %s" deffy-directory)
(cons 'directory deffy-directory)
+   (cons 'files deffy-files)
(cons 'handler #'deffy--bookmark-handler)))
 
 (defun deffy--bookmark-handler (record)
   "Show Deffy buffer for bookmark RECORD."
-  (pcase-let* ((`(,_ . ,(map directory)) record))
-(deffy :project (project-current nil directory))
+  (pcase-let* ((`(,_ . ,(map directory files)) record))
+(deffy :files files :project (project-current nil directory))
 (current-buffer)))
 
 (provide 'deffy)



[elpa] externals/taxy 5020b43 31/42: Change: (deffy-goto-form) Bug #50576 is fixed.

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 5020b43d10bc8fbfb3186a5da10db91768e1fad8
Author: Adam Porter 
Commit: Adam Porter 

Change: (deffy-goto-form) Bug #50576 is fixed.
---
 examples/deffy.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index 83ac121..c47105f 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -243,10 +243,8 @@ Interactively, with prefix, display in dedicated side 
window."
 (pop-to-buffer
  (or (find-buffer-visiting file)
 (find-file-noselect file))
- ;; FIXME: Uncomment this when 
 is fixed.
- ;; `(display-buffer-in-previous-window
- ;;   (previous-window . ,(get-mru-window)))
- )
+ `(display-buffer-in-previous-window
+   (previous-window . ,(get-mru-window
 (goto-char pos)
 (backward-sexp 1)))
 



[elpa] externals/taxy 45cdf29 41/42: Docs: Mention deffy in changelog

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 45cdf29030ddca073e96127fb2de49a7675e6f1b
Author: Adam Porter 
Commit: Adam Porter 

Docs: Mention deffy in changelog
---
 README.org |  1 +
 taxy.info  | 35 +++
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index 995e88e..53d9683 100644
--- a/README.org
+++ b/README.org
@@ -892,6 +892,7 @@ Note that while =taxy-magit-section.el= is installed with 
the =taxy= package, th
 + Table-like, column-based formatting system for ~taxy-magit-section~:
   + Function ~taxy-magit-section-format-items~, which formats items by columns.
   + Variable ~taxy-magit-section-insert-indent-items~, which controls whether 
~taxy-magit-section-insert~ applies indentation to each item.  (Used to disable 
that behavior when items are pre-indented strings, e.g. as formatted by 
~taxy-magit-section-format-items~.)
++ Example application =deffy=, which shows an overview of top-level 
definitions and forms in an Elisp project or file.  (Likely to be published as 
a separate package later.)
 
 ** 0.5
 
diff --git a/taxy.info b/taxy.info
index 2e6dbea..3f810b9 100644
--- a/taxy.info
+++ b/taxy.info
@@ -1062,6 +1062,9 @@ File: README.info,  Node: Additions,  Up: 06-pre
   indentation to each item.  (Used to disable that behavior when
   items are pre-indented strings, e.g.  as formatted by
   ‘taxy-magit-section-format-items’.)
+   • Example application ‘deffy’, which shows an overview of top-level
+ definitions and forms in an Elisp project or file.  (Likely to be
+ published as a separate package later.)
 
 
 File: README.info,  Node: 05,  Next: 04,  Prev: 06-pre,  Up: Changelog
@@ -1270,22 +1273,22 @@ Node: Magit section36693
 Node: Changelog37372
 Node: 06-pre37564
 Node: Additions37676
-Node: 0538833
-Node: Additions (1)38972
-Node: Fixes40078
-Node: 0440232
-Node: 0340454
-Node: Changes40583
-Node: Fixes (1)40946
-Node: 0241381
-Node: Changes (1)41550
-Node: Additions (2)41842
-Node: Fixes (2)42701
-Node: 0142955
-Node: Development43054
-Node: Copyright assignment43260
-Node: Credits43848
-Node: License44038
+Node: 0539026
+Node: Additions (1)39165
+Node: Fixes40271
+Node: 0440425
+Node: 0340647
+Node: Changes40776
+Node: Fixes (1)41139
+Node: 0241574
+Node: Changes (1)41743
+Node: Additions (2)42035
+Node: Fixes (2)42894
+Node: 0143148
+Node: Development43247
+Node: Copyright assignment43453
+Node: Credits44041
+Node: License44231
 
 End Tag Table
 



[elpa] externals/taxy 7a63677 08/42: Add: (taxy-define-key-definer)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 7a63677cb3388c32ba7b035ab8917f5a288596b1
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-define-key-definer)
---
 taxy.el | 41 +
 1 file changed, 41 insertions(+)

diff --git a/taxy.el b/taxy.el
index b161c3b..3fbbb5d 100644
--- a/taxy.el
+++ b/taxy.el
@@ -263,6 +263,47 @@ KEY is passed to `cl-sort', which see."
 
 (defalias 'taxy-sort* #'taxy-sort-taxys)
 
+ Defining key functions
+
+;; Utilities to define key functions and helpers in a standard way.
+
+(defmacro taxy-define-key-definer (name variable prefix docstring)
+  "Define a macro NAME that defines a key-function-defining macro.
+The defined macro, having string DOCSTRING, associates the
+defined key functions with their aliases in an alist stored in
+symbol VARIABLE.  The defined key functions are named having
+string PREFIX, which will have a hyphen appended to it.  The key
+functions take one or more arguments, the first of which is the
+item being tested, bound within the function to `item'."
+  ;; Example docstring:
+
+  ;;   "Define a `taxy-org-ql-view' key function by NAME having BODY taking 
ARGS.
+  ;; Within BODY, `element' is bound to the `org-element' element
+  ;; being tested.
+
+  ;; Defines a function named `taxy-org-ql--predicate-NAME', and adds
+  ;; an entry to `taxy-org-ql-view-keys' mapping NAME to the new
+  ;; function symbol."
+  (declare (indent defun))
+  ;; I'm not sure why it's necessary to bind the variable in the first
+  ;; level of the expansion here, but double-unquoting the variable in
+  ;; the defined macro's form leaves the second comma in place, which
+  ;; breaks the second expansion, and this works around that.
+  `(let ((variable ',variable))
+ (defvar ,variable nil
+   ,(format "Alist mapping key aliases to key functions defined with `%s'."
+   name))
+ (defmacro ,name (name args &rest body)
+   ,docstring
+   (declare (indent defun)
+   (debug (&define symbolp listp &rest def-form)))
+   (let* ((fn-symbol (intern (format "%s-%s" ,prefix name)))
+ (fn `(lambda (item ,@args)
+,@body)))
+`(progn
+   (fset ',fn-symbol ,fn)
+   (setf (map-elt ,variable ',name) ',fn-symbol))
+
  Footer
 
 (provide 'taxy)



[elpa] externals/taxy 69872e4 06/42: Docs: Update readme

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 69872e4e28657a462d964e38a957ccbdfc577a29
Author: Adam Porter 
Commit: Adam Porter 

Docs: Update readme
---
 README.org |  3 +++
 taxy.info  | 41 +
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index c5ed5f3..8eebebe 100644
--- a/README.org
+++ b/README.org
@@ -773,6 +773,9 @@ Note that while =taxy-magit-section.el= is installed with 
the =taxy= package, th
 + Sorting functions:
   + ~taxy-sort-items~ (alias: ~taxy-sort~) sorts the items in a taxy and its 
sub-taxys.
   + ~taxy-sort-taxys~ (alias: ~taxy-sort*~) sorts a taxy's sub-taxys.
++ Table-like, column-based formatting system for ~taxy-magit-section~:
+  + Function ~taxy-magit-section-format-items~, which formats items by columns.
+  + Variable ~taxy-magit-section-insert-indent-items~, which controls whether 
~taxy-magit-section-insert~ applies indentation to each item.  (Used to disable 
that behavior when items are pre-indented strings, e.g. as formatted by 
~taxy-magit-section-format-items~.)
 
 ** 0.5
 
diff --git a/taxy.info b/taxy.info
index bc57bf4..5699555 100644
--- a/taxy.info
+++ b/taxy.info
@@ -926,6 +926,15 @@ File: README.info,  Node: Additions,  Up: 06-pre
   taxy and its sub-taxys.
 • ‘taxy-sort-taxys’ (alias: ‘taxy-sort*’) sorts a taxy’s
   sub-taxys.
+   • Table-like, column-based formatting system for
+ ‘taxy-magit-section’:
+• Function ‘taxy-magit-section-format-items’, which formats
+  items by columns.
+• Variable ‘taxy-magit-section-insert-indent-items’, which
+  controls whether ‘taxy-magit-section-insert’ applies
+  indentation to each item.  (Used to disable that behavior when
+  items are pre-indented strings, e.g.  as formatted by
+  ‘taxy-magit-section-format-items’.)
 
 
 File: README.info,  Node: 05,  Next: 04,  Prev: 06-pre,  Up: Changelog
@@ -1133,22 +1142,22 @@ Node: Magit section32349
 Node: Changelog33037
 Node: 06-pre33229
 Node: Additions33341
-Node: 0533665
-Node: Additions (1)33804
-Node: Fixes34910
-Node: 0435064
-Node: 0335286
-Node: Changes35415
-Node: Fixes (1)35778
-Node: 0236213
-Node: Changes (1)36382
-Node: Additions (2)36674
-Node: Fixes (2)37533
-Node: 0137787
-Node: Development37886
-Node: Copyright assignment38092
-Node: Credits38680
-Node: License38870
+Node: 0534179
+Node: Additions (1)34318
+Node: Fixes35424
+Node: 0435578
+Node: 0335800
+Node: Changes35929
+Node: Fixes (1)36292
+Node: 0236727
+Node: Changes (1)36896
+Node: Additions (2)37188
+Node: Fixes (2)38047
+Node: 0138301
+Node: Development38400
+Node: Copyright assignment38606
+Node: Credits39194
+Node: License39384
 
 End Tag Table
 



[elpa] externals/taxy 2430282 20/42: Tidy: Indentation

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 2430282f0c83afe8cd66210e45c4fc7673edbec3
Author: Adam Porter 
Commit: Adam Porter 

Tidy: Indentation
---
 examples/deffy.el | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index 03fb40e..16c2b88 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -191,25 +191,25 @@ buffer."
 
 ;;;###autoload
 (cl-defun deffy-buffer (&optional (buffer (current-buffer))
-  &key (display-buffer-action
-(when current-prefix-arg
-  '(display-buffer-in-side-window
-(side . right)
-(window-parameters
- (window-side . right)
- (no-delete-other-windows . t))
+ &key (display-buffer-action
+   (when current-prefix-arg
+ '(display-buffer-in-side-window
+   (side . right)
+   (window-parameters
+(window-side . right)
+(no-delete-other-windows . t))
   "Show an Deffy view for BUFFER.
 Interactively, with prefix, display in dedicated side window."
   (interactive)
   (deffy :files (list (buffer-file-name buffer))
- :keys (remove 'file deffy-taxy-default-keys)
- :display-buffer-action display-buffer-action))
+:keys (remove 'file deffy-taxy-default-keys)
+:display-buffer-action display-buffer-action))
 
 (defun deffy-revert (_ignore-auto _noconfirm)
   "Revert current Deffy buffer."
   (interactive)
   (deffy :display-buffer-action (or deffy-display-buffer-action
-'((display-buffer-same-window)
+   '((display-buffer-same-window)
 
 (defun deffy-goto-form ()
   "Go to form at point."



[elpa] externals/taxy ae7456f 11/42: Add: (taxy-magit-section-define-column-definer) Indentation/align

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit ae7456fd09aaf9fe65222ccfe99475d5f21a6d47
Author: Adam Porter 
Commit: Adam Porter 

Add: (taxy-magit-section-define-column-definer) Indentation/align

Automatically handle first-column indentation in column formatters,
and allow column alignment to be specified as left/right.
---
 taxy-magit-section.el | 88 +++
 1 file changed, 61 insertions(+), 27 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 3e7c57a..1bf7e26 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -189,11 +189,20 @@ bound to the item's depth in the hierarchy.
 
 PLIST may be a plist setting the following options:
 
+  `:align' may be `left' or `right' to align the column
+  accordingly.
+
   `:face' is a face applied to the string.
 
   `:max-width' defines a customization option for the column's
   maximum width with the specified value as its default: an
   integer limits the width, while nil does not."))
+(level-indent-variable-name (intern (format "%s-taxy-level-indent" 
prefix)))
+(level-indent-docstring (format "Indentation applied to each level of 
depth for `%s' columns."
+prefix))
+(item-indent-variable-name (intern (format "%s-taxy-item-indent" 
prefix)))
+(item-indent-docstring (format "Indentation applied to each item for 
`%s' columns."
+   prefix))
 (columns-variable-name (intern (format "%s-columns" prefix)))
 (columns-variable-docstring (or columns-variable-docstring
 (format "Columns defined by `%s'."
@@ -204,6 +213,10 @@ PLIST may be a plist setting the following options:
 ;; TODO: Add defined columns to customization type for the 
columns-variable.
 `(let ((columns-variable ',columns-variable-name)
   (column-formatters-variable ',column-formatters-variable-name))
+   (defvar ,level-indent-variable-name nil
+,level-indent-docstring)
+   (defvar ,item-indent-variable-name nil
+,item-indent-docstring)
(defvar ,columns-variable-name nil
 ,columns-variable-docstring)
(defvar ,column-formatters-variable-name nil
@@ -213,6 +226,9 @@ PLIST may be a plist setting the following options:
 (declare (indent defun))
 (cl-check-type name string)
 (pcase-let* ((fn-name (intern (concat ,prefix "-column-format-" 
(downcase name
+ (columns-variable-name ',columns-variable-name)
+ (level-indent-variable-name ',level-indent-variable-name)
+ (item-indent-variable-name ',item-indent-variable-name)
  ((map (:face face) (:max-width max-width)) plist)
  (max-width-variable (intern (concat ,prefix "-" name 
"-max-width")))
  (max-width-docstring (format "Maximum width of the %s 
column." name)))
@@ -234,9 +250,18 @@ PLIST may be a plist setting the following options:
 ;; time, so we can only test that the argument is a 
symbol, not a face.
 (cl-check-type face symbol ":face must be a face 
symbol")
 `(setf string (propertize string 'face ',face)))
+ (when (equal ,name (car ,columns-variable-name))
+   ;; First column: apply indentation.
+   (let ((indentation (make-string (+ (* depth 
,level-indent-variable-name)
+  
,item-indent-variable-name)
+   ? )))
+ (setf string (concat indentation string
  string)
  ""))
- (setf (map-elt ,column-formatters-variable ,name) #',fn-name)
+ (setf (alist-get 'formatter (alist-get ,name 
,column-formatters-variable nil nil #'equal))
+   #',fn-name)
+ (setf (alist-get 'align (alist-get ,name 
,column-formatters-variable nil nil #'equal))
+   ,(plist-get plist :align))
  (unless (member ,name (get ',columns-variable 'standard-value))
(setf (get ',columns-variable 'standard-value)
  (append (get ',columns-variable 'standard-value)
@@ -260,36 +285,45 @@ and values are the column width.  Each string is formatted
 according to `columns' and takes into account the width of all
 the items' values for each column."
   (let ((table (make-hash-table))
-column-sizes)
+   column-aligns column-sizes)
 (cl-labels ((format-column
- (item depth column-name)
- (let* ((fn (alist-get column-name formatters nil nil #'equal))
-(value (funcall fn item depth))
-(current-column-size (or (map-elt column-sizes 
column-name) 0)))

[elpa] externals/taxy 421cfbf 26/42: Add: (deffy-project)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 421cfbfe9ba79fca20ac9afaca98f3fbc292b0a5
Author: Adam Porter 
Commit: Adam Porter 

Add: (deffy-project)
---
 examples/deffy.el | 12 
 1 file changed, 12 insertions(+)

diff --git a/examples/deffy.el b/examples/deffy.el
index 46e9087..f6d6c75 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -218,6 +218,18 @@ Interactively, with prefix, display in dedicated side 
window."
 :keys (remove 'file deffy-taxy-default-keys)
 :display-buffer-action display-buffer-action))
 
+(cl-defun deffy-project
+(&optional (project (or (project-current)
+   (cons 'transient default-directory)))
+  &key display-buffer-action)
+  "Show an Deffy view for PROJECT.
+Interactively, with prefix, display in dedicated side window."
+  (interactive
+   (list nil :display-buffer-action (when current-prefix-arg
+ deffy-side-window-action)))
+  (deffy :project project
+:display-buffer-action display-buffer-action))
+
 (defun deffy-revert (_ignore-auto _noconfirm)
   "Revert current Deffy buffer."
   (interactive)



[elpa] externals/taxy 8b7a95a 35/42: Docs: Clarify

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 8b7a95a891b98ae6987743fe07c1af285453
Author: Adam Porter 
Commit: Adam Porter 

Docs: Clarify
---
 README.org |  2 +-
 taxy.info  | 44 ++--
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/README.org b/README.org
index b1988f9..075f8dd 100644
--- a/README.org
+++ b/README.org
@@ -744,7 +744,7 @@ Now let's fill the taxy with the sports and format it:
 
 *** Defining a classification domain-specific language
 
-When writing a larger Taxy-based application, it may be necessary to define a 
number of key functions that would be unwieldy to manage in a ~cl-labels~ form. 
 For this case, Taxy provides the macro ~taxy-define-key-definer~ to easily 
define Taxy key functions in an application library.  Those functions are then 
passed to the function ~taxy-make-take-function~ at runtime, along with a list 
of keys being used to classify items.  Using these allows key functions to be 
defined in top-level f [...]
+When writing a larger Taxy-based application, it may be necessary to define a 
number of key functions that would be unwieldy to manage in a ~cl-labels~ form. 
 For this case, Taxy provides the macro ~taxy-define-key-definer~ to easily 
define Taxy key functions in an application library.  Those functions are then 
passed to the function ~taxy-make-take-function~ at runtime, along with a list 
of keys being used to classify items.  Using these allows key functions to be 
defined in top-level f [...]
 
 Extending the previous ~sporty~ example, let's redefine its key functions 
using ~taxy-define-key-definer~:
 
diff --git a/taxy.info b/taxy.info
index 8da2494..be025f3 100644
--- a/taxy.info
+++ b/taxy.info
@@ -883,8 +883,8 @@ define a number of key functions that would be unwieldy to 
manage in a
 application library.  Those functions are then passed to the function
 ‘taxy-make-take-function’ at runtime, along with a list of keys being
 used to classify items.  Using these allows key functions to be defined
-in top-level forms, and it allows an application to be extended by
-users’ defining additional key functions in their configuration.
+in top-level forms, and it allows an application to be extended by users
+by defining additional key functions in their configurations.
 
Extending the previous ‘sporty’ example, let’s redefine its key
 functions using ‘taxy-define-key-definer’:
@@ -1260,26 +1260,26 @@ Node: Dynamic taxys24757
 Node: Multi-level dynamic taxys27406
 Node: "Chains" of independent multi-level dynamic taxys29599
 Node: Defining a classification domain-specific language32530
-Node: Magit section36692
-Node: Changelog37371
-Node: 06-pre37563
-Node: Additions37675
-Node: 0538513
-Node: Additions (1)38652
-Node: Fixes39758
-Node: 0439912
-Node: 0340134
-Node: Changes40263
-Node: Fixes (1)40626
-Node: 0241061
-Node: Changes (1)41230
-Node: Additions (2)41522
-Node: Fixes (2)42381
-Node: 0142635
-Node: Development42734
-Node: Copyright assignment42940
-Node: Credits43528
-Node: License43718
+Node: Magit section36693
+Node: Changelog37372
+Node: 06-pre37564
+Node: Additions37676
+Node: 0538514
+Node: Additions (1)38653
+Node: Fixes39759
+Node: 0439913
+Node: 0340135
+Node: Changes40264
+Node: Fixes (1)40627
+Node: 0241062
+Node: Changes (1)41231
+Node: Additions (2)41523
+Node: Fixes (2)42382
+Node: 0142636
+Node: Development42735
+Node: Copyright assignment42941
+Node: Credits43529
+Node: License43719
 
 End Tag Table
 



[elpa] externals/taxy f8558ab 28/42: Fix: (deffy-project) Arguments

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit f8558ab750d32e080b071ec2ea6e06d78eef794b
Author: Adam Porter 
Commit: Adam Porter 

Fix: (deffy-project) Arguments
---
 examples/deffy.el | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index f6d6c75..c5f4295 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -218,16 +218,15 @@ Interactively, with prefix, display in dedicated side 
window."
 :keys (remove 'file deffy-taxy-default-keys)
 :display-buffer-action display-buffer-action))
 
-(cl-defun deffy-project
-(&optional (project (or (project-current)
-   (cons 'transient default-directory)))
-  &key display-buffer-action)
+(cl-defun deffy-project (&optional project &key display-buffer-action)
   "Show an Deffy view for PROJECT.
 Interactively, with prefix, display in dedicated side window."
   (interactive
(list nil :display-buffer-action (when current-prefix-arg
  deffy-side-window-action)))
-  (deffy :project project
+  (deffy :project (or project
+ (project-current)
+ (cons 'transient default-directory))
 :display-buffer-action display-buffer-action))
 
 (defun deffy-revert (_ignore-auto _noconfirm)



[elpa] externals/taxy a1f9081 29/42: Comment: Add TODOs

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit a1f9081d5c432701626d933747e15a67b192a31c
Author: Adam Porter 
Commit: Adam Porter 

Comment: Add TODOs
---
 taxy-magit-section.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index ce07245..61c483a 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -179,6 +179,8 @@ Default visibility function for
 
 ; Macros
 
+;; TODO: Document this.
+
 (cl-defmacro taxy-magit-section-define-column-definer (prefix &key 
columns-variable-docstring)
   "FIXME: Docstring."
   (let* ((definer-name (intern (format "%s-define-column" prefix)))
@@ -276,6 +278,8 @@ PLIST may be a plist setting the following options:
 ;; I'm not sure which would perform better; I guess that with many lines, 
redisplay might take longer to use the
 ;; display properties for alignment than just having pre-aligned lines of text.
 
+;; TODO: Document this.
+
 (defun taxy-magit-section-format-items (columns formatters taxy)
   "Return a cons (table . column-sizes) for COLUMNS, FORMATTERS, and TAXY.
 COLUMNS is a list of column names, each of which should have an
@@ -327,6 +331,7 @@ the items' values for each column."
 table)
(cons table column-sizes)
 
+;; TODO: Document this.
 (defun taxy-magit-section-format-header (column-sizes formatters)
   "Return header string for COLUMN-SIZES and FORMATTERS.
 COLUMN-SIZES should be the CDR of the cell returned by



[elpa] externals/taxy 16d4e50 23/42: Fix/Tidy: (deffy-buffer)

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 16d4e50b0f0d75bfb96e7fa946800e66fc08cdac
Author: Adam Porter 
Commit: Adam Porter 

Fix/Tidy: (deffy-buffer)
---
 examples/deffy.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/deffy.el b/examples/deffy.el
index 1457473..a3190cd 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -214,13 +214,14 @@ Interactively, with prefix, display in dedicated side 
window."
 (defun deffy-goto-form ()
   "Go to form at point."
   (interactive)
-  (pcase-let* (((cl-struct deffy-def file pos) (oref (magit-current-section) 
value)))
+  (pcase-let (((cl-struct deffy-def file pos)
+  (oref (magit-current-section) value)))
 (pop-to-buffer
  (or (find-buffer-visiting file)
 (find-file-noselect file))
  ;; FIXME: Uncomment this when 
 is fixed.
  ;; `(display-buffer-in-previous-window
- ;;   (previous-window . ,(previous-window)))
+ ;;   (previous-window . ,(get-mru-window)))
  )
 (goto-char pos)
 (backward-sexp 1)))



[elpa] externals/taxy 956efdd 37/42: Comment: Update TODO

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 956efdd0735c8c8230862c59de5d9e8f0794691c
Author: Adam Porter 
Commit: Adam Porter 

Comment: Update TODO
---
 taxy-magit-section.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 61c483a..4152b90 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -172,10 +172,10 @@ Default visibility function for
 
 ;; Column-based, or "table"?
 
-;; TODO: Probably, this belongs in a separate library, since it's not
-;; directly related to using taxy or magit-section.  Maybe it could be
-;; called something like `flextab' (or, keeping with the theme,
-;; `tabley').
+;; MAYBE: Move this to a separate library, since it's not directly
+;; related to using taxy or magit-section.  Maybe it could be called
+;; something like `flextab' (or, keeping with the theme, `tabley').
+;; But see also .
 
 ; Macros
 



[elpa] externals/taxy 3787f4f 25/42: Fix: (deffy-buffer) Ensure file name

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 3787f4f6b263ba90102fffc75179cb70391c8140
Author: Adam Porter 
Commit: Adam Porter 

Fix: (deffy-buffer) Ensure file name
---
 examples/deffy.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/deffy.el b/examples/deffy.el
index 67fb454..46e9087 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -211,6 +211,9 @@ Interactively, with prefix, display in dedicated side 
window."
(list (current-buffer)
 :display-buffer-action (when current-prefix-arg
  deffy-side-window-action)))
+  (unless (buffer-file-name buffer)
+(user-error "Buffer is not file-backed: %S.  See command `deffy-project'"
+   buffer))
   (deffy :files (list (buffer-file-name buffer))
 :keys (remove 'file deffy-taxy-default-keys)
 :display-buffer-action display-buffer-action))



[elpa] externals/taxy 5a16dd0 39/42: Comment: Add TODO

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 5a16dd05b9507135b307e206d49c0d8e16ce6764
Author: Adam Porter 
Commit: Adam Porter 

Comment: Add TODO
---
 taxy-magit-section.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 1c54376..62990d0 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -73,6 +73,7 @@ this does not disable indentation of section headings.")
   ;; performance, since slot accessors can't be optimized).
   (visibility-fn #'taxy-magit-section-visibility)
   (heading-face-fn (lambda (_depth) 'magit-section-heading))
+  ;; TODO: Rename heading-indent slot to level-indent.
   (heading-indent 2)
   (item-indent 2)
   (format-fn #'prin1-to-string))
@@ -281,9 +282,8 @@ PLIST may be a plist setting the following options:
 ;; I'm not sure which would perform better; I guess that with many lines, 
redisplay might take longer to use the
 ;; display properties for alignment than just having pre-aligned lines of text.
 
-;; TODO: Document this.
-
 (defun taxy-magit-section-format-items (columns formatters taxy)
+  ;; TODO: Document this.
   "Return a cons (table . column-sizes) for COLUMNS, FORMATTERS, and TAXY.
 COLUMNS is a list of column names, each of which should have an
 associated formatting function in FORMATTERS.
@@ -334,8 +334,8 @@ the items' values for each column."
 table)
(cons table column-sizes)
 
-;; TODO: Document this.
 (defun taxy-magit-section-format-header (column-sizes formatters)
+  ;; TODO: Document this.
   "Return header string for COLUMN-SIZES and FORMATTERS.
 COLUMN-SIZES should be the CDR of the cell returned by
 `taxy-magit-section-format-items'.  FORMATTERS should be the



[elpa] externals/taxy 284887d 3/5: Release: 0.6

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 284887d2ff0b1d271a3b47f2cbc7a4429b8a3e8f
Author: Adam Porter 
Commit: Adam Porter 

Release: 0.6
---
 README.org |  2 +-
 taxy.el|  2 +-
 taxy.info  | 84 +++---
 3 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/README.org b/README.org
index 53d9683..3771425 100644
--- a/README.org
+++ b/README.org
@@ -879,7 +879,7 @@ Note that while =taxy-magit-section.el= is installed with 
the =taxy= package, th
 :TOC:  :depth 0
 :END:
 
-** 0.6-pre
+** 0.6
 
 *** Additions
 
diff --git a/taxy.el b/taxy.el
index 50df510..5608cf9 100644
--- a/taxy.el
+++ b/taxy.el
@@ -5,7 +5,7 @@
 ;; Author: Adam Porter 
 ;; Maintainer: Adam Porter 
 ;; URL: https://github.com/alphapapa/taxy.el
-;; Version: 0.6-pre
+;; Version: 0.6
 ;; Package-Requires: ((emacs "26.3"))
 ;; Keywords: lisp
 
diff --git a/taxy.info b/taxy.info
index 3f810b9..bc88fcd 100644
--- a/taxy.info
+++ b/taxy.info
@@ -64,14 +64,14 @@ Dynamic taxys
 
 Changelog
 
-* 0.6-pre: 06-pre.
+* 0.6: 06.
 * 0.5: 05.
 * 0.4: 04.
 * 0.3: 03.
 * 0.2: 02.
 * 0.1: 01.
 
-0.6-pre
+0.6
 
 * Additions::
 
@@ -1019,7 +1019,7 @@ File: README.info,  Node: Changelog,  Next: Development,  
Prev: Usage,  Up: Top
 
 * Menu:
 
-* 0.6-pre: 06-pre.
+* 0.6: 06.
 * 0.5: 05.
 * 0.4: 04.
 * 0.3: 03.
@@ -1027,17 +1027,17 @@ File: README.info,  Node: Changelog,  Next: 
Development,  Prev: Usage,  Up: Top
 * 0.1: 01.
 
 
-File: README.info,  Node: 06-pre,  Next: 05,  Up: Changelog
+File: README.info,  Node: 06,  Next: 05,  Up: Changelog
 
-4.1 0.6-pre
-===
+4.1 0.6
+===
 
 * Menu:
 
 * Additions::
 
 
-File: README.info,  Node: Additions,  Up: 06-pre
+File: README.info,  Node: Additions,  Up: 06
 
 4.1.1 Additions
 ---
@@ -1067,7 +1067,7 @@ File: README.info,  Node: Additions,  Up: 06-pre
  published as a separate package later.)
 
 
-File: README.info,  Node: 05,  Next: 04,  Prev: 06-pre,  Up: Changelog
+File: README.info,  Node: 05,  Next: 04,  Prev: 06,  Up: Changelog
 
 4.2 0.5
 ===
@@ -1255,40 +1255,40 @@ GPLv3
 
 Tag Table:
 Node: Top218
-Node: Examples1816
-Node: Numbery (starting basically)2135
-Node: Lettery (filling incrementally)7896
-Node: Sporty (understanding completely)10410
-Node: Applications16397
-Node: Installation16797
-Node: Usage17110
-Node: Reusable taxys19247
-Node: Threading macros23400
-Node: Modifying filled taxys23939
-Node: Dynamic taxys24757
-Node: Multi-level dynamic taxys27406
-Node: "Chains" of independent multi-level dynamic taxys29599
-Node: Defining a classification domain-specific language32530
-Node: Magit section36693
-Node: Changelog37372
-Node: 06-pre37564
-Node: Additions37676
-Node: 0539026
-Node: Additions (1)39165
-Node: Fixes40271
-Node: 0440425
-Node: 0340647
-Node: Changes40776
-Node: Fixes (1)41139
-Node: 0241574
-Node: Changes (1)41743
-Node: Additions (2)42035
-Node: Fixes (2)42894
-Node: 0143148
-Node: Development43247
-Node: Copyright assignment43453
-Node: Credits44041
-Node: License44231
+Node: Examples1804
+Node: Numbery (starting basically)2123
+Node: Lettery (filling incrementally)7884
+Node: Sporty (understanding completely)10398
+Node: Applications16385
+Node: Installation16785
+Node: Usage17098
+Node: Reusable taxys19235
+Node: Threading macros23388
+Node: Modifying filled taxys23927
+Node: Dynamic taxys24745
+Node: Multi-level dynamic taxys27394
+Node: "Chains" of independent multi-level dynamic taxys29587
+Node: Defining a classification domain-specific language32518
+Node: Magit section36681
+Node: Changelog37360
+Node: 0637544
+Node: Additions37644
+Node: 0538990
+Node: Additions (1)39125
+Node: Fixes40231
+Node: 0440385
+Node: 0340607
+Node: Changes40736
+Node: Fixes (1)41099
+Node: 0241534
+Node: Changes (1)41703
+Node: Additions (2)41995
+Node: Fixes (2)42854
+Node: 0143108
+Node: Development43207
+Node: Copyright assignment43413
+Node: Credits44001
+Node: License44191
 
 End Tag Table
 



[elpa] externals/taxy 44d0a8c 5/5: Docs: Add Deffy to examples

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 44d0a8c946e7fdcf8c2a3c6ff8deeb5e2488b4d2
Author: Adam Porter 
Commit: Adam Porter 

Docs: Add Deffy to examples
---
 examples/README.org |   6 ++
 images/deffy.png| Bin 0 -> 156622 bytes
 2 files changed, 6 insertions(+)

diff --git a/examples/README.org b/examples/README.org
index 1820f59..7d416ab 100644
--- a/examples/README.org
+++ b/examples/README.org
@@ -2,6 +2,12 @@
 
 Some example applcations using ~taxy~.
 
+* Deffy
+
+=deffy= shows definitions and top-level forms in an Elisp project or file.
+
+[[../images/deffy.png]]
+
 * Diredy
 
 [[file:diredy.el][Diredy]] rearranges a Dired buffer, grouping files and 
directories by their size and MIME type.  Use it like:
diff --git a/images/deffy.png b/images/deffy.png
new file mode 100644
index 000..3c80012
Binary files /dev/null and b/images/deffy.png differ



[elpa] externals/taxy updated (ade9a02 -> 44d0a8c)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/taxy.

  from  ade9a02   Merge branch 'wip/magit-section-column-formatting'
   new  ea3b724   Change: (taxy-make-take-function) Use pre-map-2.1 pcase 
form
   new  436f345   Change: (taxy-make-take-function) Use older pcase form
   new  284887d   Release: 0.6
   new  8720f72   Meta: 0.7-pre
   new  44d0a8c   Docs: Add Deffy to examples


Summary of changes:
 README.org  |   6 +-
 examples/README.org |   6 ++
 images/deffy.png| Bin 0 -> 156622 bytes
 taxy.el |   8 +-
 taxy.info   | 263 
 5 files changed, 159 insertions(+), 124 deletions(-)
 create mode 100644 images/deffy.png



[elpa] externals/taxy ea3b724 1/5: Change: (taxy-make-take-function) Use pre-map-2.1 pcase form

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit ea3b7240ea350ea8675dfd5280294b01326143c1
Author: Adam Porter 
Commit: Adam Porter 

Change: (taxy-make-take-function) Use pre-map-2.1 pcase form
---
 taxy.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/taxy.el b/taxy.el
index 972c4e4..bc675a7 100644
--- a/taxy.el
+++ b/taxy.el
@@ -321,7 +321,8 @@ defined with a definer defined by 
`taxy-define-key-definer')."
 (quote-fn
  (fn) (pcase fn
 ((pred symbolp) (expand-form fn))
-(`(,(and (or 'and 'or 'not) boolean) . ,(and args (map 
:name :keys)))
+(`(,(and (or 'and 'or 'not) boolean)
+   . ,(and args (map (:name name) (:keys keys
  ;; Well, that pcase expression isn't confusing at 
all...  ;)
  ;;  (cl-assert name t "Boolean key functions require 
a NAME")
  ;;  (cl-assert keys t "Boolean key functions require 
KEYS")



[elpa] externals/taxy 436f345 2/5: Change: (taxy-make-take-function) Use older pcase form

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 436f345db3c32c394b9fafddaa4b26c3c1898a42
Author: Adam Porter 
Commit: Adam Porter 

Change: (taxy-make-take-function) Use older pcase form

Support for (pred (not PRED)) is new in Emacs 28.1.
---
 taxy.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/taxy.el b/taxy.el
index bc675a7..50df510 100644
--- a/taxy.el
+++ b/taxy.el
@@ -338,7 +338,8 @@ defined with a definer defined by 
`taxy-define-key-definer')."
. ,(and args (guard (pcase (car args)
  ((or (pred keywordp)
   (and (pred atom)
-   (pred (not 
symbolp)))
+   ;; SOMEDAY: Use 
(not symbolp) when depending on Emacs 28.1.
+   (pred (lambda (it) 
(not (symbolp it)
  `(quote ,_))
   t)
  ;; Key with args: replace with a lambda that



[elpa] externals/taxy 8720f72 4/5: Meta: 0.7-pre

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 8720f729a02f31e2038ce1dfd5a10da00f86a621
Author: Adam Porter 
Commit: Adam Porter 

Meta: 0.7-pre
---
 README.org |   4 +
 taxy.el|   2 +-
 taxy.info  | 257 +
 3 files changed, 145 insertions(+), 118 deletions(-)

diff --git a/README.org b/README.org
index 3771425..297f881 100644
--- a/README.org
+++ b/README.org
@@ -879,6 +879,10 @@ Note that while =taxy-magit-section.el= is installed with 
the =taxy= package, th
 :TOC:  :depth 0
 :END:
 
+** 0.7-pre
+
+Nothing new yet.
+
 ** 0.6
 
 *** Additions
diff --git a/taxy.el b/taxy.el
index 5608cf9..82c5804 100644
--- a/taxy.el
+++ b/taxy.el
@@ -5,7 +5,7 @@
 ;; Author: Adam Porter 
 ;; Maintainer: Adam Porter 
 ;; URL: https://github.com/alphapapa/taxy.el
-;; Version: 0.6
+;; Version: 0.7-pre
 ;; Package-Requires: ((emacs "26.3"))
 ;; Keywords: lisp
 
diff --git a/taxy.info b/taxy.info
index bc88fcd..a098e48 100644
--- a/taxy.info
+++ b/taxy.info
@@ -1,4 +1,4 @@
-This is README.info, produced by makeinfo version 6.5 from README.texi.
+This is README.info, produced by makeinfo version 5.2 from README.texi.
 
 INFO-DIR-SECTION Emacs
 START-INFO-DIR-ENTRY
@@ -11,24 +11,6 @@ File: README.info,  Node: Top,  Next: Examples,  Up: (dir)
 taxy.el
 ***
 
-https://elpa.gnu.org/packages/taxy.svg
-(https://elpa.gnu.org/packages/taxy.html)
-
-   _Now, where did I put that..._
-
-   This library provides a programmable way to classify arbitrary
-objects into a hierarchical taxonomy.  (That’s a lot of fancy words to
-say that this lets you automatically put things in nested groups.)
-
-   Helpful features include:
-
-Dynamic taxonomies
- Objects may be classified into hierarchies automatically defined at
- runtime based on their attributes.
-Reusable taxonomies
- Taxonomy definitions may be stored in variables and reused in other
- taxonomies’ descendant groups.
-
 * Menu:
 
 * Examples::
@@ -48,6 +30,9 @@ Examples
 * Sporty (understanding completely)::
 * Applications::
 
+
+
+
 Usage
 
 * Reusable taxys::
@@ -56,45 +41,73 @@ Usage
 * Dynamic taxys::
 * Magit section::
 
+
+
+
 Dynamic taxys
 
 * Multi-level dynamic taxys::
-* "Chains" of independent, multi-level dynamic taxys: "Chains" of independent 
multi-level dynamic taxys.
+* "Chains" of independent, multi-level dynamic taxys: "Chains" of independent 
multi-level dynamic taxys. 
 * Defining a classification domain-specific language::
 
 Changelog
 
-* 0.6: 06.
-* 0.5: 05.
-* 0.4: 04.
-* 0.3: 03.
-* 0.2: 02.
-* 0.1: 01.
+* 0.7-pre: 07-pre. 
+* 0.6: 06. 
+* 0.5: 05. 
+* 0.4: 04. 
+* 0.3: 03. 
+* 0.2: 02. 
+* 0.1: 01. 
+
 
 0.6
 
 * Additions::
 
+
 0.5
 
-* Additions: Additions (1).
+* Additions: Additionsx. 
 * Fixes::
 
+
+
+
 0.3
 
 * Changes::
-* Fixes: Fixes (1).
+* Fixes: Fixesx. 
+
+
 
 0.2
 
-* Changes: Changes (1).
-* Additions: Additions (2).
-* Fixes: Fixes (2).
+* Changes: Changesx. 
+* Additions: Additionsxx. 
+* Fixes: Fixesxx. 
 
 Development
 
 * Copyright assignment::
 
+
+(https://elpa.gnu.org/packages/taxy.html)
+
+   _Now, where did I put that…_
+
+   This library provides a programmable way to classify arbitrary
+objects into a hierarchical taxonomy.  (That’s a lot of fancy words to
+say that this lets you automatically put things in nested groups.)
+
+   Helpful features include:
+
+‘Dynamic taxonomies’
+ Objects may be classified into hierarchies automatically defined at
+ runtime based on their attributes.
+‘Reusable taxonomies’
+ Taxonomy definitions may be stored in variables and reused in other
+ taxonomies’ descendant groups.
 
 
 File: README.info,  Node: Examples,  Next: Installation,  Prev: Top,  Up: Top
@@ -151,8 +164,8 @@ Let’s imagine a silly taxonomy of numbers below 100:
   (10 25 35 50 55 65 70 85 95))
 
You might think about how to produce that by writing some imperative
-code, but ‘taxy’ allows you to do so in a more declarative and
-functional manner:
+code, but taxy allows you to do so in a more declarative and functional
+manner:
 
  (require 'taxy)
 
@@ -255,7 +268,7 @@ first taxy, i.e.  non-vowels.
("Consonants" "Well, if they aren't vowels..."
 ("B" "C" "D" "F" "G" "H" "J" "K" "L" "M" "N"
 
-   Oops, we forgot the letters after N!  Let’s add them, too:
+   Oops, we forgot the letters after N! Let’s add them, too:
 
  (taxy-plain
   (taxy-fill (reverse
@@ -487,8 +500,8 @@ File: README.info,  Node: Installation,  Next: Usage,  
Prev: Examples,  Up: Top
 2 Installation
 **
 
-‘taxy’ is distributed in GNU ELPA (https://elpa.gnu.org/), which is
-available in Emacs by default.  Use ‘M-x package-install RET taxy RET’,
+taxy is distributed in GNU ELPA (https://elpa.gnu.org/), which is
+available in Emacs by default.  Use M-x package-install RET taxy RET,
 then ‘(require 'taxy)’ in your Elisp project.
 
 
@@ -549,8 +562,8 @@ File: README.info,  Node: Re

[elpa] externals/engrave-faces c21ec36 1/2: Fix typo in LaTeX preamble

2021-09-15 Thread ELPA Syncer
branch: externals/engrave-faces
commit c21ec3629f8fbd3c34cc3c23ca3d4351aa8cb655
Author: TEC 
Commit: TEC 

Fix typo in LaTeX preamble
---
 engrave-faces-latex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/engrave-faces-latex.el b/engrave-faces-latex.el
index 1ca4f25..4d19d9a 100644
--- a/engrave-faces-latex.el
+++ b/engrave-faces-latex.el
@@ -102,7 +102,7 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-latex-output-style'."
 \\usepackage{fvextra}
 \\usepackage[margin=1.5cm]{geometry}
 \\usepackage{sourcecodepro}
-\\pagestype{empty}\n\n"
+\\pagestyle{empty}\n\n"
   (engrave-faces-latex-gen-preamble)
   "
 \\begin{document}



[elpa] externals/engrave-faces updated (6b50761 -> 32a9511)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/engrave-faces.

  from  6b50761   Reduce the public API of engrave-faces
   new  c21ec36   Fix typo in LaTeX preamble
   new  32a9511   subr-x should only be needed at compile time


Summary of changes:
 engrave-faces-latex.el | 2 +-
 engrave-faces.el   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)



[elpa] externals/engrave-faces 32a9511 2/2: subr-x should only be needed at compile time

2021-09-15 Thread ELPA Syncer
branch: externals/engrave-faces
commit 32a95110bb0a19de9e11530f7892883b63934d2c
Author: TEC 
Commit: TEC 

subr-x should only be needed at compile time
---
 engrave-faces.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/engrave-faces.el b/engrave-faces.el
index a67c483..14d0478 100644
--- a/engrave-faces.el
+++ b/engrave-faces.el
@@ -37,7 +37,8 @@
 ;;; Code:
 
 (require 'map)
-(require 'subr-x)
+(eval-when-compile
+  (require 'subr-x))
 
 (defgroup engrave-faces nil
   "Export buffers with font-lock information to other formats."



[elpa] main 75a8844: * elpa-packages (sketch-mode): New package

2021-09-15 Thread monnier--- via
branch: main
commit 75a8844efd928296ecf672e6efcdf25d6808be38
Author: Stefan Monnier 
Commit: Stefan Monnier 

* elpa-packages (sketch-mode): New package
---
 elpa-packages | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/elpa-packages b/elpa-packages
index 62fc23e..cffd9a6 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -350,8 +350,8 @@
  ("shell-quasiquote"   :url nil)
  ("shen-mode"  :url nil)
  ("sisu-mode"  :url nil)
- ;; ("sketch-mode" :url 
"https://github.com/dalanicolai/sketch-mode";
- ;;  :auto-sync t)
+ ("sketch-mode":url 
"https://github.com/dalanicolai/sketch-mode";
+  :auto-sync t)
  ("slime-volleyball"   :url nil)
  ("sm-c-mode"  :url nil)
  ("smalltalk-mode" :url nil) ;; Was "git://git.sv.gnu.org/smalltalk"



[elpa] externals/sketch-mode 35255d0 04/38: Implement undo/redo and show/edit/(re)load definition

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 35255d0a94d54c870090a25e888c5958183cc712
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement undo/redo and show/edit/(re)load definition
---
 sketch-mode.el | 42 --
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 480b36d..7d037e2 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -194,18 +194,19 @@ STOPS is a list of percentage/color pairs."
 ;;;###autoload
 (defun sketch (arg)
   "Initialize or switch to (new) SVG image.
-With prefix argument,  "
+With prefix argument, create sketch using default (customizable)
+values"
   (interactive "P")
-  (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
-(height (if arg 600 (read-number "Enter height: ")))
-(buffer (get-buffer "*sketch")))
+  (let ((buffer (get-buffer "*sketch*")))
 (if buffer
 (progn (switch-to-buffer buffer)
-   (call-interactively 'tutorial-transient))
-  (switch-to-buffer (get-buffer-create "*sketch"))
-  (defvar-local grid-param 25)
-  (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 0 
for no grid): ")))
-  (sketch--create-canvas width height grid-param
+   (call-interactively 'sketch-transient))
+  (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
+(height (if arg 600 (read-number "Enter height: "
+(switch-to-buffer (get-buffer-create "*sketch"))
+(defvar-local grid-param 25)
+(setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 
0 for no grid): ")))
+(sketch--create-canvas width height grid-param)
 
 
 (defun sketch-snap-to-grid (coord grid-param)
@@ -435,9 +436,11 @@ With prefix argument,  "
   ;; (call-interactively 'tutorial-transient)
 
 (transient-define-suffix sketch-show-definition ()
+  :transient 'transient--do-exit
   (interactive)
   (let ((buffer (get-buffer-create "svg")))
-(pp svg buffer)
+(transient-quit-one)
+(pp svg-sketch buffer)
 (switch-to-buffer-other-window buffer)
 (emacs-lisp-mode)))
 
@@ -447,6 +450,25 @@ With prefix argument,  "
 (pp svg (current-buffer))
 (kill-new (buffer-string
 
+(defun sketch-load-definition ()
+  (interactive)
+  (setq svg-sketch (read (buffer-string
+
+(transient-define-suffix sketch-undo ()
+  (interactive)
+  (defvar sketch-undo-redo nil)
+  (let ((sketch-reverse (nreverse svg-sketch)))
+(push (pop sketch-reverse) sketch-undo-redo)
+(setq svg-sketch (nreverse sketch-reverse)))
+  (sketch-redraw))
+
+(transient-define-suffix sketch-redo ()
+  (interactive)
+  (let ((sketch-reverse (nreverse svg-sketch)))
+(push (pop sketch-undo-redo) sketch-reverse)
+(setq svg-sketch (nreverse sketch-reverse)))
+  (sketch-redraw))
+
 (transient-define-suffix sketch-save ()
   (interactive)
   (image-save))



[elpa] branch externals/sketch-mode created (now aaac04d)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/sketch-mode.

at  aaac04d   Fix indentation (simply auto indent complete file)

This branch includes the following new commits:

   new  37af8f4   Initial commit
   new  96ce92b   First sketch of sketch-mode
   new  ccff908   Implement toggle grid
   new  35255d0   Implement undo/redo and show/edit/(re)load definition
   new  3c8f9f1   Add documentation (prepare for publishing)
   new  32559c4   Add remove functionality (id's and labels)
   new  04dd1db   Add sketch fonts
   new  56d7b5d   Create FUNDING.yml
   new  5c37145   Add sponsor button
   new  b944693   Add crop image feature AND add text transient into main
   new  f82ed74   Update documentation (add screencast)
   new  a715b8a   Reformat/compactify transient
   new  da9e1d7   Implement help-echo showing coordinates
   new  d3b1831   Move transient quit for more sketch space
   new  414ec7c   Don't print coordinates to message buffer
   new  87a0808   Fix file header
   new  7583fcb   Fix variable names and implement svg lisp togglable side 
window
   new  4d78311   Experimental object modify tabulated list
   new  8b63796   First try: implement update for both type side-winows
   new  0f870a1   Implement load from definition buffer & modify object 
functionality
   new  fadc554   Add xml processing instruction and DOCTYPE element (see 
#4)
   new  d42f84a   Add svg and sketch group definitions
   new  ec35bb4   Add xml processing instruction and DOCTYPE element (see 
#4)
   new  846f4a0   Implement layers (incl. reformat labels)
   new  406f51d   Fix undo-redo (i.e. switch to use undo-tree-mode)
   new  e3c16c7   Merge branch 'implement-layers' (incl. undo-tree 
undo/redo)
   new  0005a3a   Add sketch-mapcons function (refactor 
sketch--circle-radius)
   new  951c284   Fix dot marker and rename (make internal) 
sketch-snap-to-grid
   new  f0465ec   Remove sketch-interactive function
   new  6433b20   Add circle/ellipse labels
   new  9eb86b8   Add comments and cleanup
   new  19202c7   Implement first step for snippets/import
   new  4a4e2ba   Implement import/snippet functionality
   new  49c3c04   Add dasharray feature
   new  bcb99c9   Implement text label and modify feature
   new  4c6a675   Fix load definition functionality (also set layers list)
   new  bebba7b   Fix add layer mechanism
   new  aaac04d   Fix indentation (simply auto indent complete file)




[elpa] externals/sketch-mode 96ce92b 02/38: First sketch of sketch-mode

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 96ce92ba417a1034a9b3f41bf1f285988420d108
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

First sketch of sketch-mode
---
 README.org |   3 +
 sketch-mode.el | 423 +
 2 files changed, 426 insertions(+)

diff --git a/README.org b/README.org
new file mode 100644
index 000..a713b27
--- /dev/null
+++ b/README.org
@@ -0,0 +1,3 @@
+#+TITLE: Sketch mode
+
+* Welcome
diff --git a/sketch-mode.el b/sketch-mode.el
new file mode 100644
index 000..b2c4f40
--- /dev/null
+++ b/sketch-mode.el
@@ -0,0 +1,423 @@
+;;; sketch-mode.el --- Support for the Foo programming language  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2010-2021 Daniel Nicolai
+
+
+;; Author: D.L. Nicolai 
+;; Created: 17 Jul 2021
+
+;; Keywords: multimedia 
+;; URL: https://github.com/dalanicolai/sketch-mode
+
+;; 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:
+
+
+;; TODO maybe transform relevant transient argument (strings) to variables
+
+;; TODO add function to open svg code in 'other buffer' and quickly reload
+;; (after editing)
+
+;; TODO add functionality to start drawing from org-mode source block and 
update
+;; source block after each draw/edit
+
+;; TODO maybe add keybindings (save/bind transient setting to specific 'mouse 
keys')
+
+;; TODO add functionality to toggle grid
+
+;; NOTE this is a most straightforward sketch-mode. A more advanced/general 
version
+;; could implement a drawing DSL based on nodes (a la tikz/asymptote etc.)
+
+
+;;; Code:
+(require 'svg)
+(require 'transient)
+
+(defgroup sketch nil
+  "Configure default sketch (object) properties.")
+
+(defcustom sketch-default-image-size '(800 . 600)
+  "Default size for sketch canvas.
+Cons cell with car and cdr both integers, respectively
+representing the image width and image height
+(default: `'(800 . 600)')."
+  :type '(cons integer integer))
+
+(defcustom sketch-default-grid-parameter 25
+  "Default grid line separation distance (integer)."
+  :type 'integer)
+
+(defcustom sketch-default-shape 'line
+  "Default object type for `sketch-interactively.'"
+  :type '(choice
+   (const :tag "Line" 'line)
+   (const :tag "Rectangle" 'rectangle)
+  (const :tag "Circle" 'circle)
+  (const :tag "Ellipse" 'ellipse)))
+
+(defcustom sketch-snap-to-grid t
+  "When non-nil snap to grid."
+  :type 'boolean)
+
+(defcustom sketch-include-start-marker nil
+  "Start start-marker"
+  :type '(choice
+   (const :tag "No marker" nil)
+   (const :tag "Arrow" 'arrow)
+  (const :tag "Point" 'point)))
+
+(defcustom sketch-include-mid-marker nil
+  "Mid marker type"
+  :type '(choice
+   (const :tag "No marker" nil)
+   (const :tag "Arrow" 'arrow)
+  (const :tag "Point" 'point)))
+
+(defcustom sketch-include-end-marker nil
+  "End marker type"
+  :type '(choice
+   (const :tag "No marker" nil)
+   (const :tag "Arrow" 'arrow)
+  (const :tag "Point" 'point)))
+
+(defun svg-marker (svg id width height &optional color reverse)
+  "Add a gradient with ID to SVG.
+TYPE is `linear' or `radial'.
+STOPS is a list of percentage/color pairs."
+  (svg--def
+   svg
+   (apply
+'dom-node
+'marker 
+`((id . ,id)
+  (viewBox . "0 0 10 10")
+  (refX . 5)
+  (refY . 5)
+  ,(pcase id
+ ("arrow" `(markerWidth . ,width))
+ ("dot" `(markerWidth . ,width)))
+  ,(pcase id
+ ("arrow" `(markerHeight . ,height))
+ ("dot" `(markerHeight . ,height)))
+  ,(pcase id
+ ;; ("arrow" '(orient . auto-start-reverse
+ ("arrow" (if reverse
+  '(orient . auto)
+'(orient . auto-start-reverse)
+(pcase id
+  ("arrow" (list (dom-node 'path `((d . "M 0 0 L 10 5 L 0 10 z")
+   (fill . ,(or color "black"))
+  ("dot" (list (dom-node 'circle `((cx . 5)
+   (cy . 5)
+   (r . 5)
+   (fill . ,(or color "black"))
+
+(define-minor-mode sketch-mode
+  "Create svg images using the mouse."
+  nil "sketch-mode"
+  '(([drag-mouse-1] . sketch-interactively)
+([C-S-d

[elpa] externals/sketch-mode 04dd1db 07/38: Add sketch fonts

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 04dd1dbace8cf2e1e143a6b5f8489ff61f4bf398
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add sketch fonts

Currently the fonts have their own prefix, but for usability it is probably
nicer to add it to the main sketch transient prefix
---
 sketch-mode.el | 124 ++---
 1 file changed, 118 insertions(+), 6 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 5215e43..05f2dd0 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -27,6 +27,22 @@
 ;;; Commentary:
 
 
+;; DONE add functionality to toggle grid
+
+;; DONE implement (simple) undo mechanism
+
+;; DONE add remove (objects) functionality (see `svg-remove')
+
+;; TODO add text objects
+
+;; TODO move font transient (also its suffix) into main sketch transient 
(suffix)
+
+;; TODO add functionality to crop/select part of image (on save)
+
+;; TODO add functionality to modify objects
+
+;; TODO enable defining global svg settings (object properties)
+
 ;; TODO maybe transform relevant transient argument (strings) to variables
 
 ;; TODO add function to open svg code in 'other buffer' and quickly reload
@@ -37,12 +53,6 @@
 
 ;; TODO maybe add keybindings (save/bind transient setting to specific 'mouse 
keys')
 
-;; DONE add functionality to toggle grid
-
-;; TODO implement undo mechanism
-
-;; TODO add remove (objects) functionality (see `svg-remove')
-
 ;; TODO add clipping fuctionality (see `svg-clip-path')
 
 ;; NOTE this is a most straightforward sketch-mode. A more advanced/general 
version
@@ -299,6 +309,106 @@ values"
 (propertize (apply 'color-rgb-to-hex (color-name-to-rgb 
default))
 'face 'transient-inactive-argument))
 
+(transient-define-prefix sketch-text ()
+  "Some Emacs magic"
+  :transient-suffix 'transient--do-call
+  :transient-non-suffix 'transient--do-stay
+  ["Font definitions"
+   [("f" "family" sketch-select-font)]
+   [("s" "stroke-color" sketch-font-size)
+("w" "fill-color" sketch-font-weight)]
+   ;; [("w" "stroke-width" sketch-stroke-width)]
+   [("m" "end-marker" sketch-object-marker)]]
+  ["Commands"
+   ([mouse-1] "Sketch"  sketch-text-interactively)]
+  [("q" "Quit"   transient-quit-one)])
+
+(transient-define-infix sketch-select-font ()
+  :description "Option with list"
+  :class 'transient-option
+  :argument "--family="
+  :choices (font-family-list))
+
+(transient-define-infix sketch-font-size ()
+  :description "Option with list"
+  :class 'transient-option
+  :argument "--font-size="
+  :choices (mapcar (lambda (x)
+ (number-to-string x))
+   (number-sequence 1 100)))
+
+(transient-define-infix sketch-font-weight ()
+  :description "Option with list"
+  :class 'sketch-variable:choices
+  :argument "--object="
+  :choices '("bold")
+  :default "normal")
+
+
+(transient-define-suffix sketch-text-interactively (event)
+  (interactive "@e")
+  (let* ((sketch-args (when transient-current-prefix (transient-args 
'sketch-transient)))
+ (text-args (when transient-current-prefix (transient-args 
'sketch-text)))
+ (start (event-start event))
+ (grid-param (plist-get (cdr (posn-image start)) :grid-param))
+ (snap (transient-arg-value "--snap-to-grid=" sketch-args))
+ (coords (if (or (not snap) (string= snap "nil"))
+   (posn-object-x-y start)
+ (sketch-snap-to-grid (posn-object-x-y start) 
grid-param)))
+ (text (read-string "Enter text: "))
+ (object-props (list :font-size
+ (transient-arg-value "--font-size=" text-args)
+ :font-weight
+ (transient-arg-value "--font-weight=" text-args)
+ )))
+ ;; :fill
+ ;; (transient-arg-value "--fill-color=" 
sketch-args)
+ ;; :marker-end (if sketch-args (pcase 
(transient-arg-value "--marker=" sketch-args)
+ ;;("arrow" "url(#arrow)")
+ ;;("point" "url(#point)")
+ ;;(_ "none"))
+ ;;   (if sketch-include-end-marker
+ ;;   "url(#arrow)"
+ ;; "none"
+(apply 'svg-text svg-sketch text :x (car coords) :y (cdr coords) 
object-props))
+(sketch-redraw))
+
+  ;; (let* ((args (when transient-current-prefix (transient-args 
'sketch-transient)))
+  ;;(print event
+;;  (start (event-start event))
+;;  (grid-param (plist-get (cdr (posn-image start)) :grid-param))
+;;  (snap (transient-arg-value "--snap-to-grid=" args))
+;;  (start-coords (if (or (not snap) (string= sna

[elpa] externals/sketch-mode ccff908 03/38: Implement toggle grid

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit ccff908fe722883c64719c649866ba89724f850a
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement toggle grid
---
 sketch-mode.el | 86 --
 1 file changed, 59 insertions(+), 27 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index b2c4f40..480b36d 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -37,7 +37,13 @@
 
 ;; TODO maybe add keybindings (save/bind transient setting to specific 'mouse 
keys')
 
-;; TODO add functionality to toggle grid
+;; DONE add functionality to toggle grid
+
+;; TODO implement undo mechanism
+
+;; TODO add remove (objects) functionality (see `svg-remove')
+
+;; TODO add clipping fuctionality (see `svg-clip-path')
 
 ;; NOTE this is a most straightforward sketch-mode. A more advanced/general 
version
 ;; could implement a drawing DSL based on nodes (a la tikz/asymptote etc.)
@@ -54,9 +60,13 @@
   "Default size for sketch canvas.
 Cons cell with car and cdr both integers, respectively
 representing the image width and image height
-(default: `'(800 . 600)')."
+(default: '(800 . 600))."
   :type '(cons integer integer))
 
+(defcustom sketch-show-grid t
+  "When non-nil, show grid lines (default: t)."
+  :type 'boolean)
+
 (defcustom sketch-default-grid-parameter 25
   "Default grid line separation distance (integer)."
   :type 'integer)
@@ -130,7 +140,8 @@ STOPS is a list of percentage/color pairs."
   "Create svg images using the mouse."
   nil "sketch-mode"
   '(([drag-mouse-1] . sketch-interactively)
-([C-S-drag-mouse-1] . sketch-interactively)))
+([C-S-drag-mouse-1] . sketch-interactively)
+("" . sketch-transient)))
 
 
 (defun sketch--circle-radius (start-coords end-coords)
@@ -154,25 +165,31 @@ STOPS is a list of percentage/color pairs."
 (defun sketch--create-canvas (width height &optional grid-param)
   "Create canvas for drawing svg using the mouse."
   (defvar svg)
-(insert-image (let ((width width)
-(height height))
-(setq svg (svg-create width height :stroke "gray"))
-(svg-marker svg "arrow" 8 8 "black" t)
-(svg-rectangle svg 0 0 width height :fill "white")
-(unless (or (not grid-param) (= grid-param 0) )
-  (let ((dash t))
-(dotimes (x (1- (/ width grid-param)))
-  (let ((pos (* (1+ x) grid-param)))
-(svg-line svg pos 0 pos height :stroke-dasharray 
(when dash "2,4"))
-(setq dash (if dash nil t)
-  (let ((dash t))
-(dotimes (x (1- (/ height grid-param)))
-  (let ((pos (* (1+ x) grid-param)))
-(svg-line svg 0 pos width pos :stroke-dasharray 
(when dash "2,4"))
-(setq dash (if dash nil t))
-(svg-image svg :pointer 'arrow :grid-param grid-param)))
+  (defvar svg-canvas)
+  (defvar svg-grid)
+  (defvar svg-sketch)
+(insert-image
+ (let ((width width)
+   (height height))
+   (setq svg-canvas (svg-create width height :stroke "gray"))
+   (svg-marker svg-canvas "arrow" 8 8 "black" t)
+   (svg-rectangle svg-canvas 0 0 width height :fill "white")
+   (setq svg-grid (svg-create width height))
+   (let ((dash t))
+ (dotimes (x (1- (/ width grid-param)))
+   (let ((pos (* (1+ x) grid-param)))
+ (svg-line svg-grid pos 0 pos height :stroke-dasharray (when dash 
"2,4"))
+ (setq dash (if dash nil t)
+   (let ((dash t))
+ (dotimes (x (1- (/ height grid-param)))
+   (let ((pos (* (1+ x) grid-param)))
+ (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
+ (setq dash (if dash nil t)
+   (setq svg (append svg-canvas (when sketch-show-grid (cddr svg-grid
+   (svg-image svg :pointer 'arrow :grid-param grid-param)))
 (sketch-mode)
-(call-interactively 'sketch-transient))
+(call-interactively 'sketch-transient)
+(setq svg-sketch (svg-create width height)))
 
 ;;;###autoload
 (defun sketch (arg)
@@ -181,12 +198,13 @@ With prefix argument,  "
   (interactive "P")
   (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
 (height (if arg 600 (read-number "Enter height: ")))
-(grid-param (if arg 25 (read-number "Enter grid parameter (enter 0 for 
no grid): ")))
 (buffer (get-buffer "*sketch")))
 (if buffer
 (progn (switch-to-buffer buffer)
(call-interactively 'tutorial-transient))
   (switch-to-buffer (get-buffer-create "*sketch"))
+  (defvar-local grid-param 25)
+  (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 0 
for no grid): ")))
   (sketch--create-canvas width height grid-param
 
 
@@ -284,9 +

[elpa] externals/sketch-mode 56d7b5d 08/38: Create FUNDING.yml

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 56d7b5dd90f533ca3f7f4eff4fa6388dfad2457c
Author: Daniel Nicolai 
Commit: GitHub 

Create FUNDING.yml
---
 .github/FUNDING.yml | 12 
 1 file changed, 12 insertions(+)

diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 000..8f7a904
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github:  [dalanicolai]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., 
npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., 
cloud-foundry
+liberapay: dalanicolai
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']



[elpa] externals/sketch-mode 414ec7c 15/38: Don't print coordinates to message buffer

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 414ec7c07bf8f917dfaf4c9c4e943f3ff8d84a27
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Don't print coordinates to message buffer
---
 sketch-mode.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 95fc88e..24c878e 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -218,7 +218,8 @@ transient."
   ;; :map '(((rect . ((0 . 0) . (800 . 600)))
   sketch
   (pointer arrow help-echo (lambda (_ _ pos)
- (let ((coords (cdr 
(mouse-pixel-position
+ (let ((message-log-max 
nil)
+   (coords (cdr 
(mouse-pixel-position
(print (format "(%s, 
%s)"
   (- (car 
coords) sketch-im-x-offset)
   (+ (cdr 
coords) sketch-im-y-offset)))
@@ -518,7 +519,8 @@ values"
;; :map '(((rect . ((0 . 0) . (800 . 600)))
sketch
(pointer arrow help-echo (lambda (_ _ pos)
-  (let ((coords 
(mouse-pixel-position)))
+  (let 
((message-log-max nil)
+(coords 
(mouse-pixel-position)))
 (print (format 
"(%s, %s)"

(- (cadr coords) pos)

(cddr coords)))



[elpa] externals/sketch-mode d3b1831 14/38: Move transient quit for more sketch space

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit d3b1831019df65423432d990813dc2b3ac654d21
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Move transient quit for more sketch space
---
 sketch-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 713c67c..95fc88e 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -393,8 +393,8 @@ values"
 ("r" "Redo" sketch-redo)]
[("d" "Show definition" sketch-show-definition)
 ("D" "Copy definition" sketch-copy-definition)
-("S" "Save image" sketch-save)]]
-  [("q" "Quit"   transient-quit-one)])
+("S" "Save image" sketch-save)]
+   [("q" "Quit"   transient-quit-one)]])
 
 (transient-define-infix sketch-object ()
   :description "Option with list"



[elpa] externals/sketch-mode da9e1d7 13/38: Implement help-echo showing coordinates

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit da9e1d7ff54a532df76976e3555e7f2fcd2f4424
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement help-echo showing coordinates
---
 sketch-mode.el | 40 ++--
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 0f820af..713c67c 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -67,6 +67,14 @@
 (defgroup sketch nil
   "Configure default sketch (object) properties.")
 
+(defcustom sketch-im-x-offset 7
+  "Default grid line separation distance (integer)."
+  :type 'integer)
+
+(defcustom sketch-im-y-offset 1
+  "Default grid line separation distance (integer)."
+  :type 'integer)
+
 (defcustom sketch-default-image-size '(800 . 600)
   "Default size for sketch canvas.
 Cons cell with car and cdr both integers, respectively
@@ -157,7 +165,7 @@ In sketch-mode buffer press \\[sketch-transient] to 
activate the
 transient."
   :lighter "sketch-mode"
   :keymap
-  '(([drag-mouse-1] . sketch-interactively)
+  '(([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
 ("" . sketch-transient)))
 
@@ -203,7 +211,17 @@ transient."
  (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
  (setq dash (if dash nil t)
(setq svg (append svg-canvas (when sketch-show-grid (cddr svg-grid
-   (svg-image svg :pointer 'arrow :grid-param grid-param)))
+   (svg-image svg
+  :grid-param grid-param
+  :pointer 'arrow
+  :map `(((rect . ((0 . 0) . (,(dom-attr svg 'width) . 
,(dom-attr svg 'height
+  ;; :map '(((rect . ((0 . 0) . (800 . 600)))
+  sketch
+  (pointer arrow help-echo (lambda (_ _ pos)
+ (let ((coords (cdr 
(mouse-pixel-position
+   (print (format "(%s, 
%s)"
+  (- (car 
coords) sketch-im-x-offset)
+  (+ (cdr 
coords) sketch-im-y-offset)))
 (sketch-mode)
 (call-interactively 'sketch-transient)
 (setq svg-sketch (svg-create width height)))
@@ -367,9 +385,9 @@ values"
["Labels"
 ("l" "Toggle labels" sketch-toggle-labels)]]
   ["Commands"
-   [([drag-mouse-1] "Draw object"  sketch-interactively-1)
-([mouse-1] "Draw text"  sketch-text-interactively)
-([C-S-drag-mouse-1] "Crop image" sketch-crop)]
+   [([sketch drag-mouse-1] "Draw object"  sketch-interactively-1)
+([sketch mouse-1] "Draw text"  sketch-text-interactively)
+([sketch C-S-drag-mouse-1] "Crop image" sketch-crop)]
[("R" "Remove object" sketch-remove-object)
 ("u" "Undo" sketch-undo)
 ("r" "Redo" sketch-redo)]
@@ -493,7 +511,17 @@ values"
 (cddr svg-sketch)
 (when sketch-show-labels (sketch-labels
   (erase-buffer) ;; a (not exact) alternative is to use (kill-backward-chars 1)
-  (insert-image (svg-image svg :pointer 'arrow :grid-param grid-param)))
+  (insert-image (svg-image svg
+   :pointer 'arrow
+   :grid-param grid-param
+   :map `(((rect . ((0 . 0) . (,(dom-attr svg 'width) 
. ,(dom-attr svg 'height
+   ;; :map '(((rect . ((0 . 0) . (800 . 600)))
+   sketch
+   (pointer arrow help-echo (lambda (_ _ pos)
+  (let ((coords 
(mouse-pixel-position)))
+(print (format 
"(%s, %s)"
+   
(- (cadr coords) pos)
+   
(cddr coords)))
 
 (transient-define-suffix sketch-interactively-1 (event)
   (interactive "@e")



[elpa] externals/sketch-mode 87a0808 16/38: Fix file header

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 87a080823099d075bfd7f891c8695c43d090b554
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix file header
---
 sketch-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 24c878e..bedd344e 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1,6 +1,6 @@
-;;; sketch-mode.el --- Support for the Foo programming language  -*- 
lexical-binding: t; -*-
+;;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse 
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2021 Daniel Nicolai
+;; Copyright (C) 2021 Daniel Nicolai
 
 
 ;; Author: D.L. Nicolai 



[elpa] externals/sketch-mode a715b8a 12/38: Reformat/compactify transient

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit a715b8ac3e743a617c63645842ee63c31af44dfd
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Reformat/compactify transient
---
 sketch-mode.el | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 547e510..0f820af 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -350,21 +350,22 @@ values"
   "Some Emacs magic"
   :transient-suffix 'transient--do-call
   :transient-non-suffix 'transient--do-stay
-  [[("c" "stroke-color" sketch-stroke-color)
-("C" "fill-color" sketch-fill-color)]
-   [("w" "stroke-width" sketch-stroke-width)]]
-  ["Object definitions"
-   [("o" "object" sketch-object)]
-   [("m" "end-marker" sketch-object-marker)]]
-  ["Font definitions"
-   [("-f" "family" sketch-select-font)
-("-w" "font-weight" sketch-font-weight)]
-   [("-s" "font-size" sketch-font-size)]]
-  ["Grid"
-   ("s" "Snap to grid" sketch-snap)
-   ("g" "Toggle grid" sketch-toggle-grid)]
-  ["Labels"
-   ("l" "Toggle labels" sketch-toggle-labels)]
+  [["General definitions"
+("c" "stroke-color" sketch-stroke-color)
+("C" "fill-color" sketch-fill-color)
+("w" "stroke-width" sketch-stroke-width)]
+   ["Object definitions"
+("o" "object" sketch-object)
+("m" "end-marker" sketch-object-marker)]
+   ["Font definitions"
+("-f" "family" sketch-select-font)
+("-w" "font-weight" sketch-font-weight)
+("-s" "font-size" sketch-font-size)]
+   ["Grid"
+("s" "Snap to grid" sketch-snap)
+("g" "Toggle grid" sketch-toggle-grid)]
+   ["Labels"
+("l" "Toggle labels" sketch-toggle-labels)]]
   ["Commands"
[([drag-mouse-1] "Draw object"  sketch-interactively-1)
 ([mouse-1] "Draw text"  sketch-text-interactively)



[elpa] externals/sketch-mode 5c37145 09/38: Add sponsor button

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 5c37145055a2ede2161296dd95898a34a525ba9a
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add sponsor button
---
 .github/FUNDING.yml |  4 ++--
 README.org  | 26 ++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 8f7a904..05d317b 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,6 +1,6 @@
 # These are supported funding model platforms
 
-github:  [dalanicolai]
+github:  # dalanicolai
 patreon: # Replace with a single Patreon username
 open_collective: # Replace with a single Open Collective username
 ko_fi: # Replace with a single Ko-fi username
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge 
project-name e.g., cl
 liberapay: dalanicolai
 issuehunt: # Replace with a single IssueHunt username
 otechie: # Replace with a single Otechie username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+custom: 
"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6BHLS7H9ARJXE&source=url";
diff --git a/README.org b/README.org
index 7aff01e..f198860 100644
--- a/README.org
+++ b/README.org
@@ -49,3 +49,29 @@
   is more or less self explanatory.
 
   Create your sketch and then save the file by pressing =S=.
+
+* Sponsor the project
+  Due to a combination of unfortunate circumstances, I am in an unfortunate
+  financial situation (dependent on my family), while I would love to get a
+  modest income. As you can see from my [projects page][link to be inserted]
+  this is not because I don't do (I hope useful) work. It is just that I don't
+  get paid, nor receive any allowance, for writing free software while working
+  on a thesis. Anyway, although I really prefer to make software available to
+  anyone who would like to use it (I know quite well the frustration of
+  "financial exclusion"), I would be very happy with a donation from users who
+  enjoy 'my' packages, and can easily afford it (e.g. by using the packages for
+  their work). Of course, if you'd like to see this package (or any of my other
+  packages) get developed further you could also consider to become a sponsor 
(I
+  have no experience with this kind of business, but I guess it starts with
+  letting users know about it).
+
+  Accepted donation methods
+  [[https://en.liberapay.com/dalanicolai/][liberapay]]
+  
[[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6BHLS7H9ARJXE&source=url][PayPal
 donate]]
+
+# https://www.paypal.com/cgi-bin/webscr"; method="post" 
target="_top">
+# 
+# 
+# https://www.paypalobjects.com/en_US/NL/i/btn/btn_donateCC_LG.gif"; 
border="0" name="submit" title="PayPal - The safer, easier way to pay online!" 
alt="Donate with PayPal button" />
+# https://www.paypal.com/en_NL/i/scr/pixel.gif"; 
width="1" height="1" />
+# 



[elpa] externals/sketch-mode 8b63796 19/38: First try: implement update for both type side-winows

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 8b63796df62712976b745527a9b73ae11e9cc485
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

First try: implement update for both type side-winows
---
 sketch-mode.el| 60 ++-
 sketch-scratch.el | 17 
 2 files changed, 51 insertions(+), 26 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 85f9b2c..f757bc1 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -34,18 +34,18 @@
 
 ;; DONE add remove (objects) functionality (see `svg-remove')
 
-;; TODO move font transient (also its suffix) into main sketch transient 
(suffix)
+;; DONE move font transient (also its suffix) into main sketch transient 
(suffix)
 
-;; TODO add functionality to crop/select part of image (on save)
+;; DONE add functionality to crop/select part of image (on save)
 
-;; TODO add functionality to modify objects
+;; TODO add functionality to modify objects (see `add-object-modify-feature' 
branch)
 
 ;; TODO enable defining global svg settings (object properties)
 
 ;; TODO maybe transform relevant transient argument (strings) to variables
 
 ;; TODO add function to open svg code in 'other buffer' and quickly reload
-;; (after editing)
+;; (after editing, DONE see `add-object-modify-feature' branch)
 
 ;; TODO add functionality to start drawing from org-mode source block and 
update
 ;; source block after each draw/edit
@@ -396,8 +396,9 @@ values"
[([sketch drag-mouse-1] "Draw object"  sketch-interactively-1)
 ([sketch mouse-1] "Draw text"  sketch-text-interactively)
 ([sketch C-S-drag-mouse-1] "Crop image" sketch-crop)]
-   [("R" "Remove object" sketch-remove-object)
-("u" "Undo" sketch-undo)
+   [("T" "Transfrom object" sketch-modify-object)
+("R" "Remove object" sketch-remove-object)]
+[("u" "Undo" sketch-undo)
 ("r" "Redo" sketch-redo)]
[("d" "Show definition" sketch-show-definition)
 ("D" "Copy definition" sketch-copy-definition)
@@ -511,9 +512,15 @@ values"
  (sketch-translate-node-coords node dy 'y
   (cddr sketch-root)))
 
-(defun sketch-redraw ()
+(defun sketch-redraw (&optional lisp lisp-buffer)
   (unless sketch-mode
 (user-error "Not in sketch-mode buffer"))
+  (let ((lisp-window (or (get-buffer-window "*sketch-root*")
+ (get-buffer-window lisp-buffer
+(unless (string= (buffer-name (window-buffer lisp-window)) "*sketch*")
+  (if-let (buf (get-buffer"*sketch-root*"))
+  (sketch-update-lisp-window sketch-root buf)
+(sketch-update-lisp-window lisp lisp-buffer
   (setq sketch-svg (append svg-canvas
 (when sketch-show-grid (cddr svg-grid))
 (cddr sketch-root)
@@ -616,9 +623,9 @@ values"
 (transient-define-suffix sketch-show-definition ()
   ;; :transient 'transient--do-exit
   (interactive)
-  (if-let (win (get-buffer-window "sketch-svg"))
+  (if-let (win (get-buffer-window "*sketch-root*"))
   (delete-window win)
-(let ((buffer (get-buffer-create "sketch-svg"))
+(let ((buffer (get-buffer-create "*sketch-root*"))
   (sketch sketch-root))
   (set-window-dedicated-p
(get-buffer-window
@@ -730,5 +737,40 @@ values"
 (transient-define-suffix sketch-save ()
   (interactive)
   (image-save))
+
+
+;;; Modify object
+
+(transient-define-suffix sketch-translate-down (args)
+  (interactive (list (transient-args 'sketch-modify-object)))
+  (let* ((object (transient-arg-value "--object=" args))
+ (object-def (dom-by-id sketch-svg (format "^a$" object)))
+ (props (cadar object-def)))
+(dolist (coord '(y1 y2))
+  (cl-incf (alist-get coord props) 10))
+(sketch-redraw object-def)))
+
+(transient-define-prefix sketch-modify-object ()
+  "Set object properties."
+  :transient-suffix 'transient--do-call
+  ["Properties"
+   [("o" "object" "--object=")]]
+  [("" "Down" sketch-translate-down)
+   ("q" "Quit" transient-quit-one)]
+  (interactive)
+  (let* ((object (completing-read "Transform element with id: "
+ (sketch-labels-list)))
+ (buffer (get-buffer-create (format "*sketch-object-%s*" object
+(display-buffer buffer '(display-buffer-in-side-window . ((side . right) 
(window-width . 70
+(pp (cadar (dom-by-id sketch-svg (format "^%s$" object))) buffer)
+(transient-setup 'sketch-modify-object nil nil :value (list (format 
"--object=%s" object)
+
+(defun sketch-update-lisp-window (lisp buffer)
+  ;; (let ((sketch sketch-root))
+  (with-current-buffer buffer
+(erase-buffer)
+(pp lisp (current-buffer
+
+
  (provide 'sketch-mode)
 ;;; sketch-mode.el ends here
diff --git a/sketch-scratch.el b/sketch-scratch.el
index 7c52f85..d89b298 100644
--- a/sketch-scratch.el
+++ b/sketch-scratch.el
@@ -42,20 +42,3 @@
 props)
 (tabulated-list-print)))
 
-(defun sketch-translate-down ()
-  

[elpa] externals/sketch-mode 4d78311 18/38: Experimental object modify tabulated list

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 4d783114bfd5ce54a0fa89cdd92230f9a61b
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Experimental object modify tabulated list

Tabulated list is probably not the way to go. See /vision/ page in the 
github wiki.
---
 sketch-scratch.el | 67 ++-
 1 file changed, 51 insertions(+), 16 deletions(-)

diff --git a/sketch-scratch.el b/sketch-scratch.el
index c9f60b2..7c52f85 100644
--- a/sketch-scratch.el
+++ b/sketch-scratch.el
@@ -6,21 +6,56 @@
 
 ;; (insert-image (svg-image (append svg-scratch (nthcdr 2 svg-labels
 
-(defun sketch-translate-node-coords (node amount &rest args)
-  (dolist (coord args node)
-(cl-decf (alist-get coord (cadr node)) amount)))
+(defun sketch-modify-line-entry (node)
+  (let* ((props (copy-alist (cadr node)))
+ (id (alist-get 'id props)))
+(assq-delete-all 'id props)
+(vconcat [("id" 4 t)]
+ (map 'vector (lambda (prop)
+;; (let* ((key (car prop))
+;;(val (cdr prop))
+;;(length (when (stringp val)
+;;  (length val
+(list (symbol-name (car prop))
+  (pcase (car prop)
+((or 'x1 'y1 'x2 'y2) 5)
+('marker-end 7)
+('fill 18)
+('stroke 18)
+(_ 10))
+  t))
+  props
 
-(defun svg-translate (dx dy)
+(define-derived-mode sketch-modify-mode tabulated-list-mode "sketch-modify"
+  (setq tabulated-list-format (sketch-modify-line-entry (car (dom-by-id svg 
"^a$"
+  (let* ((props (copy-alist (cadar (dom-by-id svg "^a$"
+ (id (alist-get 'id props)))
+(assq-delete-all 'id props)
+(setq tabulated-list-entries(list
+ (list
+  nil
+  (vconcat (vector id)
+   (map 'vector (lambda (prop) (let 
((val (cdr prop)))
+ (if 
(stringp val)
+ 
val
+   
(number-to-string val
+props)
+(tabulated-list-print)))
+
+(defun sketch-translate-down ()
   (interactive)
-  (mapcar (lambda (node)
-(pcase (car node)
-  ('line (sketch-translate-node-coords node dx 'x1 'x2)
- (sketch-translate-node-coords node dx 'y1 'y2))
-  ('rect (sketch-translate-node-coords node dx 'x)
-(sketch-translate-node-coords node dx 'y))
-  ((or 'circle 'ellipse)
-   (sketch-translate-node-coords node dx 'cx)
-   (sketch-translate-node-coords node dx 'cy))
-  ('text (sketch-translate-node-coords node dx 'x)
- (sketch-translate-node-coords node dx 'y
-  (cddr svg-sketch)))
+  (let* ((props (cadar (dom-by-id svg "^a$"
+(dolist (coord '(y1 y2))
+  (cl-incf (alist-get coord props) 10)))
+  (sketch-redraw))
+
+(transient-define-prefix sketch-modify-object ()
+  "Set object properties."
+  :transient-suffix 'transient--do-call
+  ["Properties"
+   [("x1" "author" "author=")
+("y" "year" "year=")]]
+  [("" "Down" sketch-translate-down)
+   ("q" "Quit" transient-quit-one)])
+  ;; (interactive)
+  ;; (djvu-switch-shared))



[elpa] externals/sketch-mode 0f870a1 20/38: Implement load from definition buffer & modify object functionality

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 0f870a1e2dceb4975bc794043c3be4e9b84a628f
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement load from definition buffer & modify object functionality
---
 README.org|  46 +++
 sketch-mode.el| 131 +-
 sketch-scratch.el |  44 --
 3 files changed, 128 insertions(+), 93 deletions(-)

diff --git a/README.org b/README.org
index 4284f79..2dddf7f 100644
--- a/README.org
+++ b/README.org
@@ -3,28 +3,50 @@
 
 * Preliminary comment
   This is a new package that is still in development. However, its main
-  functionality is very usable already. Any feedback, for example suggestions
-  for enhancing the interface/usability, is very welcome (probably best by
-  opening an issue). Also, any contributions are very welcome. The code of the
-  package is very accessible (especially if you quickly read how to use 
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html][edebug]].
+  functionality is very usable already. On the other hand, several (or most)
+  features are not implemented completely, simply because implementing these
+  things take time, and I should first focus on keeping myself alive:|. But if
+  you know some elisp, than it should be quite straightforward to complete the
+  implementation of those features. Any feedback, for example suggestions for
+  enhancing the interface/usability, is very welcome (probably best by opening
+  an issue). Also, any contributions are very welcome. The code of the package
+  is very accessible (especially if you quickly read how to use 
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html][edebug]]).
 
+  A list of ideas for implementation can be found in the preliminary comment in
+  the =sketch.el= file and additionally in the 
[[https://github.com/dalanicolai/sketch-mode/wiki/vision][wiki]] section.
+  
+  
 ** Included features
- snap to grid
- draw text
- crop finale image
- set stroke, fill, width etc.
- show dom (lisp) in other window
-   - draw angle arcs (between lines, available soon)
+   - draw angle arcs (between lines, available soon, I hope. See
+ =implement-angle-arc= branch)
- save drawing presets using 
[[https://magit.vc/manual/transient.html#Saving-Values][transient's saving 
values feature]] (documentation
  contribution welcome)
  
+** Incomplete features (merged into main)
+   - Draw labels (not implemented for all type of objects. Easy to implement)
+   - Modify object (not, at all, fully implemented for all object. Easy to
+ implement).
+ 
+ It would be handy to have a 'transform group' option also. 
[[https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform][SVG 
groups allow
+ for easy transformations]]. Then it would probably be handy to wrap all
+ objects in group tags.
+
+** Incomplete features (not merged into main)
+   - Implement layers (see/try out =implement-layers= branch)
+   
 ** Delicious low hanging fruit
- use svg snippets (i.e. design object in external programs like inkscape,
  geogebra etc., end quickly insert them in your sketches)
-   - export to tikz, asymptote, other image extensions etc.
 
 ** Less low hanging fruit
- draw directly in you literate org file, with the dom updated in your 
source block
+   - export to tikz, asymptote, other image extensions etc. (probably requires
+ to implement 'nodes')
  
   The =sketch-mode.el= file starts with listing TODO items describing features
   that are missing from the package.
@@ -76,8 +98,13 @@
   - to remove an object (without using undo), you should toggle labels by
 pressing =l=, and then to remove an object enter its label after pressing
 =R=.
-  - You can hide the transient by pressing =q=, and you can go back to sketch
-mode via =M-x sketch= (or =C-c C-t= when still in the sketch-mode buffer)
+  - You can also modify the drawing by changing the object definition (i.e.
+elisp). For that press =d= to open the definition in a side-window, then
+press =q= to hide (deactivate the) transient (keymap). Now modify the code
+and press =C-c C=c=, to load it and update the =\*sketch\*= buffer. 
+  - After you've hidden the transient by pressing =q=, you can go back to
+sketch mode via =M-x sketch= (or =C-c C-s= when still in the sketch-mode
+buffer)
 
   Create your sketch and then save
   the file by pressing =S=.
@@ -87,7 +114,8 @@
   the Netherlands, I have no penny to scratch my butt. Therefore, although I am
   also really happy to offer it for free, if you find 
[[https://github.com/dalanicolai][my package(s)]] (real
   projects page in the making) useful (e.g. for you work), and if you can 
afford
-  it, then I would be very happy with any donation. As soon as I have the
+  it, then I would be very happy with any donation (of course that would also
+  enable me to work on your feature 

[elpa] externals/sketch-mode 951c284 28/38: Fix dot marker and rename (make internal) sketch-snap-to-grid

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 951c28436123915c0e78b283e3806dc38014fa54
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix dot marker and rename (make internal) sketch-snap-to-grid
---
 sketch-mode.el | 37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index d574b61..715d3f0 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -111,36 +111,37 @@ default: (800 . 600)."
   (const :tag "Circle" 'circle)
   (const :tag "Ellipse" 'ellipse)))
 
-(defcustom sketch-snap-to-grid t
-  "When non-nil snap to grid."
+(defcustom sketch--snap-to-grid t
+  "Default value of snap to grid.
+If non-nil then snap to grid."
   :type 'boolean)
 
 (defcustom sketch-include-start-marker nil
-  "Start start-marker"
+  "Start marker type"
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
-  (const :tag "Point" 'point)))
+  (const :tag "Dot" 'dot)))
 
 (defcustom sketch-include-mid-marker nil
   "Mid marker type"
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
-  (const :tag "Point" 'point)))
+  (const :tag "Dot" 'dot)))
 
 (defcustom sketch-include-end-marker nil
   "End marker type"
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
-  (const :tag "Point" 'point)))
+  (const :tag "Dot" 'dot)))
 
 
 ;;; SVG-definitions
 
 (defun svg-marker (svg id width height &optional color reverse)
-  "Add a gradient with ID to SVG.
+  "Define a marker with ID to SVG.
 TYPE is `linear' or `radial'.
 STOPS is a list of percentage/color pairs."
   (svg--def
@@ -300,7 +301,7 @@ values"
   (call-interactively 'sketch-transient
 
 
-(defun sketch-snap-to-grid (coord grid-parameter)
+(defun sketch--snap-to-grid (coord grid-parameter)
   (cons (* (round (/ (float (car coord)) grid-parameter)) grid-parameter)
 (* (round (/ (float (cdr coord)) grid-parameter)) grid-parameter)))
 
@@ -395,11 +396,11 @@ values"
 ;;  (snap (transient-arg-value "--snap-to-grid=" args))
 ;;  (start-coords (if (or (not snap) (string= snap "nil"))
 ;;   (posn-object-x-y start)
-;; (sketch-snap-to-grid (posn-object-x-y start) 
grid-param)))
+;; (sketch--snap-to-grid (posn-object-x-y start) 
grid-param)))
 ;;  (end (event-end event))
 ;;  (end-coords (if (or (not snap) (string= snap "nil"))
 ;; (posn-object-x-y end)
-;;   (sketch-snap-to-grid (posn-object-x-y end) 
grid-param)))
+;;   (sketch--snap-to-grid (posn-object-x-y end) 
grid-param)))
 ;;  (object-props (list :stroke-width
 ;;  (transient-arg-value "--stroke-width=" args)
 ;;  :stroke
@@ -492,7 +493,7 @@ values"
   :description "Option with list"
   :class 'sketch-variable:choices
   :argument "--marker="
-  :choices '("arrow" "point")
+  :choices '("arrow" "dot")
   :default "none")
 
 (transient-define-infix sketch-snap ()
@@ -675,11 +676,11 @@ values"
  (snap (transient-arg-value "--snap-to-grid=" args))
  (start-coords (if (or (not snap) (string= snap "nil"))
   (posn-object-x-y start)
-(sketch-snap-to-grid (posn-object-x-y start) 
grid-param)))
+(sketch--snap-to-grid (posn-object-x-y start) 
grid-param)))
  (end (event-end event))
  (end-coords (if (or (not snap) (string= snap "nil"))
 (posn-object-x-y end)
-  (sketch-snap-to-grid (posn-object-x-y end) grid-param)))
+  (sketch--snap-to-grid (posn-object-x-y end) grid-param)))
  (object-props (list :stroke-width
  (transient-arg-value "--stroke-width=" args)
  :stroke
@@ -688,7 +689,7 @@ values"
  (transient-arg-value "--fill-color=" args)
  :marker-end (if args (pcase (transient-arg-value 
"--marker=" args)
 ("arrow" "url(#arrow)")
-("point" "url(#point)")
+("dot" "url(#dot)")
 (_ "none"))
(if sketch-include-end-marker
"url(#arrow)"
@@ -811,7 +812,7 @@ values"
  (snap (transient-arg-value "--snap-to-grid=" sketch-args))
  (coords (if (or (not snap) (string= snap "nil"))
(posn-object-x-y start)
- (sketch-snap-to-grid (posn-object-x-y start) 
grid-param)

[elpa] externals/sketch-mode e3c16c7 26/38: Merge branch 'implement-layers' (incl. undo-tree undo/redo)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit e3c16c7c3f8d9f223d2a96a1182de1993d35f46c
Merge: ec35bb4 406f51d
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Merge branch 'implement-layers' (incl. undo-tree undo/redo)
---
 sketch-mode.el | 379 +
 1 file changed, 273 insertions(+), 106 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 3ebe1ef..7c16703 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1,4 +1,4 @@
-;;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse 
-*- lexical-binding: t; -*-
+;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 
@@ -36,9 +36,9 @@
 
 ;; DONE move font transient (also its suffix) into main sketch transient 
(suffix)
 
-;; DONE add functionality to crop/select part of image (on save)
+;; DONE add functionality to crop/select part of image (on/before save)
 
-;; TODO add functionality to modify objects (see `add-object-modify-feature' 
branch)
+;; DONE(-partially) add functionality to modify objects (see 
`add-object-modify-feature' branch)
 
 ;; TODO enable defining global svg settings (object properties)
 
@@ -57,6 +57,13 @@
 ;; TODO create function to insert svg snippets (so you could design objects in
 ;; advanced software and use them quickly here in your sketches)
 
+;; TODO create function to save snippets
+
+;; TODO implement modularity. i.e. create 'layers' via svg groups  (related
+;; to snippet functionality)
+
+;; TODO create zoom functionality
+
 ;; NOTE this is a most straightforward sketch-mode. A more advanced/general 
version
 ;; could implement a drawing DSL based on nodes (a la tikz/asymptote etc.)
 
@@ -129,6 +136,9 @@ default: (800 . 600)."
(const :tag "Arrow" 'arrow)
   (const :tag "Point" 'point)))
 
+
+;;; SVG-definitions
+
 (defun svg-marker (svg id width height &optional color reverse)
   "Add a gradient with ID to SVG.
 TYPE is `linear' or `radial'.
@@ -161,6 +171,20 @@ STOPS is a list of percentage/color pairs."
(r . 5)
(fill . ,(or color "black"))
 
+(defun svg-group (&rest args)
+  (apply #'dom-node
+ 'g
+ `(,(svg--arguments nil args
+
+
+;;; Resume sketch-code
+
+(defun sketch-group (id &rest args)
+  (apply #'svg-group
+ :id id
+ :transform "translate(0 0)"
+ args))
+
 (define-minor-mode sketch-mode
   "Create svg images using the mouse.
 In sketch-mode buffer press \\[sketch-transient] to activate the
@@ -169,7 +193,8 @@ transient."
   :keymap
   `(([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
-(,(kbd "C-c C-s") . sketch-transient)))
+(,(kbd "C-c C-s") . sketch-transient))
+  (undo-tree-mode))
 
 (defun sketch--circle-radius (start-coords end-coords)
   (sqrt (+ (expt (- (car end-coords) (car start-coords)) 2)
@@ -190,46 +215,51 @@ transient."
 
 (defvar sketch-svg)
 (defvar-local svg-canvas nil)
-(defvar-local svg-grid nil)
+(defvar-local sketch-grid nil)
 (defvar-local sketch-root nil)
+(defvar-local sketch-layers-list nil)
+(defvar-local show-layers '(0))
 
 (defun sketch--create-canvas (width height &optional grid-parameter)
   "Create canvas for drawing svg using the mouse."
-(insert-image
- (let ((width width)
-   (height height))
-   (setq svg-canvas (svg-create width height :stroke "gray"))
-   (svg-marker svg-canvas "arrow" 8 8 "black" t)
-   (svg-rectangle svg-canvas 0 0 width height :fill "white")
-   (setq svg-grid (svg-create width height))
-   (let ((dash t))
- (dotimes (x (1- (/ width grid-parameter)))
-   (let ((pos (* (1+ x) grid-parameter)))
- (svg-line svg-grid pos 0 pos height :stroke-dasharray (when dash 
"2,4"))
- (setq dash (if dash nil t)
-   (let ((dash t))
- (dotimes (x (1- (/ height grid-parameter)))
-   (let ((pos (* (1+ x) grid-parameter)))
- (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
- (setq dash (if dash nil t)
-   (setq sketch-svg (append svg-canvas (when sketch-show-grid (cddr 
svg-grid
-   (sketch-image sketch-svg
-  :grid-param grid-parameter
-  :pointer 'arrow
-  :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . 
,(dom-attr sketch-svg 'height
-  ;; :map '(((rect . ((0 . 0) . (800 . 600)))
-  sketch
-  (pointer arrow help-echo (lambda (_ _ pos)
- (let ((message-log-max 
nil)
-   (coords (cdr 
(mouse-pixel-position
-   (print (format "(%s, 

[elpa] externals/sketch-mode fadc554 21/38: Add xml processing instruction and DOCTYPE element (see #4)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit fadc554e83c6af9a54b6b8ff814afa388c7da087
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add xml processing instruction and DOCTYPE element (see #4)
---
 sketch-mode.el | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 4713604..9379efd 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -213,7 +213,7 @@ transient."
  (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
  (setq dash (if dash nil t)
(setq sketch-svg (append svg-canvas (when sketch-show-grid (cddr 
svg-grid
-   (svg-image sketch-svg
+   (sketch-image sketch-svg
   :grid-param grid-parameter
   :pointer 'arrow
   :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . 
,(dom-attr sketch-svg 'height
@@ -533,7 +533,7 @@ values"
 (cddr sketch-root)
 (when sketch-show-labels (sketch-labels
   (erase-buffer) ;; a (not exact) alternative is to use (kill-backward-chars 1)
-  (insert-image (svg-image sketch-svg
+  (insert-image (sketch-image sketch-svg
:pointer 'arrow
:grid-param grid-param
:map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 
'width) . ,(dom-attr sketch-svg 'height
@@ -619,7 +619,7 @@ values"
 ;;:fill "none"))
 ;;   ('ellipse (apply 'svg-ellipse sketch-svg  (append 
(sketch--ellipse-coords start-coords end-coords) '(:fill "none")
 ;; (kill-backward-chars 1)
-;; (insert-image (svg-image sketch-svg :pointer 'arrow :grid-param 
grid-param
+;; (insert-image (sketch-image sketch-svg :pointer 'arrow :grid-param 
grid-param
   ;; (call-interactively 'tutorial-transient)
 
 (define-minor-mode sketch-lisp-mode
@@ -744,6 +744,18 @@ values"
 (setf (cddr sketch-root) (sketch--svg-translate (car start-coords) (cdr 
start-coords)))
 (sketch-redraw)))
 
+(defun sketch-image (svg &rest props)
+  "Return an image object from SVG.
+PROPS is passed on to `create-image' as its PROPS list."
+  (apply
+   #'create-image
+   (with-temp-buffer
+ (insert "
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>\n")
+ (svg-print svg)
+ (buffer-string))
+   'svg t props))
+
 (transient-define-suffix sketch-save ()
   (interactive)
   (image-save))



[elpa] externals/sketch-mode 6433b20 30/38: Add circle/ellipse labels

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 6433b20da7a98f8eec597d86f57be61a562da393
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add circle/ellipse labels
---
 sketch-mode.el | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 9987caa..62900ac 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -552,7 +552,14 @@ values"
:y (dom-attr node 'y1)
:font-size 20
:stroke "red"
-   :fill "red"
+   :fill "red"))
+  ((or 'circle 'ellipse) (svg-text svg-labels
+   (dom-attr node 'id)
+   :x (dom-attr node 'cx)
+   :y (dom-attr node 'cy)
+   :font-size 20
+   :stroke "red"
+   :fill "red"
 nodes)
 svg-labels))
 



[elpa] externals/sketch-mode 9eb86b8 31/38: Add comments and cleanup

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 9eb86b85bc486ec3eafafca89d2a7c3777ae305a
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add comments and cleanup
---
 sketch-mode.el | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 62900ac..7c303d5 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -40,6 +40,8 @@
 
 ;; DONE(-partially) add functionality to modify objects (see 
`add-object-modify-feature' branch)
 
+;; TODO add functionality to customize markers
+
 ;; TODO enable defining global svg settings (object properties)
 
 ;; TODO maybe transform relevant transient argument (strings) to variables
@@ -77,11 +79,13 @@
   :group 'Applications)
 
 (defcustom sketch-im-x-offset 7
-  "Default grid line separation distance (integer)."
+  "Horizontal offset in pixels of image position within frame.
+Set this value to correct for cursor 'bias'."
   :type 'integer)
 
 (defcustom sketch-im-y-offset 1
-  "Default grid line separation distance (integer)."
+  "Vertical offset in pixels of image position within frame.
+Set this value to correct for cursor 'bias'."
   :type 'integer)
 
 (defcustom sketch-default-image-size '(800 . 600)
@@ -705,8 +709,10 @@ values"
  (object-type (transient-arg-value "--object=" args))
  (command-and-coords (pcase object-type
("line" (list 'svg-line
- (car start-coords) (cdr 
start-coords) (car end-coords) (cdr end-coords)))
-   ("rectangle" `(svg-rectangle 
,@(sketch--rectangle-coords start-coords end-coords)))
+ (car start-coords) (cdr 
start-coords)
+ (car end-coords) (cdr 
end-coords)))
+   ("rectangle" `(svg-rectangle
+  ,@(sketch--rectangle-coords 
start-coords end-coords)))
("circle" (list 'svg-circle
(car start-coords) (cdr 
start-coords)
(sketch--circle-radius 
start-coords end-coords)))
@@ -738,17 +744,19 @@ values"
   (sketch sketch-root))
   (set-window-dedicated-p
(get-buffer-window
-(pop-to-buffer buffer '(display-buffer-in-side-window . ((side . 
right) (window-width . 70)
+(pop-to-buffer buffer
+   '(display-buffer-in-side-window . ((side . right) 
(window-width . 70)
t)
 (erase-buffer)
-(pp sketch buffer))
+(with-current-buffer buffer
+  (dom-pp sketch)))
 (emacs-lisp-mode)
 (sketch-lisp-mode)))
 
 (transient-define-suffix sketch-copy-definition ()
   (interactive)
   (with-temp-buffer
-(pp sketch-svg (current-buffer))
+(dom-pp sketch-svg)
 (kill-new (buffer-string)))
   (message "SVG definition added to kill-ring"))
 



[elpa] externals/sketch-mode f0465ec 29/38: Remove sketch-interactive function

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit f0465ec7a87585438edcca86e3838e0a64e1631b
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Remove sketch-interactive function

Setting `transient-show-popup` to `nil` might be a better alternative.
---
 sketch-mode.el | 34 ++
 1 file changed, 2 insertions(+), 32 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 715d3f0..9987caa 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -192,7 +192,8 @@ In sketch-mode buffer press \\[sketch-transient] to 
activate the
 transient."
   :lighter "sketch-mode"
   :keymap
-  `(([sketch drag-mouse-1] . sketch-interactively)
+  `(
+;; ([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
 (,(kbd "C-c C-s") . sketch-transient))
   (undo-tree-mode))
@@ -713,37 +714,6 @@ values"
   (svg-remove sketch-root (completing-read "Remove element with id: "
   (sketch-labels-list)))
   (sketch-redraw))
-;; (defun sketch-interactively (event)
-;;   "Draw object interactively, interpreting mouse event."
-;;   (interactive "e")
-;;   (let* ((start (event-start event))
-;;  (start-coords (posn-object-x-y start))
-;;  (end (event-end event))
-;;  (end-coords (posn-object-x-y end))
-;;  (grid-param (plist-get (cdr (posn-image start)) :grid-param)))
-;; (when (or (not grid-param) (= grid-param 0))
-;;   (setq sketch-snap-to-grid nil))
-;; (when sketch-snap-to-grid
-;;   (setq start-coords (sketch-snap-to-grid start-coords grid-param))
-;;   (setq end-coords (sketch-snap-to-grid end-coords grid-param)))
-;; (pcase sketch-default-shape
-;;   ('line   (svg-line sketch-svg (car start-coords) (cdr start-coords) 
(car end-coords) (cdr end-coords)
-;;  :marker-start (if sketch-include-start-marker
-;;  "url(#arrow)"
-;;"none")
-;;  :marker-mid (if sketch-include-mid-marker
-;;"url(#arrow)"
-;;  "none")
-;;  :marker-end (if sketch-include-end-marker
-;;  "url(#arrow)"
-;;"none")))
-;;   ('rectangle (apply 'svg-rectangle sketch-svg (append 
(sketch--rectangle-coords start-coords end-coords) '(:fill "none"
-;;   ('circle (svg-circle sketch-svg (car start-coords) (cdr start-coords) 
(sketch--circle-radius start-coords end-coords)
-;;:fill "none"))
-;;   ('ellipse (apply 'svg-ellipse sketch-svg  (append 
(sketch--ellipse-coords start-coords end-coords) '(:fill "none")
-;; (kill-backward-chars 1)
-;; (insert-image (sketch-image sketch-svg :pointer 'arrow :grid-param 
grid-param
-  ;; (call-interactively 'tutorial-transient)
 
 (define-minor-mode sketch-lisp-mode
   "Minor mode for svg lisp buffers."



[elpa] externals/sketch-mode bcb99c9 35/38: Implement text label and modify feature

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit bcb99c98f9c54701c0a0510651ad6a3ccacd9454
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement text label and modify feature
---
 sketch-mode.el | 24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 0089246..819fd9e 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -584,6 +584,14 @@ else return nil"
:font-size sketch-label-size
:stroke "red"
:fill "red"))
+  ('text (svg-text svg-labels
+   (dom-attr node 'id)
+   :x (dom-attr node 'x)
+   :y (+ (dom-attr node 'y)
+ sketch-label-size)
+   :font-size sketch-label-size
+   :stroke "red"
+   :fill "red"))
   ('g (let ((s (dom-attr node
  'transform)))
 (string-match "translate\(\\([0-9]*\\)[, ]*\\([0-9]*\\)" s)
@@ -624,6 +632,7 @@ else return nil"
("rectangle" "r")
("circle" "c")
("ellipse" "e")
+   ("text" "t")
("group" "g"
  (idx 0)
  (label (concat prefix (number-to-string idx)))
@@ -1103,7 +1112,6 @@ PROPS is passed on to `create-image' as its PROPS list."
  (object-def (dom-by-id sketch-svg (format "^%s$" object
 (sketch-group-scale buffer (car object-def) 'down t)))
 
-
 ;; TODO 'refactor' subsequent suffixes (e.g. create general function/macro)
 (transient-define-suffix sketch-translate-down (args)
   (interactive (list (oref transient-current-prefix value)))
@@ -1116,7 +1124,10 @@ PROPS is passed on to `create-image' as its PROPS list."
 (sketch-translate-object buffer
  object-def
  props
- '(y1 y2) 1
+ (pcase (caar object-def)
+   ('line '(y1 y2))
+   ('text '(y)))
+ 1
 
 (transient-define-suffix sketch-translate-fast-down (args)
   (interactive (list (oref transient-current-prefix value)))
@@ -1130,7 +1141,8 @@ PROPS is passed on to `create-image' as its PROPS list."
  object-def
  props
  (pcase (caar object-def)
-   ('line '(y1 y2)))
+   ('line '(y1 y2))
+   ('text '(y)))
  10
 
 (transient-define-suffix sketch-translate-up (args)
@@ -1145,7 +1157,8 @@ PROPS is passed on to `create-image' as its PROPS list."
  object-def
  props
  (pcase (caar object-def)
-   ('line '(y1 y2)))
+   ('line '(y1 y2))
+   ('text '(y)))
  -1
 
 (transient-define-suffix sketch-translate-fast-up (args)
@@ -1160,7 +1173,8 @@ PROPS is passed on to `create-image' as its PROPS list."
  object-def
  props
  (pcase (caar object-def)
-   ('line '(y1 y2)))
+   ('line '(y1 y2))
+   ('text '(y)))
  -10
 
 (transient-define-prefix sketch-modify-object (&optional group)



[elpa] externals/sketch-mode bebba7b 37/38: Fix add layer mechanism

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit bebba7bc5c0ef25613cc14d9f466ec603edfa87a
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix add layer mechanism
---
 sketch-mode.el | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 495ed4f..d78fc0b 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -253,7 +253,7 @@ VEC should be a cons or a list containing only number 
elements."
 (defvar-local sketch-grid nil)
 (defvar-local sketch-root nil)
 (defvar-local sketch-layers-list nil)
-(defvar-local show-layers '(0))
+(defvar-local show-layers nil)
 
 (defun sketch--create-canvas (width height &optional grid-parameter)
   "Create canvas of size WIDTH x HEIGHT for drawing svg.
@@ -277,7 +277,8 @@ Optionally set a custom GRID-PARAMETER (default is value of
   (setq dash (if dash nil t)
 (setq sketch-svg (append svg-canvas (when sketch-show-grid (list 
sketch-grid
 (setq sketch-root (sketch-group "root"))
-(sketch-add-layer)
+(setq sketch-layers-list (list (sketch-group "layer-0")))
+(setq show-layers '(0))
 (insert-image (sketch-image sketch-svg
 :grid-param grid-parameter
 :pointer 'arrow
@@ -538,7 +539,8 @@ else return nil"
   ;; (let ((variable (oref obj variable)))
   (oset obj value value)
   (setq sketch-show-labels value)
-  (auto-revert-buffers)
+  ;; (auto-revert-buffers)
+  (transient--redisplay)
   (sketch-redraw))
   ;; (unless (or value transient--prefix)
   ;;   (message "Unset %s" variable)))
@@ -660,7 +662,7 @@ else return nil"
 (defun sketch--svg-translate (dx dy)
   (interactive)
   (mapcar (lambda (node)
-(pcase (dome-tag node)
+(pcase (dom-tag node)
   ('line (sketch-translate-node-coords node dx 'x1 'x2)
  (sketch-translate-node-coords node dy 'y1 'y2))
   ('rect (sketch-translate-node-coords node dx 'x)
@@ -971,11 +973,21 @@ else return nil"
 
 (transient-define-suffix sketch-add-layer ()
   (interactive)
-  (setq sketch-layers-list (append sketch-layers-list
-   (list (sketch-group (format "layer-%s" (length 
sketch-layers-list))
+  (let ((new-layer (length sketch-layers-list))
+(active-layer-infix (object-assoc "Active layer" 'description 
transient-current-suffixes))
+(show-layers-infix (object-assoc "Show layers" 'description 
transient-current-suffixes)))
+(setq sketch-layers-list (append sketch-layers-list
+ (list (sketch-group (format "layer-%s" 
new-layer)
+(setq active-layer new-layer)
+(setq show-layers (append show-layers (list new-layer)))
+(print (transient-infix-set active-layer-infix new-layer))
+(propertize (prin1-to-string (oref active-layer-infix value))
+'face 'transient-value)
+(print (transient-infix-set show-layers-infix show-layers)))
+  (transient--redisplay)
   (message "Existing layers (indices): %s" (mapconcat #'number-to-string
-(number-sequence 0 (1- (length 
sketch-layers-list)))
-", ")))
+  (number-sequence 0 (1- 
(length sketch-layers-list)))
+  ", ")))
 
 (transient-define-infix sketch-layers ()
   "List with layers that should be added to the image.



[elpa] externals/sketch-mode 406f51d 25/38: Fix undo-redo (i.e. switch to use undo-tree-mode)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 406f51d8c99ea72689800d93083ed3673873cade
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix undo-redo (i.e. switch to use undo-tree-mode)
---
 sketch-mode.el | 148 ++---
 1 file changed, 78 insertions(+), 70 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 8b0e4f1..7ce136b 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -193,7 +193,8 @@ transient."
   :keymap
   `(([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
-(,(kbd "C-c C-s") . sketch-transient)))
+(,(kbd "C-c C-s") . sketch-transient))
+  (undo-tree-mode))
 
 (defun sketch--circle-radius (start-coords end-coords)
   (sqrt (+ (expt (- (car end-coords) (car start-coords)) 2)
@@ -216,45 +217,43 @@ transient."
 (defvar-local svg-canvas nil)
 (defvar-local sketch-grid nil)
 (defvar-local sketch-root nil)
-(defvar-local svg-layers nil)
+(defvar-local sketch-layers-list nil)
 (defvar-local show-layers '(0))
 
 (defun sketch--create-canvas (width height &optional grid-parameter)
   "Create canvas for drawing svg using the mouse."
-(insert-image
- (let ((width width)
-   (height height))
-   (setq svg-canvas (svg-create width height :stroke "gray"))
-   (svg-marker svg-canvas "arrow" 8 8 "black" t)
-   (svg-rectangle svg-canvas 0 0 width height :fill "white")
-   (setq sketch-grid (sketch-group "grid"))
-   (let ((dash t))
- (dotimes (x (1- (/ width grid-parameter)))
-   (let ((pos (* (1+ x) grid-parameter)))
- (svg-line sketch-grid pos 0 pos height :stroke-dasharray (when 
dash "2,4"))
- (setq dash (if dash nil t)
-   (let ((dash t))
- (dotimes (x (1- (/ height grid-parameter)))
-   (let ((pos (* (1+ x) grid-parameter)))
- (svg-line sketch-grid 0 pos width pos :stroke-dasharray (when 
dash "2,4"))
- (setq dash (if dash nil t)
-   (setq sketch-svg (append svg-canvas (when sketch-show-grid (list 
sketch-grid
-   (sketch-image sketch-svg
-  :grid-param grid-parameter
-  :pointer 'arrow
-  :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . 
,(dom-attr sketch-svg 'height
-  ;; :map '(((rect . ((0 . 0) . (800 . 600)))
-  sketch
-  (pointer arrow help-echo (lambda (_ _ pos)
- (let ((message-log-max 
nil)
-   (coords (cdr 
(mouse-pixel-position
-   (print (format "(%s, 
%s)"
-  (- (car 
coords) sketch-im-x-offset)
-  (+ (cdr 
coords) sketch-im-y-offset)))
-(sketch-mode)
-(call-interactively 'sketch-transient)
-(setq sketch-root (sketch-group "main"))
-(sketch-add-layer))
+  (let ((width width)
+(height height))
+(setq svg-canvas (svg-create width height :stroke "gray"))
+(svg-marker svg-canvas "arrow" 8 8 "black" t)
+(svg-rectangle svg-canvas 0 0 width height :fill "white")
+(setq sketch-grid (sketch-group "grid"))
+(let ((dash t))
+  (dotimes (x (1- (/ width grid-parameter)))
+(let ((pos (* (1+ x) grid-parameter)))
+  (svg-line sketch-grid pos 0 pos height :stroke-dasharray (when dash 
"2,4"))
+  (setq dash (if dash nil t)
+(let ((dash t))
+  (dotimes (x (1- (/ height grid-parameter)))
+(let ((pos (* (1+ x) grid-parameter)))
+  (svg-line sketch-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
+  (setq dash (if dash nil t)
+(setq sketch-svg (append svg-canvas (when sketch-show-grid (list 
sketch-grid
+(setq sketch-root (sketch-group "root"))
+(sketch-add-layer)
+(insert-image (sketch-image sketch-svg
+:grid-param grid-parameter
+:pointer 'arrow
+:map `(((rect . ((0 . 0) . (,(dom-attr 
sketch-svg 'width) . ,(dom-attr sketch-svg 'height
+;; :map '(((rect . ((0 . 0) . (800 . 
600)))
+sketch
+(pointer arrow help-echo (lambda (_ _ 
pos)
+   (let 
((message-log-max nil)
+ 
(coords (cdr (mouse-pixel-position
+ (print 
(format "(%s, %s)"
+   
 (- (car coords) sketch-im-x-offset)
+ 

[elpa] externals/sketch-mode 49c3c04 34/38: Add dasharray feature

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 49c3c040cacfa348c2dcf5e2866c5d879f106ddd
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add dasharray feature
---
 sketch-mode.el | 40 +---
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 9c7ca45..0089246 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -448,14 +448,15 @@ else return nil"
   [["General definitions"
 ("c" "stroke-color" sketch-stroke-color)
 ("C" "fill-color" sketch-fill-color)
-("w" "stroke-width" sketch-stroke-width)]
+("w" "stroke-width" sketch-stroke-width)
+("d" "stroke-dasharray" sketch-dasharray)]
["Object definitions"
 ("o" "object" sketch-object)
 ("m" "end-marker" sketch-object-marker)]
["Font definitions"
-("-f" "family" sketch-select-font)
-("-w" "font-weight" sketch-font-weight)
-("-s" "font-size" sketch-font-size)]]
+("ff" "family" sketch-select-font)
+("fw" "font-weight" sketch-font-weight)
+("fs" "font-size" sketch-font-size)]]
[["Grid"
 ("s" "Snap to grid" sketch-snap)
 ("g" "Toggle grid" sketch-toggle-grid)]
@@ -474,8 +475,8 @@ else return nil"
 ("i" "Import object" sketch-import)]
 [("u" "Undo" sketch-undo)
 ("U" "Redo" sketch-redo)]
-   [("d" "Show definition" sketch-show-definition)
-("D" "Copy definition" sketch-copy-definition)
+   [("D" "Show definition" sketch-show-definition)
+("K" "Copy definition" sketch-copy-definition)
 ("S" "Save image" sketch-save)]
[("q" "Quit transient"   transient-quit-one)]])
 
@@ -486,14 +487,6 @@ else return nil"
   :choices '("rectangle" "circle" "ellipse")
   :default "line")
 
-(transient-define-infix sketch-stroke-width ()
-  :description "Option with list"
-  :class 'transient-option
-  :argument "--stroke-width="
-  :choices (mapcar (lambda (x)
- (number-to-string x))
-   (number-sequence 1 100)))
-
 (transient-define-infix sketch-stroke-color ()
   :description "Option with list"
   :class 'sketch-variable:colors
@@ -506,6 +499,21 @@ else return nil"
   :argument "--fill-color="
   :default "none")
 
+(transient-define-infix sketch-stroke-width ()
+  :description "Option with list"
+  :class 'transient-option
+  :argument "--stroke-width="
+  :choices (mapcar (lambda (x)
+ (number-to-string x))
+   (number-sequence 1 100)))
+
+(transient-define-infix sketch-dasharray ()
+  :description "stroke-dasharray"
+  :class 'sketch-variable:choices
+  :argument "--stroke-dasharray="
+  :choices '("8" "8,4")
+  :default "none")
+
 (transient-define-infix sketch-object-marker ()
   :description "Option with list"
   :class 'sketch-variable:choices
@@ -725,6 +733,8 @@ else return nil"
  (transient-arg-value "--stroke-color=" args)
  :fill
  (transient-arg-value "--fill-color=" args)
+ :stroke-dasharray
+ (transient-arg-value "--stroke-dasharray=" args)
  :marker-end (if args (pcase (transient-arg-value 
"--marker=" args)
 ("arrow" "url(#arrow)")
 ("dot" "url(#dot)")
@@ -885,7 +895,7 @@ else return nil"
  ;;   (if sketch-include-end-marker
  ;;   "url(#arrow)"
  ;; "none"
-(apply #'svg-text (nth active-layer sketch-layers-list) text :x (car 
coords) :y (cdr coords) object-props))
+(apply #'svg-text (nth active-layer sketch-layers-list) text :x (car 
coords) :y (cdr coords) :id (sketch-create-label "text") object-props))
 (sketch-redraw))
 
 (transient-define-infix sketch-select-font ()



[elpa] externals/sketch-mode 19202c7 32/38: Implement first step for snippets/import

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 19202c75aa53305d509480cece8fec03ff86a35c
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement first step for snippets/import
---
 sketch-mode.el | 53 +
 1 file changed, 53 insertions(+)

diff --git a/sketch-mode.el b/sketch-mode.el
index 7c303d5..418377a 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1006,6 +1006,59 @@ PROPS is passed on to `create-image' as its PROPS list."
   (pp lisp (current-buffer))
   (end-of-buffer)))
 
+;;; import/snippets
+
+(defun sketch-snippets-add-ids (dom)
+  (let ((idx 0))
+(dolist (n (dom-by-tag dom 'g))
+  (dom-set-attribute n 'id (number-to-string idx))
+  (setq idx (1+ idx)
+
+(defun sketch-snippets-add-labels (svg-file)
+  (interactive "f")
+  (let (dom)
+(with-temp-buffer "svg"
+  (insert-file-contents-literally svg-file)
+  (xml-remove-comments (point-min) (point-max))
+  (setq dom (libxml-parse-xml-region (point-min) 
(point-max)))
+  (sketch-snippets-add-ids dom))
+(mapc (lambda (n)
+(let* ((s (dom-attr n 'transform))
+   (coords (when s
+ (split-string
+  (string-trim
+   s
+   "translate(" ")")
+  ","
+  (svg-text dom
+(dom-attr n 'id)
+:x (car coords)
+:y (cadr coords)
+:font-size 10
+:stroke "red"
+:fill "red")))
+  (cdr (dom-by-tag dom 'g)))
+(unless sketch-mode
+  (user-error "Not in sketch-mode buffer"))
+;; (save-current-buffer
+  ;; (when lisp-buffer
+  ;;   (sketch-update-lisp-window lisp lisp-buffer))
+  ;; (let ((lisp-window (or (get-buffer-window "*sketch-root*")
+  ;;(get-buffer-window lisp-buffer
+  ;;   (unless (string= (buffer-name (window-buffer lisp-window)) 
"*sketch*")
+  ;; (if-let (buf (get-buffer"*sketch-root*"))
+  ;; (sketch-update-lisp-window sketch-root buf)
+  ;;   (sketch-update-lisp-window lisp lisp-buffer
+  ;; (setq sketch-root (append (subseq sketch-root 0 2) (list (nth (car 
show-layers) svg-layers
+  ;; (dolist (layer (cdr show-layers))
+  ;;   (setq sketch-root (append sketch-root (list (nth layer 
svg-layers)
+  ;; (setq sketch-svg (append svg-canvas
+  ;;  (when sketch-show-grid (list sketch-grid))
+  ;;  (when sketch-show-labels (list 
(sketch-labels)))
+  ;;  (list sketch-root)))
+(erase-buffer) ;; a (not exact) alternative is to use (kill-backward-chars 
1)
+(insert-image (svg-image dom))
+(print dom)))
 
  (provide 'sketch-mode)
 ;;; sketch-mode.el ends here



[elpa] externals/sketch-mode aaac04d 38/38: Fix indentation (simply auto indent complete file)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit aaac04d7ac8d35dc398f1d201b1ad37db3a281a0
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix indentation (simply auto indent complete file)
---
 sketch-mode.el | 308 -
 1 file changed, 153 insertions(+), 155 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index d78fc0b..2b70234 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -234,13 +234,13 @@ VEC should be a cons or a list containing only number 
elements."
   (sketch-norm
(sketch-mapcons #'- end-coords start-coords)))
 
- (defun sketch--rectangle-coords (start-coords end-coords)
+(defun sketch--rectangle-coords (start-coords end-coords)
   (let ((base-coords (cons (apply #'min (list (car start-coords) (car 
end-coords)))
(apply #'min (list (cdr start-coords) (cdr 
end-coords))
-  (list (car base-coords)
-(cdr base-coords)
-(abs (- (car end-coords) (car start-coords)))
-(abs (- (cdr end-coords) (cdr start-coords))
+(list (car base-coords)
+  (cdr base-coords)
+  (abs (- (car end-coords) (car start-coords)))
+  (abs (- (cdr end-coords) (cdr start-coords))
 
 (defun sketch--ellipse-coords (start-coords end-coords)
   (list (/ (+ (car start-coords) (car end-coords)) 2)
@@ -389,7 +389,7 @@ else return nil"
 ;; We always call the autoloaded `color-name-to-rgb' before calling this
 ;; function, so we know it's available even tho the compiler doesn't.
 (declare-function color-rgb-to-hex "color"
- (red green blue &optional 
digits-per-component))
+  (red green blue &optional digits-per-component))
 
 (cl-defmethod transient-format-value ((obj sketch-variable:colors))
   (let ((value (oref obj value))
@@ -406,41 +406,41 @@ else return nil"
 (propertize (apply #'color-rgb-to-hex (color-name-to-rgb 
default))
 'face 'transient-inactive-argument))
 
-  ;; (let* ((args (when transient-current-prefix (transient-args 
'sketch-transient)))
-  ;;(print event
-;;  (start (event-start event))
-;;  (grid-param (plist-get (cdr (posn-image start)) :grid-param))
-;;  (snap (transient-arg-value "--snap-to-grid=" args))
-;;  (start-coords (if (or (not snap) (string= snap "nil"))
-;;   (posn-object-x-y start)
-;; (sketch--snap-to-grid (posn-object-x-y start) 
grid-param)))
-;;  (end (event-end event))
-;;  (end-coords (if (or (not snap) (string= snap "nil"))
-;; (posn-object-x-y end)
-;;   (sketch--snap-to-grid (posn-object-x-y end) 
grid-param)))
-;;  (object-props (list :stroke-width
-;;  (transient-arg-value "--stroke-width=" args)
-;;  :stroke
-;;  (transient-arg-value "--stroke-color=" args)
-;;  :fill
-;;  (transient-arg-value "--fill-color=" args)
-;;  :marker-end (if args (pcase 
(transient-arg-value "--marker=" args)
-;; ("arrow" "url(#arrow)")
-;; ("point" "url(#point)")
-;; (_ "none"))
-;;(if sketch-include-end-marker
-;;"url(#arrow)"
-;;  "none"
-;;  (command-and-coords (pcase (transient-arg-value "--object=" args)
-;;("line" (list 'svg-line
-;;  (car start-coords) (cdr 
start-coords) (car end-coords) (cdr end-coords)))
-;;("rectangle" `(svg-rectangle 
,@(sketch--rectangle-coords start-coords end-coords)))
-;;("circle" (list 'svg-circle
-;;(car start-coords) (cdr 
start-coords)
-;;(sketch--circle-radius 
start-coords end-coords)))
-;;("ellipse" `(svg-ellipse 
,@(sketch--ellipse-coords start-coords end-coords))
-;; (apply (car command-and-coords) sketch-root `(,@(cdr 
command-and-coords) ,@object-props :id ,(sketch-create-label)))
-;; (sketch-redraw)))
+;; (let* ((args (when transient-current-prefix (transient-args 
'sketch-transient)))
+;;(print event
+;;  (start (event-start event))
+;;  (grid-param (plist-get (cdr (posn-image start)) :grid-param))
+;;  (snap (transient-arg-value "--snap-to-grid=" args))
+;;  (start-coords (if (or (not snap) (string= snap "nil"))
+;;   (posn-object-x-y start)
+;; (sketch

[elpa] externals/sketch-mode 4a4e2ba 33/38: Implement import/snippet functionality

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 4a4e2ba1c791937cfa1107d52497887126a14977
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement import/snippet functionality
---
 README.org   |9 +-
 sketch-mode.el   |  376 ++---
 snippet-files/circuit_components.svg | 1417 ++
 3 files changed, 1701 insertions(+), 101 deletions(-)

diff --git a/README.org b/README.org
index 2dddf7f..43bc237 100644
--- a/README.org
+++ b/README.org
@@ -75,9 +75,10 @@
   Add the following lines to =dotspacemacs-additional-packages=
   
 #+begin_src emacs-lisp :tangle yes
- (sketch-mode :location (recipe
-:fetcher github
-:repo "dalanicolai/sketch-mode"))
+  (sketch-mode :location (recipe
+ :fetcher github
+ :repo "dalanicolai/sketch-mode"
+ :files ("*.el" "snippet-files")))
 #+end_src
 
   Subsequently load the packages by adding the following line to 
=dotspacemacs/user-config=
@@ -93,8 +94,6 @@
   package, the usage is more or less self explanatory, it is wise to take note
   of the following comments:
 
-  - the undo/redo functionality is really basic, and does not work for all 
actions
-(e.g. does not work yet when removing object or cropping images).
   - to remove an object (without using undo), you should toggle labels by
 pressing =l=, and then to remove an object enter its label after pressing
 =R=.
diff --git a/sketch-mode.el b/sketch-mode.el
index 418377a..9c7ca45 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1,13 +1,12 @@
-;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse -*- 
lexical-binding: t; -*-
+;;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse 
-*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 
-
 ;; Author: D.L. Nicolai 
 ;; Created: 17 Jul 2021
 ;; Version: 0
 
-;; Keywords: multimedia 
+;; Keywords: multimedia
 ;; URL: https://github.com/dalanicolai/sketch-mode
 
 ;; This file is not part of GNU Emacs.
@@ -42,6 +41,9 @@
 
 ;; TODO add functionality to customize markers
 
+;; TODO Add options to hide transient suffixes (e.g. commands are trivial and 
could be hidden to get more drawing space.
+;; unfortunately transient levels (de)activate instead of hide/show suffixes)
+
 ;; TODO enable defining global svg settings (object properties)
 
 ;; TODO maybe transform relevant transient argument (strings) to variables
@@ -73,6 +75,7 @@
 ;;; Code:
 (require 'svg)
 (require 'transient)
+(require 'seq)
 
 (defgroup sketch nil
   "Configure default sketch (object) properties."
@@ -107,8 +110,12 @@ default: (800 . 600)."
   "Default grid line separation distance (integer)."
   :type 'integer)
 
+(defcustom sketch-label-size 15
+  "Size of object labels."
+  :type 'integer)
+
 (defcustom sketch-default-shape 'line
-  "Default object type for `sketch-interactively.'"
+  "Default object type for `sketch-interactively'."
   :type '(choice
(const :tag "Line" 'line)
(const :tag "Rectangle" 'rectangle)
@@ -121,21 +128,21 @@ If non-nil then snap to grid."
   :type 'boolean)
 
 (defcustom sketch-include-start-marker nil
-  "Start marker type"
+  "Start marker type."
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
   (const :tag "Dot" 'dot)))
 
 (defcustom sketch-include-mid-marker nil
-  "Mid marker type"
+  "Mid marker type."
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
   (const :tag "Dot" 'dot)))
 
 (defcustom sketch-include-end-marker nil
-  "End marker type"
+  "End marker type."
   :type '(choice
(const :tag "No marker" nil)
(const :tag "Arrow" 'arrow)
@@ -187,7 +194,7 @@ STOPS is a list of percentage/color pairs."
 (defun sketch-group (id &rest args)
   (apply #'svg-group
  :id id
- :transform "translate(0 0)"
+ :transform "translate(0,0)"
  args))
 
 (define-minor-mode sketch-mode
@@ -200,7 +207,9 @@ transient."
 ;; ([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
 (,(kbd "C-c C-s") . sketch-transient))
-  (undo-tree-mode))
+  (if (boundp 'undo-tree-mode)
+  (undo-tree-mode)
+(buffer-enable-undo)))
 
 (defun sketch-mapcons (fn &rest cons-cells)
   "Apply FN to list of car's and cdr's of CONS-CELLS.
@@ -247,7 +256,9 @@ VEC should be a cons or a list containing only number 
elements."
 (defvar-local show-layers '(0))
 
 (defun sketch--create-canvas (width height &optional grid-parameter)
-  "Create canvas for drawing svg using the mouse."
+  "Create canvas of size WIDTH x HEIGHT for drawing svg.
+Optionally set a custom GRID-PARAMETER (default is value of
+`sketch-default-grid-parameter')."
   (let ((width width)
 (height hei

[elpa] externals/sketch-mode 0005a3a 27/38: Add sketch-mapcons function (refactor sketch--circle-radius)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 0005a3adbc8ee355a96a2eb6f73485b74d8360c7
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add sketch-mapcons function (refactor sketch--circle-radius)
---
 sketch-mode.el | 24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 7c16703..d574b61 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -196,9 +196,29 @@ transient."
 (,(kbd "C-c C-s") . sketch-transient))
   (undo-tree-mode))
 
+(defun sketch-mapcons (fn &rest cons-cells)
+  "Apply FN to list of car's and cdr's of CONS-CELLS.
+Return a single cons cell."
+  (cons (apply fn (mapcar #'car cons-cells))
+(apply fn (mapcar #'cdr cons-cells
+
+(defun sketch-norm (vec)
+  "Return norm of a vector.
+VEC should be a cons or a list containing only number elements."
+  (let ((sum-of-squares (if (consp vec)
+(+ (expt (car vec) 2)
+   (expt (cdr vec) 2))
+  (apply #'+
+ (mapcar (lambda (x) (* x x))
+ vec)
+(expt sum-of-squares (/ 1.0 (if (consp vec)
+2
+  (length vec))
+
 (defun sketch--circle-radius (start-coords end-coords)
-  (sqrt (+ (expt (- (car end-coords) (car start-coords)) 2)
-   (expt (- (cdr end-coords) (cdr start-coords)) 2
+  (sketch-norm
+   (sketch-mapcons #'- end-coords start-coords)))
+
  (defun sketch--rectangle-coords (start-coords end-coords)
   (let ((base-coords (cons (apply #'min (list (car start-coords) (car 
end-coords)))
(apply #'min (list (cdr start-coords) (cdr 
end-coords))



[elpa] externals/sketch-mode 3c8f9f1 05/38: Add documentation (prepare for publishing)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 3c8f9f14b329aa14cd42051bde35145fece1dee8
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add documentation (prepare for publishing)
---
 README.org | 50 +-
 sketch-mode.el |  7 ---
 2 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index a713b27..7aff01e 100644
--- a/README.org
+++ b/README.org
@@ -1,3 +1,51 @@
 #+TITLE: Sketch mode
+#+DESCRIPTION: Quickly create simple SVG sketches using the mouse
 
-* Welcome
+* Preliminary comment
+  This is a new package that is still in development. However, its main
+  functionality is very usable already. Any feedback is very welcome (probably
+  most suitable by opening an issue).
+
+  The =sketch-mode.el= start with listing
+  TODO items describing features that are missing from the package.
+  
+* Installation
+  When installing the package it probably still shows some warnings, you can
+  safely ignore them.
+  
+  Either =git clone= the package and load =sketch-mode.el= using =load file=
+  either manually or from =.emacs.d=.
+
+  Alternatively you could use a [[quelpa][https://github.com/quelpa/quelpa]] 
with the
+  following recipe:
+ #+begin_src emacs-lisp :tangle yes
+   (quelpa '(sketch-mode :repo "dalanicolai/sketch-mode" :fetcher github))
+ #+end_src 
+ then subsequently load the package with
+#+begin_src emacs-lisp :tangle yes
+  (use-package sketch-mode
+:defer t)
+#+end_src  
+
+** Spacemacs
+  Add the following lines to =dotspacemacs-additional-packages=
+  
+#+begin_src emacs-lisp :tangle yes
+ (sketch-mode :location (recipe
+:fetcher github
+:repo "dalanicolai/sketch-mode"))
+#+end_src
+
+  Subsequently load the packages by adding the following line to 
=dotspacemacs/user-config=
+  
+ #+begin_src emacs-lisp
+  (use-package sketch-mode
+:defer t)
+ #+end_src 
+
+* Usage
+  Start a sketch with =M-x sketch= and enter values at the prompts (or prefix
+  with =C-u= to use default values). Thanks to the =transient= package the 
usage
+  is more or less self explanatory.
+
+  Create your sketch and then save the file by pressing =S=.
diff --git a/sketch-mode.el b/sketch-mode.el
index 7d037e2..250f78e 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -203,7 +203,7 @@ values"
(call-interactively 'sketch-transient))
   (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
 (height (if arg 600 (read-number "Enter height: "
-(switch-to-buffer (get-buffer-create "*sketch"))
+(switch-to-buffer (get-buffer-create "*sketch*"))
 (defvar-local grid-param 25)
 (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 
0 for no grid): ")))
 (sketch--create-canvas width height grid-param)
@@ -388,10 +388,11 @@ values"
  (transient-arg-value "--fill-color=" args)
  :marker-end (if args (pcase (transient-arg-value 
"--marker=" args)
 ("arrow" "url(#arrow)")
-("point" "url(#point)"))
+("point" "url(#point)")
+(_ "none"))
(if sketch-include-end-marker
"url(#arrow)"
- "none")  (_ "none"
+ "none"
  (command-and-coords (pcase (transient-arg-value "--object=" args)
("line" (list 'svg-line
  (car start-coords) (cdr 
start-coords) (car end-coords) (cdr end-coords)))



[elpa] externals/sketch-mode 32559c4 06/38: Add remove functionality (id's and labels)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 32559c4c0e47de52f74ea2f661a5c4f029e08764
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add remove functionality (id's and labels)
---
 sketch-mode.el|  72 +-
 sketch-mode.png   | Bin 0 -> 65687 bytes
 sketch-scratch.el |   7 ++
 3 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 250f78e..5215e43 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -67,6 +67,10 @@ representing the image width and image height
   "When non-nil, show grid lines (default: t)."
   :type 'boolean)
 
+(defcustom sketch-show-labels nil
+  "When non-nil, show object labels (default: t)."
+  :type 'boolean)
+
 (defcustom sketch-default-grid-parameter 25
   "Default grid line separation distance (integer)."
   :type 'integer)
@@ -137,7 +141,9 @@ STOPS is a list of percentage/color pairs."
(fill . ,(or color "black"))
 
 (define-minor-mode sketch-mode
-  "Create svg images using the mouse."
+  "Create svg images using the mouse.
+In sketch-mode buffer press \\[sketch-transient] to activate the
+transient."
   nil "sketch-mode"
   '(([drag-mouse-1] . sketch-interactively)
 ([C-S-drag-mouse-1] . sketch-interactively)
@@ -204,6 +210,7 @@ values"
   (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
 (height (if arg 600 (read-number "Enter height: "
 (switch-to-buffer (get-buffer-create "*sketch*"))
+(defvar-local sketch-elements nil)
 (defvar-local grid-param 25)
 (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 
0 for no grid): ")))
 (sketch--create-canvas width height grid-param)
@@ -292,7 +299,7 @@ values"
 (propertize (apply 'color-rgb-to-hex (color-name-to-rgb 
default))
 'face 'transient-inactive-argument))
 
-(transient-define-prefix  sketch-transient ()
+(transient-define-prefix sketch-transient ()
   "Some Emacs magic"
   :transient-suffix 'transient--do-call
   :transient-non-suffix 'transient--do-stay
@@ -302,11 +309,14 @@ values"
 ("C" "fill-color" sketch-fill-color)]
[("w" "stroke-width" sketch-stroke-width)]
[("m" "end-marker" sketch-object-marker)]]
-  ["Snap-to-grid"
+  ["Grid"
("s" "Snap to grid" sketch-snap)
-   ("t" "Toggle grid" sketch-toggle-grid)]
+   ("g" "Toggle grid" sketch-toggle-grid)]
+  ["Labels"
+   ("l" "Toggle labels" sketch-toggle-labels)]
   ["Commands"
[([drag-mouse-1] "Sketch"  sketch-interactively-1)
+("R" "Remove object" sketch-remove-object)
 ("u" "Undo" sketch-undo)
 ("r" "Redo" sketch-redo)]
[("d" "Show definition" sketch-show-definition)
@@ -360,10 +370,55 @@ values"
   (setq sketch-show-grid (if sketch-show-grid nil t))
   (sketch-redraw))
 
+(defun sketch-labels ()
+  (interactive)
+  (let ((svg-labels (svg-create 100 100)))
+(mapc (lambda (node)
+(pcase (car node)
+  ('rect (svg-text svg-labels
+   (dom-attr node 'id)
+   :x (+ (dom-attr node 'x) 2)
+   :y (+ (dom-attr node 'y)
+ (- (dom-attr node 'height) 2))
+   :font-size 20
+   :stroke "red"
+   :fill "red"))
+  ('line (svg-text svg-labels
+   (dom-attr node 'id)
+   :x (dom-attr node 'x1)
+   :y (dom-attr node 'y1)
+   :font-size 20
+   :stroke "red"
+   :fill "red"
+(cddr svg-sketch))
+(cddr svg-labels)))
+
+(defun sketch-labels-list ()
+  (mapcar (lambda (node)
+(dom-attr node 'id))
+  (cddr svg-sketch)))
+
+(defun sketch-create-label ()
+  (interactive)
+  (let* ((alphabet "abcdefghijklmnopqrstuvwxyz")
+ (labels-list (mapcar 'string (concat alphabet (upcase alphabet
+ (labels (sketch-labels-list)))
+(while (member (car labels-list) labels)
+  (setq labels-list (cdr labels-list)))
+(car labels-list)))
+
+(defun sketch-toggle-labels ()
+  (interactive)
+  (setq sketch-show-labels (if sketch-show-labels nil t))
+  (sketch-redraw))
+
 (defun sketch-redraw ()
   (unless sketch-mode
 (user-error "Not in sketch-mode buffer"))
-  (setq svg (append svg-canvas (when sketch-show-grid (cddr svg-grid)) (cddr 
svg-sketch)))
+  (setq svg (append svg-canvas
+(when sketch-show-grid (cddr svg-grid))
+(cddr svg-sketch)
+(when sketch-show-labels (sketch-labels
   (erase-buffer) ;; a (not exact) alternative is to use (kill-backward-chars 1)
   (insert-image (svg-image svg :pointer 'arrow :grid-param grid-param))

[elpa] externals/sketch-mode b944693 10/38: Add crop image feature AND add text transient into main

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit b9446933bcb21bf6ba558e0d640257f1748c7968
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add crop image feature AND add text transient into main
---
 README.org|  15 +
 sketch-mode.el| 187 +++---
 sketch-scratch.el |  29 +++--
 3 files changed, 136 insertions(+), 95 deletions(-)

diff --git a/README.org b/README.org
index f198860..4e7bb4c 100644
--- a/README.org
+++ b/README.org
@@ -52,18 +52,9 @@
 
 * Sponsor the project
   Due to a combination of unfortunate circumstances, I am in an unfortunate
-  financial situation (dependent on my family), while I would love to get a
-  modest income. As you can see from my [projects page][link to be inserted]
-  this is not because I don't do (I hope useful) work. It is just that I don't
-  get paid, nor receive any allowance, for writing free software while working
-  on a thesis. Anyway, although I really prefer to make software available to
-  anyone who would like to use it (I know quite well the frustration of
-  "financial exclusion"), I would be very happy with a donation from users who
-  enjoy 'my' packages, and can easily afford it (e.g. by using the packages for
-  their work). Of course, if you'd like to see this package (or any of my other
-  packages) get developed further you could also consider to become a sponsor 
(I
-  have no experience with this kind of business, but I guess it starts with
-  letting users know about it).
+  financial situation (dependent on my family), therefore if you find [[my
+  package(s)]][project page link to be inserted] useful, and if you can afford 
it,
+  then I would be very happy with any small (or less small) donation.
 
   Accepted donation methods
   [[https://en.liberapay.com/dalanicolai/][liberapay]]
diff --git a/sketch-mode.el b/sketch-mode.el
index 05f2dd0..f4b3f2f 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -154,12 +154,12 @@ STOPS is a list of percentage/color pairs."
   "Create svg images using the mouse.
 In sketch-mode buffer press \\[sketch-transient] to activate the
 transient."
-  nil "sketch-mode"
+  :lighter "sketch-mode"
+  :keymap
   '(([drag-mouse-1] . sketch-interactively)
-([C-S-drag-mouse-1] . sketch-interactively)
+;; ([C-S-drag-mouse-1] . sketch-interactively)
 ("" . sketch-transient)))
 
-
 (defun sketch--circle-radius (start-coords end-coords)
   (sqrt (+ (expt (- (car end-coords) (car start-coords)) 2)
(expt (- (cdr end-coords) (cdr start-coords)) 2
@@ -309,70 +309,6 @@ values"
 (propertize (apply 'color-rgb-to-hex (color-name-to-rgb 
default))
 'face 'transient-inactive-argument))
 
-(transient-define-prefix sketch-text ()
-  "Some Emacs magic"
-  :transient-suffix 'transient--do-call
-  :transient-non-suffix 'transient--do-stay
-  ["Font definitions"
-   [("f" "family" sketch-select-font)]
-   [("s" "stroke-color" sketch-font-size)
-("w" "fill-color" sketch-font-weight)]
-   ;; [("w" "stroke-width" sketch-stroke-width)]
-   [("m" "end-marker" sketch-object-marker)]]
-  ["Commands"
-   ([mouse-1] "Sketch"  sketch-text-interactively)]
-  [("q" "Quit"   transient-quit-one)])
-
-(transient-define-infix sketch-select-font ()
-  :description "Option with list"
-  :class 'transient-option
-  :argument "--family="
-  :choices (font-family-list))
-
-(transient-define-infix sketch-font-size ()
-  :description "Option with list"
-  :class 'transient-option
-  :argument "--font-size="
-  :choices (mapcar (lambda (x)
- (number-to-string x))
-   (number-sequence 1 100)))
-
-(transient-define-infix sketch-font-weight ()
-  :description "Option with list"
-  :class 'sketch-variable:choices
-  :argument "--object="
-  :choices '("bold")
-  :default "normal")
-
-
-(transient-define-suffix sketch-text-interactively (event)
-  (interactive "@e")
-  (let* ((sketch-args (when transient-current-prefix (transient-args 
'sketch-transient)))
- (text-args (when transient-current-prefix (transient-args 
'sketch-text)))
- (start (event-start event))
- (grid-param (plist-get (cdr (posn-image start)) :grid-param))
- (snap (transient-arg-value "--snap-to-grid=" sketch-args))
- (coords (if (or (not snap) (string= snap "nil"))
-   (posn-object-x-y start)
- (sketch-snap-to-grid (posn-object-x-y start) 
grid-param)))
- (text (read-string "Enter text: "))
- (object-props (list :font-size
- (transient-arg-value "--font-size=" text-args)
- :font-weight
- (transient-arg-value "--font-weight=" text-args)
- )))
- ;; :fill
- ;; (transient-arg-value "--fill-color=" 
sketch-args)
- ;; :marker-e

[elpa] externals/sketch-mode 37af8f4 01/38: Initial commit

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 37af8f4339189fbf93a6523b2ad1e3edf021f2bf
Author: Daniel Nicolai 
Commit: GitHub 

Initial commit
---
 LICENSE | 674 
 1 file changed, 674 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. 
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+   TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secon

[elpa] externals/sketch-mode f82ed74 11/38: Update documentation (add screencast)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit f82ed74c6e7d1c6ba92bcb5e5a3439914389585e
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Update documentation (add screencast)
---
 README.org  |  63 ++--
 happy-sketching.gif | Bin 0 -> 2063069 bytes
 happy-sketching.svg |   1 +
 sketch-mode.el  |   5 +++--
 4 files changed, 55 insertions(+), 14 deletions(-)

diff --git a/README.org b/README.org
index 4e7bb4c..4284f79 100644
--- a/README.org
+++ b/README.org
@@ -3,12 +3,34 @@
 
 * Preliminary comment
   This is a new package that is still in development. However, its main
-  functionality is very usable already. Any feedback is very welcome (probably
-  most suitable by opening an issue).
+  functionality is very usable already. Any feedback, for example suggestions
+  for enhancing the interface/usability, is very welcome (probably best by
+  opening an issue). Also, any contributions are very welcome. The code of the
+  package is very accessible (especially if you quickly read how to use 
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html][edebug]].
+
+** Included features
+   - snap to grid
+   - draw text
+   - crop finale image
+   - set stroke, fill, width etc.
+   - show dom (lisp) in other window
+   - draw angle arcs (between lines, available soon)
+   - save drawing presets using 
[[https://magit.vc/manual/transient.html#Saving-Values][transient's saving 
values feature]] (documentation
+ contribution welcome)
+ 
+** Delicious low hanging fruit
+   - use svg snippets (i.e. design object in external programs like inkscape,
+ geogebra etc., end quickly insert them in your sketches)
+   - export to tikz, asymptote, other image extensions etc.
+
+** Less low hanging fruit
+   - draw directly in you literate org file, with the dom updated in your 
source block
+ 
+  The =sketch-mode.el= file starts with listing TODO items describing features
+  that are missing from the package.
+
+  [[./happy-sketching.gif]]
 
-  The =sketch-mode.el= start with listing
-  TODO items describing features that are missing from the package.
-  
 * Installation
   When installing the package it probably still shows some warnings, you can
   safely ignore them.
@@ -45,16 +67,33 @@
 
 * Usage
   Start a sketch with =M-x sketch= and enter values at the prompts (or prefix
-  with =C-u= to use default values). Thanks to the =transient= package the 
usage
-  is more or less self explanatory.
+  with =C-u= to use default values). Although, thanks to the =transient=
+  package, the usage is more or less self explanatory, it is wise to take note
+  of the following comments:
+
+  - the undo/redo functionality is really basic, and does not work for all 
actions
+(e.g. does not work yet when removing object or cropping images).
+  - to remove an object (without using undo), you should toggle labels by
+pressing =l=, and then to remove an object enter its label after pressing
+=R=.
+  - You can hide the transient by pressing =q=, and you can go back to sketch
+mode via =M-x sketch= (or =C-c C-t= when still in the sketch-mode buffer)
 
-  Create your sketch and then save the file by pressing =S=.
+  Create your sketch and then save
+  the file by pressing =S=.
 
 * Sponsor the project
-  Due to a combination of unfortunate circumstances, I am in an unfortunate
-  financial situation (dependent on my family), therefore if you find [[my
-  package(s)]][project page link to be inserted] useful, and if you can afford 
it,
-  then I would be very happy with any small (or less small) donation.
+  It takes me a lot of time to develop these packages, while, as we would say 
in
+  the Netherlands, I have no penny to scratch my butt. Therefore, although I am
+  also really happy to offer it for free, if you find 
[[https://github.com/dalanicolai][my package(s)]] (real
+  projects page in the making) useful (e.g. for you work), and if you can 
afford
+  it, then I would be very happy with any donation. As soon as I have the
+  opportunity/possibility to find a stable job, I will happily suggest you to
+  transfer or donate to other projects/charity.
+
+  If you would like to =boost= development of any of my projects, then
+  contribute (code or documentation), or consider more sustainable financial
+  support (i.e. sponsor).
 
   Accepted donation methods
   [[https://en.liberapay.com/dalanicolai/][liberapay]]
diff --git a/happy-sketching.gif b/happy-sketching.gif
new file mode 100644
index 000..ef5aaae
Binary files /dev/null and b/happy-sketching.gif differ
diff --git a/happy-sketching.svg b/happy-sketching.svg
new file mode 100644
index 000..e7bf00d
--- /dev/null
+++ b/happy-sketching.svg
@@ -0,0 +1 @@
+http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; stroke="gray">  

[elpa] externals/sketch-mode 7583fcb 17/38: Fix variable names and implement svg lisp togglable side window

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 7583fcb3116146e2f4aef0c752327cf263000774
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix variable names and implement svg lisp togglable side window

This commit applies the major part of S. Monnier's patch.
Additionally, it implements a side window for showing the svg (elisp) dom 
in a
dedicated side window.
---
 sketch-mode.el | 133 +
 1 file changed, 77 insertions(+), 56 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index bedd344e..85f9b2c 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1,10 +1,11 @@
 ;;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse 
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Daniel Nicolai
+;; Copyright (C) 2021  Free Software Foundation, Inc.
 
 
 ;; Author: D.L. Nicolai 
 ;; Created: 17 Jul 2021
+;; Version: 0
 
 ;; Keywords: multimedia 
 ;; URL: https://github.com/dalanicolai/sketch-mode
@@ -79,7 +80,7 @@
   "Default size for sketch canvas.
 Cons cell with car and cdr both integers, respectively
 representing the image width and image height
-(default: '(800 . 600))."
+default: (800 . 600)."
   :type '(cons integer integer))
 
 (defcustom sketch-show-grid t
@@ -134,8 +135,8 @@ STOPS is a list of percentage/color pairs."
   (svg--def
svg
(apply
-'dom-node
-'marker 
+#'dom-node
+'marker
 `((id . ,id)
   (viewBox . "0 0 10 10")
   (refX . 5)
@@ -165,17 +166,16 @@ In sketch-mode buffer press \\[sketch-transient] to 
activate the
 transient."
   :lighter "sketch-mode"
   :keymap
-  '(([sketch drag-mouse-1] . sketch-interactively)
+  `(([sketch drag-mouse-1] . sketch-interactively)
 ;; ([C-S-drag-mouse-1] . sketch-interactively)
-("" . sketch-transient)))
+(,(kbd "C-c C-s") . sketch-transient)))
 
 (defun sketch--circle-radius (start-coords end-coords)
   (sqrt (+ (expt (- (car end-coords) (car start-coords)) 2)
(expt (- (cdr end-coords) (cdr start-coords)) 2
-
-(defun sketch--rectangle-coords (start-coords end-coords)
-  (let ((base-coords (cons (apply 'min (list (car start-coords) (car 
end-coords)))
-   (apply 'min (list (cdr start-coords) (cdr 
end-coords))
+ (defun sketch--rectangle-coords (start-coords end-coords)
+  (let ((base-coords (cons (apply #'min (list (car start-coords) (car 
end-coords)))
+   (apply #'min (list (cdr start-coords) (cdr 
end-coords))
   (list (car base-coords)
 (cdr base-coords)
 (abs (- (car end-coords) (car start-coords)))
@@ -189,10 +189,10 @@ transient."
 
 (defun sketch--create-canvas (width height &optional grid-param)
   "Create canvas for drawing svg using the mouse."
-  (defvar svg)
+  (defvar sketch-svg)
   (defvar svg-canvas)
   (defvar svg-grid)
-  (defvar svg-sketch)
+  (defvar sketch-root)
 (insert-image
  (let ((width width)
(height height))
@@ -210,11 +210,11 @@ transient."
(let ((pos (* (1+ x) grid-param)))
  (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
  (setq dash (if dash nil t)
-   (setq svg (append svg-canvas (when sketch-show-grid (cddr svg-grid
-   (svg-image svg
+   (setq sketch-svg (append svg-canvas (when sketch-show-grid (cddr 
svg-grid
+   (svg-image sketch-svg
   :grid-param grid-param
   :pointer 'arrow
-  :map `(((rect . ((0 . 0) . (,(dom-attr svg 'width) . 
,(dom-attr svg 'height
+  :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . 
,(dom-attr sketch-svg 'height
   ;; :map '(((rect . ((0 . 0) . (800 . 600)))
   sketch
   (pointer arrow help-echo (lambda (_ _ pos)
@@ -225,7 +225,7 @@ transient."
   (+ (cdr 
coords) sketch-im-y-offset)))
 (sketch-mode)
 (call-interactively 'sketch-transient)
-(setq svg-sketch (svg-create width height)))
+(setq sketch-root (svg-create width height)))
 
 ;;;###autoload
 (defun sketch (arg)
@@ -240,6 +240,8 @@ values"
   (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
 (height (if arg 600 (read-number "Enter height: "
 (switch-to-buffer (get-buffer-create "*sketch*"))
+;; FIXME: `defvar' can't be meaningfully inside a function like that.
+;; FIXME: Use a `sketch-' prefix for all dynbound vars.
 (defvar-local sketch-elements nil)
 (defvar-local grid-param 25)
 (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 
0 for no grid): ")))
@@ -304,7 +306,7 @@ values"
   ((fallback:initarg :fallback:initform nil)
(default :initarg :default :initform nil)))
 
-(cl-defmethod transient-infix-read ((obj sketch-v

[elpa] externals/sketch-mode d42f84a 22/38: Add svg and sketch group definitions

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit d42f84a975bf35d687224ca023749f46ee576492
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add svg and sketch group definitions
---
 sketch-mode.el | 17 +
 1 file changed, 17 insertions(+)

diff --git a/sketch-mode.el b/sketch-mode.el
index 9379efd..16b9774 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -129,6 +129,9 @@ default: (800 . 600)."
(const :tag "Arrow" 'arrow)
   (const :tag "Point" 'point)))
 
+
+;;; SVG-definitions
+
 (defun svg-marker (svg id width height &optional color reverse)
   "Add a gradient with ID to SVG.
 TYPE is `linear' or `radial'.
@@ -161,6 +164,20 @@ STOPS is a list of percentage/color pairs."
(r . 5)
(fill . ,(or color "black"))
 
+(defun svg-group (&rest args)
+  (apply #'dom-node
+ 'g
+ `(,(svg--arguments nil args
+
+
+;;; Resume sketch-code
+
+(defun sketch-group (id &rest args)
+  (apply #'svg-group
+ :id id
+ :transform "translate(0 0)"
+ args))
+
 (define-minor-mode sketch-mode
   "Create svg images using the mouse.
 In sketch-mode buffer press \\[sketch-transient] to activate the



[elpa] externals/sketch-mode ec35bb4 23/38: Add xml processing instruction and DOCTYPE element (see #4)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit ec35bb44a6a6c7c1ec997908ad27801ee4ee937a
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Add xml processing instruction and DOCTYPE element (see #4)
---
 sketch-mode.el | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 4713604..3ebe1ef 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -213,7 +213,7 @@ transient."
  (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
  (setq dash (if dash nil t)
(setq sketch-svg (append svg-canvas (when sketch-show-grid (cddr 
svg-grid
-   (svg-image sketch-svg
+   (sketch-image sketch-svg
   :grid-param grid-parameter
   :pointer 'arrow
   :map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 'width) . 
,(dom-attr sketch-svg 'height
@@ -533,7 +533,7 @@ values"
 (cddr sketch-root)
 (when sketch-show-labels (sketch-labels
   (erase-buffer) ;; a (not exact) alternative is to use (kill-backward-chars 1)
-  (insert-image (svg-image sketch-svg
+  (insert-image (sketch-image sketch-svg
:pointer 'arrow
:grid-param grid-param
:map `(((rect . ((0 . 0) . (,(dom-attr sketch-svg 
'width) . ,(dom-attr sketch-svg 'height
@@ -619,7 +619,7 @@ values"
 ;;:fill "none"))
 ;;   ('ellipse (apply 'svg-ellipse sketch-svg  (append 
(sketch--ellipse-coords start-coords end-coords) '(:fill "none")
 ;; (kill-backward-chars 1)
-;; (insert-image (svg-image sketch-svg :pointer 'arrow :grid-param 
grid-param
+;; (insert-image (sketch-image sketch-svg :pointer 'arrow :grid-param 
grid-param
   ;; (call-interactively 'tutorial-transient)
 
 (define-minor-mode sketch-lisp-mode
@@ -744,6 +744,18 @@ values"
 (setf (cddr sketch-root) (sketch--svg-translate (car start-coords) (cdr 
start-coords)))
 (sketch-redraw)))
 
+(defun sketch-image (svg &rest props)
+  "Return an image object from SVG.
+PROPS is passed on to `create-image' as its PROPS list."
+  (apply
+   #'create-image
+   (with-temp-buffer
+ (insert "
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\";>\n")
+ (svg-print svg)
+ (buffer-string))
+   'svg t props))
+
 (transient-define-suffix sketch-save ()
   (interactive)
   (image-save))
@@ -816,11 +828,10 @@ values"
 
 (defun sketch-update-lisp-window (lisp buffer)
   ;; (let ((sketch sketch-root))
-  (save-current-buffer
-(switch-to-buffer-other-window buffer)
-(erase-buffer)
-(pp lisp (current-buffer))
-(end-of-buffer)))
+(with-current-buffer buffer
+  (erase-buffer)
+  (pp lisp (current-buffer))
+  (end-of-buffer)))
 
 
  (provide 'sketch-mode)



[elpa] externals/sketch-mode 846f4a0 24/38: Implement layers (incl. reformat labels)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 846f4a0c517520b97de34752064f1272aab876f4
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Implement layers (incl. reformat labels)

Somehow the `sketch-modify-object`, possibly due to a bug in
'save-current-buffer`
---
 sketch-mode.el | 289 ++---
 1 file changed, 215 insertions(+), 74 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 16b9774..8b0e4f1 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -1,4 +1,4 @@
-;;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse 
-*- lexical-binding: t; -*-
+;; sketch-mode.el --- Quickly create svg sketches using keyboard and mouse -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 
@@ -36,9 +36,9 @@
 
 ;; DONE move font transient (also its suffix) into main sketch transient 
(suffix)
 
-;; DONE add functionality to crop/select part of image (on save)
+;; DONE add functionality to crop/select part of image (on/before save)
 
-;; TODO add functionality to modify objects (see `add-object-modify-feature' 
branch)
+;; DONE(-partially) add functionality to modify objects (see 
`add-object-modify-feature' branch)
 
 ;; TODO enable defining global svg settings (object properties)
 
@@ -57,6 +57,13 @@
 ;; TODO create function to insert svg snippets (so you could design objects in
 ;; advanced software and use them quickly here in your sketches)
 
+;; TODO create function to save snippets
+
+;; TODO implement modularity. i.e. create 'layers' via svg groups  (related
+;; to snippet functionality)
+
+;; TODO create zoom functionality
+
 ;; NOTE this is a most straightforward sketch-mode. A more advanced/general 
version
 ;; could implement a drawing DSL based on nodes (a la tikz/asymptote etc.)
 
@@ -207,8 +214,10 @@ transient."
 
 (defvar sketch-svg)
 (defvar-local svg-canvas nil)
-(defvar-local svg-grid nil)
+(defvar-local sketch-grid nil)
 (defvar-local sketch-root nil)
+(defvar-local svg-layers nil)
+(defvar-local show-layers '(0))
 
 (defun sketch--create-canvas (width height &optional grid-parameter)
   "Create canvas for drawing svg using the mouse."
@@ -218,18 +227,18 @@ transient."
(setq svg-canvas (svg-create width height :stroke "gray"))
(svg-marker svg-canvas "arrow" 8 8 "black" t)
(svg-rectangle svg-canvas 0 0 width height :fill "white")
-   (setq svg-grid (svg-create width height))
+   (setq sketch-grid (sketch-group "grid"))
(let ((dash t))
  (dotimes (x (1- (/ width grid-parameter)))
(let ((pos (* (1+ x) grid-parameter)))
- (svg-line svg-grid pos 0 pos height :stroke-dasharray (when dash 
"2,4"))
+ (svg-line sketch-grid pos 0 pos height :stroke-dasharray (when 
dash "2,4"))
  (setq dash (if dash nil t)
(let ((dash t))
  (dotimes (x (1- (/ height grid-parameter)))
(let ((pos (* (1+ x) grid-parameter)))
- (svg-line svg-grid 0 pos width pos :stroke-dasharray (when dash 
"2,4"))
+ (svg-line sketch-grid 0 pos width pos :stroke-dasharray (when 
dash "2,4"))
  (setq dash (if dash nil t)
-   (setq sketch-svg (append svg-canvas (when sketch-show-grid (cddr 
svg-grid
+   (setq sketch-svg (append svg-canvas (when sketch-show-grid (list 
sketch-grid
(sketch-image sketch-svg
   :grid-param grid-parameter
   :pointer 'arrow
@@ -244,9 +253,14 @@ transient."
   (+ (cdr 
coords) sketch-im-y-offset)))
 (sketch-mode)
 (call-interactively 'sketch-transient)
-(setq sketch-root (svg-create width height)))
+(setq sketch-root (sketch-group "main"))
+(sketch-add-layer))
 
+;; FIXME: `defvar' can't be meaningfully inside a function like that.
+;; FIXME: Use a `sketch-' prefix for all dynbound vars.
 (defvar-local sketch-elements nil)
+(defvar-local grid-param 25)
+(defvar-local active-layer 0)
 
 ;;;###autoload
 (defun sketch (arg)
@@ -261,9 +275,6 @@ values"
   (let ((width (if arg (car sketch-default-image-size) (read-number "Enter 
width: ") ))
 (height (if arg 600 (read-number "Enter height: "
 (switch-to-buffer (get-buffer-create "*sketch*"))
-;; FIXME: `defvar' can't be meaningfully inside a function like that.
-;; FIXME: Use a `sketch-' prefix for all dynbound vars.
-(setq grid-param 25)
 (setq grid-param (if arg 25 (read-number "Enter grid parameter (enter 
0 for no grid): ")))
 (sketch--create-canvas width height grid-param)
 
@@ -406,12 +417,16 @@ values"
["Font definitions"
 ("-f" "family" sketch-select-font)
 ("-w" "font-weight" sketch-font-weight)
-("-s" "font-size" sketch-font-size)]
-   ["Grid"
+("-s" "font-size" sketch-font-size)]]
+   [["Grid"
 ("s" "Snap to grid" sketch-snap)
 ("g" "

[elpa] externals/sketch-mode 4c6a675 36/38: Fix load definition functionality (also set layers list)

2021-09-15 Thread ELPA Syncer
branch: externals/sketch-mode
commit 4c6a675cc03b44cccb91e8eb8dab99945872c21f
Author: Daniel Nicolai 
Commit: Daniel Nicolai 

Fix load definition functionality (also set layers list)
---
 sketch-mode.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sketch-mode.el b/sketch-mode.el
index 819fd9e..495ed4f 100644
--- a/sketch-mode.el
+++ b/sketch-mode.el
@@ -561,7 +561,7 @@ else return nil"
 show-layers)
 (svg-labels (sketch-group "labels")))
 (mapc (lambda (node)
-(pcase (car node)
+(pcase (dom-tag node)
   ('rect (svg-text svg-labels
(dom-attr node 'id)
:x (+ (dom-attr node 'x) 2)
@@ -660,7 +660,7 @@ else return nil"
 (defun sketch--svg-translate (dx dy)
   (interactive)
   (mapcar (lambda (node)
-(pcase (car node)
+(pcase (dome-tag node)
   ('line (sketch-translate-node-coords node dx 'x1 'x2)
  (sketch-translate-node-coords node dy 'y1 'y2))
   ('rect (sketch-translate-node-coords node dx 'x)
@@ -846,6 +846,7 @@ else return nil"
   (let ((def (read (buffer-string
 (with-current-buffer "*sketch*"
   (setq sketch-root def)
+  (setq sketch-layers-list (dom-by-id sketch-root "layer"))
   (sketch-redraw
 
 ;; (defvar sketch-undo-redo nil)



[elpa] externals/taxy updated (44d0a8c -> 4aeaeef)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/taxy.

  from  44d0a8c   Docs: Add Deffy to examples
   new  6382bec   Docs: Update summary
   new  4aeaeef   Docs: Update examples


Summary of changes:
 README.org |   6 +-
 taxy.info  | 232 ++---
 2 files changed, 119 insertions(+), 119 deletions(-)



[elpa] externals/taxy 6382bec 1/2: Docs: Update summary

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 6382bec8ceecdef746b7a89bd3de85a7448ae8fc
Author: Adam Porter 
Commit: Adam Porter 

Docs: Update summary
---
 README.org |   2 +
 taxy.info  | 228 ++---
 2 files changed, 113 insertions(+), 117 deletions(-)

diff --git a/README.org b/README.org
index 297f881..0d90f38 100644
--- a/README.org
+++ b/README.org
@@ -16,6 +16,8 @@ Helpful features include:
 
 +  Dynamic taxonomies :: Objects may be classified into hierarchies 
automatically defined at runtime based on their attributes.
 +  Reusable taxonomies :: Taxonomy definitions may be stored in variables and 
reused in other taxonomies' descendant groups.
++  Classification domain-specific language :: Easily define a custom DSL used 
to classify items dynamically (which can be extended by users).
++  Flexible table view :: Based on =magit-section=, with easily defined 
columns (also extendable by users).
 
 * Contents :noexport:
 :PROPERTIES:
diff --git a/taxy.info b/taxy.info
index a098e48..ca9ce83 100644
--- a/taxy.info
+++ b/taxy.info
@@ -1,4 +1,4 @@
-This is README.info, produced by makeinfo version 5.2 from README.texi.
+This is README.info, produced by makeinfo version 6.5 from README.texi.
 
 INFO-DIR-SECTION Emacs
 START-INFO-DIR-ENTRY
@@ -11,6 +11,30 @@ File: README.info,  Node: Top,  Next: Examples,  Up: (dir)
 taxy.el
 ***
 
+https://elpa.gnu.org/packages/taxy.svg
+(https://elpa.gnu.org/packages/taxy.html)
+
+   _Now, where did I put that..._
+
+   This library provides a programmable way to classify arbitrary
+objects into a hierarchical taxonomy.  (That’s a lot of fancy words to
+say that this lets you automatically put things in nested groups.)
+
+   Helpful features include:
+
+Dynamic taxonomies
+ Objects may be classified into hierarchies automatically defined at
+ runtime based on their attributes.
+Reusable taxonomies
+ Taxonomy definitions may be stored in variables and reused in other
+ taxonomies’ descendant groups.
+Classification domain-specific language
+ Easily define a custom DSL used to classify items dynamically
+ (which can be extended by users).
+Flexible table view
+ Based on ‘magit-section’, with easily defined columns (also
+ extendable by users).
+
 * Menu:
 
 * Examples::
@@ -30,9 +54,6 @@ Examples
 * Sporty (understanding completely)::
 * Applications::
 
-
-
-
 Usage
 
 * Reusable taxys::
@@ -41,73 +62,46 @@ Usage
 * Dynamic taxys::
 * Magit section::
 
-
-
-
 Dynamic taxys
 
 * Multi-level dynamic taxys::
-* "Chains" of independent, multi-level dynamic taxys: "Chains" of independent 
multi-level dynamic taxys. 
+* "Chains" of independent, multi-level dynamic taxys: "Chains" of independent 
multi-level dynamic taxys.
 * Defining a classification domain-specific language::
 
 Changelog
 
-* 0.7-pre: 07-pre. 
-* 0.6: 06. 
-* 0.5: 05. 
-* 0.4: 04. 
-* 0.3: 03. 
-* 0.2: 02. 
-* 0.1: 01. 
-
+* 0.7-pre: 07-pre.
+* 0.6: 06.
+* 0.5: 05.
+* 0.4: 04.
+* 0.3: 03.
+* 0.2: 02.
+* 0.1: 01.
 
 0.6
 
 * Additions::
 
-
 0.5
 
-* Additions: Additionsx. 
+* Additions: Additions (1).
 * Fixes::
 
-
-
-
 0.3
 
 * Changes::
-* Fixes: Fixesx. 
-
-
+* Fixes: Fixes (1).
 
 0.2
 
-* Changes: Changesx. 
-* Additions: Additionsxx. 
-* Fixes: Fixesxx. 
+* Changes: Changes (1).
+* Additions: Additions (2).
+* Fixes: Fixes (2).
 
 Development
 
 * Copyright assignment::
 
-
-(https://elpa.gnu.org/packages/taxy.html)
-
-   _Now, where did I put that…_
-
-   This library provides a programmable way to classify arbitrary
-objects into a hierarchical taxonomy.  (That’s a lot of fancy words to
-say that this lets you automatically put things in nested groups.)
-
-   Helpful features include:
-
-‘Dynamic taxonomies’
- Objects may be classified into hierarchies automatically defined at
- runtime based on their attributes.
-‘Reusable taxonomies’
- Taxonomy definitions may be stored in variables and reused in other
- taxonomies’ descendant groups.
 
 
 File: README.info,  Node: Examples,  Next: Installation,  Prev: Top,  Up: Top
@@ -164,8 +158,8 @@ Let’s imagine a silly taxonomy of numbers below 100:
   (10 25 35 50 55 65 70 85 95))
 
You might think about how to produce that by writing some imperative
-code, but taxy allows you to do so in a more declarative and functional
-manner:
+code, but ‘taxy’ allows you to do so in a more declarative and
+functional manner:
 
  (require 'taxy)
 
@@ -268,7 +262,7 @@ first taxy, i.e.  non-vowels.
("Consonants" "Well, if they aren't vowels..."
 ("B" "C" "D" "F" "G" "H" "J" "K" "L" "M" "N"
 
-   Oops, we forgot the letters after N! Let’s add them, too:
+   Oops, we forgot the letters after N!  Let’s add them, too:
 
  (taxy-plain
   (taxy-fill (reverse
@@ -500,8 +494,8 @@ File: README.info,  Node: Installation,  Next: Usage,  
Prev: Exampl

[elpa] externals/taxy 4aeaeef 2/2: Docs: Update examples

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 4aeaeef0d0bf9308c19cc33f8a10527e26a8814a
Author: Adam Porter 
Commit: Adam Porter 

Docs: Update examples
---
 README.org |  4 +++-
 taxy.info  | 64 --
 2 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/README.org b/README.org
index 0d90f38..63b40cd 100644
--- a/README.org
+++ b/README.org
@@ -410,8 +410,10 @@ Ah, now I understand.
 
 ** Applications
 
-Some example applications may be found in the 
[[file:examples/README.org][examples directory]]:
+Some example applications may be found in the [[file:examples/][examples 
directory]]:
 
++  Deffy shows top-level definitions and forms in an Elisp project or file:
+   [[images/deffy.png]]
 +  Diredy rearranges a Dired buffer into groups by file size and type:
[[images/diredy.png]]
 +  Musicy shows a music library with tracks categorized by genre, artist, 
year, album, etc:
diff --git a/taxy.info b/taxy.info
index ca9ce83..3731e07 100644
--- a/taxy.info
+++ b/taxy.info
@@ -482,8 +482,10 @@ File: README.info,  Node: Applications,  Prev: Sporty 
(understanding completely)
 
 
 Some example applications may be found in the examples directory
-(examples/README.org):
+(examples/):
 
+   • Deffy shows top-level definitions and forms in an Elisp project or
+ file:
• Diredy rearranges a Dired buffer into groups by file size and type:
• Musicy shows a music library with tracks categorized by genre,
  artist, year, album, etc:
@@ -1276,36 +1278,36 @@ Node: Numbery (starting basically)2404
 Node: Lettery (filling incrementally)8165
 Node: Sporty (understanding completely)10679
 Node: Applications1
-Node: Installation17066
-Node: Usage17379
-Node: Reusable taxys19516
-Node: Threading macros23669
-Node: Modifying filled taxys24208
-Node: Dynamic taxys25026
-Node: Multi-level dynamic taxys27675
-Node: "Chains" of independent multi-level dynamic taxys29868
-Node: Defining a classification domain-specific language32799
-Node: Magit section36962
-Node: Changelog37641
-Node: 07-pre37844
-Node: 0637950
-Node: Additions38065
-Node: 0539411
-Node: Additions (1)39546
-Node: Fixes40652
-Node: 0440806
-Node: 0341028
-Node: Changes41157
-Node: Fixes (1)41520
-Node: 0241955
-Node: Changes (1)42124
-Node: Additions (2)42416
-Node: Fixes (2)43275
-Node: 0143529
-Node: Development43628
-Node: Copyright assignment43834
-Node: Credits44422
-Node: License44612
+Node: Installation17141
+Node: Usage17454
+Node: Reusable taxys19591
+Node: Threading macros23744
+Node: Modifying filled taxys24283
+Node: Dynamic taxys25101
+Node: Multi-level dynamic taxys27750
+Node: "Chains" of independent multi-level dynamic taxys29943
+Node: Defining a classification domain-specific language32874
+Node: Magit section37037
+Node: Changelog37716
+Node: 07-pre37919
+Node: 0638025
+Node: Additions38140
+Node: 0539486
+Node: Additions (1)39621
+Node: Fixes40727
+Node: 0440881
+Node: 0341103
+Node: Changes41232
+Node: Fixes (1)41595
+Node: 0242030
+Node: Changes (1)42199
+Node: Additions (2)42491
+Node: Fixes (2)43350
+Node: 0143604
+Node: Development43703
+Node: Copyright assignment43909
+Node: Credits44497
+Node: License44687
 
 End Tag Table
 



[elpa] externals/taxy 24486d3 1/2: Examples: (deffy) Require map and taxy

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 24486d3fa26354880e684210afadc0e82f0ff980
Author: Adam Porter 
Commit: Adam Porter 

Examples: (deffy) Require map and taxy

Shouldn't be necessary, but...
---
 examples/deffy.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/deffy.el b/examples/deffy.el
index c47105f..6524392 100644
--- a/examples/deffy.el
+++ b/examples/deffy.el
@@ -26,6 +26,9 @@
 
 ;;; Code:
 
+(require 'map)
+
+(require 'taxy)
 (require 'taxy-magit-section)
 
 (cl-defstruct deffy-def



[elpa] externals/taxy updated (4aeaeef -> 9eca81b)

2021-09-15 Thread ELPA Syncer
elpasync pushed a change to branch externals/taxy.

  from  4aeaeef   Docs: Update examples
   new  24486d3   Examples: (deffy) Require map and taxy
   new  9eca81b   Fix: (taxy-magit-section) Require map


Summary of changes:
 examples/deffy.el | 3 +++
 taxy-magit-section.el | 2 ++
 2 files changed, 5 insertions(+)



[elpa] externals/taxy 9eca81b 2/2: Fix: (taxy-magit-section) Require map

2021-09-15 Thread ELPA Syncer
branch: externals/taxy
commit 9eca81b193a0bd792e63a86c21c32a52a84f7fe5
Author: Adam Porter 
Commit: Adam Porter 

Fix: (taxy-magit-section) Require map
---
 taxy-magit-section.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 00dd217..728d0e5 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -27,6 +27,8 @@
 
  Requirements
 
+(require 'map)
+
 (require 'taxy)
 (require 'magit-section)
 



  1   2   >