[elpa] externals/denote d0e7c844ce: Document Summer Emacs' essay about usage of Emacs, Denote, etc.

2023-05-08 Thread ELPA Syncer
branch: externals/denote
commit d0e7c844ceefe7edacb59377082c1a510914a9fe
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Document Summer Emacs' essay about usage of Emacs, Denote, etc.
---
 README.org | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.org b/README.org
index 297a811c50..6670a4d0bb 100644
--- a/README.org
+++ b/README.org
@@ -3617,6 +3617,9 @@ Denote, feel welcome to tell us about it 
([[#h:1ebe4865-c001-4747-a6f2-0fe45aad7
 + Stefan Thesing: /Denote as a Zettelkasten/, 2023-03-02,
   
 
++ Summer Emacs: /An explanation of how I use Emacs/, 2023-05-04,
+  

+
 * Alternatives to Denote
 :PROPERTIES:
 :CUSTOM_ID: h:dbb51a1b-90b8-48e8-953c-e2fb3e36981e



[elpa] externals/org-transclusion 6c0352f33a 01/29: Feature: select end via n things at point.

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 6c0352f33ad4386f7b69faa358a9ab91078b8fd7
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Feature: select end via n things at point.
---
 org-transclusion-src-lines.el | 57 +--
 org-transclusion.el   | 10 
 2 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index b37b1c826c..3458991fc3 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -32,6 +32,8 @@
 (declare-function org-transclusion-org-file-p
   "org-transclusion")
 
+(declare-function org-transclusion-keyword-value-thing-at-point
+  "org-transclusion")
  Setting up the extension
 
 ;; Add a new transclusion type
@@ -46,6 +48,8 @@
   #'org-transclusion-keyword-value-rest)
 (add-hook 'org-transclusion-keyword-value-functions
   #'org-transclusion-keyword-value-end)
+(add-hook 'org-transclusion-keyword-value-functions
+  #'org-transclusion-keyword-value-thing-at-point)
 ;; plist back to string
 (add-hook 'org-transclusion-keyword-plist-to-string-functions
   #'org-transclusion-keyword-plist-to-string-src-lines)
@@ -62,6 +66,22 @@
 
 ;;; Functions
 
+(defun bounds-of-n-things-at-point (thing count)
+  "Return the bounds of COUNT THING (s) -at-point."
+  (save-excursion
+(let ((bounds (bounds-of-thing-at-point thing)))
+  (when bounds
+(push-mark (car bounds) t t)
+(goto-char (cdr bounds))
+(while (and (> count 1) bounds)
+  (setq bounds (bounds-of-thing-at-point thing))
+  (when bounds
+(if (> count 1)
+(forward-thing thing)
+  (goto-char (cdr bounds)))
+(setq count (1- count
+(car (region-bounds))
+
 (defun org-transclusion-add-src-lines (link plist)
   "Return a list for non-Org text and source file.
 Determine add function based on LINK and PLIST.
@@ -76,8 +96,8 @@ Return nil if PLIST does not contain \":src\" or \":lines\" 
properties."
 (plist-get plist :end)
 ;; Link contains a search-option ::
 ;; and NOT for an Org file
-   (and (org-element-property :search-option link)
-(not (org-transclusion-org-file-p (org-element-property :path 
link)
+(and (org-element-property :search-option link)
+ (not (org-transclusion-org-file-p (org-element-property :path 
link)
 (append '(:tc-type "lines")
 (org-transclusion-content-range-of-lines link plist)
 
@@ -107,7 +127,8 @@ it means from line 10 to the end of file."
  (type (org-element-property :type link))
  (entry-pos) (buf)
  (lines (plist-get plist :lines))
- (end-search-op (plist-get plist :end)))
+ (end-search-op (plist-get plist :end))
+ (thing-at-point (make-symbol (plist-get plist :thing-at-point
 (if (not (string= type "id")) (setq buf (find-file-noselect path))
   (let ((filename-pos (org-id-find path)))
 (setq buf (find-file-noselect (car filename-pos)))
@@ -125,15 +146,23 @@ it means from line 10 to the end of file."
;; ::/regex/ or ::number is used
(if (org-link-search search-option)
(line-beginning-position))
- ((point-min
+((point-min
+(bounds (when thing-at-point
+  (let ((count (if end-search-op
+   (string-to-number end-search-op) 
1)))
+(save-excursion
+  (goto-char start-pos)
+  (bounds-of-n-things-at-point thing-at-point 
count)
+(start-pos (if thing-at-point (car bounds) start-pos))
 (end-pos (when end-search-op
-   (save-excursion
- (ignore-errors
-   ;; FIXME `org-link-search' does not
-   ;; return postion when either ::/regex/
-   ;; or ::number is used
-   (when (org-link-search end-search-op)
- (line-beginning-position))
+   (cond ((when thing-at-point (+ 1 (cdr bounds
+ ((save-excursion
+(ignore-errors
+  ;; FIXME `org-link-search' does not
+  ;; return postion when either ::/regex/
+  ;; or ::number is used
+  (when (org-link-search end-search-op)
+(line-beginning-position
   

[elpa] externals/org-transclusion 1d6fb83578 21/29: fix: (unit-tests.el) require org-transclusion

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 1d6fb835789c9ebd217be2034807e722eaf41d72
Author: Joseph Turner 
Commit: Noboru Ota 

fix: (unit-tests.el) require org-transclusion

Resolves:

unit-tests.el:8:19: Warning: the function `org-transclusion-org-file-p' is 
not known to be defined.
---
 test/unit-tests.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/unit-tests.el b/test/unit-tests.el
index 57dcddcbaa..a8339a6273 100644
--- a/test/unit-tests.el
+++ b/test/unit-tests.el
@@ -2,6 +2,7 @@
 ;; org-transclusion unit tests
 ;; To run the tests you can use: M-x ert RET t RET
 ;; You can read more about ert here: 
https://www.gnu.org/software/emacs/manual/html_node/ert/index.html
+(require 'org-transclusion)
 
 (ert-deftest org-transclusion-org-file-p-test ()
   "Tests org-transclusion-org-file-p against string inputs."



[elpa] externals/org-transclusion ccc7870f07 12/29: Fixup

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit ccc7870f0740d8fec2cbdb814ce10b6f6649ecb4
Author: Benjamin Cherry 
Commit: Noboru Ota 

Fixup
---
 org-transclusion.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index ed6cf3ba5c..bca8f3f235 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -950,8 +950,9 @@ Return nil if not found."
  Functions for inserting content
 
 (defun org-transclusion--ensure-newline (str)
-  (when (not (string-suffix-p "\n" str))
-(concat str "\n")))
+  (if (not (string-suffix-p "\n" str))
+  (concat str "\n")
+str))
 
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.



[elpa] externals/org-transclusion 28737e1b5c 08/29: Need newline guarentee also in content-src-lines

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 28737e1b5c7490c1fb1f0dcb3cf122eb3cc90c10
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Need newline guarentee also in content-src-lines
---
 org-transclusion-src-lines.el |  2 +-
 org-transclusion.el   | 29 +++--
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 4aec22daae..3bc7cc4e76 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -211,7 +211,7 @@ for the range works."
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
-  src-content
+  (org-transclusion--ensure-newline src-content)
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
diff --git a/org-transclusion.el b/org-transclusion.el
index 5f4c3acbed..ed6cf3ba5c 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -949,6 +949,10 @@ Return nil if not found."
 ;;-
  Functions for inserting content
 
+(defun org-transclusion--ensure-newline (str)
+  (when (not (string-suffix-p "\n" str))
+(concat str "\n")))
+
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.
 Return t when successful.
@@ -978,20 +982,17 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (ensure-newline (lambda (str)
-   (when (not (string-suffix-p "\n" str)))
-   (concat str "\n")))
- (content (funcall ensure-newline content)))
+ (content (org-transclusion--ensure-newline content)))
 (when (org-transclusion-type-is-org type)
-(with-temp-buffer
-  ;; This temp buffer needs to be in Org Mode
-  ;; Otherwise, subtree won't be recognized as a Org subtree
-  (delay-mode-hooks (org-mode))
-  (insert content)
-  (org-with-point-at 1
-(let* ((to-level (plist-get keyword-values :level))
-   (level (org-transclusion-content-highest-org-headline))
-   (diff (when (and level to-level) (- level to-level
+  (with-temp-buffer
+;; This temp buffer needs to be in Org Mode
+;; Otherwise, subtree won't be recognized as a Org subtree
+(delay-mode-hooks (org-mode))
+(insert content)
+(org-with-point-at 1
+  (let* ((to-level (plist-get keyword-values :level))
+ (level (org-transclusion-content-highest-org-headline))
+ (diff (when (and level to-level) (- level to-level
 (when diff
   (cond ((< diff 0) ; demote
  (org-map-entries (lambda ()
@@ -1001,7 +1002,7 @@ based on the following arguments:
  (org-map-entries (lambda ()
 (dotimes (_ diff)
   (org-do-promote
-(setq content (buffer-string)
+  (setq content (buffer-string)
 (insert
  (run-hook-with-args-until-success
   'org-transclusion-content-format-functions



[elpa] externals/org-transclusion b3e59a7b0a 25/29: refactor(thing-at-point): contain within src-lines.el #157

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit b3e59a7b0a56bfafff7a753d6ebbd8ad60ef745c
Author: Noboru Ota 
Commit: Noboru Ota 

refactor(thing-at-point): contain within src-lines.el #157

- Use 'org-transclusion-content-format-functions' hook for ensure new line
- Change name of function 'org-transclusion-ensure-newline'
  We haven't used the double hyphen "--" convention to visually denote
  "private" functions
---
 org-transclusion-src-lines.el | 35 ++-
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 97fdbf3583..4d431e794b 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -17,7 +17,7 @@
 
 ;; Author: Noboru Ota 
 ;; Created: 24 May 2021
-;; Last modified: 28 March 2023
+;; Last modified: 08 May 2023
 
 ;;; Commentary:
 ;;  This is an extension to `org-transclusion'.  When active, it adds features
@@ -32,8 +32,6 @@
 (declare-function org-transclusion-org-file-p
   "org-transclusion")
 
-(declare-function org-transclusion-keyword-value-thing-at-point
-  "org-transclusion")
  Setting up the extension
 
 ;; Add a new transclusion type
@@ -55,7 +53,8 @@
   #'org-transclusion-keyword-plist-to-string-src-lines)
 
 ;; Transclusion content formating
-;; Not needed. Default works for text files.
+(add-hook 'org-transclusion-content-format-functions
+  #'org-transclusion-content-format-src-lines)
 
 ;; Open source buffer
 (add-hook 'org-transclusion-open-source-marker-functions
@@ -211,7 +210,7 @@ for the range works."
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
-  (org-transclusion--ensure-newline src-content)
+  (org-transclusion-ensure-newline src-content)
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
@@ -305,5 +304,31 @@ for non-Org text files including program source files."
   (- (region-end) newline-offset
 (cons src-ov tc-ov
 
+;;; Thing-at-point
+(defun org-transclusion-keyword-value-thing-at-point (string)
+  "It is a utility function used converting a keyword STRING to plist.
+It is meant to be used by `org-transclusion-get-string-to-plist'.
+It needs to be set in `org-transclusion-get-keyword-values-hook'.
+Double qutations are optional :thing-at-point \"sexp\".  The regex should
+match any valid elisp symbol (but please don't quote it)."
+  (when (string-match ":thing-at-point \\([[:alnum:][:punct:]]+\\)" string)
+(list :thing-at-point (org-strip-quotes (match-string 1 string)
+
+(defun org-transclusion-content-format-src-lines (type content indent)
+  "Format text CONTENT from source before transcluding.
+Return content modified (or unmodified, if not applicable).
+
+This is the default one.  It only returns the content as is.
+
+INDENT is the number of current indentation of the #+transclude."
+  (when (org-transclusion-src-lines-p type)
+(let ((content (org-transclusion-ensure-newline content)))
+  (org-transclusion-content-format type content indent
+
+(defun org-transclusion-ensure-newline (str)
+  (if (not (string-suffix-p "\n" str))
+  (concat str "\n")
+str))
+
 (provide 'org-transclusion-src-lines)
 ;;; org-transclusion-src-lines.el ends here



[elpa] externals/org-transclusion 654c1a83f9 17/29: feat: suggestion for live-sync-buffers-src-lines

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 654c1a83f90d3f059d98afc0df6d5e7374c8f458
Author: Noboru Ota 
Commit: Noboru Ota 

feat: suggestion for live-sync-buffers-src-lines

Suggestion: instead of changing function
'live-sync-buffers-others-default', change 'live-sync-buffers-src-lines'

Discussed here:
https://github.com/nobiot/org-transclusion/pull/176#discussion_r1149612461
---
 org-transclusion-src-lines.el | 20 +++-
 org-transclusion.el   | 39 ++-
 2 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 381aad2a2b..a4d01919a9 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -17,7 +17,7 @@
 
 ;; Author: Noboru Ota 
 ;; Created: 24 May 2021
-;; Last modified: 08 February 2023
+;; Last modified: 28 March 2023
 
 ;;; Commentary:
 ;;  This is an extension to `org-transclusion'.  When active, it adds features
@@ -292,10 +292,20 @@ The cons cell to be returned is in this format:
 This function uses TYPE to identify relevant files; it's meant
 for non-Org text files including program source files."
   (when (org-transclusion-src-lines-p type)
-;; Let's not allow live-sync when source is transcluded into a source 
block.
-;; (when (string= "src" type)
-;;   (user-error "No live sync for src-code block"))
-(org-transclusion-live-sync-buffers-others-default nil)))
+(cl-destructuring-bind
+(src-ov . tc-ov) (org-transclusion-live-sync-buffers-others-default 
nil)
+  (save-mark-and-excursion
+  (org-babel-mark-block)
+  (let* ((tc-ov-beg-mkr (get-text-property (point) 
'org-transclusion-beg-mkr))
+ (tc-ov-end-mkr (get-text-property (point) 
'org-transclusion-end-mkr))
+ (src-ov-length (- (overlay-end src-ov) (overlay-start 
src-ov)))
+ (region-length (- (region-end) (region-beginning)))
+ (overlay-has-extra-newline (= 1 (- region-length 
src-ov-length)))
+ (newline-offset (if overlay-has-extra-newline 1 0)))
+(move-overlay tc-ov
+  (region-beginning)
+  (- (region-end) newline-offset
+(cons src-ov tc-ov
 
 (provide 'org-transclusion-src-lines)
 ;;; org-transclusion-src-lines.el ends here
diff --git a/org-transclusion.el b/org-transclusion.el
index 68ff7633a0..9ceaaa004f 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -17,7 +17,7 @@
 
 ;; Author:Noboru Ota 
 ;; Created:   10 October 2020
-;; Last modified: 05 March 2023
+;; Last modified: 28 March 2023
 
 ;; URL: https://github.com/nobiot/org-transclusion
 ;; Keywords: org-mode, transclusion, writing
@@ -1655,20 +1655,9 @@ This function is for non-Org text files."
(overlay-start tc-pair)
(overlay-end tc-pair)
(overlay-buffer tc-pair)))
-  (tc-ov-beg-mkr (get-text-property (point) 
'org-transclusion-beg-mkr))
-  (tc-ov-end-mkr (get-text-property (point) 
'org-transclusion-end-mkr))
-  (tc-ov (if (org-in-src-block-p)
- (with-current-buffer (marker-buffer tc-ov-beg-mkr)
-   (save-mark-and-excursion
- (org-babel-mark-block)
- (let* ((src-ov-length (- (overlay-end src-ov) 
(overlay-start src-ov)))
-(region-length (- (region-end) 
(region-beginning)))
-(overlay-has-extra-newline (= 1 (- 
region-length src-ov-length)))
-(newline-offset (if 
overlay-has-extra-newline 1 0)))
-   (text-clone-make-overlay (region-beginning)
-(- (region-end) 
newline-offset)
-   (text-clone-make-overlay tc-ov-beg-mkr
-tc-ov-end-mkr
+  (tc-ov (text-clone-make-overlay
+  (get-text-property (point) 'org-transclusion-beg-mkr)
+  (get-text-property (point) 'org-transclusion-end-mkr
 (cons src-ov tc-ov)))
 
 ;;-
@@ -1687,16 +1676,16 @@ ensure the settings revert to the user's setting prior 
to
   ;; Ensure this happens only once until deactivation
   (unless (memq 'org-transclusion-type yank-excluded-properties)
 (let ((excluded-props))
-  ;; Return t if 'wrap-prefix is already in `yank-excluded-properties'
-  ;; if not push to elm the list
-  ;; wrap-prefix, etc.
-  (dolist (sym org-transclusion-yank-excluded-properties)
-(if (memq sym yank-excluded-properties)
-(push sym org-transclusion-yank-remember-user-excluded-props)
-  ;;

[elpa] externals/org-transclusion 27abeab88d 06/29: test: test files things-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 27abeab88debe275ee36ceaf18b5b471ab6210ac
Author: Noboru Ota 
Commit: Noboru Ota 

test: test files things-at-point
---
 test/things-at-point-dir/baz.el| 10 ++
 test/things-at-point-dir/story.txt |  7 +++
 test/things-at-point.org   | 27 +++
 3 files changed, 44 insertions(+)

diff --git a/test/things-at-point-dir/baz.el b/test/things-at-point-dir/baz.el
new file mode 100644
index 00..f0546a38dc
--- /dev/null
+++ b/test/things-at-point-dir/baz.el
@@ -0,0 +1,10 @@
+(defun bar (arg)
+  "Documentation for bar"
+  arg)
+
+
+;; Comments
+(defun foo ()
+  "Documentation for this function."
+  (bar (let ((fuzz (buzz))) ;
+(baz fuzz)))
diff --git a/test/things-at-point-dir/story.txt 
b/test/things-at-point-dir/story.txt
new file mode 100644
index 00..3c9521de54
--- /dev/null
+++ b/test/things-at-point-dir/story.txt
@@ -0,0 +1,7 @@
+This is a story
+
+Once upon a time. This paragraph should be transcluded. This is a story.
+And if I have a hard line break, I belive this line is still part of
+the paragraph as defined by ... thing-at-point I think.
+
+This is a new paragraph and should not be included.
diff --git a/test/things-at-point.org b/test/things-at-point.org
new file mode 100644
index 00..1b1a99e0b1
--- /dev/null
+++ b/test/things-at-point.org
@@ -0,0 +1,27 @@
+What are the allowed (intended?) or tested "things"?
+
+I've briefly tested these:
+
+word
+symbol
+line (redundant, since we already have :lines)
+
+forward-thing is the function used for selecting multiple things. Some gotchas 
from some of the less common things could stem from this not handing them as 
expected.
+
+I expect these will be more common:
+
+sentence
+paragraph
+defun
+sexp
+list
+
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point paragraph
+
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point sentence
+
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][[barz-baz-fuzz]]  
:src elisp :thing-at-point sexp
+
+#+transclude: [[./things-at-point-dir/baz.el::foo][[barz-baz-fuzz]]  :src 
elisp :thing-at-point defun
+
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][[barz-baz-fuzz]]  
:src elisp :thing-at-point defun



[elpa] externals/org-transclusion 364cb5bf3f 28/29: docs: NEWS and user manual to mention thing-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 364cb5bf3fa78217ac3f777601d13fc35908c279
Author: Noboru Ota 
Commit: Noboru Ota 

docs: NEWS and user manual to mention thing-at-point
---
 NEWS |  4 
 docs/org-transclusion-manual.org | 40 +++-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9fe7d840d1..ff1f1d5c3f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,8 @@
 * Current development version
+
+  - feat: add :things-at-point property for transcluding source and
+other non-org text files
+
   - feat: add org-block-live-sync
 
   - Command 'org-transclusion-live-sync-start' now can start live sync
diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index 8100ff41ec..f3d3c4afb8 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -1,7 +1,7 @@
 #+title: Org-transclusion User Manual
 #+author: Noboru Ota 
 #+macro: version 1.3.x
-#+macro: modified 29 March 2023
+#+macro: modified 08 May 2023
 
 #+language: en
 #+export_file_name: org-transclusion.texi
@@ -484,6 +484,42 @@ Example 3:
 #+transclude: [[file:../../test/python-1.py::id-1234]] :lines 2- :src python 
:end "id-1234 end here"
 #+end_example
 
+*** =:thing-at-point= property to specify a "thing" to transclude from the 
source.
+
+#+cindex: Property - :thing-at-point
+
+You can add =:thing-at-point= property to transclude a certain "thing" at 
point to be transcluded. The following text elements have been tested to work:
+
+- sentence
+- paragraph
+- defun
+- sexp
+
+#+ATTR_TEXINFO: :tag Note
+#+begin_quote
+As it stands now, you cannot use :thing-at-point to specify the precise 
beginning of the thing within a line -- it is always the beginning of the line.
+#+end_quote
+
+See Example 4. When you have a text file for prose, you can use paragraph or 
sentence as a "thing" to transclude. In this example, the beginning of the 
source of transclude is specified by the search option with "::Once upon a 
time".  The two colons "::" immediately following the file name denote the 
search option, which is a built-in Org syntax. Then the paragraph or sentence 
beginning "Once upon a time" is transcluded. When the source file contains 
multiple occurrences of "Once upon a  [...]
+
+Example 4:
+#+begin_example
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point paragraph
+
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point sentence
+#+end_example
+
+You can combine =:thing-at=point= with =:src= property so that the transcluded 
text is wrapped in Org's source block. Example 5 shows a way to do so. 
"id:123456789" is assumed to be present as comment in the source file.
+
+Example 5:
+#+begin_example
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][barz-baz-fuzz]]  
:src elisp
+
+#+transclude: [[./things-at-point-dir/baz.el::foo][barz-baz-fuzz]]  :src elisp 
:thing-at-point sexp
+
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][barz-baz-fuzz]]  
:src elisp :thing-at-point defun
+#+end_example
+
 ** Extensions
 :PROPERTIES:
 :CUSTOM_ID: extensions
@@ -685,6 +721,8 @@ Note this section is still incomplete, not exhaustive for 
"known" limitations.
 - Undo detach does not add the overlay back on the source ::
   This should not break any feature. You can safely refresh the transclusion 
and recover the source overlay. You can also safely open or moved to the source 
while the source overlay is not present.
 
+- For =:thing-at-point, you cannot use :thing-at-point to specify the precise 
beginning of the thing within a line -- it is always the beginning of the line.
+
 * Credits
 ** Original idea by John Kitchin
 :PROPERTIES:



[elpa] externals/org-transclusion e4f96e114b 27/29: Merge branch 'dev/feature--things-at-point'

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit e4f96e114bfb782a7d0c9a6f7bc095b78e6ee4ea
Merge: 1146293107 b3e59a7b0a
Author: Noboru Ota 
Commit: Noboru Ota 

Merge branch 'dev/feature--things-at-point'
---
 org-transclusion-src-lines.el  | 35 +-
 org-transclusion.el| 44 +++---
 test/things-at-point-dir/baz.el| 10 +
 test/things-at-point-dir/story.txt |  7 ++
 test/things-at-point.org   | 27 +++
 5 files changed, 91 insertions(+), 32 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 97fdbf3583..4d431e794b 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -17,7 +17,7 @@
 
 ;; Author: Noboru Ota 
 ;; Created: 24 May 2021
-;; Last modified: 28 March 2023
+;; Last modified: 08 May 2023
 
 ;;; Commentary:
 ;;  This is an extension to `org-transclusion'.  When active, it adds features
@@ -32,8 +32,6 @@
 (declare-function org-transclusion-org-file-p
   "org-transclusion")
 
-(declare-function org-transclusion-keyword-value-thing-at-point
-  "org-transclusion")
  Setting up the extension
 
 ;; Add a new transclusion type
@@ -55,7 +53,8 @@
   #'org-transclusion-keyword-plist-to-string-src-lines)
 
 ;; Transclusion content formating
-;; Not needed. Default works for text files.
+(add-hook 'org-transclusion-content-format-functions
+  #'org-transclusion-content-format-src-lines)
 
 ;; Open source buffer
 (add-hook 'org-transclusion-open-source-marker-functions
@@ -211,7 +210,7 @@ for the range works."
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
-  (org-transclusion--ensure-newline src-content)
+  (org-transclusion-ensure-newline src-content)
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
@@ -305,5 +304,31 @@ for non-Org text files including program source files."
   (- (region-end) newline-offset
 (cons src-ov tc-ov
 
+;;; Thing-at-point
+(defun org-transclusion-keyword-value-thing-at-point (string)
+  "It is a utility function used converting a keyword STRING to plist.
+It is meant to be used by `org-transclusion-get-string-to-plist'.
+It needs to be set in `org-transclusion-get-keyword-values-hook'.
+Double qutations are optional :thing-at-point \"sexp\".  The regex should
+match any valid elisp symbol (but please don't quote it)."
+  (when (string-match ":thing-at-point \\([[:alnum:][:punct:]]+\\)" string)
+(list :thing-at-point (org-strip-quotes (match-string 1 string)
+
+(defun org-transclusion-content-format-src-lines (type content indent)
+  "Format text CONTENT from source before transcluding.
+Return content modified (or unmodified, if not applicable).
+
+This is the default one.  It only returns the content as is.
+
+INDENT is the number of current indentation of the #+transclude."
+  (when (org-transclusion-src-lines-p type)
+(let ((content (org-transclusion-ensure-newline content)))
+  (org-transclusion-content-format type content indent
+
+(defun org-transclusion-ensure-newline (str)
+  (if (not (string-suffix-p "\n" str))
+  (concat str "\n")
+str))
+
 (provide 'org-transclusion-src-lines)
 ;;; org-transclusion-src-lines.el ends here
diff --git a/org-transclusion.el b/org-transclusion.el
index 9ceaaa004f..86c61cc83f 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -17,7 +17,7 @@
 
 ;; Author:Noboru Ota 
 ;; Created:   10 October 2020
-;; Last modified: 28 March 2023
+;; Last modified: 08 May 2023
 
 ;; URL: https://github.com/nobiot/org-transclusion
 ;; Keywords: org-mode, transclusion, writing
@@ -201,7 +201,6 @@ that consists of the following properties:
 
 (defvar org-transclusion-keyword-value-functions
   '(org-transclusion-keyword-value-link
-org-transclusion-keyword-value-thing-at-point
 org-transclusion-keyword-value-level
 org-transclusion-keyword-value-disable-auto
 org-transclusion-keyword-value-only-contents
@@ -800,15 +799,6 @@ It is meant to be used by
 (user-error "Error.  Link in #+transclude is mandatory at %d" (point))
 nil))
 
-(defun org-transclusion-keyword-value-thing-at-point (string)
-  "It is a utility function used converting a keyword STRING to plist.
-It is meant to be used by `org-transclusion-get-string-to-plist'.
-It needs to be set in `org-transclusion-get-keyword-values-hook'.
-Double qutations are optional :thing-at-point \"sexp\".  The regex should
-match any valid elisp symbol (but please don't quote it)."
-  (when (string-match ":thing-at-point \\([[:alnum:][:punct:]]+\\)" string)
-(list :thing-at-point (org-strip-quotes (match-string 1 string)
-
 (defun org-transclusion-key

[elpa] externals/org-transclusion 01a8367387 07/29: Move new-line guarentee to cover all content sources

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 01a836738777972e3911fbe138281a5088a266ce
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Move new-line guarentee to cover all content sources
---
 org-transclusion-src-lines.el | 4 +---
 org-transclusion.el   | 5 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index ff1af8239f..4aec22daae 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -206,14 +206,12 @@ for the range works."
 (when src-lang
   (setq payload
 (plist-put payload :src-content
-   (let* ((src-content (plist-get payload :src-content))
-  (needs-newline (not (string-suffix-p "\n" 
src-content
+   (let ((src-content (plist-get payload :src-content)))
  (concat
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
   src-content
-  (if needs-newline "\n" "")
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
diff --git a/org-transclusion.el b/org-transclusion.el
index e53f275f62..5f4c3acbed 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -978,7 +978,10 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (content content))
+ (ensure-newline (lambda (str)
+   (when (not (string-suffix-p "\n" str)))
+   (concat str "\n")))
+ (content (funcall ensure-newline content)))
 (when (org-transclusion-type-is-org type)
 (with-temp-buffer
   ;; This temp buffer needs to be in Org Mode



[elpa] externals/org-transclusion b9d73ad7fd 16/29: Typo.

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit b9d73ad7fde1d6b38efb1357fc546089a4dd72f0
Author: Benjamin Cherry 
Commit: Noboru Ota 

Typo.
---
 org-transclusion.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index c6e9eb0893..68ff7633a0 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1667,7 +1667,7 @@ This function is for non-Org text files."
 (newline-offset (if 
overlay-has-extra-newline 1 0)))
(text-clone-make-overlay (region-beginning)
 (- (region-end) 
newline-offset)
-   (text-clone-make-overlay tc-ov-end-mkr
+   (text-clone-make-overlay tc-ov-beg-mkr
 tc-ov-end-mkr
 (cons src-ov tc-ov)))
 



[elpa] externals/org-transclusion 8317ec94fa 09/29: Fixup

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 8317ec94fa27ffef5354925b0dcb86681db43487
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Fixup
---
 org-transclusion.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index ed6cf3ba5c..bca8f3f235 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -950,8 +950,9 @@ Return nil if not found."
  Functions for inserting content
 
 (defun org-transclusion--ensure-newline (str)
-  (when (not (string-suffix-p "\n" str))
-(concat str "\n")))
+  (if (not (string-suffix-p "\n" str))
+  (concat str "\n")
+str))
 
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.



[elpa] externals/org-transclusion 83868e2cd9 13/29: Allow live sync on org-blocks -- experimental

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 83868e2cd90a8371712720b10a83c8adb6dd42ca
Author: Benjamin Cherry 
Commit: Noboru Ota 

Allow live sync on org-blocks -- experimental
---
 org-transclusion-src-lines.el |  4 ++--
 org-transclusion.el   | 38 --
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 3bc7cc4e76..381aad2a2b 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -293,8 +293,8 @@ This function uses TYPE to identify relevant files; it's 
meant
 for non-Org text files including program source files."
   (when (org-transclusion-src-lines-p type)
 ;; Let's not allow live-sync when source is transcluded into a source 
block.
-(when (string= "src" type)
-  (user-error "No live sync for src-code block"))
+;; (when (string= "src" type)
+;;   (user-error "No live sync for src-code block"))
 (org-transclusion-live-sync-buffers-others-default nil)))
 
 (provide 'org-transclusion-src-lines)
diff --git a/org-transclusion.el b/org-transclusion.el
index bca8f3f235..008e34df8f 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -681,7 +681,10 @@ a couple of org-transclusion specific keybindings; namely:
 (user-error
  (concat
   "No live-sync can be started.  "
-  "Lengths of transclusion and source are not identical"))
+  "Lengths of transclusion and source are not identical"
+  (format " - tc: [%s] src: [%s]"
+  (- (overlay-end tc-ov) (overlay-start tc-ov))
+  (- (overlay-end src-ov) (overlay-start src-ov)
 nil) ; return nil
 (org-transclusion-live-sync-modify-overlays
  (text-clone-set-overlays src-ov tc-ov))
@@ -1652,9 +1655,16 @@ This function is for non-Org text files."
(overlay-start tc-pair)
(overlay-end tc-pair)
(overlay-buffer tc-pair)))
-  (tc-ov (text-clone-make-overlay
-  (get-text-property (point) 'org-transclusion-beg-mkr)
-  (get-text-property (point) 'org-transclusion-end-mkr
+  (tc-ov-beg-mkr (get-text-property (point) 
'org-transclusion-beg-mkr))
+  (tc-ov-end-mkr (get-text-property (point) 
'org-transclusion-end-mkr))
+  (tc-ov (if (org-in-src-block-p)
+ (with-current-buffer (marker-buffer tc-ov-beg-mkr)
+   (save-mark-and-excursion
+ (org-babel-mark-block)
+ (text-clone-make-overlay (region-beginning)
+  (1- (region-end)
+   (text-clone-make-overlay tc-ov-end-mkr
+tc-ov-end-mkr
 (cons src-ov tc-ov)))
 
 ;;-
@@ -1673,16 +1683,16 @@ ensure the settings revert to the user's setting prior 
to
   ;; Ensure this happens only once until deactivation
   (unless (memq 'org-transclusion-type yank-excluded-properties)
 (let ((excluded-props))
-;; Return t if 'wrap-prefix is already in `yank-excluded-properties'
-;; if not push to elm the list
-;; wrap-prefix, etc.
-(dolist (sym org-transclusion-yank-excluded-properties)
-  (if (memq sym yank-excluded-properties)
-(push sym org-transclusion-yank-remember-user-excluded-props)
-;; Avoid duplicate
-(push sym excluded-props)))
-(setq yank-excluded-properties
-  (append yank-excluded-properties excluded-props)
+  ;; Return t if 'wrap-prefix is already in `yank-excluded-properties'
+  ;; if not push to elm the list
+  ;; wrap-prefix, etc.
+  (dolist (sym org-transclusion-yank-excluded-properties)
+(if (memq sym yank-excluded-properties)
+(push sym org-transclusion-yank-remember-user-excluded-props)
+  ;; Avoid duplicate
+  (push sym excluded-props)))
+  (setq yank-excluded-properties
+(append yank-excluded-properties excluded-props)
 
 (defun org-transclusion-yank-excluded-properties-remove ()
   "Remove transclusion-specific text props from `yank-excluded-properties'.



[elpa] externals/org-transclusion c44071dfb5 29/29: docs: fix id:1234567890 with zero-width space

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit c44071dfb566fa14d3981a5e85e69d7428676a6b
Author: Noboru Ota 
Commit: Noboru Ota 

docs: fix id:1234567890 with zero-width space
---
 docs/org-transclusion-manual.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index f3d3c4afb8..6df4077b8f 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -509,7 +509,7 @@ Example 4:
 #+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point sentence
 #+end_example
 
-You can combine =:thing-at=point= with =:src= property so that the transcluded 
text is wrapped in Org's source block. Example 5 shows a way to do so. 
"id:123456789" is assumed to be present as comment in the source file.
+You can combine =:thing-at=point= with =:src= property so that the transcluded 
text is wrapped in Org's source block. Example 5 shows a way to do so. 
id​:​1234567890 is assumed to be present as comment in the source file.
 
 Example 5:
 #+begin_example



[elpa] externals/org-transclusion 1b5f428e58 10/29: Move new-line guarentee to cover all content sources

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 1b5f428e589bcdaf02381fd2df14e5168a8420a6
Author: Benjamin Cherry 
Commit: Noboru Ota 

Move new-line guarentee to cover all content sources
---
 org-transclusion-src-lines.el | 4 +---
 org-transclusion.el   | 5 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index ff1af8239f..4aec22daae 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -206,14 +206,12 @@ for the range works."
 (when src-lang
   (setq payload
 (plist-put payload :src-content
-   (let* ((src-content (plist-get payload :src-content))
-  (needs-newline (not (string-suffix-p "\n" 
src-content
+   (let ((src-content (plist-get payload :src-content)))
  (concat
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
   src-content
-  (if needs-newline "\n" "")
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
diff --git a/org-transclusion.el b/org-transclusion.el
index e53f275f62..5f4c3acbed 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -978,7 +978,10 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (content content))
+ (ensure-newline (lambda (str)
+   (when (not (string-suffix-p "\n" str)))
+   (concat str "\n")))
+ (content (funcall ensure-newline content)))
 (when (org-transclusion-type-is-org type)
 (with-temp-buffer
   ;; This temp buffer needs to be in Org Mode



[elpa] externals/org-transclusion d66e4b1f7d 24/29: test: remove spurflous bracket

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit d66e4b1f7d91aa04c3bd3a33dab5a5702c83bff2
Author: Noboru Ota 
Commit: Noboru Ota 

test: remove spurflous bracket
---
 test/things-at-point.org | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/things-at-point.org b/test/things-at-point.org
index 1b1a99e0b1..3fd9568b64 100644
--- a/test/things-at-point.org
+++ b/test/things-at-point.org
@@ -20,8 +20,8 @@ I expect these will be more common:
 
 #+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point sentence
 
-#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][[barz-baz-fuzz]]  
:src elisp :thing-at-point sexp
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][barz-baz-fuzz]]  
:src elisp
 
-#+transclude: [[./things-at-point-dir/baz.el::foo][[barz-baz-fuzz]]  :src 
elisp :thing-at-point defun
+#+transclude: [[./things-at-point-dir/baz.el::foo][barz-baz-fuzz]]  :src elisp 
:thing-at-point sexp
 
-#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][[barz-baz-fuzz]]  
:src elisp :thing-at-point defun
+#+transclude: [[./things-at-point-dir/baz.el::id:1234567890][barz-baz-fuzz]]  
:src elisp :thing-at-point defun



[elpa] externals/org-transclusion 9db0791c07 18/29: refactor: remove unused let variable

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 9db0791c07c08d369e9eaf1a63b0c28a184d941e
Author: Noboru Ota 
Commit: Noboru Ota 

refactor: remove unused let variable
---
 org-transclusion-src-lines.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index a4d01919a9..97fdbf3583 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -296,9 +296,7 @@ for non-Org text files including program source files."
 (src-ov . tc-ov) (org-transclusion-live-sync-buffers-others-default 
nil)
   (save-mark-and-excursion
   (org-babel-mark-block)
-  (let* ((tc-ov-beg-mkr (get-text-property (point) 
'org-transclusion-beg-mkr))
- (tc-ov-end-mkr (get-text-property (point) 
'org-transclusion-end-mkr))
- (src-ov-length (- (overlay-end src-ov) (overlay-start 
src-ov)))
+  (let* ((src-ov-length (- (overlay-end src-ov) (overlay-start 
src-ov)))
  (region-length (- (region-end) (region-beginning)))
  (overlay-has-extra-newline (= 1 (- region-length 
src-ov-length)))
  (newline-offset (if overlay-has-extra-newline 1 0)))



[elpa] externals/org-transclusion f0e8240695 20/29: doc: mention the live-sync to be in the next stable rel for ELPA

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit f0e8240695d597b569f02d94f03cc5d92620f11e
Author: Noboru Ota 
Commit: Noboru Ota 

doc: mention the live-sync to be in the next stable rel for ELPA

Currently ELPA-devel will receive it.  ELPA will need to wait for the
next release. Clarified this in the manual
---
 docs/org-transclusion-manual.org | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index b636cb8a7f..8100ff41ec 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -420,7 +420,8 @@ The source block will have the additional properties:
 #+end_example
 
 With since 2023-03-28 update, you can also use live-sync the source code
-transcluded into src-block.
+transcluded into src-block. It is planned to be added to the next stable
+release.
 
 ** Transclude range of lines for text and source files
 :PROPERTIES:



[elpa] externals/org-transclusion 1146293107 26/29: Merge pull request #157 from devcarbon-com/feature--things-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 11462931077568b8f4fe30bd2d47a1dcb508eaf0
Merge: ed141838d0 8317ec94fa
Author: nobiot 
Commit: GitHub 

Merge pull request #157 from devcarbon-com/feature--things-at-point

Feature: select end via n things at point.
---
 org-transclusion-src-lines.el | 72 +++
 org-transclusion.el   | 37 +++---
 2 files changed, 79 insertions(+), 30 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index b0aaafdc8d..97fdbf3583 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -32,6 +32,8 @@
 (declare-function org-transclusion-org-file-p
   "org-transclusion")
 
+(declare-function org-transclusion-keyword-value-thing-at-point
+  "org-transclusion")
  Setting up the extension
 
 ;; Add a new transclusion type
@@ -46,6 +48,8 @@
   #'org-transclusion-keyword-value-rest)
 (add-hook 'org-transclusion-keyword-value-functions
   #'org-transclusion-keyword-value-end)
+(add-hook 'org-transclusion-keyword-value-functions
+  #'org-transclusion-keyword-value-thing-at-point)
 ;; plist back to string
 (add-hook 'org-transclusion-keyword-plist-to-string-functions
   #'org-transclusion-keyword-plist-to-string-src-lines)
@@ -62,6 +66,22 @@
 
 ;;; Functions
 
+(defun org-transclusion--bounds-of-n-things-at-point (thing count)
+  "Return the bounds of COUNT THING (s) -at-point."
+  (save-excursion
+(let ((bounds (bounds-of-thing-at-point thing)))
+  (when bounds
+(push-mark (car bounds) t t)
+(goto-char (cdr bounds))
+(while (and (> count 1) bounds)
+  (setq bounds (bounds-of-thing-at-point thing))
+  (when bounds
+(if (> count 1)
+(forward-thing thing)
+  (goto-char (cdr bounds)))
+(setq count (1- count
+(car (region-bounds))
+
 (defun org-transclusion-add-src-lines (link plist)
   "Return a list for non-Org text and source file.
 Determine add function based on LINK and PLIST.
@@ -107,7 +127,9 @@ it means from line 10 to the end of file."
  (type (org-element-property :type link))
  (entry-pos) (buf)
  (lines (plist-get plist :lines))
- (end-search-op (plist-get plist :end)))
+ (end-search-op (plist-get plist :end))
+ (thing-at-point (plist-get plist :thing-at-point))
+ (thing-at-point (when thing-at-point (make-symbol thing-at-point
 (if (not (string= type "id")) (setq buf (find-file-noselect path))
   (let ((filename-pos (org-id-find path)))
 (setq buf (find-file-noselect (car filename-pos)))
@@ -125,15 +147,23 @@ it means from line 10 to the end of file."
;; ::/regex/ or ::number is used
(if (org-link-search search-option)
(line-beginning-position))
- ((point-min
-(end-pos (when end-search-op
-   (save-excursion
- (ignore-errors
-   ;; FIXME `org-link-search' does not
-   ;; return postion when either ::/regex/
-   ;; or ::number is used
-   (when (org-link-search end-search-op)
- (line-beginning-position))
+((point-min
+(bounds (when thing-at-point
+  (let ((count (if end-search-op
+   (string-to-number end-search-op) 
1)))
+(save-excursion
+  (goto-char start-pos)
+  (back-to-indentation)
+  (org-transclusion--bounds-of-n-things-at-point 
thing-at-point count)
+(end-pos (cond ((when thing-at-point (cdr bounds)))
+   ((when end-search-op
+  (save-excursion
+(ignore-errors
+  ;; FIXME `org-link-search' does not
+  ;; return postion when either ::/regex/
+  ;; or ::number is used
+  (when (org-link-search end-search-op)
+(line-beginning-position
 (range (when lines (split-string lines "-")))
 (lbeg (if range (string-to-number (car range))
 0))
@@ -148,7 +178,8 @@ it means from line 10 to the end of file."
 ;;; This `cond' means :end prop has priority over the end
 ;;; position of the range. They don't mix.
 (end (cond
-

[elpa] externals/org-transclusion 2bade767cb 15/29: Adapt to magic enter.

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 2bade767cbbb87df9d9f76d347579e231cb44785
Author: Benjamin Cherry 
Commit: Noboru Ota 

Adapt to magic enter.
---
 org-transclusion.el | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index dea5db9da1..c6e9eb0893 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1661,8 +1661,12 @@ This function is for non-Org text files."
  (with-current-buffer (marker-buffer tc-ov-beg-mkr)
(save-mark-and-excursion
  (org-babel-mark-block)
- (text-clone-make-overlay (region-beginning)
-  (region-end
+ (let* ((src-ov-length (- (overlay-end src-ov) 
(overlay-start src-ov)))
+(region-length (- (region-end) 
(region-beginning)))
+(overlay-has-extra-newline (= 1 (- 
region-length src-ov-length)))
+(newline-offset (if 
overlay-has-extra-newline 1 0)))
+   (text-clone-make-overlay (region-beginning)
+(- (region-end) 
newline-offset)
(text-clone-make-overlay tc-ov-end-mkr
 tc-ov-end-mkr
 (cons src-ov tc-ov)))



[elpa] externals/org-transclusion 2053106e73 23/29: style(org-transclusion.el): indentation

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 2053106e739315baeec87ab594d328f3aacacc33
Author: Noboru Ota 
Commit: Noboru Ota 

style(org-transclusion.el): indentation

No functional change. Only indentation
---
 org-transclusion.el | 60 ++---
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 213834f153..6b6d0a85f1 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -17,7 +17,7 @@
 
 ;; Author:Noboru Ota 
 ;; Created:   10 October 2020
-;; Last modified: 06 May 2023
+;; Last modified: 08 May 2023
 
 ;; URL: https://github.com/nobiot/org-transclusion
 ;; Keywords: org-mode, transclusion, writing
@@ -979,19 +979,19 @@ based on the following arguments:
 (delay-mode-hooks (org-mode))
 (insert content)
 (org-with-point-at 1
-   (let* ((to-level (plist-get keyword-values :level))
-  (level 
(org-transclusion-content-highest-org-headline))
-  (diff (when (and level to-level) (- level 
to-level
- (when diff
-   (cond ((< diff 0) ; demote
-  (org-map-entries (lambda ()
- (dotimes (_ (abs 
diff))
-   (org-do-demote)
- ((> diff 0) ; promote
-  (org-map-entries (lambda ()
- (dotimes (_ diff)
-   
(org-do-promote
-   (setq content (buffer-string)
+  (let* ((to-level (plist-get keyword-values :level))
+ (level (org-transclusion-content-highest-org-headline))
+ (diff (when (and level to-level) (- level to-level
+(when diff
+  (cond ((< diff 0) ; demote
+ (org-map-entries (lambda ()
+(dotimes (_ (abs diff))
+  (org-do-demote)
+((> diff 0) ; promote
+ (org-map-entries (lambda ()
+(dotimes (_ diff)
+  (org-do-promote
+  (setq content (buffer-string)
 (insert
  (run-hook-with-args-until-success
   'org-transclusion-content-format-functions
@@ -1053,22 +1053,22 @@ This function is the default for org-transclusion-type 
(TYPE)
 \"org-*\". Currently it only re-aligns table with links in the
 content."
   (when (org-transclusion-type-is-org type)
-  (with-temp-buffer
-(let ((org-inhibit-startup t))
-  (delay-mode-hooks (org-mode))
-  (insert content)
-  ;; Fix table alignment
-  (let ((point (point-min)))
-(while point
-  (goto-char (1+ point))
-  (when (org-at-table-p)
-(org-table-align)
-(goto-char (org-table-end)))
-  (setq point (search-forward "|" (point-max) t
-  ;; Fix indentation when `org-adapt-indentation' is non-nil
-  (org-indent-region (point-min) (point-max))
-  ;; Return the temp-buffer's string
-  (buffer-string)
+(with-temp-buffer
+  (let ((org-inhibit-startup t))
+(delay-mode-hooks (org-mode))
+(insert content)
+;; Fix table alignment
+(let ((point (point-min)))
+  (while point
+(goto-char (1+ point))
+(when (org-at-table-p)
+  (org-table-align)
+  (goto-char (org-table-end)))
+(setq point (search-forward "|" (point-max) t
+;; Fix indentation when `org-adapt-indentation' is non-nil
+(org-indent-region (point-min) (point-max))
+;; Return the temp-buffer's string
+(buffer-string)
 
 (defun org-transclusion-content-format (_type content indent)
   "Format text CONTENT from source before transcluding.



[elpa] externals/org-transclusion 4881798b9d 05/29: Nil Safety

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 4881798b9db82ba0c0b07999b512b8b8c6cf1840
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Nil Safety
---
 org-transclusion-src-lines.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index aee70ce2f9..ff1af8239f 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -128,7 +128,8 @@ it means from line 10 to the end of file."
  (entry-pos) (buf)
  (lines (plist-get plist :lines))
  (end-search-op (plist-get plist :end))
- (thing-at-point (make-symbol (plist-get plist :thing-at-point
+ (thing-at-point (plist-get plist :thing-at-point))
+ (thing-at-point (when thing-at-point (make-symbol thing-at-point
 (if (not (string= type "id")) (setq buf (find-file-noselect path))
   (let ((filename-pos (org-id-find path)))
 (setq buf (find-file-noselect (car filename-pos)))



[elpa] externals/org-transclusion 2cb719e80f 02/29: Add support for handling identations when using :thing-at-point sexp

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 2cb719e80ffe5b40ab31e038b986071c65d6c12c
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Add support for handling identations when using :thing-at-point sexp
---
 org-transclusion-src-lines.el | 26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 3458991fc3..a46566eb8b 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -152,11 +152,11 @@ it means from line 10 to the end of file."
(string-to-number end-search-op) 
1)))
 (save-excursion
   (goto-char start-pos)
+  (back-to-indentation)
   (bounds-of-n-things-at-point thing-at-point 
count)
-(start-pos (if thing-at-point (car bounds) start-pos))
-(end-pos (when end-search-op
-   (cond ((when thing-at-point (+ 1 (cdr bounds
- ((save-excursion
+(end-pos (cond ((when thing-at-point (cdr bounds)))
+   ((when end-search-op
+  (save-excursion
 (ignore-errors
   ;; FIXME `org-link-search' does not
   ;; return postion when either ::/regex/
@@ -177,7 +177,8 @@ it means from line 10 to the end of file."
 ;;; This `cond' means :end prop has priority over the end
 ;;; position of the range. They don't mix.
 (end (cond
-  ((when (and end-pos (> end-pos beg))
+  ((when thing-at-point end-pos)
+   (when (and end-pos (> end-pos beg))
  end-pos))
   ((if (zerop lend) (point-max)
  (goto-char start-pos)
@@ -204,12 +205,15 @@ for the range works."
 (when src-lang
   (setq payload
 (plist-put payload :src-content
-   (concat
-(format "#+begin_src %s" src-lang)
-(when rest (format " %s" rest))
-"\n"
-(plist-get payload :src-content)
-"#+end_src\n"
+   (let* ((src-content (plist-get payload :src-content))
+  (needs-newline (not (string-suffix-p "\n" 
src-content
+ (concat
+  (format "#+begin_src %s" src-lang)
+  (when rest (format " %s" rest))
+  "\n"
+  src-content
+  (if needs-newline "\n" "")
+  "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
 



[elpa] externals/org-transclusion b6091cdcaa 19/29: doc: update manual for the new feature for live-sync org src block

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit b6091cdcaaae712970d4b34ddea4c136f9c6ef7e
Author: Noboru Ota 
Commit: Noboru Ota 

doc: update manual for the new feature for live-sync org src block
---
 NEWS | 10 ++
 docs/org-transclusion-manual.org |  5 -
 test/python-1.py | 11 +++
 test/python-2.py |  8 
 test/python-3.py |  6 ++
 test/test-live-sync.org  | 12 
 6 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9e28ffd263..9fe7d840d1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,14 @@
 * Current development version
+  - feat: add org-block-live-sync
+
+  - Command 'org-transclusion-live-sync-start' now can start live sync
+when
+
+1) transcluding a source code text file
+2) into org src block with the ':src' property in #+transclude
+
+Example: #+transclude: [[python-1.py]]  :src python
+
   - feat: add org-transclusion-detach
 
 - New command 'org-transclusion-detach' can be used on the transclusion
diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index 72da9d5b36..b636cb8a7f 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -1,7 +1,7 @@
 #+title: Org-transclusion User Manual
 #+author: Noboru Ota 
 #+macro: version 1.3.x
-#+macro: modified 04 March 2023
+#+macro: modified 29 March 2023
 
 #+language: en
 #+export_file_name: org-transclusion.texi
@@ -419,6 +419,9 @@ The source block will have the additional properties:
 ,#+begin_src python :session :results value
 #+end_example
 
+With since 2023-03-28 update, you can also use live-sync the source code
+transcluded into src-block.
+
 ** Transclude range of lines for text and source files
 :PROPERTIES:
 :CUSTOM_ID: transclude-range-of-lines-for-text-and-source-files
diff --git a/test/python-1.py b/test/python-1.py
new file mode 100644
index 00..5aa2044ed5
--- /dev/null
+++ b/test/python-1.py
@@ -0,0 +1,11 @@
+import matplotlib
+import matplotlib.pyplot as plt
+# end here
+# id-1234
+fig=plt.figure(figsize=(9,6))
+plt.plot([1,3,2])
+fig.tight_layout()
+fname = 'pyfig2.png'
+plt.savefig(fname)
+# id-1234 end here
+return fname # return this to org-mode
diff --git a/test/python-2.py b/test/python-2.py
new file mode 100644
index 00..c5e29aabb3
--- /dev/null
+++ b/test/python-2.py
@@ -0,0 +1,8 @@
+def foo(x):
+if x>0:
+return x+1
+
+else:
+return x-1
+
+return foo(5)
diff --git a/test/python-3.py b/test/python-3.py
new file mode 100644
index 00..502d500580
--- /dev/null
+++ b/test/python-3.py
@@ -0,0 +1,6 @@
+import random
+if random.randint(0,10) % 2 == 0:
+ret = "even"
+else:
+ret = "odd"
+ret
diff --git a/test/test-live-sync.org b/test/test-live-sync.org
new file mode 100644
index 00..87eeced85f
--- /dev/null
+++ b/test/test-live-sync.org
@@ -0,0 +1,12 @@
+#+transclude: [[file:test-src.org::code]]
+
+#+transclude: [[python-1.py]]  :src python
+
+#+RESULTS:
+[[./pyfig2.png]]
+
+
+#+transclude: [[python-2.py]]  :src python
+
+#+RESULTS:
+: 6



[elpa] externals/org-transclusion 1695f306e6 22/29: refactor: reverted changes to org-transclusion.el

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 1695f306e61ff95487332df0eef7dfcc905be45e
Author: Noboru Ota 
Commit: Noboru Ota 

refactor: reverted changes to org-transclusion.el
---
 org-transclusion.el | 45 +++--
 1 file changed, 15 insertions(+), 30 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 9ceaaa004f..213834f153 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -17,7 +17,7 @@
 
 ;; Author:Noboru Ota 
 ;; Created:   10 October 2020
-;; Last modified: 28 March 2023
+;; Last modified: 06 May 2023
 
 ;; URL: https://github.com/nobiot/org-transclusion
 ;; Keywords: org-mode, transclusion, writing
@@ -201,7 +201,6 @@ that consists of the following properties:
 
 (defvar org-transclusion-keyword-value-functions
   '(org-transclusion-keyword-value-link
-org-transclusion-keyword-value-thing-at-point
 org-transclusion-keyword-value-level
 org-transclusion-keyword-value-disable-auto
 org-transclusion-keyword-value-only-contents
@@ -800,15 +799,6 @@ It is meant to be used by
 (user-error "Error.  Link in #+transclude is mandatory at %d" (point))
 nil))
 
-(defun org-transclusion-keyword-value-thing-at-point (string)
-  "It is a utility function used converting a keyword STRING to plist.
-It is meant to be used by `org-transclusion-get-string-to-plist'.
-It needs to be set in `org-transclusion-get-keyword-values-hook'.
-Double qutations are optional :thing-at-point \"sexp\".  The regex should
-match any valid elisp symbol (but please don't quote it)."
-  (when (string-match ":thing-at-point \\([[:alnum:][:punct:]]+\\)" string)
-(list :thing-at-point (org-strip-quotes (match-string 1 string)
-
 (defun org-transclusion-keyword-value-disable-auto (string)
   "It is a utility function used converting a keyword STRING to plist.
 It is meant to be used by `org-transclusion-get-string-to-plist'.
@@ -952,11 +942,6 @@ Return nil if not found."
 ;;-
  Functions for inserting content
 
-(defun org-transclusion--ensure-newline (str)
-  (if (not (string-suffix-p "\n" str))
-  (concat str "\n")
-str))
-
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.
 Return t when successful.
@@ -986,7 +971,7 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (content (org-transclusion--ensure-newline content)))
+ (content content))
 (when (org-transclusion-type-is-org type)
   (with-temp-buffer
 ;; This temp buffer needs to be in Org Mode
@@ -994,19 +979,19 @@ based on the following arguments:
 (delay-mode-hooks (org-mode))
 (insert content)
 (org-with-point-at 1
-  (let* ((to-level (plist-get keyword-values :level))
- (level (org-transclusion-content-highest-org-headline))
- (diff (when (and level to-level) (- level to-level
-(when diff
-  (cond ((< diff 0) ; demote
- (org-map-entries (lambda ()
-(dotimes (_ (abs diff))
-  (org-do-demote)
-((> diff 0) ; promote
- (org-map-entries (lambda ()
-(dotimes (_ diff)
-  (org-do-promote
-  (setq content (buffer-string)
+   (let* ((to-level (plist-get keyword-values :level))
+  (level 
(org-transclusion-content-highest-org-headline))
+  (diff (when (and level to-level) (- level 
to-level
+ (when diff
+   (cond ((< diff 0) ; demote
+  (org-map-entries (lambda ()
+ (dotimes (_ (abs 
diff))
+   (org-do-demote)
+ ((> diff 0) ; promote
+  (org-map-entries (lambda ()
+ (dotimes (_ diff)
+   
(org-do-promote
+   (setq content (buffer-string)
 (insert
  (run-hook-with-args-until-success
   'org-transclusion-content-format-functions



[elpa] externals/org-transclusion 51cac54fed 11/29: Need newline guarentee also in content-src-lines

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 51cac54fedf50d7f2fa856fb0423dc04d51bf45d
Author: Benjamin Cherry 
Commit: Noboru Ota 

Need newline guarentee also in content-src-lines
---
 org-transclusion-src-lines.el |  2 +-
 org-transclusion.el   | 29 +++--
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 4aec22daae..3bc7cc4e76 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -211,7 +211,7 @@ for the range works."
   (format "#+begin_src %s" src-lang)
   (when rest (format " %s" rest))
   "\n"
-  src-content
+  (org-transclusion--ensure-newline src-content)
   "#+end_src\n")
 ;; Return the payload either modified or unmodified
 payload))
diff --git a/org-transclusion.el b/org-transclusion.el
index 5f4c3acbed..ed6cf3ba5c 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -949,6 +949,10 @@ Return nil if not found."
 ;;-
  Functions for inserting content
 
+(defun org-transclusion--ensure-newline (str)
+  (when (not (string-suffix-p "\n" str))
+(concat str "\n")))
+
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.
 Return t when successful.
@@ -978,20 +982,17 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (ensure-newline (lambda (str)
-   (when (not (string-suffix-p "\n" str)))
-   (concat str "\n")))
- (content (funcall ensure-newline content)))
+ (content (org-transclusion--ensure-newline content)))
 (when (org-transclusion-type-is-org type)
-(with-temp-buffer
-  ;; This temp buffer needs to be in Org Mode
-  ;; Otherwise, subtree won't be recognized as a Org subtree
-  (delay-mode-hooks (org-mode))
-  (insert content)
-  (org-with-point-at 1
-(let* ((to-level (plist-get keyword-values :level))
-   (level (org-transclusion-content-highest-org-headline))
-   (diff (when (and level to-level) (- level to-level
+  (with-temp-buffer
+;; This temp buffer needs to be in Org Mode
+;; Otherwise, subtree won't be recognized as a Org subtree
+(delay-mode-hooks (org-mode))
+(insert content)
+(org-with-point-at 1
+  (let* ((to-level (plist-get keyword-values :level))
+ (level (org-transclusion-content-highest-org-headline))
+ (diff (when (and level to-level) (- level to-level
 (when diff
   (cond ((< diff 0) ; demote
  (org-map-entries (lambda ()
@@ -1001,7 +1002,7 @@ based on the following arguments:
  (org-map-entries (lambda ()
 (dotimes (_ diff)
   (org-do-promote
-(setq content (buffer-string)
+  (setq content (buffer-string)
 (insert
  (run-hook-with-args-until-success
   'org-transclusion-content-format-functions



[elpa] externals/org-transclusion 310bd28b10 14/29: Augment only needed for magical enter in thing-at-point branch.

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 310bd28b10c000d76b263c93397344cc1c67a0f2
Author: Benjamin Cherry 
Commit: Noboru Ota 

Augment only needed for magical enter in thing-at-point branch.
---
 org-transclusion.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 008e34df8f..dea5db9da1 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -1662,7 +1662,7 @@ This function is for non-Org text files."
(save-mark-and-excursion
  (org-babel-mark-block)
  (text-clone-make-overlay (region-beginning)
-  (1- (region-end)
+  (region-end
(text-clone-make-overlay tc-ov-end-mkr
 tc-ov-end-mkr
 (cons src-ov tc-ov)))



[elpa] externals/org-transclusion 134c8a645f 04/29: Namespace bounds-of-n-things-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 134c8a645f327e585767520a3eb84d6de9555cd3
Author: Benjamin Cherry 
Commit: Benjamin Cherry 

Namespace bounds-of-n-things-at-point
---
 org-transclusion-src-lines.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index bbd4d31db1..aee70ce2f9 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -66,7 +66,7 @@
 
 ;;; Functions
 
-(defun bounds-of-n-things-at-point (thing count)
+(defun org-transclusion--bounds-of-n-things-at-point (thing count)
   "Return the bounds of COUNT THING (s) -at-point."
   (save-excursion
 (let ((bounds (bounds-of-thing-at-point thing)))
@@ -153,7 +153,7 @@ it means from line 10 to the end of file."
 (save-excursion
   (goto-char start-pos)
   (back-to-indentation)
-  (bounds-of-n-things-at-point thing-at-point 
count)
+  (org-transclusion--bounds-of-n-things-at-point 
thing-at-point count)
 (end-pos (cond ((when thing-at-point (cdr bounds)))
((when end-search-op
   (save-excursion



[elpa] externals/org-transclusion updated (ed141838d0 -> c44071dfb5)

2023-05-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/org-transclusion.

  from  ed141838d0 fix: (unit-tests.el) require org-transclusion merge PR 
#183
   new  6c0352f33a Feature: select end via n things at point.
   new  2cb719e80f Add support for handling identations when using 
:thing-at-point sexp
   new  35ea926477 Merge branch 'main' into feature--things-at-point
   new  134c8a645f Namespace bounds-of-n-things-at-point
   new  4881798b9d Nil Safety
   new  01a8367387 Move new-line guarentee to cover all content sources
   new  28737e1b5c Need newline guarentee also in content-src-lines
   new  8317ec94fa Fixup
   new  1146293107 Merge pull request #157 from 
devcarbon-com/feature--things-at-point
   new  27abeab88d test: test files things-at-point
   new  1b5f428e58 Move new-line guarentee to cover all content sources
   new  51cac54fed Need newline guarentee also in content-src-lines
   new  ccc7870f07 Fixup
   new  83868e2cd9 Allow live sync on org-blocks -- experimental
   new  310bd28b10 Augment only needed for magical enter in thing-at-point 
branch.
   new  2bade767cb Adapt to magic enter.
   new  b9d73ad7fd Typo.
   new  654c1a83f9 feat: suggestion for live-sync-buffers-src-lines
   new  9db0791c07 refactor: remove unused let variable
   new  b6091cdcaa doc: update manual for the new feature for live-sync org 
src block
   new  f0e8240695 doc: mention the live-sync to be in the next stable rel 
for ELPA
   new  1d6fb83578 fix: (unit-tests.el) require org-transclusion
   new  1695f306e6 refactor: reverted changes to org-transclusion.el
   new  2053106e73 style(org-transclusion.el): indentation
   new  d66e4b1f7d test: remove spurflous bracket
   new  b3e59a7b0a refactor(thing-at-point): contain within src-lines.el 
#157
   new  e4f96e114b Merge branch 'dev/feature--things-at-point'
   new  364cb5bf3f docs: NEWS and user manual to mention thing-at-point
   new  c44071dfb5 docs: fix id:1234567890 with zero-width space


Summary of changes:
 NEWS   |   4 ++
 docs/org-transclusion-manual.org   |  40 ++-
 org-transclusion-src-lines.el  | 101 +
 org-transclusion.el|  61 --
 test/things-at-point-dir/baz.el|  10 
 test/things-at-point-dir/story.txt |   7 +++
 test/things-at-point.org   |  27 ++
 7 files changed, 200 insertions(+), 50 deletions(-)
 create mode 100644 test/things-at-point-dir/baz.el
 create mode 100644 test/things-at-point-dir/story.txt
 create mode 100644 test/things-at-point.org



[elpa] externals/org-transclusion 35ea926477 03/29: Merge branch 'main' into feature--things-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 35ea92647734beaf49fb27b8d199de20acad7674
Merge: 2cb719e80f ff722826ce
Author: devcarbon-com <118597387+devcarbon-...@users.noreply.github.com>
Commit: GitHub 

Merge branch 'main' into feature--things-at-point
---
 NEWS |  72 +--
 docs/org-transclusion-manual.org |  72 +--
 org-transclusion-font-lock.el|   6 +-
 org-transclusion-indent-mode.el  |   4 +-
 org-transclusion-src-lines.el|   6 +-
 org-transclusion.el  | 122 ++-
 test/test-2.0.org|   6 +-
 test/test-2.1-lines.org  |   6 +-
 text-clone.el|   4 +-
 9 files changed, 207 insertions(+), 91 deletions(-)

diff --git a/NEWS b/NEWS
index 511cd6d07a..9e28ffd263 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,68 @@
+* Current development version
+  - feat: add org-transclusion-detach
+
+- New command 'org-transclusion-detach' can be used on the transclusion
+  at point. It turns it into a normal, edtitable text content.
+
+  You can undo this operation.
+
+  In addition, you can press 'C-d' directly on the transclusion at point
+  to detach it.  This is because the command is bound to 'C-d' by
+  default in 'org-transclusion-map'.
+
+- 'org-transclusion-refresh' now accepts universal argument such as
+  'C-u M-x org-transclusion-refresh' and detaches the transclusion at
+  point.
+
+  You can undo this operation.
+
+- 'org-transclusion-add' now accepts universal argument such as 'C-u M-x
+  org-transclusion-add' and copies the source content rather than
+  transclude it.
+
+  You can undo this operation.
+
+- Limitation: Undo detach does not add the overlay back on the
+  source. This should not break any feature. You can safely refresh the
+  transclusion and recover the source overlay. You can also safely open
+  or moved to the source.
+
+* 1.3.2
+
+  - fix: Delete superfluous trailing space on remove
+
+Before the fix, function 'org-transclusion-keyword-plist-to-string'
+would add a superfluous trailing space when converting #+transclude
+keyword's properties back to the string.  This does not cause any
+harm in normal circumstances.
+
+The issue would occur with a rare combination of the case where:
+
++ You have a buffer with a large number of transclusions activated,
+  around 50 or more
+
++ You set a 'whitespace-cleanup' in 'before-save' hook
+
++ You have 'auto-save-visited-mode' or similar that automatically saves
+  a buffer
+
+If you had combination, and then saved the buffer with the
+transclusions, you might get an error mid-way of the save
+operation. You would not lose any data in the buffer, but the buffer
+would not re-activate all the transclusions that had been active
+before buffer-save.
+
+This was because of the superfluous trailing spaces and automatic
+removal of them, which caused the mismatch of the point of each
+transclusion that Org-transclusion remembered during the save
+operation.
+
+* Version 1.3.1
+
+  - build: fix #154 missing org-transclusion-pkg.el
+
+Nix requires -pkg.el. It was in ‘.elpaignore’. No functional change.
+
 * Version 1.3.0
 
   - Feature ::
@@ -6,7 +71,7 @@
   use :expand-links per transclusion
 
   - Fix ::
-  
+
 - fix: #131. For non-Org files, now the transcluded text respects the 
indent
  level of the #+transclude keyword.  This does not affect Org files.
 
@@ -53,7 +118,7 @@
 
   - Other ::
 - README, Info doc user manual, online user manual
-  
+
 * Version 1.0.1
 
   - Add .elpaignore
@@ -77,8 +142,7 @@
 
 - =org-transclusion-before-kill= now checks if the buffer to be killed
   contains any transclusion AND it is visting a file before saving. This
-  fixes some issues related to temp buffers, etc.
+  fixes some issues related to temp buffers, etc.
 - fix: search options for src-lines extension for =:lines=, =:src=, and 
=:end= properties
 
 † Changes before Version 1.0.0 are in CHANGELOG file.
-
diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index b9854f919b..72da9d5b36 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -1,7 +1,7 @@
 #+title: Org-transclusion User Manual
 #+author: Noboru Ota 
 #+macro: version 1.3.x
-#+macro: modified 12 June 2022
+#+macro: modified 04 March 2023
 
 #+language: en
 #+export_file_name: org-transclusion.texi
@@ -21,7 +21,7 @@ This manual is for Org-transclusion version {{{version}}}.
 
 Last updated: {{{modified}}}.
 
-#+transclude: [[../README.org::whatis]] 
+#+transclude: [[../README.org::whatis]]
 
 #+texinfo: @insertcopying
 
@@ -46,11 +46,11 @@ modify this GNU manual.”
 
 * Example Use Cases & Main Features
 
-#+transclude: [[../README.org::#use-cases]] :only-contents 
+#+transclude: [[../READ

[elpa] externals/org-transclusion 431d6049a4: docs: fix some typos

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 431d6049a4ca2346bace1156c2ec54e0d7854d52
Author: Noboru Ota 
Commit: Noboru Ota 

docs: fix some typos
---
 docs/org-transclusion-manual.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index 6df4077b8f..a97b185f5e 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -233,7 +233,7 @@ Other ways to control include the following.
 #+cindex: Filters
 #+vindex: org-transclusion-exclude-elements
 #+vindex: org-transclusion-include-first-section
-#+cindex: Property - :only-content
+#+cindex: Property - :only-contents
 
 You can control what elements to include in many different ways with using 
various filters. The filters work in two layers: customizable variable and 
properties per transclude keyword.
 
@@ -721,7 +721,7 @@ Note this section is still incomplete, not exhaustive for 
"known" limitations.
 - Undo detach does not add the overlay back on the source ::
   This should not break any feature. You can safely refresh the transclusion 
and recover the source overlay. You can also safely open or moved to the source 
while the source overlay is not present.
 
-- For =:thing-at-point, you cannot use :thing-at-point to specify the precise 
beginning of the thing within a line -- it is always the beginning of the line.
+- For =:thing-at-point=, you cannot use it to specify the precise beginning of 
the thing within a line -- it is always the beginning of the line.
 
 * Credits
 ** Original idea by John Kitchin



[elpa] externals/org 6e6354c074: org-tags-expand: Do no modify buffer's syntax table by side effect

2023-05-08 Thread ELPA Syncer
branch: externals/org
commit 6e6354c074a323780f103aabf45be74104ce3ecf
Author: Ihor Radchenko 
Commit: Ihor Radchenko 

org-tags-expand: Do no modify buffer's syntax table by side effect

* lisp/org.el (org-mode-tags-syntax-table): New variable holding
syntax table for tags.
(org-mode): Initialize tag syntax table.
(org-make-tags-matcher): Match tags using appropriate syntax table.
(org-tags-expand): Do no modify syntax table by side effect.

Reported-by: Mattias Engdegård 
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#68
---
 lisp/org.el | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 4fb2e94c80..542959f730 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4788,6 +4788,9 @@ This is for getting out of special buffers like capture.")
 (defvar org-agenda-file-menu-enabled t
   "When non-nil, refresh Agenda files in Org menu when loading Org.")
 
+(defvar org-mode-tags-syntax-table
+  "Syntax table including \"@\" and \"_\" as word constituents.")
+
 ;;;###autoload
 (define-derived-mode org-mode outline-mode "Org"
   "Outline-based notes management and organizer, alias
@@ -4844,6 +4847,12 @@ The following commands are available:
   (modify-syntax-entry ?~ "_")
   (modify-syntax-entry ?< "(>")
   (modify-syntax-entry ?> ")<")
+  ;; Set tags syntax table.
+  (setq org-mode-tags-syntax-table
+(make-syntax-table org-mode-syntax-table))
+  ;; @ and _ are allowed as word-components in tags.
+  (modify-syntax-entry ?@ "w" org-mode-tags-syntax-table)
+  (modify-syntax-entry ?_ "w" org-mode-tags-syntax-table)
   (setq-local font-lock-unfontify-region-function 'org-unfontify-region)
   ;; Activate before-change-function
   (setq-local org-table-may-need-update t)
@@ -11406,7 +11415,9 @@ See also `org-scan-tags'."
   (propp (match-end 5))
   (mm
(cond
-(regexp `(org-match-any-p ,(substring tag 1 -1) tags-list))
+(regexp
+  `(with-syntax-table org-mode-tags-syntax-table
+ (org-match-any-p ,(substring tag 1 -1) tags-list)))
 (levelp
  `(,(org-op-to-function (match-string 3 term))
level
@@ -11518,7 +11529,6 @@ the list of tags in this group."
  (single-as-list (org--tags-expand-group (list match) tag-groups nil))
  (org-group-tags
   (let* ((case-fold-search t)
-(tag-syntax org-mode-syntax-table)
 (group-keys (mapcar #'car tag-groups))
 (key-regexp (concat "\\([+-]?\\)" (regexp-opt group-keys 'words)))
 (return-match match))
@@ -11529,11 +11539,8 @@ the list of tags in this group."
(setq s (match-end 0))
(add-text-properties
 (match-beginning 0) (match-end 0) '(regexp t) return-match)))
-   ;; @ and _ are allowed as word-components in tags.
-   (modify-syntax-entry ?@ "w" tag-syntax)
-   (modify-syntax-entry ?_ "w" tag-syntax)
;; For each tag token found in MATCH, compute a regexp and  it
-   (with-syntax-table tag-syntax
+   (with-syntax-table org-mode-tags-syntax-table
  (replace-regexp-in-string
   key-regexp
   (lambda (m)



[elpa] externals/org-transclusion 5a080c503e: refactor(org-transclusion.el): remove --ensure-new-line

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 5a080c503edeef38262fb928158567caaf43c20a
Author: Noboru Ota 
Commit: Noboru Ota 

refactor(org-transclusion.el): remove --ensure-new-line

org-transclusion--ensure-new-line not needed (part of -src-lines.el)
---
 org-transclusion.el | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 86c61cc83f..6b6d0a85f1 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -942,11 +942,6 @@ Return nil if not found."
 ;;-
  Functions for inserting content
 
-(defun org-transclusion--ensure-newline (str)
-  (if (not (string-suffix-p "\n" str))
-  (concat str "\n")
-str))
-
 (defun org-transclusion-content-insert (keyword-values type content sbuf sbeg 
send copy)
   "Insert CONTENT at point and put source overlay in SBUF.
 Return t when successful.
@@ -976,7 +971,7 @@ based on the following arguments:
  (end-mkr)
  (ov-src (text-clone-make-overlay sbeg send sbuf)) ;; source-buffer 
overlay
  (tc-pair ov-src)
- (content (org-transclusion--ensure-newline content)))
+ (content content))
 (when (org-transclusion-type-is-org type)
   (with-temp-buffer
 ;; This temp buffer needs to be in Org Mode



[elpa] externals/denote 694c1517be 2/2: Expose public functions for returning links or backlinks

2023-05-08 Thread ELPA Syncer
branch: externals/denote
commit 694c1517be73949edbc3993c105c764da8e2571f
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Expose public functions for returning links or backlinks

We are doing the work in standalone functions that can be called from
Lisp, instead of limiting it to interactive functions.  The code is
more composable as a result.

This is in response to the mailing list thread started by relict007:


relict007 is the developer of the 'denote-cache' package (in
progress): .
---
 README.org | 10 ++
 denote.el  | 46 +++---
 2 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/README.org b/README.org
index 6670a4d0bb..b237c42de2 100644
--- a/README.org
+++ b/README.org
@@ -3411,6 +3411,16 @@ might change them without further notice.
   matter =KEYWORDS= for org file type.  =KEYWORDS= is a list of
   strings.  Consult the ~denote-file-types~ for how this is used.
 
+[ The following two functions are part of {{{development-version}}}. ]
+
+#+findex: denote-link-return-links
++ Function ~denote-link-return-links~ :: Return list of links in
+  current or optional =FILE=.  Also see ~denote-link-return-backlinks~.
+
+#+findex: denote-link-return-backlinks
++ Function ~denote-link-return-backlinks~ :: Return list of links in
+  current or optional =FILE=.  Also see ~denote-link-return-links~.
+
 * Troubleshoot Denote in a pristine environment
 :PROPERTIES:
 :CUSTOM_ID: h:9c4467d5-6480-4681-80fb-cd9717bf8b3b
diff --git a/denote.el b/denote.el
index df952c3253..ebc1145352 100644
--- a/denote.el
+++ b/denote.el
@@ -2845,17 +2845,36 @@ whitespace-only), insert an ID-ONLY link."
  (denote--completion-table 'file file-names)
  nil t nil 'denote-link--find-file-history)))
 
+(defun denote-link-return-links (&optional file)
+  "Return list of links in current or optional FILE.
+Also see `denote-link-return-backlinks'."
+  (if-let* ((current-file (or file (buffer-file-name)))
+(file-type (denote-filetype-heuristics current-file))
+(regexp (denote--link-in-context-regexp file-type))
+(links (with-current-buffer (find-file-noselect current-file)
+ (denote-link--expand-identifiers regexp
+  links
+(user-error "No links found in `%s'" current-file)))
+
+(defalias 'denote-link-return-forelinks 'denote-link-return-links
+  "Alias of `denote-link-return-links'.")
+
 ;;;###autoload
 (defun denote-link-find-file ()
   "Use minibuffer completion to visit linked file."
   (interactive)
-  (if-let* ((current-file (buffer-file-name))
-(file-type (denote-filetype-heuristics current-file))
-(regexp (denote--link-in-context-regexp file-type))
-(files (denote-link--expand-identifiers regexp)))
-  (find-file
-   (denote-link--find-file-prompt files))
-(user-error "No links found in the current buffer")))
+  (find-file
+   (denote-link--find-file-prompt
+(denote-link-return-links
+
+(defun denote-link-return-backlinks (&optional file)
+  "Return list of backlinks in current or optional FILE.
+Also see `denote-link-return-links'."
+  (if-let* ((current-file (or file (buffer-file-name)))
+(id (denote-retrieve-filename-identifier current-file))
+(backlinks (delete current-file (denote--retrieve-files-in-xrefs 
id
+  backlinks
+(user-error "No backlinks found in `%s'" current-file)))
 
 ;;;###autoload
 (defun denote-link-find-backlink ()
@@ -2863,14 +2882,11 @@ whitespace-only), insert an ID-ONLY link."
 
 Like `denote-link-find-file', but select backlink to follow."
   (interactive)
-  (if-let* ((file (buffer-file-name))
-(id (denote-retrieve-filename-identifier file))
-(files (delete file (denote--retrieve-files-in-xrefs id
-  (find-file
-   (denote-get-path-by-id
-(denote-extract-id-from-string
- (denote-link--find-file-prompt files
-(user-error "No links found in the current buffer")))
+  (find-file
+   (denote-get-path-by-id
+(denote-extract-id-from-string
+ (denote-link--find-file-prompt
+  (denote-link-return-backlinks))
 
 ;;;###autoload
 (defun denote-link-after-creating (&optional id-only)



[elpa] externals/denote 09548075cf 1/2: Tweak formatting of denote--retrieve-files-in-xrefs

2023-05-08 Thread ELPA Syncer
branch: externals/denote
commit 09548075cff19feb8ee2ace29a66128cdc5540a1
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Tweak formatting of denote--retrieve-files-in-xrefs
---
 denote.el | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/denote.el b/denote.el
index 1d986b0231..df952c3253 100644
--- a/denote.el
+++ b/denote.el
@@ -1385,14 +1385,24 @@ Run `denote-desluggify' on title if the extraction is 
sucessful."
   title
 (denote-retrieve-filename-title file)))
 
+(defun denote--retrieve-location-in-xrefs (identifier)
+  "Return list of xrefs for IDENTIFIER with their respective location.
+Limit the search to text files, per `denote-directory-text-only-files'."
+  (mapcar #'xref-match-item-location
+  (xref-matches-in-files identifier
+ (denote-directory-text-only-files
+
+(defun denote--retrieve-group-in-xrefs (identifier)
+  "Access location of xrefs for IDENTIFIER and group them per file.
+See `denote--retrieve-locations-in-xrefs'."
+  (mapcar #'xref-location-group
+  (denote--retrieve-location-in-xrefs identifier)))
+
 (defun denote--retrieve-files-in-xrefs (identifier)
-  "Return sorted, deduplicated file names from IDENTIFIER."
+  "Return sorted, deduplicated file names with IDENTIFIER in their contents."
   (sort
(delete-dups
-(mapcar #'xref-location-group
-(mapcar #'xref-match-item-location
-(xref-matches-in-files identifier
-   
(denote-directory-text-only-files)
+(denote--retrieve-group-in-xrefs identifier))
#'string-lessp))
 
  New note



[elpa] externals/denote updated (d0e7c844ce -> 694c1517be)

2023-05-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/denote.

  from  d0e7c844ce Document Summer Emacs' essay about usage of Emacs, 
Denote, etc.
   new  09548075cf Tweak formatting of denote--retrieve-files-in-xrefs
   new  694c1517be Expose public functions for returning links or backlinks


Summary of changes:
 README.org | 10 ++
 denote.el  | 66 +++---
 2 files changed, 56 insertions(+), 20 deletions(-)



[elpa] externals/org-transclusion 92b3eaed55: docs: add note on 'sentence-end' in the manual for thing-at-point

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 92b3eaed55bb8e34520a6d998a87d50c7643d1b3
Author: Noboru Ota 
Commit: Noboru Ota 

docs: add note on 'sentence-end' in the manual for thing-at-point
---
 docs/org-transclusion-manual.org   | 5 +
 test/things-at-point-dir/story.txt | 4 +---
 test/things-at-point.org   | 5 +++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/docs/org-transclusion-manual.org b/docs/org-transclusion-manual.org
index a97b185f5e..ddcceac34f 100644
--- a/docs/org-transclusion-manual.org
+++ b/docs/org-transclusion-manual.org
@@ -500,6 +500,11 @@ You can add =:thing-at-point= property to transclude a 
certain "thing" at point
 As it stands now, you cannot use :thing-at-point to specify the precise 
beginning of the thing within a line -- it is always the beginning of the line.
 #+end_quote
 
+#+ATTR_TEXINFO: :tag Note
+#+begin_quote
+The definition of sentence is controlled by various variables in Emacs. It is 
suggested to consult the documentation of function ~sentence-end~. For those  
who do not use double-space after a period (in the language this is relevant), 
it is probably more intuitive to turn off customizing  
~sentence-end-double-space~. The default behavior is this: "Non-nil means a 
single space does not end a sentence."
+#+end_quote
+
 See Example 4. When you have a text file for prose, you can use paragraph or 
sentence as a "thing" to transclude. In this example, the beginning of the 
source of transclude is specified by the search option with "::Once upon a 
time".  The two colons "::" immediately following the file name denote the 
search option, which is a built-in Org syntax. Then the paragraph or sentence 
beginning "Once upon a time" is transcluded. When the source file contains 
multiple occurrences of "Once upon a  [...]
 
 Example 4:
diff --git a/test/things-at-point-dir/story.txt 
b/test/things-at-point-dir/story.txt
index 3c9521de54..bec7eab5cd 100644
--- a/test/things-at-point-dir/story.txt
+++ b/test/things-at-point-dir/story.txt
@@ -1,7 +1,5 @@
 This is a story
 
-Once upon a time. This paragraph should be transcluded. This is a story.
-And if I have a hard line break, I belive this line is still part of
-the paragraph as defined by ... thing-at-point I think.
+Once upon a time. This paragraph should be transcluded. This is a story. And 
if I have a hard line break, I belive this line is still part of the paragraph 
as defined by ... thing-at-point I think.
 
 This is a new paragraph and should not be included.
diff --git a/test/things-at-point.org b/test/things-at-point.org
index 3fd9568b64..d36100acfa 100644
--- a/test/things-at-point.org
+++ b/test/things-at-point.org
@@ -16,9 +16,10 @@ I expect these will be more common:
 sexp
 list
 
-#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point paragraph
 
-#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:thing-at-point sentence
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:end "2" :thing-at-point paragraph
+
+#+transclude: [[./things-at-point-dir/story.txt::Once upon a time][story]]  
:end "3" :thing-at-point sentence
 
 #+transclude: [[./things-at-point-dir/baz.el::id:1234567890][barz-baz-fuzz]]  
:src elisp
 



[nongnu] elpa/racket-mode c6dbe023c6: racket-show-pseudo-tooltip: Show after end of same line if possible

2023-05-08 Thread ELPA Syncer
branch: elpa/racket-mode
commit c6dbe023c688ad1845e1f8ee250f5fa2cf2b8b01
Author: Greg Hendershott 
Commit: Greg Hendershott 

racket-show-pseudo-tooltip: Show after end of same line if possible

Show the tooltip after end of the same line if there is room to do so.
Otherwise follow the previous strategies, including trying to show on
the next line (which, although most similar to a GUI tooltip, has a
tendency to obscure something interesting on the next line -- unlike
GUI tooltips, ours don't automatically disappear because that can be
its own annoyance).
---
 racket-show.el | 144 ++---
 1 file changed, 76 insertions(+), 68 deletions(-)

diff --git a/racket-show.el b/racket-show.el
index 447ab117c5..35ec1071c0 100644
--- a/racket-show.el
+++ b/racket-show.el
@@ -126,74 +126,82 @@ any border."
  (ov (make-overlay eol (1+ eol
 (overlay-put ov 'after-string text)
 (list ov))
-;; Otherwise we simulate a tooltip displayed one line below pos,
-;; and one column right (although it might start further left
-;; depending on window-width) "over" any existing text.
-(pcase-let*
-((text (propertize (concat " " text " ")
-   'face
-   `(:inherit default
- :foreground ,(face-foreground 'tooltip)
- :background ,(face-background 'tooltip)
- :box (:line-width -1
- (text-len (length text))
- (bol  (racket--bol pos))
- (eol  (racket--eol pos))
- ;; Position the tooltip on the next line, indented to `pos'
- ;; -- but not so far it ends off right edge.
- (indent   (max 0 (min (- pos bol)
-   (- (window-width) (string-width text) 2
- (beg  (+ eol indent 1))
- (next-eol (racket--eol (1+ eol
-  ;; If the tip starts before next-eol, create an overlay with the
-  ;; 'display property, covering the span of the tooltip text but
-  ;; not beyond next-eol.
-  ;;
-  ;; As a further wrinkle, when the overlay does not cover the
-  ;; entire rest of the line, our new text might not be exactly
-  ;; the same pixel width as the text we replace -- causing the
-  ;; remaining text to shift. This can happen e.g. due to Unicode
-  ;; characters like λ. Furthermore, our replacement text can be
-  ;; two pixels wider because :box (:line-width -1) doesn't seem
-  ;; to work as advertised.
-  ;;
-  ;; To avoid this, we add _another_ overlay simply to replace the
-  ;; character following our tooltip with a space of the necessary
-  ;; pixel width to keep things aligned. Although covering the
-  ;; character with a space isn't great -- even if you justify it
-  ;; as a sort of "shadow" (?) -- it's better than having the
-  ;; remainder of the line jiggle as the tooltip apears and
-  ;; disappears.
-  (if (< beg next-eol)
-  (cl-flet ((text-pixel-width
- (beg end)
- (car (window-text-pixel-size nil beg end
-(let* ((end  (min next-eol (+ beg text-len)))
-   (ov   (make-overlay beg end))
-   (old  (text-pixel-width (1+ eol) end))
-   (_(overlay-put ov 'display text))
-   (new  (text-pixel-width (1+ eol) end))
-   (diff (- new old)))
-  (cons
-   ov
-   (when (and (not (zerop diff))
-  (< end next-eol))
- (let* ((ov-spacer   (make-overlay end (1+ end)))
-(width   (text-pixel-width end (1+ end)))
-(space-width (abs (- width diff
-   (overlay-put ov-spacer
-'display
-`(space
-  :width (,space-width)))
-   (list ov-spacer))
-;; Else the tip starts after next-eol. So, create an overlay
-;; on the newline, and use an after-string, where we prefix
-;; enough blank spaces before the tooltip text itself to get
-;; the desired indent.
-(let* ((ov (make-overlay (1- next-eol) next-eol))
-   (blanks (make-string (- beg next-eol) 32)))
-  (overlay-put ov 'after-string (concat blanks text))
-  (list ov))
+;; Else we simulate a tooltip. The only question is where, and the
+;; overlay(s) necessary to achieve that.
+(let*
+((text (propertize (concat " " text " ")
+   'face
+   `(:inherit default
+ :foreground ,(face-foreground 'tooltip)
+ :background ,(face-background 'tooltip)
+ 

[elpa] externals/ef-themes 829255213e: Remove deprecated consult-preview-cursor face

2023-05-08 Thread ELPA Syncer
branch: externals/ef-themes
commit 829255213ee7c32d34dcce71225b31cf8b71a99e
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Remove deprecated consult-preview-cursor face

This was done in commit 267b0c9 of the Consult Git repository.
Discussed here: 
.
---
 ef-themes.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ef-themes.el b/ef-themes.el
index 1ceda05d12..d63cf002ba 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -1080,7 +1080,6 @@ Optional prefix argument MAPPINGS has the same meaning as 
for
 `(consult-imenu-prefix ((,c :inherit shadow)))
 `(consult-line-number ((,c :inherit shadow)))
 `(consult-line-number-prefix ((,c :inherit shadow)))
-`(consult-preview-cursor ((,c :background ,cursor :foreground ,bg-main)))
 `(consult-separator ((,c :foreground ,border)))
  corfu
 `(corfu-current ((,c :background ,bg-completion)))



[elpa] externals/modus-themes f4cc61f4e9 2/3: Remove deprecated consult-preview-cursor face

2023-05-08 Thread ELPA Syncer
branch: externals/modus-themes
commit f4cc61f4e9de919bd069225cd1fd5290a4aa5e44
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Remove deprecated consult-preview-cursor face

This was done in commit 267b0c9 of the Consult Git repository.
Discussed here: 
.
---
 modus-themes.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/modus-themes.el b/modus-themes.el
index 524d0aa946..0071930f4e 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -2060,7 +2060,6 @@ FG and BG are the main colors."
 `(consult-imenu-prefix ((,c :inherit shadow)))
 `(consult-line-number ((,c :inherit shadow)))
 `(consult-line-number-prefix ((,c :inherit shadow)))
-`(consult-preview-cursor ((,c :background ,cursor :foreground ,bg-main)))
 ; corfu
 `(corfu-current ((,c :inherit modus-themes-completion-selected)))
 `(corfu-bar ((,c :background ,fg-dim)))



[elpa] externals/modus-themes 4be8ac678b 1/3: Add support for new vundo-saved and vundo-last-saved faces

2023-05-08 Thread ELPA Syncer
branch: externals/modus-themes
commit 4be8ac678bdcde3126bbaccca0397b20bb22d74b
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Add support for new vundo-saved and vundo-last-saved faces

They are part of the latest release of vundo.  Thanks to Nicolas
Semrau for bringing this matter to my attention in issue 79 on the
GitHub mirror: .
---
 doc/modus-themes.info | 36 ++--
 doc/modus-themes.org  | 16 
 modus-themes.el   |  2 ++
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/doc/modus-themes.info b/doc/modus-themes.info
index 24ada5299b..88a0f7f85f 100644
--- a/doc/modus-themes.info
+++ b/doc/modus-themes.info
@@ -5464,19 +5464,19 @@ Ideas and user feedback
  Simpson, Marko Kocic, Markus Beppler, Matt Armstrong, Matthias
  Fuchs, Mattias Engdegård, Mauro Aranda, Maxime Tréca, Michael
  Goldenberg, Morgan Smith, Morgan Willcock, Murilo Pereira, Nicky
- van Foreest, Nicolas De Jaeghere, Pablo Stafforini, Paul Poloskov,
- Pengji Zhang, Pete Kazmier, Peter Wu, Philip Kaludercic, Pierre
- Téchoueyres, Przemysław Kryger, Robert Hepple, Roman Rudakov,
- Russell Sim, Ryan Phillips, Rytis Paškauskas, Rudolf Adamkovič, Sam
- Kleinman, Samuel Culpepper, Saša Janiška, Shreyas Ragavan, Simon
- Pugnet, Steve Downey, Tassilo Horn, Thanos Apollo, Thibaut Verron,
- Thomas Heartman, Togan Muftuoglu, Tony Zorman, Trey Merkley, Tomasz
- Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley,
- Zoltan Kiraly.  As well as users: Ben, CsBigDataHub1, Emacs
- Contrib, Eugene, Fourchaux, Fredrik, Moesasji, Nick, Summer Emacs,
- TheBlob42, TitusMu, Trey, bepolymathe, bit9tream, bangedorrunt,
- derek-upham, doolio, fleimgruber, gitrj95, iSeeU, jixiuf, okamsn,
- pRot0ta1p, soaringbird, tumashu, wakamenod.
+ van Foreest, Nicolas De Jaeghere, Nicolas Semrau, Pablo Stafforini,
+ Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, Philip
+ Kaludercic, Pierre Téchoueyres, Przemysław Kryger, Robert Hepple,
+ Roman Rudakov, Russell Sim, Ryan Phillips, Rytis Paškauskas, Rudolf
+ Adamkovič, Sam Kleinman, Samuel Culpepper, Saša Janiška, Shreyas
+ Ragavan, Simon Pugnet, Steve Downey, Tassilo Horn, Thanos Apollo,
+ Thibaut Verron, Thomas Heartman, Togan Muftuoglu, Tony Zorman, Trey
+ Merkley, Tomasz Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh,
+ Vincent Foley, Zoltan Kiraly.  As well as users: Ben,
+ CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji,
+ Nick, Summer Emacs, TheBlob42, TitusMu, Trey, bepolymathe,
+ bit9tream, bangedorrunt, derek-upham, doolio, fleimgruber, gitrj95,
+ iSeeU, jixiuf, okamsn, pRot0ta1p, soaringbird, tumashu, wakamenod.
 
 Packaging
  Basil L. Contovounesios, Eli Zaretskii, Glenn Morris, Mauro Aranda,
@@ -6235,11 +6235,11 @@ Node: Sources of the themes219920
 Node: Issues you can help with220814
 Node: Patches require copyright assignment to the FSF05
 Node: Acknowledgements224425
-Node: GNU Free Documentation License228467
-Node: Indices253831
-Node: Function index254010
-Node: Variable index255193
-Node: Concept index257372
+Node: GNU Free Documentation License228483
+Node: Indices253847
+Node: Function index254026
+Node: Variable index255209
+Node: Concept index257388
 
 End Tag Table
 
diff --git a/doc/modus-themes.org b/doc/modus-themes.org
index e35c7e4890..d58433e7ae 100644
--- a/doc/modus-themes.org
+++ b/doc/modus-themes.org
@@ -5357,14 +5357,14 @@ The Modus themes are a collective effort.  Every bit of 
work matters.
   Bestley, Mark Burton, Mark Simpson, Marko Kocic, Markus Beppler,
   Matt Armstrong, Matthias Fuchs, Mattias Engdegård, Mauro Aranda,
   Maxime Tréca, Michael Goldenberg, Morgan Smith, Morgan Willcock,
-  Murilo Pereira, Nicky van Foreest, Nicolas De Jaeghere, Pablo
-  Stafforini, Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu,
-  Philip Kaludercic, Pierre Téchoueyres, Przemysław Kryger, Robert
-  Hepple, Roman Rudakov, Russell Sim, Ryan Phillips, Rytis Paškauskas,
-  Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, Saša Janiška,
-  Shreyas Ragavan, Simon Pugnet, Steve Downey, Tassilo Horn, Thanos
-  Apollo, Thibaut Verron, Thomas Heartman, Togan Muftuoglu, Tony
-  Zorman, Trey Merkley, Tomasz Hołubowicz, Toon Claes, Uri Sharf,
+  Murilo Pereira, Nicky van Foreest, Nicolas De Jaeghere, Nicolas
+  Semrau, Pablo Stafforini, Paul Poloskov, Pengji Zhang, Pete Kazmier,
+  Peter Wu, Philip Kaludercic, Pierre Téchoueyres, Przemysław Kryger,
+  Robert Hepple, Roman Rudakov, Russell Sim, Ryan Phillips, Rytis
+  Paškauskas, Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, Saša
+  Janiška, Shreyas Ragavan, Simon Pugnet, Steve Downey, Tassilo Horn,
+  Thanos Apollo, Thibaut Verron, Thomas Heartman, Togan Muftuoglu,
+  Tony Zorman, Trey Merkley, Tomasz Hołubowicz, Toon Claes, Uri Sha

[elpa] externals/modus-themes updated (df7749bbed -> 34a67fe530)

2023-05-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/modus-themes.

  from  df7749bbed Reword some statements about frame padding
   new  4be8ac678b Add support for new vundo-saved and vundo-last-saved 
faces
   new  f4cc61f4e9 Remove deprecated consult-preview-cursor face
   new  34a67fe530 Remove bold face from 'vundo-saved'


Summary of changes:
 doc/modus-themes.info | 36 ++--
 doc/modus-themes.org  | 16 
 modus-themes.el   |  3 ++-
 3 files changed, 28 insertions(+), 27 deletions(-)



[elpa] externals/modus-themes 34a67fe530 3/3: Remove bold face from 'vundo-saved'

2023-05-08 Thread ELPA Syncer
branch: externals/modus-themes
commit 34a67fe53051db82da1d1b680604075abca17dc7
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Remove bold face from 'vundo-saved'

It should only be there for the vundo-last-saved.  I was undoing for
testing purposes and forgot to redo before committing...

As with commit 4be8ac6, this is discussed in issue 79 on the GitHub
mirror: 
---
 modus-themes.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modus-themes.el b/modus-themes.el
index 0071930f4e..bdb7c401f4 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3838,7 +3838,7 @@ FG and BG are the main colors."
 ; vundo
 `(vundo-highlight ((,c :inherit (bold vundo-node) :foreground 
,red-intense)))
 `(vundo-last-saved ((,c :inherit (bold vundo-node) :foreground 
,cyan-intense)))
-`(vundo-saved ((,c :inherit (bold vundo-node) :foreground ,cyan-intense)))
+`(vundo-saved ((,c :inherit vundo-node :foreground ,cyan-intense)))
 ; wcheck-mode
 `(wcheck-default-face ((,c :foreground ,red :underline t)))
 ; web-mode



[elpa] externals/standard-themes d237bc1c5c: Remove deprecated consult-preview-cursor face

2023-05-08 Thread ELPA Syncer
branch: externals/standard-themes
commit d237bc1c5c3048ee73e410dd82e2c6ad559e92f3
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Remove deprecated consult-preview-cursor face

This was done in commit 267b0c9 of the Consult Git repository.
Discussed here: 
.
---
 standard-themes.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/standard-themes.el b/standard-themes.el
index fa60e1781f..9e938df4d6 100644
--- a/standard-themes.el
+++ b/standard-themes.el
@@ -1113,7 +1113,6 @@ Optional prefix argument MAPPINGS has the same meaning as 
for
 `(consult-key ((,c :inherit standard-themes-key-binding)))
 `(consult-imenu-prefix ((,c :inherit shadow)))
 `(consult-line-number ((,c :inherit shadow)))
-`(consult-preview-cursor ((,c :background ,cursor :foreground ,bg-main)))
 `(consult-separator ((,c :foreground ,border)))
  corfu
 `(corfu-current ((,c :background ,bg-completion)))



[elpa] externals/hyperbole db3de929d4 1/4: man/im/action-key-animation.gif: Update this animated gif

2023-05-08 Thread ELPA Syncer
branch: externals/hyperbole
commit db3de929d4a65aca1017aeda14df039c4f9bd22a
Author: Bob Weiner 
Commit: Bob Weiner 

man/im/action-key-animation.gif: Update this animated gif
---
 ChangeLog   |   6 +-
 README.md   |   2 +-
 man/im/action-key-animation.gif | Bin 752827 -> 669509 bytes
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 42d1ba3d81..d3c27fc31e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-05-06  Bob Weiner  
+
+* man/im/action-key-animation.gif: Update this animated gif.
+
 2023-04-30  Mats Lidell  
 
 * test/hui-tests.el (hui--ebut-rename)
@@ -50,7 +54,7 @@
 2023-04-23  Bob Weiner  
 
 * kotl/klink.el (klink:at-p):
-  hbut.el (hbut:outside-comment-p): Make the inside a comment prog
+  hbut.el (hbut:outside-comment-p): Make the inside of comment prog
 mode tests in each of these use the same conditional tests.
 
 * Makefile (version): Fix so this outputs the list of files whose
diff --git a/README.md b/README.md
index e062b1e35e..57fac24ed7 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,7 @@ In short, Hyperbole lets you:
   A single key or mouse button automatically does the right thing in
   dozens of contexts; just press and go.
 
-![Hyperbole Animation of Action Key Contexts](man/im/action-key-animation.gif)
+
 
3. Build outlines with multi-level numbered outline nodes, e.g. 1.4.8.6,
   that all renumber automatically as any node or tree is moved in the
diff --git a/man/im/action-key-animation.gif b/man/im/action-key-animation.gif
index b4bd083f08..2c03773720 100644
Binary files a/man/im/action-key-animation.gif and 
b/man/im/action-key-animation.gif differ



[elpa] externals/hyperbole bc3fbcf750 2/4: Add hyperbole-run-test-definition ibtype to run an ERT test from def

2023-05-08 Thread ELPA Syncer
branch: externals/hyperbole
commit bc3fbcf750d65e86d7783b45351921282a0a624d
Author: Bob Weiner 
Commit: Bob Weiner 

Add hyperbole-run-test-definition ibtype to run an ERT test from def

Fix kimport.el and update tests for star, aug-post and text imports.
Fix Shift-TAB within an Org table to go to previous field.
---
 ChangeLog |  27 -
 HY-NEWS   | 329 +++---
 hibtypes.el   |   7 +-
 hypb-ert.el   |  50 +++-
 kotl/EXAMPLE.kotl |  35 +++---
 kotl/kimport.el   | 229 +--
 kotl/kotl-mode.el |  11 +-
 man/hkey-help.txt |   1 +
 man/hyperbole.texi| 134 +++-
 test/kimport-tests.el |  69 ---
 10 files changed, 545 insertions(+), 347 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3c27fc31e..9b6b019470 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,30 @@
+2023-05-07  Bob Weiner  
+
+* test/kimport-tests.el: Improve all these tests and add
+`kimport--aug-post-outline'.
+
+* hypb-ert.el (hyperbole-run-test-definition): Add ibtype that when on the
+first line of an `ert-deftest' and not at eol nor on a grouping symbol,
+evaluates the current version of the test and then runs it.  Assist Key
+press in the same spot steps through the test with edebug.
+  (hyperbole-run-test-definition:help, hypb-ert-def-at-p,
+   hypb-ert-run-test-at-definition):
+Support functions.
+
 2023-05-06  Bob Weiner  
 
+* kotl/kimport.el (kimport:aug-post-outline, kimport:text):
+Update to match `kimport:star-outline'.
+  (kimport:aug-post-statements):
+Update to match `kimport:star-entries'.
+
+* kotl/EXAMPLE.kotl:
+  kotl/kotl-mode.el (kotl-mode):
+  man/hyperbole.texi (Promoting and Demoting): Update so {Shift-TAB} within
+an Org table in a Koutline moves to the previous field to complement
+the behavior of {TAB}.  This leaves {M-TAB} as the only consistent way
+to promote trees.
+
 * man/im/action-key-animation.gif: Update this animated gif.
 
 2023-04-30  Mats Lidell  
@@ -9,7 +34,7 @@
 (hui--ebut-rename-nonumbered-label, hui--ebut-rename-numbered-label)
 (hui--ebut-rename-all-copies)
   test/hbut-tests.el (hypb:program-create-ebut-in-buffer-with-same-label):
-Tests for ebut label rename.
+Test for ebut label rename.
 
 2023-04-30  Bob Weiner  
 
diff --git a/HY-NEWS b/HY-NEWS
index 59bd9069e9..3bcf70955f 100644
--- a/HY-NEWS
+++ b/HY-NEWS
@@ -8,8 +8,8 @@
 ** ACTION TYPES
 
   *** display-boolean, display-value, display-variable: Made all of these
-  interactive, so can be used as button actypes.
-
+  interactive, so can be used as button actypes.  See "(hyperbole)
+  actypes display-boolean".
 
 ** DOCUMENTATION
 
@@ -39,108 +39,115 @@
   *** Ibut Menu: Documented in the manual, notably the new Ibut/Create
   menu item.  See "(hyperbole)menu, Ibut/Create".
 
+  *** Manual Glossary: Added Ace Window, Consult, Org Mode, and Org Roam
+  entries.  See "(hyperbole)Glossary".
+
   *** Smart Key - Org Mode: Expanded with doc for more extensive behavior.
   See "(hyperbole)Smart Key - Org Mode".
 
-  *** Manual Glossary: Added Ace Window, Consult, Org Mode, and Org Roam 
entries.
-  See "(hyperbole)Glossary".
-
 
 ** HYCONTROL  (See "(hyperbole)HyControl").
 
-  *** I/J/K/M Key Bindings: In Window Control mode, move directionally (based
-  on QUERTY keyboard layout) among windows in the selected frame.  In Frame
-  Control mode, move directionally among active frames.  These keys utilize
-  and prompt to install the windmove and framemove packages if not 
installed.
-  See "(hyperbole)I/J/K/M".
+  *** I/J/K/M Key Bindings: In Window Control mode, move directionally
+  (based on QUERTY keyboard layout) among windows in the selected frame.
+  In Frame Control mode, move directionally among active frames.  These
+  keys utilize and prompt to install the windmove and framemove packages
+  if not installed.  See "(hyperbole)I/J/K/M".
 
-** HYPERBOLE SYSTEM  (See "(hyperbole)").
 
-  *** Native Compilation: Hyperbole now may be natively compiled (.eln files).
-  It works around an Emacs bug where async native comp of a package being
-  installed does not load "hyperbole-autoloads.el".  When building 
Hyperbole
-  without a package manager, 'make eln' now builds it natively.
+** HYPERBOLE SYSTEM  (See "(hyperbole)").
 
-  *** Natively Compiled Functions as Action Types: Now may be used as Hyperbole
-  button action types.  See "(hyperbole)Action Types".
+  *** Any Colorized Display: Face display and colorization of Hyperbole
+  buttons now works on any display capable of displaying colors.  See
+  "(hyperbole)Button Colors".
 
-  *** Reduced Warnings: Large number of byte-compiler warnings eliminated when
-  building the Hyperbole package.  None of these warnings should affect use

[elpa] externals/hyperbole 430fd6d23b 3/4: Update manual for today with new ibtype

2023-05-08 Thread ELPA Syncer
branch: externals/hyperbole
commit 430fd6d23b99983280b747f3699a9fce11c37431
Author: Bob Weiner 
Commit: Bob Weiner 

Update manual for today with new ibtype
---
 ChangeLog  |   3 +
 Makefile   |   9 +-
 man/hyperbole.html | 404 -
 man/hyperbole.info | Bin 598515 -> 601614 bytes
 man/hyperbole.pdf  | Bin 1350932 -> 1353645 bytes
 man/hyperbole.texi |  21 +--
 man/version.texi   |   4 +-
 7 files changed, 265 insertions(+), 176 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9b6b019470..9287a99290 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2023-05-07  Bob Weiner  
 
+* Makefile (manual): Add manual target to build manual without building other
+doc outputs.
+
 * test/kimport-tests.el: Improve all these tests and add
 `kimport--aug-post-outline'.
 
diff --git a/Makefile b/Makefile
index 8c0ba07234..3545971d98 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # Author:   Bob Weiner
 #
 # Orig-Date:15-Jun-94 at 03:42:38
-# Last-Mod: 23-Apr-23 at 14:36:37 by Bob Weiner
+# Last-Mod:  7-May-23 at 20:33:02 by Bob Weiner
 #
 # Copyright (C) 1994-2023  Free Software Foundation, Inc.
 # See the file HY-COPY for license information.
@@ -359,8 +359,11 @@ version: doc
fi
@ echo ""
 
-# Build the Info, HTML and Postscript versions of the user manual and 
README.md.html.
-doc: README.md.html info html pdf
+# Build the README.md.html and Info, HTML and Postscript versions of the user 
manual
+doc: README.md.html manual
+
+# Build the Info, HTML and Postscript versions of the user manual
+manual: info html pdf
 
 TEXINFO_SRC = $(man_dir)/hyperbole.texi $(man_dir)/version.texi 
$(man_dir)/hkey-help.txt $(man_dir)/im/*.png
 
diff --git a/man/hyperbole.html b/man/hyperbole.html
index fe9e447401..b0ae46c5c5 100644
--- a/man/hyperbole.html
+++ b/man/hyperbole.html
@@ -4,7 +4,7 @@
 
 
 

[elpa] externals/hyperbole updated (025abc4b35 -> 81dfd8961b)

2023-05-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/hyperbole.

  from  025abc4b35 Merge branch 'master' of hyperbole
   new  db3de929d4 man/im/action-key-animation.gif: Update this animated gif
   new  bc3fbcf750 Add hyperbole-run-test-definition ibtype to run an ERT 
test from def
   new  430fd6d23b Update manual for today with new ibtype
   new  81dfd8961b Merge pull request #323 from rswgnu/rsw


Summary of changes:
 ChangeLog   |  36 +++-
 HY-NEWS | 329 +---
 Makefile|   9 +-
 README.md   |   2 +-
 hibtypes.el |   7 +-
 hypb-ert.el |  50 -
 kotl/EXAMPLE.kotl   |  35 ++--
 kotl/kimport.el | 229 ++-
 kotl/kotl-mode.el   |  11 +-
 man/hkey-help.txt   |   1 +
 man/hyperbole.html  | 404 
 man/hyperbole.info  | Bin 598515 -> 601614 bytes
 man/hyperbole.pdf   | Bin 1350932 -> 1353645 bytes
 man/hyperbole.texi  | 151 ---
 man/im/action-key-animation.gif | Bin 752827 -> 669509 bytes
 man/version.texi|   4 +-
 test/kimport-tests.el   |  69 +--
 17 files changed, 814 insertions(+), 523 deletions(-)



[elpa] externals/org-transclusion 6a4145c49b: fix: load extensions upon loading org-transclusion

2023-05-08 Thread ELPA Syncer
branch: externals/org-transclusion
commit 6a4145c49b4fb52eac6429eb1edc49257d801e4a
Author: Noboru Ota 
Commit: Noboru Ota 

fix: load extensions upon loading org-transclusion

Library org-transclusion-font-lock was required regardless of the
extension setting. This is the way it is supposed to be.
---
 org-transclusion.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/org-transclusion.el b/org-transclusion.el
index 6b6d0a85f1..439995bef7 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -40,7 +40,6 @@
 (require 'org-element)
 (require 'org-id)
 (require 'text-clone)
-(require 'org-transclusion-font-lock)
 (require 'text-property-search)
 (require 'seq)
 
@@ -1749,5 +1748,8 @@ FORCE will let this function ignore
 (error (message "Problems while trying to load feature `%s'" ext
 (setq org-transclusion-extensions-loaded t)))
 
+;; Load extensions upon loading this file
+(org-transclusion-load-extensions-maybe)
+
 (provide 'org-transclusion)
 ;;; org-transclusion.el ends here



[elpa] externals/transient 6ff5c51f26: transient-isearch-abort: Fix partial match case

2023-05-08 Thread Jonas Bernoulli
branch: externals/transient
commit 6ff5c51f26fdc9c2d4fba1a0c5e7f728bb911f8e
Author: Jonas Bernoulli 
Commit: Jonas Bernoulli 

transient-isearch-abort: Fix partial match case

If the search is successful, then `isearch-abort' cancels, and we
have to additionally call `transient--isearch-exit' as we already
do.

However, if the search is unsuccessful, then `isearch-abort' only
rubs out input until the search becomes successful.  This does not
exit the search, so we must not call `transient--isearch-exit'.
---
 lisp/transient.el | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 952cfb8233..6e8f9ebf05 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3934,8 +3934,13 @@ search instead."
 (defun transient-isearch-abort ()
   "Like `isearch-abort' but adapted for `transient'."
   (interactive)
-  (condition-case nil (isearch-abort) (quit))
-  (transient--isearch-exit))
+  (let ((around (lambda (fn)
+  (condition-case nil (funcall fn) (quit))
+  (transient--isearch-exit
+(advice-add 'isearch-cancel :around around)
+(unwind-protect
+(isearch-abort)
+  (advice-remove 'isearch-cancel around
 
 (defun transient--isearch-setup ()
   (select-window transient--window)



[elpa] externals/url-http-oauth 8601d89d43 18/24: Complete regexp, list and token refresh design

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 8601d89d438f80ae83e4532497b5239bd7ad47a2
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Complete regexp, list and token refresh design

* url-http-oauth.el (url-http-oauth--interposed): Update
docstring.
(url-http-oauth--interposed-regexp): New variable.
(url-http-oauth-url-string): Update docstring.
(url-http-oauth-url-object): Likewise.
(url-http-oauth-url-no-query): New function.
(url-http-oauth-settings): Change implementation to be list-based.
(url-http-oauth-update-regexp): New function.
(url-http-oauth-interpose): Expand docstring.  Change
implementation to be list-based.
(url-http-oauth-uninterpose): Likewise.
(url-http-oauth-interposed-p): New function.
(url-http-oauth-port): Allow URL string arguments.
(url-http-oauth-auth-source-search): Reimplement to put entire
non-query URL string in :host field.
(url-http-oauth--parse-grant): New function.
(url-http-oauth-refresh-token-string): New function.
(url-http-oauth-url-build-refresh): Likewise.
(url-http-oauth--netrc-delete): Likewise.
(url-http-oauth-save-bearer): Likewise.
(url-http-oauth-refresh-access-token-grant): Likewise.
(url-http-oauth-retrieve-and-save-bearer): Likewise.
(url-http-oauth-get-bearer): Reimplement using new function.
(url-oauth-auth): Check URL argument against regexp before
proceeding.
---
 url-http-oauth.el | 529 ++
 1 file changed, 370 insertions(+), 159 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index bf1bf785a6..5d141674c2 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -37,30 +37,60 @@
 (require 'url-util)
 (require 'json)
 
+;; FIXME: make functions private.
+
 (defvar url-http-oauth--interposed nil
-  "A hash table mapping URL strings to lists of OAuth 2.0 settings.")
+  "A list of OAuth 2.0 settings association lists.")
+
+(defvar url-http-oauth--interposed-regexp nil
+  "A regular expression matching URLs.
+If a URL matches this regular expression, `url' will use this
+`url-http-oauth' to access resources at the URL via OAuth 2.0.")
 
 (defun url-http-oauth-url-string (url)
-  "Ensure URL is a string."
+  "Return URL as a string.
+URL is string or an object."
   (if (stringp url) url (url-recreate-url url)))
 
 (defun url-http-oauth-url-object (url)
-  "Ensure URL is a parsed URL object."
+  "Return URL as a parsed URL object.
+URL is a string or an object."
   (if (stringp url) (url-generic-parse-url url) url))
 
+(defun url-http-oauth-url-no-query (url)
+  "Return an object representing URL with no query components.
+URL is a string or an object."
+  (let ((url (url-http-oauth-url-object url)))
+(url-parse-make-urlobj
+ (url-type url)
+ nil nil
+ (url-host url)
+ (url-portspec url)
+ (car (url-path-and-query url))
+ nil nil t)))
+
 (defun url-http-oauth-settings (url)
   "Return a settings list if URL needs OAuth 2.0, nil otherwise.
-URL is either a URL object."
-  (when url-http-oauth--interposed
-(let* ((url-no-query (url-parse-make-urlobj
-  (url-type url)
-  nil nil
-  (url-host url)
-  (url-portspec url)
-  (car (url-path-and-query url))
-  nil nil t))
-   (key (url-http-oauth-url-string url-no-query)))
-  (gethash key url-http-oauth--interposed
+URL is an object or a string."
+  (let* ((url (url-http-oauth-url-string url)))
+(catch 'found
+  (dolist (settings url-http-oauth--interposed)
+(when (or (string-prefix-p (cdr (assoc "resource-url" settings)) url)
+  (catch 'match
+(dolist (prefix (cdr (assoc "resource-url-prefixes"
+settings)))
+  (when (string-prefix-p prefix url)
+(throw 'match t)
+  (throw 'found settings))
+
+(defun url-http-oauth-update-regexp ()
+  "Update `url-http-oauth--interposed-regexp'."
+  (let (all-urls)
+(dolist (settings url-http-oauth--interposed)
+  (push (cdr (assoc "resource-url" settings)) all-urls)
+  (dolist (prefix (cdr (assoc "resource-url-prefixes" settings)))
+(push prefix all-urls)))
+(setq url-http-oauth--interposed-regexp (regexp-opt all-urls
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
 ;; catches on, authorization-url and access-token-url can be made
@@ -68,75 +98,79 @@ URL is either a URL object."
 ;; 2023, RFC 8414 is not consistently implemented yet.
 (defun url-http-oauth-interpose (url-settings)
   "Arrange for Emacs to use OAuth 2.0 to access a URL using URL-SETTINGS.
-URL-SETTINGS is an alist with fields whose descriptions follow.
-URL will be accessed by Emacs's `url' library with a suitable
-\"Authorization\" header containin

[elpa] externals/url-http-oauth 85ea04418c 01/24: url-http-oauth.el: New package

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 85ea04418c810bb9ecf64f5a85fefc0a719e962f
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

url-http-oauth.el: New package

* url-http-oauth.el: New package.
* .gitignore: Ignore autogenerated files.
---
 .gitignore|  3 +++
 url-http-oauth.el | 51 +++
 2 files changed, 54 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00..0a4f7ee4c7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/url-http-oauth-pkg.el
+/url-http-oauth-autoloads.el
+*.elc
diff --git a/url-http-oauth.el b/url-http-oauth.el
new file mode 100644
index 00..ba0916d30f
--- /dev/null
+++ b/url-http-oauth.el
@@ -0,0 +1,51 @@
+;;; url-http-oauth.el --- Add OAuth 2.0 authentication support to URL library 
-*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation, Inc.
+
+;; Author: Thomas Fitzsimmons 
+;; Version: 0
+;; Keywords: comm, data, processes, hypermedia
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+;;
+;; This package provides an OAuth 2.0 handler for Emacs's URL library.
+;;
+;; Installation:
+;;
+;; M-x package-install RET url-http-oauth RET
+
+;;; Code:
+(require 'url-auth)
+(require 'url-http)
+(require 'url-util)
+
+(defvar url-http-oauth--registered-oauth-urls nil
+  "A hash table mapping URL strings to lists of OAuth 2.0 configuration 
items.")
+
+;;; Public function called by `url-get-authentication'.
+;;;###autoload
+(defun url-oauth-auth (url &optional _prompt _overwrite _realm _args)
+  "Return an OAuth 2.0 HTTP authorization header.
+URL is a structure representing a parsed URL."
+  nil)
+
+;;; Register `url-oauth-auth' HTTP authentication method.
+;;;###autoload
+(url-register-auth-scheme "oauth" nil 9)
+
+(provide 'url-http-oauth)
+
+;;; url-http-oauth.el ends here



[elpa] externals/url-http-oauth 40c46af10c 24/24: Bump version to 0.8.0

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 40c46af10c6b815d5f97594714469d5da079b154
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Bump version to 0.8.0

* url-http-oauth.el: Bump version to 0.8.0.
* NEWS: New file.
---
 NEWS  | 21 +
 url-http-oauth.el |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
new file mode 100644
index 00..b1131cea41
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,21 @@
+GNU Emacs url-http-oauth NEWS -- history of user-visible changes.
+
+* New in url-http-oauth 0.8.0
+
+Released 2023-05-08
+
+Warning: To handle refresh tokens, url-http-oauth needs to delete
+entries from netrc files listed in the `auth-sources' variable.
+Please back up all files listed in the `auth-sources' variable before
+trying url-http-oauth 0.8.0 because the netrc entry deletion code is
+new and relatively untested.  Deletion respects the customization
+value of `auth-source-save-behavior'; if it is set to `ask', you will
+be prompted before the entry deletion happens.
+
+** Introduce ability to delete entries in `auth-sources' netrc files.
+
+** Feature-complete for EWS access.
+See excorporate 1.1.0 package for example configuration.
+
+** Feature-complete for Sourcehut GraphQL access.
+See url-http-oauth-demo 1.0.0 package for example configuration.
diff --git a/url-http-oauth.el b/url-http-oauth.el
index 9e25ed7c6d..427fc371f4 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2023 Free Software Foundation, Inc.
 
 ;; Author: Thomas Fitzsimmons 
-;; Version: 0
+;; Version: 0.8.0
 ;; Keywords: comm, data, processes, hypermedia
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] externals/url-http-oauth 9b2af487e3 22/24: Use relative expiry time in seconds

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 9b2af487e3cb3e8ae8f5a17f4de33586cabcc37b
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Use relative expiry time in seconds

* url-http-oauth.el (url-http-oauth--expiry-string): Use
expires_in, not expires_on.
---
 url-http-oauth.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 30e0007ce3..4ca678314e 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -287,9 +287,9 @@ endpoint."
 (defun url-http-oauth--expiry-string (grant)
   "Return as a string a number representing the expiry time of GRANT.
 The time is in seconds since the epoch."
-  (let ((expiry (gethash "expires_on" grant)))
+  (let ((expiry (gethash "expires_in" grant)))
 (unless expiry (error "url-http-oauth: Did not find expiry time in grant"))
-expiry))
+(format-time-string "%s" (time-add nil (string-to-number expiry)
 
 (defun url-http-oauth--refresh-token-string (grant)
   "Return the refresh token from GRANT.



[elpa] externals/url-http-oauth 085d57961a 20/24: Make message formatting consistent

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 085d57961a4b42d41f324c0af0512f0684b3fe28
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Make message formatting consistent

* url-http-oauth.el (url-http-oauth-interpose)
(url-http-oauth--parse-grant, url-http-oauth--expiry-string)
(url-http-oauth--url-build-refresh, url-oauth-auth): Add package
name herald to error message.
(url-http-oauth--netrc-delete): Remove a message.
---
 url-http-oauth.el | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 5394846391..b0ef7dcfe5 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -133,7 +133,7 @@ REDIRECT_URI."
   (let* ((client-secret-method
   (cdr (assoc "client-secret-method" url-settings
 (unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
-  (error "Unrecognized client-secret-method value"))
+  (error "url-http-oauth: Unrecognized client-secret-method value"))
 (prog1
 (add-to-list 'url-http-oauth--interposed url-settings)
   (url-http-oauth--update-regexp
@@ -223,14 +223,14 @@ server to receive a new access token."
 (defun url-http-oauth--parse-grant ()
   "Parse the JSON grant structure in the current buffer.
 Return the parsed JSON object."
-  (message "url-http-oauth grant: %s" (buffer-string))
+  (message "url-http-oauth: grant: %s" (buffer-string))
   (progn
 (goto-char (point-min))
 (re-search-forward "\n\n")
 (let* ((grant (url-http-oauth--json-parse-buffer))
(type (gethash "token_type" grant)))
   (unless (equal (downcase type) "bearer")
-(error "Unrecognized token type %s" type))
+(error "url-http-oauth: Unrecognized token type %s" type))
   ;; Return grant object.
   grant)))
 
@@ -284,7 +284,7 @@ endpoint."
   "Return as a string a number representing the expiry time of GRANT.
 The time is in seconds since the epoch."
   (let ((expiry (gethash "expires_on" grant)))
-(unless expiry (error "Did not find expiry time in grant"))
+(unless expiry (error "url-http-oauth: Did not find expiry time in grant"))
 expiry))
 
 (defun url-http-oauth--refresh-token-string (grant)
@@ -327,13 +327,14 @@ The refresh token is an opaque string."
 (url-build-query-string
  (apply #'list
 (let ((resource-url
-   (cdr (assoc "resource-url" url-settings
+   (cdr (assoc "resource-url" url-settings)))
+  (error-message
+   "url-http-oauth: Failed to retrieve refresh token for %s"))
   (list "refresh_token"
 (or (plist-get
  (url-http-oauth--auth-source-search resource-url)
  :refresh-token)
-(error "Failed to retrieve refresh token for %s"
-   resource-url
+(error error-message resource-url
 (list "client_id" client-identifier)
 (list "grant_type" "refresh_token")
 (list "resource" resource)
@@ -415,7 +416,6 @@ The entry is cleared from the `password-data' cache after 
the
nil
1
   (when prior-start-point
-(message "prior start point: %s" prior-start-point)
 (goto-char prior-start-point)
 (auth-source-netrc-parse-next-interesting)
 (goto-char (pos-bol))
@@ -526,7 +526,7 @@ permissions that the caller is requesting."
 (let ((bearer (url-http-oauth--get-bearer url)))
   (if bearer
   (concat "Bearer " bearer)
-(error "Bearer retrieval failed for %s" url)
+(error "url-http-oauth: Bearer retrieval failed for %s" url)
 
 ;;; Register `url-oauth-auth' HTTP authentication method.
 ;;;###autoload



[elpa] externals/url-http-oauth 3b3f9fe53f 12/24: Support extra arguments on authorization URL

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 3b3f9fe53f6f716161917697b24e278cdbe8405c
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Support extra arguments on authorization URL

* url-http-oauth.el (url-http-oauth--extra-arguments): New hash
table.
(url-http-oauth-settings): Add extra parameter.
(url-http-oauth-interpose): Add extra-arguments parameter.
(url-http-oauth-uninterpose): Delete entry from new hash table.
(url-http-oauth-get-access-token-grant): Wrap a long line.
(url-http-oauth-get-bearer): Put extra arguments in query string.
---
 url-http-oauth.el | 45 +++--
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 279f718fb7..70817fb46a 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -39,6 +39,9 @@
 (defvar url-http-oauth--interposed nil
   "A hash table mapping URL strings to lists of OAuth 2.0 settings.")
 
+(defvar url-http-oauth--extra-arguments nil
+  "A hash table mapping URL strings to lists of extra OAuth 2.0 settings.")
+
 (defun url-http-oauth-url-string (url)
   "Ensure URL is a string."
   (if (stringp url) url (url-recreate-url url)))
@@ -47,10 +50,13 @@
   "Ensure URL is a parsed URL object."
   (if (stringp url) (url-generic-parse-url url) url))
 
-(defun url-http-oauth-settings (url)
+(defun url-http-oauth-settings (url &optional extra)
   "Return a settings list if URL needs OAuth 2.0, nil otherwise.
-URL is either a URL object or a URL string."
-  (when url-http-oauth--interposed
+URL is either a URL object or a URL string.  If EXTRA is non-nil,
+return the extra settings for URL."
+  (when (if extra
+url-http-oauth--extra-arguments
+  url-http-oauth--interposed)
 (let* ((url-no-query (url-parse-make-urlobj
   (url-type url)
   nil nil
@@ -59,13 +65,15 @@ URL is either a URL object or a URL string."
   (car (url-path-and-query url))
   nil nil t))
(key (url-http-oauth-url-string url-no-query)))
-  (gethash key url-http-oauth--interposed
+  (gethash key (if extra
+   url-http-oauth--extra-arguments
+ url-http-oauth--interposed)
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
 ;; catches on, authorization-url and access-token-url can be made
 ;; optional and their values retrieved automatically.  As of early
 ;; 2023, RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-interpose (url-settings)
+(defun url-http-oauth-interpose (url-settings &optional extra-arguments)
   "Arrange for Emacs to use OAuth 2.0 to access a URL using URL-SETTINGS.
 URL-SETTINGS is an alist with fields whose descriptions follow.
 URL will be accessed by Emacs's `url' library with a suitable
@@ -77,25 +85,30 @@ strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
 library or mode to the server.  SCOPE is a string defining the
 -permissions that the Emacs library or mode is requesting.
 CLIENT-SECRET-METHOD is the symbol `prompt' if a client secret is
-required, nil otherwise.  Extra fields are allowed in
-URL-SETTINGS, in which case they will be appended verbatim to the
-authorization URL's query arguments."
+required, nil otherwise.  EXTRA-ARGUMENTS contains an alist of
+extra arguments that should be included in the authorization URL."
   (unless url-http-oauth--interposed
 (setq url-http-oauth--interposed (make-hash-table :test #'equal)))
+  (unless url-http-oauth--extra-arguments
+(setq url-http-oauth--extra-arguments (make-hash-table :test #'equal)))
   (let* ((url (cadr (assoc "url" url-settings)))
  (key (url-http-oauth-url-string url))
  (client-secret-method
   (cadr (assoc "client-secret-method" url-settings
 (unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
   (error "Unrecognized client-secret-method value"))
-(puthash key url-settings url-http-oauth--interposed)))
+(puthash key url-settings url-http-oauth--interposed)
+(puthash key extra-arguments url-http-oauth--extra-arguments)))
 
 (defun url-http-oauth-uninterpose (url)
   "Arrange for Emacs not to use OAuth 2.0 when accessing URL.
 This function does the opposite of `url-http-oauth-interpose'.
 URL is either an object or a string."
-  (when url-http-oauth--interposed
-(remhash (url-http-oauth-url-string url) url-http-oauth--interposed)))
+  (let ((url-string (url-http-oauth-url-string url)))
+(when url-http-oauth--interposed
+  (remhash url-string url-http-oauth--interposed))
+(when url-http-oauth--extra-arguments
+  (remhash url-string url-http-oauth--extra-arguments
 
 (defvar url-http-response-status)
 (defvar auth-source-creation-prompts)
@@ -114,7 +127,8 @@ Assume an HTTPS URL that does not specify a port uses 443."
(cadr (assoc "access-token-

[elpa] externals/url-http-oauth e1408ed406 02/24: Implement provider registration

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit e1408ed4062f8a3cda9f18d67aeea01e8fc4d4b6
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Implement provider registration

* url-http-oauth.el (url-http-oauth--registered-oauth-urls):
Adjust doc string.
(url-http-oauth-url-string): New function.
(url-http-oauth-url-object): Likewise.
(url-http-oauth-register-provider): Likewise.
* url-http-oauth.el (url-oauth-auth): Fix byte compiler warning.
---
 url-http-oauth.el | 36 ++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index ba0916d30f..acbd40ffbb 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -32,15 +32,47 @@
 (require 'url-http)
 (require 'url-util)
 
+;; For evaluation during development:
+;; (setq url-http-oauth--registered-oauth-urls nil)
+;; (message "%S" url-http-oauth--registered-oauth-urls)
 (defvar url-http-oauth--registered-oauth-urls nil
-  "A hash table mapping URL strings to lists of OAuth 2.0 configuration 
items.")
+  "A hash table mapping URL strings to lists of OAuth 2.0 configuration.")
+
+(defun url-http-oauth-url-string (url)
+  "Ensure URL is a string."
+  (if (url-p url) (url-recreate-url url) url))
+
+(defun url-http-oauth-url-object (url)
+  "Ensure URL is a parsed URL object."
+  (if (url-p url) url (url-generic-parse-url url)))
+
+;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
+;; catches on, authorize-url and access-token-url can be made
+;; optional, and their values retrieved automatically.  But from what
+;; I can tell RFC 8414 is not consistently implemented yet.
+(defun url-http-oauth-register-provider (url authorize-url access-token-url)
+  "Register URL as an OAuth 2.0 provider.
+URL will be accessed by Emacs with a suitable \"Authorization\"
+header containing \"Bearer \".  AUTHORIZE-URL and
+ACCESS-TOKEN-URL will be used to acquire  and save it to
+the user's `auth-source' file.  URL and ACCESS-TOKEN-URL are
+either URL structures or URL strings."
+  (unless url-http-oauth--registered-oauth-urls
+(setq url-http-oauth--registered-oauth-urls
+  (make-hash-table :test #'equal)))
+  (let ((key (url-http-oauth-url-string url))
+(authorize (url-http-oauth-url-object authorize-url))
+(access-token (url-http-oauth-url-object access-token-url)))
+(puthash key (list authorize access-token)
+ url-http-oauth--registered-oauth-urls)))
 
 ;;; Public function called by `url-get-authentication'.
 ;;;###autoload
 (defun url-oauth-auth (url &optional _prompt _overwrite _realm _args)
   "Return an OAuth 2.0 HTTP authorization header.
 URL is a structure representing a parsed URL."
-  nil)
+  ;; Do nothing for now.
+  (when url nil))
 
 ;;; Register `url-oauth-auth' HTTP authentication method.
 ;;;###autoload



[elpa] externals/url-http-oauth 8719575647 10/24: Add scope argument to top-level interpose function

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 871957564735b50f2a06cfed4b382ef117fee092
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Add scope argument to top-level interpose function

* url-http-oauth.el (url-http-oauth-interpose): Include scope in
arguments.
(url-http-oauth-uninterpose): Rename.
(url-http-oauth-get-access-token-grant): Handle scope.
(url-http-oauth-get-bearer): Update scope handling.  Consolidate
let* forms.
---
 url-http-oauth.el | 100 --
 1 file changed, 52 insertions(+), 48 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 5ccf6488dc..2d94b95dc5 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -69,6 +69,7 @@ URL is either a URL object or a URL string."
  authorization-url
  access-token-url
  client-identifier
+ scope
  &optional
  client-secret-required)
   "Arrange for Emacs to use OAuth 2.0 to access URL.
@@ -78,14 +79,16 @@ AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to 
acquire
  and save it to the user's `auth-source' file.  URL,
 AUTHORIZATION-URL and ACCESS-TOKEN-URL are either objects or
 strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
-library or mode to the server.  CLIENT-SECRET-REQUIRED is the
-symbol `prompt' if a client secret is required, nil otherwise."
+library or mode to the server.  SCOPE is a string defining the
+-permissions that the Emacs library or mode is requesting.
+CLIENT-SECRET-REQUIRED is the symbol `prompt' if a client secret
+is required, nil otherwise."
   (unless url-http-oauth--interposed
 (setq url-http-oauth--interposed (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
 (authorization (url-http-oauth-url-string authorization-url))
 (access-token-object (url-http-oauth-url-object access-token-url)))
-(puthash key (list authorization access-token-object client-identifier
+(puthash key (list authorization access-token-object client-identifier 
scope
(cond
 ((eq client-secret-required 'prompt) 'prompt)
 ((eq client-secret-required nil) nil)
@@ -93,10 +96,10 @@ symbol `prompt' if a client secret is required, nil 
otherwise."
 "Unrecognized client-secret-required value"
  url-http-oauth--interposed)))
 
-(defun url-http-oauth-ignore (url)
+(defun url-http-oauth-uninterpose (url)
   "Arrange for Emacs not to use OAuth 2.0 when accessing URL.
 This function does the opposite of `url-http-oauth-interpose'.
-URL is either an objects or a string."
+URL is either an object or a string."
   (when url-http-oauth--interposed
 (remhash (url-http-oauth-url-string url) url-http-oauth--interposed)))
 
@@ -114,7 +117,8 @@ Assume an HTTPS URL that does not specify a port uses 443."
  (url-list (url-http-oauth-configuration url))
  (access-token-object (nth 1 url-list))
  (client-identifier (nth 2 url-list))
- (client-secret-required (nth 3 url-list))
+ (scope (nth 3 url-list))
+ (client-secret-required (nth 4 url-list))
  (auth-result
   (when client-secret-required
 (car (let ((auth-source-creation-prompts
@@ -126,6 +130,7 @@ Assume an HTTPS URL that does not specify a port uses 443."
 :host (url-host access-token-object)
 :port (url-http-oauth-port access-token-object)
 :path (url-filename access-token-object)
+:scope scope
 :create '(path)
 :max 1)
  (client-secret (auth-info-password auth-result))
@@ -181,10 +186,10 @@ The time is in seconds since the epoch."
 (defun url-http-oauth-get-bearer (url)
   "Prompt the user with the authorization endpoint for URL.
 URL is a parsed object."
-  (let* ((path-and-query (url-path-and-query url))
+  (let* ((url-list (url-http-oauth-configuration url))
+ (path-and-query (url-path-and-query url))
  (path (car path-and-query))
- (query (cdr path-and-query))
- (scope (cadr (assoc "scope" (url-parse-query-string query
+ (scope (nth 3 url-list))
  (bearer-current (auth-info-password
   (car
(let ((auth-source-do-cache nil))
@@ -195,46 +200,45 @@ URL is a parsed object."
   :path path
   :scope scope
   :max 1))
+(unless url-list
+  (error "%s is not interposed by url-http-oauth"
+ (url-http-oauth-url-string url)))
 (or bearer-current
-(let ((url-list (url-http-oauth-configuration url)))
-  (unless ur

[elpa] externals/url-http-oauth 0bf4a7633d 08/24: Complete confidential client support

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 0bf4a7633d6ca1958323500c00fdd82efe4f11ff
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Complete confidential client support

* url-http-oauth.el: Remove mml-url requirement.  Remove
development comments.
(url-http-oauth-configuration): Allow user and scope in URL
itself.
(url-http-oauth-register-resource): Remove scope argument.  Rename
some variables.
(url-http-oauth-get-access-token-grant): Rename.  Implement
auth-source saving.
(url-http-oauth-expiry-string): New function.
(url-http-oauth-extract-authorization-code): Reimplement using
url-parse-query-string.
(url-http-oauth-get-bearer): Do not cache auth-source queries.
(url-oauth-auth): Remove a debug message.
---
 url-http-oauth.el | 233 --
 1 file changed, 122 insertions(+), 111 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 382d26b35f..4852bab2f3 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -31,11 +31,7 @@
 (require 'url-auth)
 (require 'url-http)
 (require 'url-util)
-(require 'mm-url)
 
-;; For evaluation during development:
-;; (setq url-http-oauth--registered-oauth-urls nil)
-;; (message "%S" url-http-oauth--registered-oauth-urls)
 (defvar url-http-oauth--registered-oauth-urls nil
   "A hash table mapping URL strings to lists of OAuth 2.0 configuration.")
 
@@ -50,18 +46,25 @@
 (defun url-http-oauth-configuration (url)
   "Return a configuration list if URL needs OAuth 2.0, nil otherwise.
 URL is either a URL object or a URL string."
-  (let ((key (url-http-oauth-url-string url)))
-(gethash key url-http-oauth--registered-oauth-urls)))
+  (when url-http-oauth--registered-oauth-urls
+(let* ((url-no-query (url-parse-make-urlobj
+  (url-type url)
+  nil nil
+  (url-host url)
+  (url-portspec url)
+  (car (url-path-and-query url))
+  nil nil t))
+   (key (url-http-oauth-url-string url-no-query)))
+  (gethash key url-http-oauth--registered-oauth-urls
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
 ;; catches on, authorization-url and access-token-url can be made
-;; optional, and their values retrieved automatically.  But from what
-;; I can tell RFC 8414 is not consistently implemented yet.
+;; optional and their values retrieved automatically.  As of early
+;; 2023, RFC 8414 is not consistently implemented yet.
 (defun url-http-oauth-register-resource (url
  authorization-url
  access-token-url
  client-identifier
- scope
  &optional
  client-secret-required)
   "Tell Emacs that to access URL, it needs to use OAuth 2.0.
@@ -69,19 +72,17 @@ URL will be accessed by Emacs's `url' library with a 
suitable
 \"Authorization\" header containing \"Bearer \".
 AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to acquire
  and save it to the user's `auth-source' file.  URL,
-AUTHORIZATION-URL and ACCESS-TOKEN-URL are either URL objects or
-URL strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
-library or mode to the server.  SCOPE is a string defining the
-permissions that the Emacs library or mode is requesting.
-CLIENT-SECRET-REQUIRED is the symbol `prompt' if a client secret
-is required, nil otherwise."
+AUTHORIZATION-URL and ACCESS-TOKEN-URL are either objects or
+strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
+library or mode to the server.  CLIENT-SECRET-REQUIRED is the
+symbol `prompt' if a client secret is required, nil otherwise."
   (unless url-http-oauth--registered-oauth-urls
 (setq url-http-oauth--registered-oauth-urls
   (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
 (authorization (url-http-oauth-url-string authorization-url))
-(access-token (url-http-oauth-url-string access-token-url)))
-(puthash key (list authorization access-token client-identifier scope
+(access-token-object (url-http-oauth-url-object access-token-url)))
+(puthash key (list authorization access-token-object client-identifier
(cond
 ((eq client-secret-required 'prompt) 'prompt)
 ((eq client-secret-required nil) nil)
@@ -89,148 +90,158 @@ is required, nil otherwise."
 "Unrecognized client-secret-required value"
  url-http-oauth--registered-oauth-urls)))
 
-;; (car (auth-source-search :host "https://meta.sr.ht/oauth2/access-token"; 
:login "107ba4a9-2a96-4420-8818-84ec1f112405" :max 1))
+(defun url-http-oauth-unregister-resource (url)
+  "Te

[elpa] externals/url-http-oauth 1ecb40b545 17/24: Make some adjustments based on testing

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 1ecb40b5454af9346cf6d2092e45eb96029f41ad
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Make some adjustments based on testing

* url-http-oauth.el (url-http-oauth-get-access-token-grant): Omit
authorization header if it is not required.  Include client_id and
redirect_uri in request data.  Downcase token_type value.
(url-http-oauth-get-bearer): Encode scope for auth-source search.
---
 url-http-oauth.el | 43 +++
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 1591a0eaa6..bf1bf785a6 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -185,15 +185,20 @@ Filter out nil spec entries prior to searching."
 (format "%s:%s" client-identifier client-secret)
 t
  (url-request-extra-headers
-  (if authorization
-  (list (cons "Content-Type" "application/x-www-form-urlencoded")
-(cons "Authorization" authorization))
-;; client-secret-method was nil; no authorization required.
-(list (cons "Content-Type" "application/x-www-form-urlencoded"
+  (apply #'list
+ (cons "Content-Type" "application/x-www-form-urlencoded")
+ (when authorization (cons "Authorization" authorization
+ (redirect-uri
+  (cdr (assoc "redirect_uri"
+  (cdr (assoc "authorization-extra-arguments"
+  url-settings)
  (url-request-data
   (url-build-query-string
-   (list (list "grant_type" "authorization_code")
- (list "code" code)
+   (apply #'list (list "code" code)
+  (list "client_id" client-identifier)
+  (list "grant_type" "authorization_code")
+  (when redirect-uri
+(list (list "redirect_uri" redirect-uri)))
 (with-current-buffer (url-retrieve-synchronously access-token-object)
   (if (eq 'OK (car (alist-get url-http-response-status url-http-codes)))
   (progn
@@ -201,7 +206,7 @@ Filter out nil spec entries prior to searching."
 (re-search-forward "\n\n")
 (let* ((grant (url-http-oauth-json-parse-buffer))
(type (gethash "token_type" grant)))
-  (unless (equal type "bearer" )
+  (unless (equal (dowcase type) "bearer")
 (error "Unrecognized token type %s for %s at %s" type
client-identifier (url-http-oauth-url-string url)))
   ;; Success, so save client secret, if necessary.
@@ -247,7 +252,7 @@ URL is a parsed object."
  (url-settings (url-http-oauth-settings url))
  (path-and-query (url-path-and-query url))
  (path (car path-and-query))
- (scope (cdr (assoc "scope" url-settings)))
+ (scope (url-http-oauth-encode-scope (cdr (assoc "scope" 
url-settings
  (bearer-current (url-http-oauth-auth-info-password
   (car
(let ((auth-source-do-cache nil))
@@ -284,13 +289,19 @@ URL is a parsed object."
  :host (url-host url)
  :port (url-http-oauth-port url)
  :path path
- :scope (if (string= (gethash "scope" grant)
- scope)
-(url-http-oauth-encode-scope scope)
-  (error
-   (concat "url-http-oauth:"
-   " Returned scope did not"
-   " match requested scope")))
+ :scope
+ (let ((returned-scope
+(gethash "scope" grant)))
+   (if (string=
+(url-http-oauth-encode-scope
+ returned-scope)
+scope)
+   scope
+ (error
+  (concat "url-http-oauth:"
+  " Returned scope %S did not"
+  " match requested scope"
+  returned-scope
  :expiry (url-http-oauth-expiry-string grant)
  :secret bearer-retrieved))
(save-function (plist-get (car auth-result) :save-function)))



[elpa] externals/url-http-oauth 334e644a43 07/24: Finish bearer proof-of-concept

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 334e644a439cf584c946c42472fcc0a0456d18d4
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Finish bearer proof-of-concept

* url-http-oauth.el: Remove some commented sections.
(url-http-oauth-get-bearer): Finish rough implementation.
---
 url-http-oauth.el | 84 ---
 1 file changed, 37 insertions(+), 47 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 5257d3b9f5..382d26b35f 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -130,22 +130,6 @@ is required, nil otherwise."
   (mm-url-encode-www-form-urlencoded
(list (cons "grant_type" "authorization_code")
  (cons "code" code)
-;; (url-retrieve access-token-url
-;;   (lambda (status)
-;; (let ((event (plist-get status :error)))
-;;   (if event
-;;   (error "Failed to get token: %s" event)
-;; (goto-char (point-min))
-;; (re-search-forward "\n\n")
-;; (let* ((grant (json-parse-buffer))
-;;(type (gethash "token_type" grant)))
-;;   (unless (equal type "bearer" )
-;; (error "Unrecognized token type: %s" type))
-;;   (auth-source-search
-;;:host key-url
-;;:secret (gethash "access_token" grant)
-;;:expiry (gethash "expires_in" grant)
-;;:create t))
 (with-current-buffer (url-retrieve-synchronously access-token-url)
   (if (eq 'OK (car (alist-get url-http-response-status url-http-codes)))
   (progn
@@ -200,37 +184,43 @@ is required, nil otherwise."
 (defun url-http-oauth-get-bearer (url)
   "Prompt the user with the authorization endpoint for URL."
   (let* ((key-url (url-http-oauth-url-string url))
- (url-list (url-http-oauth-configuration key-url)))
-(unless url-list
-  (error "%s is not registered with url-http-oauth" key-url))
-(let* ((response-url
-(read-from-minibuffer
- (format "Browse to %s and paste the redirected code URL: "
- (concat (nth 0 url-list)
- "?"
- (mm-url-encode-www-form-urlencoded
-  (list (cons "client_id" (nth 2 url-list))
-(cons "response_type" "code")
-;; FIXME: expiry?
-(cons "scope" (nth 3 url-list
-   (code (url-http-oauth-extract-authorization-code response-url)))
-  (url-http-oauth-get-access-token url code)
-  ;; FIXME: why doesn't the authentication get saved?
-  ;; (funcall (plist-get (car (auth-source-search :host 
"https://meta.sr.ht/query"; :secret "example" :expiry 86399 :create t)) 
:save-function))
-  )))
-
-;; (setq fitzsim-banana (auth-source-search :host "banana" :secret "orange3" 
:create t))
-
-;; Works, but need 
-;; (when (functionp (plist-get (car fitzsim-banana) :save-function)) (funcall 
(plist-get (car fitzsim-banana) :save-function)))
-
-;;(defvar url-http-oauth-testval nil "Test value.")
-;;(setq url-http-oauth-testval nil)
-;;(setq url-http-oauth-testval (url-http-oauth-get-authorization-code 
"https://meta.sr.ht/query";))
-
-;; works: (auth-source-search :max 1 :host 
"https://meta.sr.ht/oauth2/access-token";)
-;; (defvar url-http-oauth-fulltokenbuf nil "Test buf.")
-;; (setq url-http-oauth-fulltokenbuf (url-http-oauth-get-access-token 
"https://meta.sr.ht/query"; "eb869898585b6e21cf016dc0126d48e8"))
+ (bearer-current (auth-info-password
+  (car (auth-source-search
+:host key-url
+:user user-login-name
+:max 1)
+(or bearer-current
+(let ((url-list (url-http-oauth-configuration key-url)))
+  (unless url-list
+(error "%s is not registered with url-http-oauth" key-url))
+  (let* ((response-url
+  (read-from-minibuffer
+   (format "Browse to %s and paste the redirected code URL: "
+   (concat (nth 0 url-list)
+   "?"
+   (mm-url-encode-www-form-urlencoded
+(list (cons "client_id" (nth 2 url-list))
+  (cons "response_type" "code")
+  ;; FIXME: Add :expiry support to
+  ;; auth-source?
+  (cons "scope" (nth 3 url-list
+ (code (url-http-oauth-extract-authorization

[elpa] externals/url-http-oauth ee73bb0450 19/24: Make functions private, fix some bugs

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit ee73bb045021eeef119ed638f61226fdcd011ed1
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Make functions private, fix some bugs

* url-http-oauth.el (url-http-oauth--url-string)
(url-http-oauth--url-object, url-http-oauth--url-no-query)
(url-http-oauth--settings, url-http-oauth--update-regexp)
(url-http-oauth--port, url-http-oauth--auth-info-password)
(url-http-oauth--json-parse-buffer)
(url-http-oauth--auth-source-search)
(url-http-oauth--parse-grant)
(url-http-oauth--get-access-token-grant)
(url-http-oauth--expiry-string)
(url-http-oauth--refresh-token-string)
(url-http-oauth--extract-authorization-code)
(url-http-oauth--authorization-url)
(url-http-oauth--url-build-refresh)
(url-http-oauth--netrc-delete, url-http-oauth--save-bearer)
(url-http-oauth--refresh-access-token-grant)
(url-http-oauth--retrieve-and-save-bearer)
(url-http-oauth--get-bearer): Rename to indicate private scope.
(url-http-oauth--parse-grant): Dump grant buffer contents to
messages buffer.  Fix downcase typo.  Fix error message format.
(url-http-oauth--get-access-token-grant): Save access-token-url to
auth-sources.  Fix access-token-object typo.
(url-http-oauth--expiry-string): Use "expires_on" for absolute
expiry time.
(url-http-oauth--refresh-token-string): Fix copy-n-paste error.
(url-http-oauth--authorization-url): Wrap a long line.
(url-http-oauth--url-build-refresh): Wrap some long lines.
(url-http-oauth--netrc-delete): Use pos-bol and pos-eol.
(url-http-oauth--refresh-access-token-grant): Update docstring.
(url-http-oauth--retrieve-and-save-bearer): Fix docstring.
(url-http-oauth-get-bearer): Simplify resource-url handling.
---
 url-http-oauth.el | 190 ++
 1 file changed, 93 insertions(+), 97 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 5d141674c2..5394846391 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -37,8 +37,6 @@
 (require 'url-util)
 (require 'json)
 
-;; FIXME: make functions private.
-
 (defvar url-http-oauth--interposed nil
   "A list of OAuth 2.0 settings association lists.")
 
@@ -47,20 +45,20 @@
 If a URL matches this regular expression, `url' will use this
 `url-http-oauth' to access resources at the URL via OAuth 2.0.")
 
-(defun url-http-oauth-url-string (url)
+(defun url-http-oauth--url-string (url)
   "Return URL as a string.
 URL is string or an object."
   (if (stringp url) url (url-recreate-url url)))
 
-(defun url-http-oauth-url-object (url)
+(defun url-http-oauth--url-object (url)
   "Return URL as a parsed URL object.
 URL is a string or an object."
   (if (stringp url) (url-generic-parse-url url) url))
 
-(defun url-http-oauth-url-no-query (url)
+(defun url-http-oauth--url-no-query (url)
   "Return an object representing URL with no query components.
 URL is a string or an object."
-  (let ((url (url-http-oauth-url-object url)))
+  (let ((url (url-http-oauth--url-object url)))
 (url-parse-make-urlobj
  (url-type url)
  nil nil
@@ -69,10 +67,10 @@ URL is a string or an object."
  (car (url-path-and-query url))
  nil nil t)))
 
-(defun url-http-oauth-settings (url)
+(defun url-http-oauth--settings (url)
   "Return a settings list if URL needs OAuth 2.0, nil otherwise.
 URL is an object or a string."
-  (let* ((url (url-http-oauth-url-string url)))
+  (let* ((url (url-http-oauth--url-string url)))
 (catch 'found
   (dolist (settings url-http-oauth--interposed)
 (when (or (string-prefix-p (cdr (assoc "resource-url" settings)) url)
@@ -83,7 +81,7 @@ URL is an object or a string."
 (throw 'match t)
   (throw 'found settings))
 
-(defun url-http-oauth-update-regexp ()
+(defun url-http-oauth--update-regexp ()
   "Update `url-http-oauth--interposed-regexp'."
   (let (all-urls)
 (dolist (settings url-http-oauth--interposed)
@@ -138,7 +136,7 @@ REDIRECT_URI."
   (error "Unrecognized client-secret-method value"))
 (prog1
 (add-to-list 'url-http-oauth--interposed url-settings)
-  (url-http-oauth-update-regexp
+  (url-http-oauth--update-regexp
 
 (defun url-http-oauth-uninterpose (url-settings)
   "Arrange for Emacs not to use OAuth 2.0 when accessing URL in URL-SETTINGS.
@@ -146,33 +144,28 @@ This function does the opposite of 
`url-http-oauth-interpose'."
   (prog1
   (setq url-http-oauth--interposed
 (delete url-settings url-http-oauth--interposed))
-(url-http-oauth-update-regexp)))
+(url-http-oauth--update-regexp)))
 
 (defun url-http-oauth-interposed-p (url)
   "Return non-nil if `url' will use OAuth 2.0 to access URL.
 URL is an object."
   (string-match-p url-http-oauth--interposed-regexp
-  (url-http-oauth-url-string url)))
+  (url-http-oauth--url-string url)))
 
 (defvar url-http-re

[elpa] externals/url-http-oauth 7e825a8765 21/24: Allow per-provider user-agent interaction function

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 7e825a876548502a52107048e6f8a8ab49e0f2c9
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Allow per-provider user-agent interaction function

* url-http-oauth.el (url-http-oauth-interpose): Document
authorization-code-function.
(url-http-oauth--retrieve-and-save-bearer): Use
authorization-code-function if it is provided in settings.
---
 url-http-oauth.el | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index b0ef7dcfe5..30e0007ce3 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -129,7 +129,11 @@ pairs that will be appended to the authorization URL.  
Specific
 pairs in this list are not standardized but may be required or
 recommended by the OAuth 2.0 provider.  Examples of string types
 include RESOURCE, RESPONSE_MODE, LOGIN_HINT, PROMPT and
-REDIRECT_URI."
+REDIRECT_URI.
+
+AUTHORIZATION-CODE-FUNCTION is an elisp function that takes an
+authorization URL as a string argument, and returns, as a string,
+a full URL containing a code value in its query string."
   (let* ((client-secret-method
   (cdr (assoc "client-secret-method" url-settings
 (unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
@@ -485,11 +489,15 @@ Save the bearer token to `auth-sources' then return it."
 (defun url-http-oauth--retrieve-and-save-bearer (url url-settings)
   "Retrieve the bearer token required for URL, using URL-SETTINGS.
 Save the bearer token to `auth-sources' upon success."
-  (let* ((response-url
-  ;; FIXME: Make this a per-provider function.
-  (read-from-minibuffer
-   (format "Browse to %s and paste the redirected code URL: "
-   (url-http-oauth--authorization-url url-settings
+  (let* ((authorization-code-function
+  (cdr (assoc "authorization-code-function" url-settings)))
+ (authorization-url (url-http-oauth--authorization-url url-settings))
+ (response-url
+  (if (functionp authorization-code-function)
+  (funcall authorization-code-function authorization-url)
+(read-from-minibuffer
+ (format "Browse to %s and paste the redirected code URL: "
+ authorization-url
  (code
   (url-http-oauth--extract-authorization-code response-url))
  (grant (url-http-oauth--get-access-token-grant url-settings code)))



[elpa] externals/url-http-oauth 9d5c820c90 14/24: Fix auth-source lookups

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 9d5c820c9025405637a455fc359b4a3fd03c5919
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Fix auth-source lookups

* url-http-oauth.el (url-http-oauth-port): Always return the port
as a string.
(url-http-oauth-get-bearer): Use empty string for null user.
---
 url-http-oauth.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 6d2f68c5d7..8ec20bc314 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -102,7 +102,10 @@ This function does the opposite of 
`url-http-oauth-interpose'."
 (defun url-http-oauth-port (url)
   "Return port of URL object.
 Assume an HTTPS URL that does not specify a port uses 443."
-  (or (url-port url) (when (string= "https" (url-type url)) 443)))
+  (let ((port-number (url-port url)))
+(if port-number
+   (number-to-string port-number)
+  (when (string= "https" (url-type url)) "443"
 
 (defun url-http-oauth-get-access-token-grant (url code)
   "Get an access token for URL using CODE."
@@ -202,7 +205,7 @@ URL is a parsed object."
   (car
(let ((auth-source-do-cache nil))
  (auth-source-search
-  :user (url-user url)
+  :user (or (url-user url) "")
   :host (url-host url)
   :port (url-http-oauth-port url)
   :path path
@@ -222,7 +225,7 @@ URL is a parsed object."
(bearer-retrieved (gethash "access_token" grant))
(auth-result (let ((auth-source-do-cache nil))
   (auth-source-search
-   :user (url-user url)
+   :user (or (url-user url) "")
:host (url-host url)
:port (url-http-oauth-port url)
:path path
@@ -238,7 +241,7 @@ URL is a parsed object."
:create '(path scope expiry)
:max 1)))
(save-function (plist-get (car auth-result) :save-function)))
-;; Success; save bearer.
+  ;; Success; save bearer.
   (when (functionp save-function)
 (funcall save-function))
   bearer-retrieved



[elpa] externals/url-http-oauth 972011f217 04/24: Shorten header line to fit into 80 columns

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 972011f21704950543062ddf7d3254ec5269eef0
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Shorten header line to fit into 80 columns

* url-http-oauth.el: Shorten header line to fit into 80 columns.
---
 url-http-oauth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 56fb613347..0799642196 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -1,4 +1,4 @@
-;;; url-http-oauth.el --- Add OAuth 2.0 authentication support to URL library 
-*- lexical-binding: t -*-
+;;; url-http-oauth.el --- OAuth 2.0 for URL library -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2023 Free Software Foundation, Inc.
 



[elpa] externals/url-http-oauth e95f685771 06/24: Begin auth-source implementation

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit e95f6857719d4781a9f51659e3cbd6f65f32ca04
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Begin auth-source implementation

* url-http-oauth.el (url-http-oauth-register-resource): Add
client-secret-required argument.
(url-http-response-status): Define variable.
(url-http-oauth-get-access-token): Start client-secret
implementation.  Start auth-source implementation.
---
 url-http-oauth.el | 99 ++-
 1 file changed, 76 insertions(+), 23 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 78ef0dafe1..5257d3b9f5 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -61,7 +61,9 @@ URL is either a URL object or a URL string."
  authorization-url
  access-token-url
  client-identifier
- scope)
+ scope
+ &optional
+ client-secret-required)
   "Tell Emacs that to access URL, it needs to use OAuth 2.0.
 URL will be accessed by Emacs's `url' library with a suitable
 \"Authorization\" header containing \"Bearer \".
@@ -70,17 +72,27 @@ AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to 
acquire
 AUTHORIZATION-URL and ACCESS-TOKEN-URL are either URL objects or
 URL strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
 library or mode to the server.  SCOPE is a string defining the
-permissions that the Emacs library or mode is requesting."
+permissions that the Emacs library or mode is requesting.
+CLIENT-SECRET-REQUIRED is the symbol `prompt' if a client secret
+is required, nil otherwise."
   (unless url-http-oauth--registered-oauth-urls
 (setq url-http-oauth--registered-oauth-urls
   (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
 (authorization (url-http-oauth-url-string authorization-url))
 (access-token (url-http-oauth-url-string access-token-url)))
-(puthash key (list authorization access-token client-identifier scope)
+(puthash key (list authorization access-token client-identifier scope
+   (cond
+((eq client-secret-required 'prompt) 'prompt)
+((eq client-secret-required nil) nil)
+(t (error
+"Unrecognized client-secret-required value"
  url-http-oauth--registered-oauth-urls)))
 
-;; (car (auth-source-search :host "https://meta.sr.ht/oauth2/access-token"; 
:user "107ba4a9-2a96-4420-8818-84ec1f112405" :max 1))
+;; (car (auth-source-search :host "https://meta.sr.ht/oauth2/access-token"; 
:login "107ba4a9-2a96-4420-8818-84ec1f112405" :max 1))
+
+(defvar url-http-response-status)
+
 (defun url-http-oauth-get-access-token (url code)
   "Get an access token for URL using CODE."
   (let* ((url-request-method "POST")
@@ -88,16 +100,29 @@ permissions that the Emacs library or mode is requesting."
  (url-list (url-http-oauth-configuration key-url))
  (access-token-url (nth 1 url-list))
  (client-identifier (nth 2 url-list))
- (client-secret
-  (auth-info-password
-   (car (auth-source-search :host access-token-url
-:user client-identifier
-:max 1
- (authorization (concat "Basic "
-(base64-encode-string
- (format "%s:%s" client-identifier
- client-secret)
- t)))
+ (client-secret-required (nth 4 url-list))
+ (client-secret-current (when client-secret-required
+  (auth-info-password
+   (car (auth-source-search
+ :host access-token-url
+ ;; FIXME: Why doesn't :user
+ ;; work here, but :login
+ ;; does?
+ :login client-identifier
+ :max 1)
+ (client-secret-read (unless client-secret-current
+   (when client-secret-required
+ (read-from-minibuffer
+  (format "Client secret for %s at %s: "
+  client-identifier key-url)
+ (authorization (concat
+ "Basic "
+ (base64-encode-string
+  (format "%s:%s" client-identifier
+  (or client-secret-current client-secret-read

[elpa] externals/url-http-oauth d86dbb478d 23/24: Retest against sourcehut, fix new issues

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit d86dbb478d2eccebf276c554eebe8c6c53c67f89
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Retest against sourcehut, fix new issues

* url-http-oauth.el (url-http-oauth--update-regexp): Check for nil
resource-url and resource-url-prefixes entries.
(url-http-oauth--get-access-token-grant): Add missing nil argument
to url-http-oauth--auth-source-search call.  Make last argument to
apply a list.  Do not include client identifier in request body if
it is already in the authorization header.
(url-http-oauth--expiry-string): Handle expiry being a number
instead of a string.
---
 url-http-oauth.el | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 4ca678314e..9e25ed7c6d 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -85,9 +85,14 @@ URL is an object or a string."
   "Update `url-http-oauth--interposed-regexp'."
   (let (all-urls)
 (dolist (settings url-http-oauth--interposed)
-  (push (cdr (assoc "resource-url" settings)) all-urls)
-  (dolist (prefix (cdr (assoc "resource-url-prefixes" settings)))
-(push prefix all-urls)))
+  (let ((resource-url (cdr (assoc "resource-url" settings)))
+(resource-url-prefixes
+ (cdr (assoc "resource-url-prefixes" settings
+(when resource-url
+  (push resource-url all-urls))
+(when resource-url-prefixes
+  (dolist (prefix resource-url-prefixes)
+(push prefix all-urls)
 (setq url-http-oauth--interposed-regexp (regexp-opt all-urls
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
@@ -250,7 +255,7 @@ endpoint."
  (auth-result
   (when client-secret-method
 (url-http-oauth--auth-source-search
- access-token-url client-identifier
+ access-token-url client-identifier nil
  "Client secret for %u at %h: ")))
  (client-secret (url-http-oauth--auth-info-password auth-result))
  (save-function (plist-get auth-result :save-function))
@@ -263,14 +268,19 @@ endpoint."
  (url-request-extra-headers
   (apply #'list
  (cons "Content-Type" "application/x-www-form-urlencoded")
- (when authorization (cons "Authorization" authorization
+ (when authorization
+   (list (cons "Authorization" authorization)
  (redirect-uri
   (cdr (assoc "redirect_uri" (cdr (assoc 
"authorization-extra-arguments"
  url-settings)
  (url-request-data
   (url-build-query-string
(apply #'list (list "code" code)
-  (list "client_id" client-identifier)
+  (when (not authorization)
+;; Client identifier is included in authorization
+;; string.  Some services object to it also being
+;; in the body.
+(list "client_id" client-identifier))
   (list "grant_type" "authorization_code")
   (when redirect-uri
 (list (list "redirect_uri" redirect-uri)))
@@ -289,7 +299,9 @@ endpoint."
 The time is in seconds since the epoch."
   (let ((expiry (gethash "expires_in" grant)))
 (unless expiry (error "url-http-oauth: Did not find expiry time in grant"))
-(format-time-string "%s" (time-add nil (string-to-number expiry)
+(format-time-string "%s" (time-add nil (if (stringp expiry)
+   (string-to-number expiry)
+ expiry)
 
 (defun url-http-oauth--refresh-token-string (grant)
   "Return the refresh token from GRANT.



[elpa] externals/url-http-oauth f5b953197b 15/24: Fix auth-source-search for path and scope

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit f5b953197b880c8de162c50428d9e7c26ab6f3ea
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Fix auth-source-search for path and scope

* url-http-oauth.el(url-http-oauth-port): Fix whitespace.
(url-http-oauth-auth-source-search): New function.
(url-http-oauth-get-access-token-grant): Search using new function
before saving client secret.
(url-http-oauth-port): Fix whitespace.
(url-http-oauth-get-bearer): Make use of new function.
---
 url-http-oauth.el | 92 ++-
 1 file changed, 57 insertions(+), 35 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 8ec20bc314..40e7b4e72f 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -104,9 +104,27 @@ This function does the opposite of 
`url-http-oauth-interpose'."
 Assume an HTTPS URL that does not specify a port uses 443."
   (let ((port-number (url-port url)))
 (if port-number
-   (number-to-string port-number)
+(number-to-string port-number)
   (when (string= "https" (url-type url)) "443"
 
+(defun url-http-oauth-auth-source-search (&rest spec)
+  "Like `auth-source-search' but search for all of SPEC in all backends.
+Filter out nil spec entries prior to searching."
+  (let* ((auth-source-do-cache nil)
+ (all (apply #'auth-source-search :max 5001 spec)) ; no :max 'all
+ (spec (cl-loop for i below (length spec) by 2
+unless (null (nth (1+ i) spec))
+collect (nth i spec)
+unless (null (nth (1+ i) spec))
+collect (nth (1+ i) spec)))
+ (result (cl-loop for entry in all
+  when (auth-source-specmatchp spec entry)
+  collect entry)))
+(unless (eq (length result) 1)
+  (warn "url-http-oauth-auth-source-search produced multiple results for 
%s"
+spec))
+result))
+
 (defun url-http-oauth-get-access-token-grant (url code)
   "Get an access token for URL using CODE."
   (let* ((url-request-method "POST")
@@ -120,18 +138,21 @@ Assume an HTTPS URL that does not specify a port uses 
443."
 url-settings)))
  (auth-result
   (when client-secret-method
-(car (let ((auth-source-creation-prompts
-'((secret . "Client secret for %u at %h")))
-   ;; Do not cache nil result.
-   (auth-source-do-cache nil))
-   (auth-source-search
-:user client-identifier
-:host (url-host access-token-object)
-:port (url-http-oauth-port access-token-object)
-:path (url-filename access-token-object)
-:scope scope
-:create '(path)
-:max 1)
+(car (let* ((auth-source-creation-prompts
+ '((secret . "Client secret for %u at %h")))
+;; Do not cache nil result.
+(auth-source-do-cache nil)
+(spec (list :user client-identifier
+:host (url-host access-token-object)
+:port (url-http-oauth-port
+   access-token-object)
+:path (url-filename access-token-object)
+:scope scope))
+(existing-entry
+ (apply #'url-http-oauth-auth-source-search spec)))
+   (or existing-entry
+   (apply #'auth-source-search
+  :create '(path scope) spec))
  (client-secret (auth-info-password auth-result))
  (save-function (plist-get auth-result :save-function))
  (authorization (when client-secret
@@ -197,20 +218,20 @@ The time is in seconds since the epoch."
 (defun url-http-oauth-get-bearer (url)
   "Prompt the user with the authorization endpoint for URL.
 URL is a parsed object."
-  (let* ((url-settings (url-http-oauth-settings url))
+  (let* ((url (url-http-oauth-url-object url))
+ (url-settings (url-http-oauth-settings url))
  (path-and-query (url-path-and-query url))
  (path (car path-and-query))
  (scope (cadr (assoc "scope" url-settings)))
  (bearer-current (auth-info-password
   (car
(let ((auth-source-do-cache nil))
- (auth-source-search
-  :user (or (url-user url) "")
+ (url-http-oauth-auth-source-search
+  :user (url-user url)
   :host (url-host url)
   :port (url-http-oauth-port url)
   

[elpa] externals/url-http-oauth 38157dfb3a 09/24: Reduce overloading of "register"

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 38157dfb3adf3f7fd44ecaa7eed738fff0b22606
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Reduce overloading of "register"

* url-http-oauth.el: Add Usage section to Commentary.
(url-http-oauth--interposed): Rename.
(url-http-oauth-configuration): Update references.
(url-http-oauth-interpose): Rename.  Update references.
(url-http-oauth-ignore): Rename.
(url-http-oauth-get-bearer): Update error message.
---
 url-http-oauth.el | 43 +++
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 4852bab2f3..5ccf6488dc 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -26,13 +26,17 @@
 ;; Installation:
 ;;
 ;; M-x package-install RET url-http-oauth RET
+;;
+;; Usage:
+;;
+;; See url-http-oauth-demo.el.
 
 ;;; Code:
 (require 'url-auth)
 (require 'url-http)
 (require 'url-util)
 
-(defvar url-http-oauth--registered-oauth-urls nil
+(defvar url-http-oauth--interposed nil
   "A hash table mapping URL strings to lists of OAuth 2.0 configuration.")
 
 (defun url-http-oauth-url-string (url)
@@ -46,7 +50,7 @@
 (defun url-http-oauth-configuration (url)
   "Return a configuration list if URL needs OAuth 2.0, nil otherwise.
 URL is either a URL object or a URL string."
-  (when url-http-oauth--registered-oauth-urls
+  (when url-http-oauth--interposed
 (let* ((url-no-query (url-parse-make-urlobj
   (url-type url)
   nil nil
@@ -55,19 +59,19 @@ URL is either a URL object or a URL string."
   (car (url-path-and-query url))
   nil nil t))
(key (url-http-oauth-url-string url-no-query)))
-  (gethash key url-http-oauth--registered-oauth-urls
+  (gethash key url-http-oauth--interposed
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
 ;; catches on, authorization-url and access-token-url can be made
 ;; optional and their values retrieved automatically.  As of early
 ;; 2023, RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-register-resource (url
- authorization-url
- access-token-url
- client-identifier
- &optional
- client-secret-required)
-  "Tell Emacs that to access URL, it needs to use OAuth 2.0.
+(defun url-http-oauth-interpose (url
+ authorization-url
+ access-token-url
+ client-identifier
+ &optional
+ client-secret-required)
+  "Arrange for Emacs to use OAuth 2.0 to access URL.
 URL will be accessed by Emacs's `url' library with a suitable
 \"Authorization\" header containing \"Bearer \".
 AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to acquire
@@ -76,9 +80,8 @@ AUTHORIZATION-URL and ACCESS-TOKEN-URL are either objects or
 strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
 library or mode to the server.  CLIENT-SECRET-REQUIRED is the
 symbol `prompt' if a client secret is required, nil otherwise."
-  (unless url-http-oauth--registered-oauth-urls
-(setq url-http-oauth--registered-oauth-urls
-  (make-hash-table :test #'equal)))
+  (unless url-http-oauth--interposed
+(setq url-http-oauth--interposed (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
 (authorization (url-http-oauth-url-string authorization-url))
 (access-token-object (url-http-oauth-url-object access-token-url)))
@@ -88,14 +91,14 @@ symbol `prompt' if a client secret is required, nil 
otherwise."
 ((eq client-secret-required nil) nil)
 (t (error
 "Unrecognized client-secret-required value"
- url-http-oauth--registered-oauth-urls)))
+ url-http-oauth--interposed)))
 
-(defun url-http-oauth-unregister-resource (url)
-  "Tell Emacs not to use OAuth 2.0 when accessing URL.
+(defun url-http-oauth-ignore (url)
+  "Arrange for Emacs not to use OAuth 2.0 when accessing URL.
+This function does the opposite of `url-http-oauth-interpose'.
 URL is either an objects or a string."
-  (when url-http-oauth--registered-oauth-urls
-(remhash (url-http-oauth-url-string url)
- url-http-oauth--registered-oauth-urls)))
+  (when url-http-oauth--interposed
+(remhash (url-http-oauth-url-string url) url-http-oauth--interposed)))
 
 (defvar url-http-response-status)
 (defvar auth-source-creation-prompts)
@@ -195,7 +198,7 @@ URL is a parsed object."
 (or bearer-current
 (let ((url-list (url-http-oauth-configuration url)))
   (unless url-list
-(error "%s is not re

[elpa] externals/url-http-oauth e104630233 11/24: Convert to URL settings alist

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit e104630233c511b475c64cbcfd253d644a0b41fb
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Convert to URL settings alist

* url-http-oauth.el: Change "configuration" term to "settings".
(url-http-oauth-settings): Rename.
(url-http-oauth-interpose): Take a single alist argument.
(url-http-oauth-get-access-token-grant): Use settings alist.
Handle case where no client secret is required.
(url-http-oauth-get-bearer): Use settings alist.
(url-oauth-auth): Update call to url-http-oauth-settings.
---
 url-http-oauth.el | 90 +++
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 2d94b95dc5..279f718fb7 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -37,7 +37,7 @@
 (require 'url-util)
 
 (defvar url-http-oauth--interposed nil
-  "A hash table mapping URL strings to lists of OAuth 2.0 configuration.")
+  "A hash table mapping URL strings to lists of OAuth 2.0 settings.")
 
 (defun url-http-oauth-url-string (url)
   "Ensure URL is a string."
@@ -47,8 +47,8 @@
   "Ensure URL is a parsed URL object."
   (if (stringp url) (url-generic-parse-url url) url))
 
-(defun url-http-oauth-configuration (url)
-  "Return a configuration list if URL needs OAuth 2.0, nil otherwise.
+(defun url-http-oauth-settings (url)
+  "Return a settings list if URL needs OAuth 2.0, nil otherwise.
 URL is either a URL object or a URL string."
   (when url-http-oauth--interposed
 (let* ((url-no-query (url-parse-make-urlobj
@@ -65,14 +65,9 @@ URL is either a URL object or a URL string."
 ;; catches on, authorization-url and access-token-url can be made
 ;; optional and their values retrieved automatically.  As of early
 ;; 2023, RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-interpose (url
- authorization-url
- access-token-url
- client-identifier
- scope
- &optional
- client-secret-required)
-  "Arrange for Emacs to use OAuth 2.0 to access URL.
+(defun url-http-oauth-interpose (url-settings)
+  "Arrange for Emacs to use OAuth 2.0 to access a URL using URL-SETTINGS.
+URL-SETTINGS is an alist with fields whose descriptions follow.
 URL will be accessed by Emacs's `url' library with a suitable
 \"Authorization\" header containing \"Bearer \".
 AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to acquire
@@ -81,20 +76,19 @@ AUTHORIZATION-URL and ACCESS-TOKEN-URL are either objects or
 strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
 library or mode to the server.  SCOPE is a string defining the
 -permissions that the Emacs library or mode is requesting.
-CLIENT-SECRET-REQUIRED is the symbol `prompt' if a client secret
-is required, nil otherwise."
+CLIENT-SECRET-METHOD is the symbol `prompt' if a client secret is
+required, nil otherwise.  Extra fields are allowed in
+URL-SETTINGS, in which case they will be appended verbatim to the
+authorization URL's query arguments."
   (unless url-http-oauth--interposed
 (setq url-http-oauth--interposed (make-hash-table :test #'equal)))
-  (let ((key (url-http-oauth-url-string url))
-(authorization (url-http-oauth-url-string authorization-url))
-(access-token-object (url-http-oauth-url-object access-token-url)))
-(puthash key (list authorization access-token-object client-identifier 
scope
-   (cond
-((eq client-secret-required 'prompt) 'prompt)
-((eq client-secret-required nil) nil)
-(t (error
-"Unrecognized client-secret-required value"
- url-http-oauth--interposed)))
+  (let* ((url (cadr (assoc "url" url-settings)))
+ (key (url-http-oauth-url-string url))
+ (client-secret-method
+  (cadr (assoc "client-secret-method" url-settings
+(unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
+  (error "Unrecognized client-secret-method value"))
+(puthash key url-settings url-http-oauth--interposed)))
 
 (defun url-http-oauth-uninterpose (url)
   "Arrange for Emacs not to use OAuth 2.0 when accessing URL.
@@ -114,13 +108,15 @@ Assume an HTTPS URL that does not specify a port uses 
443."
 (defun url-http-oauth-get-access-token-grant (url code)
   "Get an access token for URL using CODE."
   (let* ((url-request-method "POST")
- (url-list (url-http-oauth-configuration url))
- (access-token-object (nth 1 url-list))
- (client-identifier (nth 2 url-list))
- (scope (nth 3 url-list))
- (client-secret-required (nth 4 url-list))
+ (url-settings (url-http-oauth-settings url))
+ (access-token-object
+  (url-http-oauth-ur

[elpa] externals/url-http-oauth fcb5929654 16/24: Fix auth-source lookup conflicts and config cdrs

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit fcb592965458196b4e0982b0c3fc3fd6a4bbc16e
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Fix auth-source lookup conflicts and config cdrs

* url-http-oauth.el (url-http-oauth-interpose): Change url to
urls.  Assume conses, not lists in url-settings.
(url-http-oauth-uninterpose): Likewise.
(url-http-no-retry): Define special variable.
(url-http-oauth-auth-source-search): Do not warn on zero results.
(url-http-oauth-encode-scope): New function.
(url-http-oauth-auth-info-password): Likewise.
(url-http-oauth-json-parse-buffer): Likewise.
(url-http-oauth-get-access-token-grant): Assume conses, not lists
in url-settings.  Do not set auth-source-do-cache to nil.
Simplify url-http-oauth-auth-source-search call.  Encode scope
with no spaces for authinfo storage.  Use
url-http-oauth-json-parse-buffer instead of json-parse-buffer
(url-http-oauth-authorization-url): Assume conses, not lists in
url-settings.  Apply list instead of using macro for
url-build-query-string argument.
(url-http-oauth-get-bearer): Use dummy "BEARER" user name.
Simplify call to auth-source-search.
---
 url-http-oauth.el | 135 +-
 1 file changed, 83 insertions(+), 52 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 40e7b4e72f..1591a0eaa6 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -35,6 +35,7 @@
 (require 'url-auth)
 (require 'url-http)
 (require 'url-util)
+(require 'json)
 
 (defvar url-http-oauth--interposed nil
   "A hash table mapping URL strings to lists of OAuth 2.0 settings.")
@@ -80,24 +81,30 @@ CLIENT-SECRET-METHOD is the symbol `prompt' if a client 
secret is
 required, nil otherwise."
   (unless url-http-oauth--interposed
 (setq url-http-oauth--interposed (make-hash-table :test #'equal)))
-  (let* ((url (cadr (assoc "url" url-settings)))
- (key (url-http-oauth-url-string url))
+  (let* ((urls (cdr (assoc "urls" url-settings)))
  (client-secret-method
-  (cadr (assoc "client-secret-method" url-settings
+  (cdr (assoc "client-secret-method" url-settings
 (unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
   (error "Unrecognized client-secret-method value"))
-(puthash key url-settings url-http-oauth--interposed)))
+(dolist (url urls)
+  (puthash (url-http-oauth-url-string url) url-settings
+   url-http-oauth--interposed
 
 (defun url-http-oauth-uninterpose (url-settings)
   "Arrange for Emacs not to use OAuth 2.0 when accessing URL in URL-SETTINGS.
 This function does the opposite of `url-http-oauth-interpose'."
   (when url-http-oauth--interposed
-(let* ((url (cadr (assoc "url" url-settings)))
-   (key (url-http-oauth-url-string url)))
-  (remhash key url-http-oauth--interposed
+(let* ((urls (cdr (assoc "urls" url-settings
+  (dolist (url urls)
+(remhash (url-http-oauth-url-string url)
+ url-http-oauth--interposed)
 
 (defvar url-http-response-status)
 (defvar auth-source-creation-prompts)
+;; FIXME: if anything goes wrong during the authentication steps,
+;; `url-http-end-of-document-sentinel' calls back into
+;; `url-oauth-auth' somehow.  Maybe `url-http-no-retry' can help here?
+(defvar url-http-no-retry)
 
 (defun url-http-oauth-port (url)
   "Return port of URL object.
@@ -110,8 +117,8 @@ Assume an HTTPS URL that does not specify a port uses 443."
 (defun url-http-oauth-auth-source-search (&rest spec)
   "Like `auth-source-search' but search for all of SPEC in all backends.
 Filter out nil spec entries prior to searching."
-  (let* ((auth-source-do-cache nil)
- (all (apply #'auth-source-search :max 5001 spec)) ; no :max 'all
+  (let* ((auth-source-do-cache nil) ; do not cache nil result.
+ (all (apply #'auth-source-search :max 5001 spec)) ; hmm, no :max 'all.
  (spec (cl-loop for i below (length spec) by 2
 unless (null (nth (1+ i) spec))
 collect (nth i spec)
@@ -120,40 +127,56 @@ Filter out nil spec entries prior to searching."
  (result (cl-loop for entry in all
   when (auth-source-specmatchp spec entry)
   collect entry)))
-(unless (eq (length result) 1)
+(unless (or (eq (length result) 0)
+(eq (length result) 1))
   (warn "url-http-oauth-auth-source-search produced multiple results for 
%s"
 spec))
 result))
 
+(defun url-http-oauth-encode-scope (scope)
+  "Replace spaces in SCOPE with plus signs."
+  (replace-regexp-in-string " " "+" scope))
+
+;; Backport of `auth-info-password'.
+(defun url-http-oauth-auth-info-password (auth-info)
+  "Return the :secret password from the AUTH-INFO."
+  (let ((secret (plist-get auth-info :secret)))
+(if (functionp secret)
+(funcal

[elpa] externals/url-http-oauth b884e725af 05/24: Get basics working for Sourcehut

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit b884e725af9704fe6d9d6660054dc9a50e6b70a8
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Get basics working for Sourcehut

* url-http-oauth.el: Update commentary.
Require mm-url.  Comment some test lines.
(url-http-oauth-url-string): Use stringp instead of url-p.
(url-http-oauth-url-object): Likewise.
(url-http-oauth-configuration): New function.
(url-http-oauth-register-resource): Rename.  Update documentation
and arguments.
(url-http-oauth-get-access-token): Use
url-http-oauth-configuration.  Use url-retrieve-synchronously.
(url-oauth-auth): Implement.
---
 url-http-oauth.el | 138 --
 1 file changed, 83 insertions(+), 55 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 0799642196..78ef0dafe1 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -21,7 +21,7 @@
 
 ;;; Commentary:
 ;;
-;; This package provides an OAuth 2.0 handler for Emacs's URL library.
+;; This package adds OAuth 2.0 support to Emacs's URL library.
 ;;
 ;; Installation:
 ;;
@@ -31,6 +31,7 @@
 (require 'url-auth)
 (require 'url-http)
 (require 'url-util)
+(require 'mm-url)
 
 ;; For evaluation during development:
 ;; (setq url-http-oauth--registered-oauth-urls nil)
@@ -40,79 +41,101 @@
 
 (defun url-http-oauth-url-string (url)
   "Ensure URL is a string."
-  (if (url-p url) (url-recreate-url url) url))
+  (if (stringp url) url (url-recreate-url url)))
 
 (defun url-http-oauth-url-object (url)
   "Ensure URL is a parsed URL object."
-  (if (url-p url) url (url-generic-parse-url url)))
+  (if (stringp url) (url-generic-parse-url url) url))
+
+(defun url-http-oauth-configuration (url)
+  "Return a configuration list if URL needs OAuth 2.0, nil otherwise.
+URL is either a URL object or a URL string."
+  (let ((key (url-http-oauth-url-string url)))
+(gethash key url-http-oauth--registered-oauth-urls)))
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
-;; catches on, authorize-url and access-token-url can be made
+;; catches on, authorization-url and access-token-url can be made
 ;; optional, and their values retrieved automatically.  But from what
 ;; I can tell RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-register-provider (url authorize-url access-token-url
- client-identifier scope)
-  "Register URL as an OAuth 2.0 provider.
-URL will be accessed by Emacs with a suitable \"Authorization\"
-header containing \"Bearer \".  AUTHORIZE-URL and
-ACCESS-TOKEN-URL will be used to acquire  and save it to
-the user's `auth-source' file.  URL and ACCESS-TOKEN-URL are
-either URL structures or URL strings."
+(defun url-http-oauth-register-resource (url
+ authorization-url
+ access-token-url
+ client-identifier
+ scope)
+  "Tell Emacs that to access URL, it needs to use OAuth 2.0.
+URL will be accessed by Emacs's `url' library with a suitable
+\"Authorization\" header containing \"Bearer \".
+AUTHORIZATION-URL and ACCESS-TOKEN-URL will be used to acquire
+ and save it to the user's `auth-source' file.  URL,
+AUTHORIZATION-URL and ACCESS-TOKEN-URL are either URL objects or
+URL strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
+library or mode to the server.  SCOPE is a string defining the
+permissions that the Emacs library or mode is requesting."
   (unless url-http-oauth--registered-oauth-urls
 (setq url-http-oauth--registered-oauth-urls
   (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
-(authorize (url-http-oauth-url-string authorize-url))
+(authorization (url-http-oauth-url-string authorization-url))
 (access-token (url-http-oauth-url-string access-token-url)))
-(puthash key (list authorize access-token client-identifier scope)
+(puthash key (list authorization access-token client-identifier scope)
  url-http-oauth--registered-oauth-urls)))
 
-
+;; (car (auth-source-search :host "https://meta.sr.ht/oauth2/access-token"; 
:user "107ba4a9-2a96-4420-8818-84ec1f112405" :max 1))
 (defun url-http-oauth-get-access-token (url code)
   "Get an access token for URL using CODE."
   (let* ((url-request-method "POST")
  (key-url (url-http-oauth-url-string url))
- (url-list (gethash key-url url-http-oauth--registered-oauth-urls))
+ (url-list (url-http-oauth-configuration key-url))
  (access-token-url (nth 1 url-list))
  (client-identifier (nth 2 url-list))
  (client-secret
-  (auth-info-password (car (auth-source-search :host access-token-url
-   :user client-identifier
-   :max 1
+   

[elpa] externals/url-http-oauth 4441b79a9a 13/24: Remove explicit extra argument handling

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 4441b79a9a21e3bfbad596779ffe4b466c7d9df6
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Remove explicit extra argument handling

* url-http-oauth.el (url-http-oauth--extra-arguments): Delete.
(url-http-oauth-settings): Remove extra argument.
(url-http-oauth-interpose): Likewise.
(url-http-oauth-uninterpose): Likewise.
(url-http-oauth-authorization-url): New function.
(url-http-oauth-get-bearer): Call new function.
---
 url-http-oauth.el | 68 ++-
 1 file changed, 27 insertions(+), 41 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 70817fb46a..6d2f68c5d7 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -39,9 +39,6 @@
 (defvar url-http-oauth--interposed nil
   "A hash table mapping URL strings to lists of OAuth 2.0 settings.")
 
-(defvar url-http-oauth--extra-arguments nil
-  "A hash table mapping URL strings to lists of extra OAuth 2.0 settings.")
-
 (defun url-http-oauth-url-string (url)
   "Ensure URL is a string."
   (if (stringp url) url (url-recreate-url url)))
@@ -50,13 +47,10 @@
   "Ensure URL is a parsed URL object."
   (if (stringp url) (url-generic-parse-url url) url))
 
-(defun url-http-oauth-settings (url &optional extra)
+(defun url-http-oauth-settings (url)
   "Return a settings list if URL needs OAuth 2.0, nil otherwise.
-URL is either a URL object or a URL string.  If EXTRA is non-nil,
-return the extra settings for URL."
-  (when (if extra
-url-http-oauth--extra-arguments
-  url-http-oauth--interposed)
+URL is either a URL object."
+  (when url-http-oauth--interposed
 (let* ((url-no-query (url-parse-make-urlobj
   (url-type url)
   nil nil
@@ -65,15 +59,13 @@ return the extra settings for URL."
   (car (url-path-and-query url))
   nil nil t))
(key (url-http-oauth-url-string url-no-query)))
-  (gethash key (if extra
-   url-http-oauth--extra-arguments
- url-http-oauth--interposed)
+  (gethash key url-http-oauth--interposed
 
 ;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
 ;; catches on, authorization-url and access-token-url can be made
 ;; optional and their values retrieved automatically.  As of early
 ;; 2023, RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-interpose (url-settings &optional extra-arguments)
+(defun url-http-oauth-interpose (url-settings)
   "Arrange for Emacs to use OAuth 2.0 to access a URL using URL-SETTINGS.
 URL-SETTINGS is an alist with fields whose descriptions follow.
 URL will be accessed by Emacs's `url' library with a suitable
@@ -85,30 +77,24 @@ strings.  CLIENT-IDENTIFIER is a string identifying an Emacs
 library or mode to the server.  SCOPE is a string defining the
 -permissions that the Emacs library or mode is requesting.
 CLIENT-SECRET-METHOD is the symbol `prompt' if a client secret is
-required, nil otherwise.  EXTRA-ARGUMENTS contains an alist of
-extra arguments that should be included in the authorization URL."
+required, nil otherwise."
   (unless url-http-oauth--interposed
 (setq url-http-oauth--interposed (make-hash-table :test #'equal)))
-  (unless url-http-oauth--extra-arguments
-(setq url-http-oauth--extra-arguments (make-hash-table :test #'equal)))
   (let* ((url (cadr (assoc "url" url-settings)))
  (key (url-http-oauth-url-string url))
  (client-secret-method
   (cadr (assoc "client-secret-method" url-settings
 (unless (or (eq client-secret-method 'prompt) (eq client-secret-method 
nil))
   (error "Unrecognized client-secret-method value"))
-(puthash key url-settings url-http-oauth--interposed)
-(puthash key extra-arguments url-http-oauth--extra-arguments)))
+(puthash key url-settings url-http-oauth--interposed)))
 
-(defun url-http-oauth-uninterpose (url)
-  "Arrange for Emacs not to use OAuth 2.0 when accessing URL.
-This function does the opposite of `url-http-oauth-interpose'.
-URL is either an object or a string."
-  (let ((url-string (url-http-oauth-url-string url)))
-(when url-http-oauth--interposed
-  (remhash url-string url-http-oauth--interposed))
-(when url-http-oauth--extra-arguments
-  (remhash url-string url-http-oauth--extra-arguments
+(defun url-http-oauth-uninterpose (url-settings)
+  "Arrange for Emacs not to use OAuth 2.0 when accessing URL in URL-SETTINGS.
+This function does the opposite of `url-http-oauth-interpose'."
+  (when url-http-oauth--interposed
+(let* ((url (cadr (assoc "url" url-settings)))
+   (key (url-http-oauth-url-string url)))
+  (remhash key url-http-oauth--interposed
 
 (defvar url-http-response-status)
 (defvar auth-source-creation-prompts)
@@ -194,6 +180,17 @@ The time is in seconds since the epoch."
 (error "url-

[elpa] externals/url-http-oauth cd6df20689 03/24: Implement authorization and access-token steps

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit cd6df20689edc63c55bcb85a873adfd76af6699f
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Implement authorization and access-token steps

* url-http-oauth.el (url-http-oauth-register-provider): Add
client-identifier and scope arguments.
(url-http-oauth-get-access-token): New function.
(url-http-oauth-extract-authorization-code): Likewise.
(url-http-oauth-get-authorization-code): Likewise.
Add some commented values for development.
---
 url-http-oauth.el | 96 ---
 1 file changed, 92 insertions(+), 4 deletions(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index acbd40ffbb..56fb613347 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -50,7 +50,8 @@
 ;; catches on, authorize-url and access-token-url can be made
 ;; optional, and their values retrieved automatically.  But from what
 ;; I can tell RFC 8414 is not consistently implemented yet.
-(defun url-http-oauth-register-provider (url authorize-url access-token-url)
+(defun url-http-oauth-register-provider (url authorize-url access-token-url
+ client-identifier scope)
   "Register URL as an OAuth 2.0 provider.
 URL will be accessed by Emacs with a suitable \"Authorization\"
 header containing \"Bearer \".  AUTHORIZE-URL and
@@ -61,11 +62,98 @@ either URL structures or URL strings."
 (setq url-http-oauth--registered-oauth-urls
   (make-hash-table :test #'equal)))
   (let ((key (url-http-oauth-url-string url))
-(authorize (url-http-oauth-url-object authorize-url))
-(access-token (url-http-oauth-url-object access-token-url)))
-(puthash key (list authorize access-token)
+(authorize (url-http-oauth-url-string authorize-url))
+(access-token (url-http-oauth-url-string access-token-url)))
+(puthash key (list authorize access-token client-identifier scope)
  url-http-oauth--registered-oauth-urls)))
 
+
+(defun url-http-oauth-get-access-token (url code)
+  "Get an access token for URL using CODE."
+  (let* ((url-request-method "POST")
+ (key-url (url-http-oauth-url-string url))
+ (url-list (gethash key-url url-http-oauth--registered-oauth-urls))
+ (access-token-url (nth 1 url-list))
+ (client-identifier (nth 2 url-list))
+ (client-secret
+  (auth-info-password (car (auth-source-search :host access-token-url
+   :user client-identifier
+   :max 1
+ (authorization (concat "Basic "
+(base64-encode-string
+ (format "%s:%s" client-identifier
+ client-secret)
+ t)))
+(url-request-extra-headers
+ (list (cons "Content-Type" "application/x-www-form-urlencoded")
+(cons "Authorization" authorization)))
+(url-request-data
+ (mm-url-encode-www-form-urlencoded
+   (list (cons "grant_type" "authorization_code")
+ (cons "code" code)
+(url-retrieve access-token-url
+  (lambda (status arguments)
+(let ((event (plist-get status :error)))
+  (if event
+  (error "Failed to get token: %s" event)
+(goto-char (point-min))
+(re-search-forward "\n\n")
+(let* ((grant (json-parse-buffer))
+   (type (gethash "token_type" grant)))
+  (unless (equal type "bearer" )
+(error "Unrecognized token type: %s" type))
+  (auth-source-search :host key-url
+  :secret (gethash "access_token")
+  :expiry (gethash "expires_in")
+  :create t
+
+;; FIXME: why doesn't the authentication get saved?
+;; (funcall (plist-get (car (auth-source-search :host 
"https://meta.sr.ht/query"; :secret "example" :expiry 86399 :create t)) 
:save-function))
+(defun url-http-oauth-extract-authorization-code (url)
+  "Extract the value of the code parameter in URL."
+  (let ((filename (url-filename (url-generic-parse-url url)))
+(query-index (string-search "?" filename)))
+(unless query-index
+  (error "Expected a URL with a query component after a `?' character"))
+(let* ((query (substring filename (1+ query-index)))
+   (code
+(catch 'found
+  (dolist (parameter (string-split query "&" t))
+(let ((pair (split-string parameter "=")))
+  (when (equal (car pair) "code")
+(throw 'found (cadr pair
+  (unless co

[elpa] branch externals/url-http-oauth created (now 40c46af10c)

2023-05-08 Thread Thomas Fitzsimmons
fitzsim pushed a change to branch externals/url-http-oauth.

at  40c46af10c Bump version to 0.8.0

This branch includes the following new commits:

   new  85ea04418c url-http-oauth.el: New package
   new  e1408ed406 Implement provider registration
   new  cd6df20689 Implement authorization and access-token steps
   new  972011f217 Shorten header line to fit into 80 columns
   new  b884e725af Get basics working for Sourcehut
   new  e95f685771 Begin auth-source implementation
   new  334e644a43 Finish bearer proof-of-concept
   new  0bf4a7633d Complete confidential client support
   new  38157dfb3a Reduce overloading of "register"
   new  8719575647 Add scope argument to top-level interpose function
   new  e104630233 Convert to URL settings alist
   new  3b3f9fe53f Support extra arguments on authorization URL
   new  4441b79a9a Remove explicit extra argument handling
   new  9d5c820c90 Fix auth-source lookups
   new  f5b953197b Fix auth-source-search for path and scope
   new  fcb5929654 Fix auth-source lookup conflicts and config cdrs
   new  1ecb40b545 Make some adjustments based on testing
   new  8601d89d43 Complete regexp, list and token refresh design
   new  ee73bb0450 Make functions private, fix some bugs
   new  085d57961a Make message formatting consistent
   new  7e825a8765 Allow per-provider user-agent interaction function
   new  9b2af487e3 Use relative expiry time in seconds
   new  d86dbb478d Retest against sourcehut, fix new issues
   new  40c46af10c Bump version to 0.8.0




[elpa] externals/url-http-oauth-demo 828ef46e55 05/13: Add background documentation

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 828ef46e55511d581bf1ef722a4eeacccefc1ae3
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Add background documentation

* url-http-oauth-demo.el: Add Background section.
(url-http-oauth-interpose): Rename.  Document arguments.
---
 url-http-oauth-demo.el | 104 -
 1 file changed, 95 insertions(+), 9 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 0ab1598b0c..b86563d2b9 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -22,8 +22,72 @@
 
 ;;; Commentary:
 ;;
-;; This package demonstrates an OAuth 2.0 flow for Sourcehut using the
-;; built-in GNU Emacs URL library and the url-http-oauth package.
+;; This package demonstrates OAuth 2.0 authentication and
+;; authorization to Sourcehut, using the built-in `url' and
+;; `auth-source'libraries and the new `url-http-oauth' package.
+;;
+;; Background:
+;;
+;; Sourcehut has implemented OAuth 2.0 for its services.  Its
+;; implementation is unique in that it is released as Free Software,
+;; and does not require JavaScript for any of the OAuth 2.0 steps.
+;;
+;; Here is a diagram summarizing protocol, adapted from RFC 6749:
+;;
+;;   `url' and `url-http-oauth' implement
+;;  these middle steps
+;; ++   ++
+;; ||--(A)- Authorization Request ->|(Resource Owner)|
+;; ||   ||
+;; ||<-(B)-- Authorization Grant ---| You, the Human,|
+;; ||   | user of Emacs and  |
+;; ||   | Sourcehut, performing  |
+;; ||   | steps in a web browser |
+;; ||   ++
+;; ||
+;; ||   +--+
+;; ||--(C)-- Authorization Grant -->|(Authorization Server)|
+;; |(Client)|   |  |
+;; ||<-(D)- Access Token ---| URLs starting with   |
+;; | Emacs  |   | meta.sr.ht/oauth2|
+;; ||   +--+
+;; ||
+;; ||   ++
+;; ||--(E)- Access Token -->| (Resource Server)  |
+;; ||   ||
+;; ||<-(F)--- Protected Resource ---| URLs starting with |
+;; ||   | meta.sr.ht/query   |
+;; ++   ++
+;;
+;; For generality¹ there is no web browser automation.  Here is a
+;; breakdown of Steps A and B:
+;;
+;; Step A:
+;;  A.1: A request URL is shown in the minibuffer; the minibuffer
+;;   prompts for a response URL and waits.
+;;  A.2: The user copies the request URL into their web browser of
+;;   choice¹.
+;;  A.3: The user authenticates to Sourcehut, using the web browser.
+;;  A.4: The user authorizes Emacs to access their Sourcehut
+;;   resource, using the web browser.
+;;  A.5: The web browser redirects to a URL; this redirection may
+;;   fail or it may not.  All that matters is the URL itself,
+;;   which will contain a "code" query argument.
+;;  A.6: The user copies the full "code" URL from the web browser.
+;;
+;; Step B:   The user pastes the full "code" URL into the minibuffer
+;;   and presses RET.
+;;
+;; The remaining steps, C through F, are all handled within Emacs.
+;;
+;; 1. For example, when running Emacs in a VT100 terminal emulator
+;;through two SSH hops.
+;;
+;; 2. For Sourcehut in particular, steps A.2 through A.5 can be done
+;;using EWW because Sourcehut does not need JavaScript.  Today EWW
+;;needs to run in a separate process so it does not conflict with
+;;url-http-oauth, which blocks the minibuffer waiting for the
+;;response URL.
 ;;
 ;; Installation:
 ;;
@@ -37,14 +101,36 @@
 ;;; Code:
 (require 'url-http-oauth)
 
-;;; Register "https://meta.sr.ht/query"; as needing OAuth 2.0 for
-;;; authentication.
+;;; Tell Emacs that "https://meta.sr.ht/query"; uses OAuth 2.0 for
+;;; authentication and authorization.
 ;;;###autoload
-(url-http-oauth-register-resource "https://meta.sr.ht/query";
-  "https://meta.sr.ht/oauth2/authorize";
-  "https://meta.sr.ht/oauth2/access-token";
-  "107ba4a9-2a96-4420-8818-84ec1f112405"
-  'prompt)
+(url-http-oauth-interpose
+ ;; This is the URL that the `url-http-oauth-demo' package wants to do
+ ;; stuff with.  Everything else is authentication and authorization
+ ;; to satisfy OAuth 2.0 requirements.
+ "h

[elpa] externals/url-http-oauth-demo a2b9116412 11/13: Use updated settings format

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit a2b91164129c96ef0eeb5a0b89cf8dd9d1004c7e
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Use updated settings format

* url-http-oauth-demo.el: Change "urls" entry to "resource-url".
---
 url-http-oauth-demo.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 5bdad985c1..9b10120340 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -113,7 +113,7 @@
;; This is the URL at which the `url-http-oauth-demo' package will
;; access resources.  Everything that follows is for authentication
;; and authorization to satisfy OAuth 2.0 requirements.
-   ("urls". ("https://meta.sr.ht/query";))
+   ("resource-url" . "https://meta.sr.ht/query";)
;; These are the authorization and token endpoints, published in
;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
;; autodiscover them from "https://meta.sr.ht/query";.



[elpa] externals/url-http-oauth-demo de81100f6e 04/13: Finish confidential client demonstration

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit de81100f6ea0a1d375998706a8b0b9d355ee0e1d
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Finish confidential client demonstration

* url-http-oauth-demo.el: Add usage section to comment header.
Remove scope registration argument.
(url-http-oauth-demo-get-api-version): Remove function.
(url-http-oauth-demo-get-profile-name): Create URL object from
individual slots.  Adjust message and return value.
---
 url-http-oauth-demo.el | 56 ++
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 5b13e0bd91..0ab1598b0c 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -23,12 +23,16 @@
 ;;; Commentary:
 ;;
 ;; This package demonstrates an OAuth 2.0 flow for Sourcehut using the
-;; built-in GNU Emacs URL library and the GNU ELPA url-http-oauth
-;; package.
+;; built-in GNU Emacs URL library and the url-http-oauth package.
 ;;
 ;; Installation:
 ;;
 ;; M-x package-install RET url-http-oauth-demo RET
+;;
+;; Usage:
+;;
+;; M-x url-http-oauth-demo-get-profile-name RET
+;; M-: (url-http-oauth-demo-get-profile-name) RET
 
 ;;; Code:
 (require 'url-http-oauth)
@@ -40,44 +44,42 @@
   "https://meta.sr.ht/oauth2/authorize";
   "https://meta.sr.ht/oauth2/access-token";
   "107ba4a9-2a96-4420-8818-84ec1f112405"
-  "meta.sr.ht/PROFILE:RO"
   'prompt)
 
-;;;###autoload
-(defun url-http-oauth-demo-get-api-version ()
-  "Asynchronously retrieve the Sourcehut GraphQL API version.
-Print the HTTP status and response in *Messages*."
-  (interactive)
-  (let ((url-request-method "POST")
-(url-request-extra-headers
- (list (cons "Content-Type" "application/json")
-   (cons "Authorization" "Bearer abcd")))
-(url-request-data
- "{\"query\": \"{ version { major, minor, patch } }\"}"))
-(url-retrieve "https://meta.sr.ht/query";
-  (lambda (status)
-(message "GET-API-VERSION: %S, %S"
- status (buffer-string))
-
 ;;;###autoload
 (defun url-http-oauth-demo-get-profile-name ()
   "Asynchronously retrieve the Sourcehut profile name.
-Print the result to *Messages*."
+Print the result to *Messages*.  Return the name."
   (interactive)
   (let ((url-request-method "POST")
 (url-request-extra-headers
  (list (cons "Content-Type" "application/json")))
 (url-request-data
  "{\"query\": \"{ me { canonicalName } }\"}"))
-(with-current-buffer (url-retrieve-synchronously 
"https://meta.sr.ht/query";)
-  (message "GET-PROFILE-NAME: %s" (buffer-string))
+(with-current-buffer
+(url-retrieve-synchronously
+ (url-parse-make-urlobj
+  "https" ; type
+  "fitzsim"   ; user
+  nil ; password, resolved by url-http-oauth
+  "meta.sr.ht"; host
+  443 ; port
+  (concat "/query"; path
+  "?" ; scope:
+  (url-build-query-string
+   (list
+(list "scope" "meta.sr.ht/PROFILE:RO"
+  nil nil t))
   (goto-char (point-min))
   (re-search-forward "\n\n")
-  (let* ((result (json-parse-buffer))
- ;;(me (gethash "me" result))
- ;;(name me)
- )
-(message "GET-PROFILE-NAME PARSED: %S" result)
+  (message "%s" (buffer-substring (point) (point-max)))
+  (gethash
+   "canonicalName"
+   (gethash
+"me"
+(gethash
+ "data"
+ (json-parse-buffer)))
 
 (provide 'url-http-oauth-demo)
 



[elpa] externals/url-http-oauth-demo d45c47de23 03/13: Make get-profile-name function synchronous

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit d45c47de2364d2879cd183b531602b57bd2d8244
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Make get-profile-name function synchronous

* url-http-oauth-demo.el: Use new registration
client-secret-required argument.
(url-http-oauth-demo-get-profile-name): Fix indentation.  Change
debug message.  Make synchronous.
---
 url-http-oauth-demo.el | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 4874a290cc..5b13e0bd91 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -40,7 +40,8 @@
   "https://meta.sr.ht/oauth2/authorize";
   "https://meta.sr.ht/oauth2/access-token";
   "107ba4a9-2a96-4420-8818-84ec1f112405"
-  "meta.sr.ht/PROFILE:RO")
+  "meta.sr.ht/PROFILE:RO"
+  'prompt)
 
 ;;;###autoload
 (defun url-http-oauth-demo-get-api-version ()
@@ -49,13 +50,13 @@ Print the HTTP status and response in *Messages*."
   (interactive)
   (let ((url-request-method "POST")
 (url-request-extra-headers
-(list (cons "Content-Type" "application/json")
+ (list (cons "Content-Type" "application/json")
(cons "Authorization" "Bearer abcd")))
 (url-request-data
  "{\"query\": \"{ version { major, minor, patch } }\"}"))
 (url-retrieve "https://meta.sr.ht/query";
   (lambda (status)
-(message "%S, %S"
+(message "GET-API-VERSION: %S, %S"
  status (buffer-string))
 
 ;;;###autoload
@@ -65,20 +66,18 @@ Print the result to *Messages*."
   (interactive)
   (let ((url-request-method "POST")
 (url-request-extra-headers
-(list (cons "Content-Type" "application/json")))
+ (list (cons "Content-Type" "application/json")))
 (url-request-data
  "{\"query\": \"{ me { canonicalName } }\"}"))
-(url-retrieve "https://meta.sr.ht/query";
-  (lambda (status)
-(message "STR: %s" (buffer-string))
-(goto-char (point-min))
-(re-search-forward "\n\n")
-
-(let* ((result (json-parse-buffer))
-   ;;(me (gethash "me" result))
-   ;;(name me)
-   )
-  (message "%S" result))
+(with-current-buffer (url-retrieve-synchronously 
"https://meta.sr.ht/query";)
+  (message "GET-PROFILE-NAME: %s" (buffer-string))
+  (goto-char (point-min))
+  (re-search-forward "\n\n")
+  (let* ((result (json-parse-buffer))
+ ;;(me (gethash "me" result))
+ ;;(name me)
+ )
+(message "GET-PROFILE-NAME PARSED: %S" result)
 
 (provide 'url-http-oauth-demo)
 



[elpa] branch externals/url-http-oauth-demo created (now ee91889a8e)

2023-05-08 Thread Thomas Fitzsimmons
fitzsim pushed a change to branch externals/url-http-oauth-demo.

at  ee91889a8e Bump version to 1.0.0

This branch includes the following new commits:

   new  d5ebb7e14f url-http-oauth-demo.el: New package
   new  f2d8a1a4bb url-http-oauth-demo-get-profile-name is working
   new  d45c47de23 Make get-profile-name function synchronous
   new  de81100f6e Finish confidential client demonstration
   new  828ef46e55 Add background documentation
   new  bcbea4d8ef Change scope handling
   new  d14fc3e005 Update url-http-oauth-interpose call
   new  8ba62b2072 Update a comment
   new  aa62f012d0 Fix URL retrieval
   new  8ea929c685 Update config format and Emacs 26 support
   new  a2b9116412 Use updated settings format
   new  68dd6973b2 Update comments
   new  ee91889a8e Bump version to 1.0.0




[elpa] externals/url-http-oauth-demo 8ea929c685 10/13: Update config format and Emacs 26 support

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 8ea929c68541cf4fef1e47e49d47723545142b0f
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Update config format and Emacs 26 support

* url-http-oauth-demo.el: Use cons pairs in
url-http-oauth-interpose call.
(url-http-oauth-demo-get-profile-name): Use
url-http-oauth-json-parse-buffer instead of json-parse-buffer.
---
 url-http-oauth-demo.el | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 0c32abab18..5bdad985c1 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -109,19 +109,19 @@
  '(;; This is the client identifier, which can be generated by the
;; user, or by the Emacs library developer, at
;; "https://meta.sr.ht/oauth2/client-registration";.
-   ("client-identifier" "107ba4a9-2a96-4420-8818-84ec1f112405")
+   ("client-identifier" . "107ba4a9-2a96-4420-8818-84ec1f112405")
;; This is the URL at which the `url-http-oauth-demo' package will
;; access resources.  Everything that follows is for authentication
;; and authorization to satisfy OAuth 2.0 requirements.
-   ("url" "https://meta.sr.ht/query";)
+   ("urls". ("https://meta.sr.ht/query";))
;; These are the authorization and token endpoints, published in
;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
;; autodiscover them from "https://meta.sr.ht/query";.
-   ("authorization-endpoint" "https://meta.sr.ht/oauth2/authorize";)
-   ("access-token-endpoint" "https://meta.sr.ht/oauth2/access-token";)
+   ("authorization-endpoint" . "https://meta.sr.ht/oauth2/authorize";)
+   ("access-token-endpoint" . "https://meta.sr.ht/oauth2/access-token";)
;; This is the list of features to which Emacs is requesting the
;; server grant it access.
-   ("scope" "meta.sr.ht/PROFILE:RO")
+   ("scope" . "meta.sr.ht/PROFILE:RO")
;; This is the client secret, which will be generated as part of
;; client registration, at
;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
@@ -134,7 +134,7 @@
;; ZU3P7ant959W1RkzgvXSeNf2mdxuk5EfA==".  The user would paste this
;; 88 character client secret string into the minibuffer when
;; prompted.
-   ("client-secret-method" prompt)))
+   ("client-secret-method" . prompt)))
 
 ;;;###autoload
 (defun url-http-oauth-demo-get-profile-name ()
@@ -165,7 +165,7 @@ Print the result to *Messages*.  Return the name."
 "me"
 (gethash
  "data"
- (json-parse-buffer)))
+ (url-http-oauth-json-parse-buffer)))
 
 (provide 'url-http-oauth-demo)
 



[elpa] externals/url-http-oauth-demo d14fc3e005 07/13: Update url-http-oauth-interpose call

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit d14fc3e005bd3c7dc004406b7089451e6e62f99b
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Update url-http-oauth-interpose call

* url-http-oauth-demo.el: Update url-http-oauth-interpose call to
provide single alist settings argument.
---
 url-http-oauth-demo.el | 58 +-
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 890641e207..d0a0125282 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -105,35 +105,35 @@
 ;;; authentication and authorization.
 ;;;###autoload
 (url-http-oauth-interpose
- ;; This is the URL that the `url-http-oauth-demo' package wants to do
- ;; stuff with.  Everything else is authentication and authorization
- ;; to satisfy OAuth 2.0 requirements.
- "https://meta.sr.ht/query";
- ;; These are the authorization and token endpoints, published in
- ;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
- ;; autodiscover them from "https://meta.sr.ht/query";.
- "https://meta.sr.ht/oauth2/authorize";
- "https://meta.sr.ht/oauth2/access-token";
- ;; This is the client identifier, which can be generated by the user,
- ;; or by the Emacs library developer, at
- ;; "https://meta.sr.ht/oauth2/client-registration";.
- "107ba4a9-2a96-4420-8818-84ec1f112405"
- ;; This is the list of features to which Emacs is requesting the
- ;; server grant it access.
- "meta.sr.ht/PROFILE:RO"
- ;; This is the client secret, which will be generated as part of
- ;; client registration, at
- ;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
- ;; generates the client secret, they should note it down.  If the
- ;; Emacs library developer generates it, they should make it
- ;; available to the users of their library somehow.  In either case,
- ;; Emacs will prompt for it, and store it, ideally GPG-encrypted,
- ;; using `auth-source'.  An example, no-longer-active client secret
- ;; string is "CeuivTBzZbqJ4iTc+VEdPZJODkBHhuCj4bIqQQAONYaOUGubNM0yG
- ;; ZU3P7ant959W1RkzgvXSeNf2mdxuk5EfA==".  The user would paste this
- ;; 88 character client secret string into the minibuffer when
- ;; prompted.
- 'prompt)
+   ;; This is the URL at which the `url-http-oauth-demo' package will
+   ;; access resources.  Everything that follows is for authentication
+   ;; and authorization to satisfy OAuth 2.0 requirements.
+ '(("url" "https://meta.sr.ht/query";)
+   ;; These are the authorization and token endpoints, published in
+   ;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
+   ;; autodiscover them from "https://meta.sr.ht/query";.
+   ("authorization-endpoint" "https://meta.sr.ht/oauth2/authorize";)
+   ("access-token-endpoint" "https://meta.sr.ht/oauth2/access-token";)
+   ;; This is the client identifier, which can be generated by the user,
+   ;; or by the Emacs library developer, at
+   ;; "https://meta.sr.ht/oauth2/client-registration";.
+   ("client-identifier" "107ba4a9-2a96-4420-8818-84ec1f112405")
+   ;; This is the list of features to which Emacs is requesting the
+   ;; server grant it access.
+   ("scope" "meta.sr.ht/PROFILE:RO")
+   ;; This is the client secret, which will be generated as part of
+   ;; client registration, at
+   ;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
+   ;; generates the client secret, they should note it down.  If the
+   ;; Emacs library developer generates it, they should make it
+   ;; available to the users of their library somehow.  In either case,
+   ;; Emacs will prompt for it, and store it, ideally GPG-encrypted,
+   ;; using `auth-source'.  An example, no-longer-active client secret
+   ;; string is "CeuivTBzZbqJ4iTc+VEdPZJODkBHhuCj4bIqQQAONYaOUGubNM0yG
+   ;; ZU3P7ant959W1RkzgvXSeNf2mdxuk5EfA==".  The user would paste this
+   ;; 88 character client secret string into the minibuffer when
+   ;; prompted.
+   ("client-secret-method" prompt)))
 
 ;;;###autoload
 (defun url-http-oauth-demo-get-profile-name ()



[elpa] externals/url-http-oauth-demo 68dd6973b2 12/13: Update comments

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 68dd6973b240ba98bc11b9be60b58ddb7d4a9503
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Update comments

* url-http-oauth-demo.el: Update some comments.
---
 url-http-oauth-demo.el | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 9b10120340..b6d9a2c9bd 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -101,29 +101,29 @@
 ;;; Code:
 (require 'url-http-oauth)
 
-;;; Tell Emacs that the URL "https://meta.sr.ht/query";, with
-;;; client-identifier "107ba4a9-2a96-4420-8818-84ec1f112405", uses
-;;; OAuth 2.0 for authentication and authorization.
+;;; Tell Emacs that the URL "https://meta.sr.ht/query"; uses OAuth 2.0
+;;; for authentication and authorization.
 ;;;###autoload
 (url-http-oauth-interpose
- '(;; This is the client identifier, which can be generated by the
-   ;; user, or by the Emacs library developer, at
-   ;; "https://meta.sr.ht/oauth2/client-registration";.
-   ("client-identifier" . "107ba4a9-2a96-4420-8818-84ec1f112405")
-   ;; This is the URL at which the `url-http-oauth-demo' package will
-   ;; access resources.  Everything that follows is for authentication
-   ;; and authorization to satisfy OAuth 2.0 requirements.
+ '(;; The client identifier.  Replace
+   ;; "----" with a new client
+   ;; identifier generated by the user, or by the Emacs library
+   ;; developer, at "https://meta.sr.ht/oauth2/client-registration";.
+   ("client-identifier" . "----")
+   ;; The URL at which the `url-http-oauth-demo' package will access
+   ;; resources.  Everything that follows is for authentication and
+   ;; authorization to satisfy OAuth 2.0 requirements.
("resource-url" . "https://meta.sr.ht/query";)
-   ;; These are the authorization and token endpoints, published in
+   ;; The authorization and token endpoints, published in
;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
;; autodiscover them from "https://meta.sr.ht/query";.
("authorization-endpoint" . "https://meta.sr.ht/oauth2/authorize";)
("access-token-endpoint" . "https://meta.sr.ht/oauth2/access-token";)
-   ;; This is the list of features to which Emacs is requesting the
-   ;; server grant it access.
+   ;; The list of features to which Emacs is requesting the server
+   ;; grant it access.
("scope" . "meta.sr.ht/PROFILE:RO")
-   ;; This is the client secret, which will be generated as part of
-   ;; client registration, at
+   ;; The client secret, which will be generated as part of client
+   ;; registration, at
;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
;; generates the client secret, they should note it down.  If the
;; Emacs library developer generates it, they should make it



[elpa] externals/url-http-oauth-demo ee91889a8e 13/13: Bump version to 1.0.0

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit ee91889a8e3fed7db255b9be8970ca081b9d6c2f
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Bump version to 1.0.0

* url-http-oauth-demo.el: Bump version to 1.0.0.
* NEWS: New file.
---
 NEWS   | 7 +++
 url-http-oauth-demo.el | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
new file mode 100644
index 00..453e0aef1c
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,7 @@
+GNU Emacs url-http-oauth-demo NEWS -- history of user-visible changes.
+
+* New in url-http-oauth-demo 1.0.0
+
+Released 2023-05-08
+
+** Demonstrate how to use the new url-http-oauth library.
diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index b6d9a2c9bd..25486dec12 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2023 Free Software Foundation, Inc.
 
 ;; Author: Thomas Fitzsimmons 
-;; Version: 0
+;; Version: 1.0.0
 ;; Keywords: comm, data, processes, hypermedia
 ;; Package-Requires: ((url-http-oauth "0"))
 



[elpa] externals/url-http-oauth-demo aa62f012d0 09/13: Fix URL retrieval

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit aa62f012d0d774b24008c804e8d4aa9957982289
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Fix URL retrieval

* url-http-oauth-demo.el (url-http-oauth-demo-get-profile-name):
Set user to nil.
---
 url-http-oauth-demo.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 56697b5138..0c32abab18 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -150,7 +150,7 @@ Print the result to *Messages*.  Return the name."
 (url-retrieve-synchronously
  (url-parse-make-urlobj
   "https"  ; type
-  "fitzsim"; user
+  nil  ; user
   nil  ; password, resolved by url-http-oauth
   "meta.sr.ht" ; host
   443  ; port



[elpa] externals/url-http-oauth-demo 8ba62b2072 08/13: Update a comment

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 8ba62b2072e1d884dcf4a1fb22d0c8aaf3c2376b
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Update a comment

* url-http-oauth-demo.el: Update a comment.
---
 url-http-oauth-demo.el | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index d0a0125282..56697b5138 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -101,23 +101,24 @@
 ;;; Code:
 (require 'url-http-oauth)
 
-;;; Tell Emacs that "https://meta.sr.ht/query"; uses OAuth 2.0 for
-;;; authentication and authorization.
+;;; Tell Emacs that the URL "https://meta.sr.ht/query";, with
+;;; client-identifier "107ba4a9-2a96-4420-8818-84ec1f112405", uses
+;;; OAuth 2.0 for authentication and authorization.
 ;;;###autoload
 (url-http-oauth-interpose
+ '(;; This is the client identifier, which can be generated by the
+   ;; user, or by the Emacs library developer, at
+   ;; "https://meta.sr.ht/oauth2/client-registration";.
+   ("client-identifier" "107ba4a9-2a96-4420-8818-84ec1f112405")
;; This is the URL at which the `url-http-oauth-demo' package will
;; access resources.  Everything that follows is for authentication
;; and authorization to satisfy OAuth 2.0 requirements.
- '(("url" "https://meta.sr.ht/query";)
+   ("url" "https://meta.sr.ht/query";)
;; These are the authorization and token endpoints, published in
;; "https://man.sr.ht/meta.sr.ht/oauth.md";.  There is no way to
;; autodiscover them from "https://meta.sr.ht/query";.
("authorization-endpoint" "https://meta.sr.ht/oauth2/authorize";)
("access-token-endpoint" "https://meta.sr.ht/oauth2/access-token";)
-   ;; This is the client identifier, which can be generated by the user,
-   ;; or by the Emacs library developer, at
-   ;; "https://meta.sr.ht/oauth2/client-registration";.
-   ("client-identifier" "107ba4a9-2a96-4420-8818-84ec1f112405")
;; This is the list of features to which Emacs is requesting the
;; server grant it access.
("scope" "meta.sr.ht/PROFILE:RO")
@@ -126,9 +127,9 @@
;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
;; generates the client secret, they should note it down.  If the
;; Emacs library developer generates it, they should make it
-   ;; available to the users of their library somehow.  In either case,
-   ;; Emacs will prompt for it, and store it, ideally GPG-encrypted,
-   ;; using `auth-source'.  An example, no-longer-active client secret
+   ;; available to the users of their library somehow.  In either
+   ;; case, Emacs will prompt for it, and store it, ideally
+   ;; GPG-encrypted, using `auth-source'.  An example client secret
;; string is "CeuivTBzZbqJ4iTc+VEdPZJODkBHhuCj4bIqQQAONYaOUGubNM0yG
;; ZU3P7ant959W1RkzgvXSeNf2mdxuk5EfA==".  The user would paste this
;; 88 character client secret string into the minibuffer when



[elpa] externals/url-http-oauth-demo f2d8a1a4bb 02/13: url-http-oauth-demo-get-profile-name is working

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit f2d8a1a4bb6c40d0488abe2fb7b3e938392419d6
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

url-http-oauth-demo-get-profile-name is working

* url-http-oauth-demo.el: Call url-http-oauth-register-resource.
(url-http-oauth-demo-get-api-version): New function.
(url-http-oauth-demo-get-profile-name): Likewise.
---
 url-http-oauth-demo.el | 41 ++---
 1 file changed, 38 insertions(+), 3 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 902475f37a..4874a290cc 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -36,14 +36,49 @@
 ;;; Register "https://meta.sr.ht/query"; as needing OAuth 2.0 for
 ;;; authentication.
 ;;;###autoload
-(url-http-oauth-register-provider "https://meta.sr.ht/query";
+(url-http-oauth-register-resource "https://meta.sr.ht/query";
   "https://meta.sr.ht/oauth2/authorize";
   "https://meta.sr.ht/oauth2/access-token";
   "107ba4a9-2a96-4420-8818-84ec1f112405"
   "meta.sr.ht/PROFILE:RO")
 
-;; FIXME: Make an authenticated API call using "meta.sr.ht/PROFILE:RO"
-;; to prove the OAuth 2.0 procedure was successful.
+;;;###autoload
+(defun url-http-oauth-demo-get-api-version ()
+  "Asynchronously retrieve the Sourcehut GraphQL API version.
+Print the HTTP status and response in *Messages*."
+  (interactive)
+  (let ((url-request-method "POST")
+(url-request-extra-headers
+(list (cons "Content-Type" "application/json")
+   (cons "Authorization" "Bearer abcd")))
+(url-request-data
+ "{\"query\": \"{ version { major, minor, patch } }\"}"))
+(url-retrieve "https://meta.sr.ht/query";
+  (lambda (status)
+(message "%S, %S"
+ status (buffer-string))
+
+;;;###autoload
+(defun url-http-oauth-demo-get-profile-name ()
+  "Asynchronously retrieve the Sourcehut profile name.
+Print the result to *Messages*."
+  (interactive)
+  (let ((url-request-method "POST")
+(url-request-extra-headers
+(list (cons "Content-Type" "application/json")))
+(url-request-data
+ "{\"query\": \"{ me { canonicalName } }\"}"))
+(url-retrieve "https://meta.sr.ht/query";
+  (lambda (status)
+(message "STR: %s" (buffer-string))
+(goto-char (point-min))
+(re-search-forward "\n\n")
+
+(let* ((result (json-parse-buffer))
+   ;;(me (gethash "me" result))
+   ;;(name me)
+   )
+  (message "%S" result))
 
 (provide 'url-http-oauth-demo)
 



[elpa] externals/url-http-oauth-demo bcbea4d8ef 06/13: Change scope handling

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit bcbea4d8efd5c2ab298a1cde1f14bf07be9c6aa6
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Change scope handling

* url-http-oauth-demo.el: Add scope argument to interpose call.
(url-http-oauth-demo-get-profile-name): Remove explicit scope
handling.
---
 url-http-oauth-demo.el | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index b86563d2b9..890641e207 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -118,6 +118,9 @@
  ;; or by the Emacs library developer, at
  ;; "https://meta.sr.ht/oauth2/client-registration";.
  "107ba4a9-2a96-4420-8818-84ec1f112405"
+ ;; This is the list of features to which Emacs is requesting the
+ ;; server grant it access.
+ "meta.sr.ht/PROFILE:RO"
  ;; This is the client secret, which will be generated as part of
  ;; client registration, at
  ;; "https://meta.sr.ht/oauth2/client-registration";.  If the user
@@ -145,16 +148,12 @@ Print the result to *Messages*.  Return the name."
 (with-current-buffer
 (url-retrieve-synchronously
  (url-parse-make-urlobj
-  "https" ; type
-  "fitzsim"   ; user
-  nil ; password, resolved by url-http-oauth
-  "meta.sr.ht"; host
-  443 ; port
-  (concat "/query"; path
-  "?" ; scope:
-  (url-build-query-string
-   (list
-(list "scope" "meta.sr.ht/PROFILE:RO"
+  "https"  ; type
+  "fitzsim"; user
+  nil  ; password, resolved by url-http-oauth
+  "meta.sr.ht" ; host
+  443  ; port
+  "/query" ; path
   nil nil t))
   (goto-char (point-min))
   (re-search-forward "\n\n")



[elpa] externals/url-http-oauth-demo d5ebb7e14f 01/13: url-http-oauth-demo.el: New package

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit d5ebb7e14f6ed4a02f02c99db23780026e7b7beb
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

url-http-oauth-demo.el: New package

* url-http-oauth-demo.el: New file.
* .gitignore: Likewise.
---
 .gitignore |  3 +++
 url-http-oauth-demo.el | 50 ++
 2 files changed, 53 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00..fa7b465de0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/url-http-oauth-demo-pkg.el
+/url-http-oauth-demo-autoloads.el
+*.elc
diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
new file mode 100644
index 00..902475f37a
--- /dev/null
+++ b/url-http-oauth-demo.el
@@ -0,0 +1,50 @@
+;;; url-http-oauth-demo.el --- Demo url-http-oauth -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation, Inc.
+
+;; Author: Thomas Fitzsimmons 
+;; Version: 0
+;; Keywords: comm, data, processes, hypermedia
+;; Package-Requires: ((url-http-oauth "0"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Commentary:
+;;
+;; This package demonstrates an OAuth 2.0 flow for Sourcehut using the
+;; built-in GNU Emacs URL library and the GNU ELPA url-http-oauth
+;; package.
+;;
+;; Installation:
+;;
+;; M-x package-install RET url-http-oauth-demo RET
+
+;;; Code:
+(require 'url-http-oauth)
+
+;;; Register "https://meta.sr.ht/query"; as needing OAuth 2.0 for
+;;; authentication.
+;;;###autoload
+(url-http-oauth-register-provider "https://meta.sr.ht/query";
+  "https://meta.sr.ht/oauth2/authorize";
+  "https://meta.sr.ht/oauth2/access-token";
+  "107ba4a9-2a96-4420-8818-84ec1f112405"
+  "meta.sr.ht/PROFILE:RO")
+
+;; FIXME: Make an authenticated API call using "meta.sr.ht/PROFILE:RO"
+;; to prove the OAuth 2.0 procedure was successful.
+
+(provide 'url-http-oauth-demo)
+
+;;; url-http-oauth-demo.el ends here



[elpa] externals/url-http-oauth-demo 64002d21e5: Bump url-http-oauth requirement to 0.8.0

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 64002d21e5ca4f9af3ea7a209ca02ae7bcda8a86
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Bump url-http-oauth requirement to 0.8.0

* url-http-oauth-demo.el: Bump url-http-oauth requirement to
0.8.0.
---
 url-http-oauth-demo.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 25486dec12..9cdad79264 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -5,7 +5,7 @@
 ;; Author: Thomas Fitzsimmons 
 ;; Version: 1.0.0
 ;; Keywords: comm, data, processes, hypermedia
-;; Package-Requires: ((url-http-oauth "0"))
+;; Package-Requires: ((url-http-oauth "0.8.0"))
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by



[elpa] externals/url-http-oauth 0c284dd7da 2/2: Bump version to 0.8.1

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 0c284dd7dae76265293b9b35a9bc7aff14a23ed0
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Bump version to 0.8.1

* url-http-oauth.el, NEWS: Bump version to 0.8.1.
---
 NEWS  | 4 ++--
 url-http-oauth.el | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index b1131cea41..6fc079ff12 100644
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,13 @@
 GNU Emacs url-http-oauth NEWS -- history of user-visible changes.
 
-* New in url-http-oauth 0.8.0
+* New in url-http-oauth 0.8.1
 
 Released 2023-05-08
 
 Warning: To handle refresh tokens, url-http-oauth needs to delete
 entries from netrc files listed in the `auth-sources' variable.
 Please back up all files listed in the `auth-sources' variable before
-trying url-http-oauth 0.8.0 because the netrc entry deletion code is
+trying url-http-oauth 0.8.1 because the netrc entry deletion code is
 new and relatively untested.  Deletion respects the customization
 value of `auth-source-save-behavior'; if it is set to `ask', you will
 be prompted before the entry deletion happens.
diff --git a/url-http-oauth.el b/url-http-oauth.el
index 9afc5f643c..8be12bdde5 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2023 Free Software Foundation, Inc.
 
 ;; Author: Thomas Fitzsimmons 
-;; Version: 0.8.0
+;; Version: 0.8.1
 ;; Keywords: comm, data, processes, hypermedia
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] externals/url-http-oauth updated (40c46af10c -> 0c284dd7da)

2023-05-08 Thread Thomas Fitzsimmons
fitzsim pushed a change to branch externals/url-http-oauth.

  from  40c46af10c Bump version to 0.8.0
   new  5823a0a850 Remove a debugging message
   new  0c284dd7da Bump version to 0.8.1


Summary of changes:
 NEWS  | 4 ++--
 url-http-oauth.el | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)



[elpa] externals/url-http-oauth 5823a0a850 1/2: Remove a debugging message

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth
commit 5823a0a850aa95716596c919f60858b256840397
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Remove a debugging message

* url-http-oauth.el (url-http-oauth--parse-grant): Remove
debugging message.
---
 url-http-oauth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth.el b/url-http-oauth.el
index 427fc371f4..9afc5f643c 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -232,7 +232,7 @@ server to receive a new access token."
 (defun url-http-oauth--parse-grant ()
   "Parse the JSON grant structure in the current buffer.
 Return the parsed JSON object."
-  (message "url-http-oauth: grant: %s" (buffer-string))
+  ;; (message "url-http-oauth: grant: %s" (buffer-string))
   (progn
 (goto-char (point-min))
 (re-search-forward "\n\n")



[elpa] externals/url-http-oauth-demo updated (64002d21e5 -> 17230fc651)

2023-05-08 Thread Thomas Fitzsimmons
fitzsim pushed a change to branch externals/url-http-oauth-demo.

  from  64002d21e5 Bump url-http-oauth requirement to 0.8.0
   new  b6e4ca1d11 Require url-http-oauth 0.8.1
   new  17230fc651 Bump version to 1.0.1


Summary of changes:
 NEWS   | 2 +-
 url-http-oauth-demo.el | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)



[elpa] externals/url-http-oauth-demo b6e4ca1d11 1/2: Require url-http-oauth 0.8.1

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit b6e4ca1d1158c80cd3e4d42d694c8a00427c32e4
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Require url-http-oauth 0.8.1

* url-http-oauth-demo.el: Require url-http-oauth 0.8.1.
---
 url-http-oauth-demo.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 9cdad79264..970a15395b 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -5,7 +5,7 @@
 ;; Author: Thomas Fitzsimmons 
 ;; Version: 1.0.0
 ;; Keywords: comm, data, processes, hypermedia
-;; Package-Requires: ((url-http-oauth "0.8.0"))
+;; Package-Requires: ((url-http-oauth "0.8.1"))
 
 ;; 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



[elpa] externals/url-http-oauth-demo 17230fc651 2/2: Bump version to 1.0.1

2023-05-08 Thread Thomas Fitzsimmons
branch: externals/url-http-oauth-demo
commit 17230fc6513df52f1417b335f64c9f405e5a9126
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Bump version to 1.0.1

* url-http-oauth-demo.el, NEWS: Bump version to 1.0.1.
---
 NEWS   | 2 +-
 url-http-oauth-demo.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 453e0aef1c..f9bde16f21 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
 GNU Emacs url-http-oauth-demo NEWS -- history of user-visible changes.
 
-* New in url-http-oauth-demo 1.0.0
+* New in url-http-oauth-demo 1.0.1
 
 Released 2023-05-08
 
diff --git a/url-http-oauth-demo.el b/url-http-oauth-demo.el
index 970a15395b..3371f3c9b9 100644
--- a/url-http-oauth-demo.el
+++ b/url-http-oauth-demo.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2023 Free Software Foundation, Inc.
 
 ;; Author: Thomas Fitzsimmons 
-;; Version: 1.0.0
+;; Version: 1.0.1
 ;; Keywords: comm, data, processes, hypermedia
 ;; Package-Requires: ((url-http-oauth "0.8.1"))
 



[elpa] main b530dc52c0: Add url-http-oauth and url-http-oauth-demo

2023-05-08 Thread Thomas Fitzsimmons
branch: main
commit b530dc52c0baace0fa8af6d441de6fd8db95a2c5
Author: Thomas Fitzsimmons 
Commit: Thomas Fitzsimmons 

Add url-http-oauth and url-http-oauth-demo

* elpa-packages (url-http-oauth, url-http-oauth-demo): New
packages.
---
 elpa-packages | 4 
 1 file changed, 4 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index f46b36c8db..93f6ccc118 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -697,6 +697,10 @@
   :readme "README.md")
  (uniquify-files   :url nil)
  (url-http-ntlm:url nil)
+ (url-http-oauth   :url "https://git.sr.ht/~fitzsim/url-http-oauth";
+  :readme ignore)
+ (url-http-oauth-demo  :url "https://git.sr.ht/~fitzsim/url-http-oauth-demo";
+  :readme ignore)
  (url-scgi :url "https://github.com/skangas/url-scgi";
   :readme "README.org")
  (use-package



[elpa] externals/modus-themes 7661b78509: Refine vundo faces to make saved states easier to spot

2023-05-08 Thread ELPA Syncer
branch: externals/modus-themes
commit 7661b78509c86bb8f4faf8f9cf605dfbb29c18a2
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Refine vundo faces to make saved states easier to spot

This is discussed in issue 79 on the GitHub mirror:
.
---
 modus-themes.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index bdb7c401f4..272fcc98e4 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3836,9 +3836,10 @@ FG and BG are the main colors."
 `(vterm-color-white ((,c :background "white" :foreground "gray65")))
 `(vterm-color-yellow ((,c :background ,yellow-warmer :foreground ,yellow)))
 ; vundo
-`(vundo-highlight ((,c :inherit (bold vundo-node) :foreground 
,red-intense)))
-`(vundo-last-saved ((,c :inherit (bold vundo-node) :foreground 
,cyan-intense)))
-`(vundo-saved ((,c :inherit vundo-node :foreground ,cyan-intense)))
+`(vundo-default ((,c :inherit shadow)))
+`(vundo-highlight ((,c :inherit (bold vundo-node) :foreground ,red)))
+`(vundo-last-saved ((,c :inherit (bold vundo-node) :foreground ,blue)))
+`(vundo-saved ((,c :inherit vundo-node :foreground ,blue-intense)))
 ; wcheck-mode
 `(wcheck-default-face ((,c :foreground ,red :underline t)))
 ; web-mode