[elpa] externals/ef-themes 9fca59c2fe: Simplify ef-themes--retrieve-palette-value

2025-02-08 Thread ELPA Syncer
branch: externals/ef-themes
commit 9fca59c2fe2e90ed63e34b811595e7708928a050
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Simplify ef-themes--retrieve-palette-value

This is the same change that Basil L. Contovounesios contributed to
the Modus themes Git repository, in commit de57a78.
---
 ef-themes.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ef-themes.el b/ef-themes.el
index c23bbbf17c..897a804ea9 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -416,8 +416,7 @@ This function is used in the macros `ef-themes-theme',
  ((or (stringp value)
   (eq value 'unspecified))
   value)
- ((and (symbolp value)
-   (memq value (mapcar #'car palette)))
+ ((and (symbolp value) value)
   (ef-themes--retrieve-palette-value value palette))
  (t
   'unspecified



[elpa] externals/autorevert-tail-truncate a9ce5a63d3: Bump version to 1.0.0 for ELPA.

2025-02-08 Thread ELPA Syncer
branch: externals/autorevert-tail-truncate
commit a9ce5a63d37c0a5ab3603d168599c72fbd57da50
Author: shipmints 
Commit: shipmints 

Bump version to 1.0.0 for ELPA.
---
 autorevert-tail-truncate.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/autorevert-tail-truncate.el b/autorevert-tail-truncate.el
index dfcfbbbf7f..7bf761e550 100644
--- a/autorevert-tail-truncate.el
+++ b/autorevert-tail-truncate.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Stephane Marks 
 ;; Url: https://github.com/shipmints/autorevert-tail-truncate.el
 ;; Created: 2025-02-03
-;; Version: 1.0 pre
+;; Version: 1.0.0
 ;; Package-Requires: ((emacs "29.1"))
 ;; Keywords: convenience, tools, log files, autorevert
 



[elpa] externals/ellama updated (ed530c7f0d -> cc436ef525)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/ellama.

  from  ed530c7f0d Bump version
   new  82ed968e1e Add Emacs 29.4 to MELPA workflow
   new  cddea3d08e Add semantic similarity check functionality
   new  a9df949586 Add integration tests for Ellama
   new  e0b6d939f5 Merge pull request #200 from 
s-kostyaev/add-semantic-similarity-check-function
   new  375daa66e7 Bump version
   new  9bd8853f19 Add required packages to integration test
   new  cc436ef525 Bump version


Summary of changes:
 .github/workflows/melpa.yml  |  1 +
 NEWS.org |  6 +
 ellama.el| 31 ++-
 tests/integration-test-ellama.el | 53 
 tests/test-ellama.el |  2 +-
 5 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100644 tests/integration-test-ellama.el



[elpa] externals/ellama e0b6d939f5 4/7: Merge pull request #200 from s-kostyaev/add-semantic-similarity-check-function

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit e0b6d939f537c62054afe9089004a82404d779ff
Merge: ed530c7f0d a9df949586
Author: Sergey Kostyaev 
Commit: GitHub 

Merge pull request #200 from 
s-kostyaev/add-semantic-similarity-check-function

Add semantic similarity check function
---
 .github/workflows/melpa.yml  |  1 +
 ellama.el| 29 +++
 tests/integration-test-ellama.el | 50 
 tests/test-ellama.el |  2 +-
 4 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/melpa.yml b/.github/workflows/melpa.yml
index 4b61dce6a5..9a34a8e9f4 100644
--- a/.github/workflows/melpa.yml
+++ b/.github/workflows/melpa.yml
@@ -58,6 +58,7 @@ jobs:
   - 29.1
   - 29.2
   - 29.3
+  - 29.4
 ignore_warnings:
   - false
 warnings_as_errors:
diff --git a/ellama.el b/ellama.el
index 4b94bfd3c3..4c6f7e30d8 100644
--- a/ellama.el
+++ b/ellama.el
@@ -367,6 +367,20 @@ is not changed.
   :group 'ellama
   :type 'string)
 
+(defcustom ellama-semantic-identity-template "Determine if two texts have the 
same meaning. If they are similar but differ in key aspects, they are not the 
same. Return the answer as a JSON object.
+
+%s
+
+
+%s
+
+
+{\"same\": true}
+"
+  "Extract string list template."
+  :group 'ellama
+  :type 'string)
+
 (defcustom ellama-extraction-provider nil
   "LLM provider for data extraction."
   :group 'ellama
@@ -2197,6 +2211,21 @@ otherwise prompt user for URL to summarize."
   (kill-region (point) (point-max))
   (ellama-summarize
 
+(defun ellama-semantic-similar-p (text1 text2)
+  "Check if TEXT1 means the same as TEXT2."
+  (plist-get
+   (json-parse-string
+(llm-chat
+ (or ellama-extraction-provider ellama-provider)
+ (llm-make-chat-prompt
+  (format ellama-semantic-identity-template text1 text2)
+  :response-format '(:type object :properties
+  (:same (:type boolean))
+  :required (same
+:object-type 'plist
+:false-object nil)
+   :same))
+
 (defun ellama--make-extract-string-list-prompt (elements input)
   "Create LLM prompt for list of ELEMENTS extraction from INPUT."
   (llm-make-chat-prompt
diff --git a/tests/integration-test-ellama.el b/tests/integration-test-ellama.el
new file mode 100644
index 00..23334e1bd5
--- /dev/null
+++ b/tests/integration-test-ellama.el
@@ -0,0 +1,50 @@
+;;; integration-test-ellama.el --- Ellama integration tests -*- 
lexical-binding: t; package-lint-main-file: "../ellama.el"; -*-
+
+;; Copyright (C) 2023-2025  Free Software Foundation, Inc.
+
+;; Author: Sergey Kostyaev 
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+;;
+;; Ellama tests.
+;;
+
+;;; Code:
+
+(ert-deftest ellama-extract-sting-list-test ()
+  "Check if `ellama-extract-string-list' works correctly."
+  (should (equal-including-properties
+  (ellama-extract-string-list
+   "fruits"
+   "Here is the fruits: apple, banana, dragon fruit. I like it.")
+  '("apple" "banana" "dragon fruit"
+
+(ert-deftest ellama-semantic-similar-test ()
+  "Check if `ellama-semantic-similar-p' works correctly."
+  (should (equal-including-properties
+  (let ((res))
+(dolist (el '("How many r's in strawberry?"
+  "How many times letter r appears in word strawberry?"
+  "How many r's in strawberry?"
+  "How many times letter e appears in word 
strawberry?"))
+  (cl-pushnew el res :test #'ellama-semantic-similar-p))
+(reverse res))
+  '("How many r's in strawberry?"
+"How many times letter e appears in word strawberry?"
+
+(provide 'integration-test-ellama)
+
+;;; integration-test-ellama.el ends here
diff --git a/tests/test-ellama.el b/tests/test-ellama.el
index 39af77314a..8c93f6ee03 100644
--- a/tests/test-ellama.el
+++ b/tests/test-ellama.el
@@ -1,6 +1,6 @@
 ;;; test-ellama.el --- Ellama tests -*- lexical-binding: t; 
package-lint-main-file: "../ellama.el"; -*-
 
-;; Copyright (C) 2023  Free Software Foundation, Inc.
+;; Copyright (C) 2023-2025  Free Software Foundation, Inc.
 
 ;; Author: Sergey Kostyaev 
 



[elpa] externals/ellama 9bd8853f19 6/7: Add required packages to integration test

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit 9bd8853f19e42315126052db4981d4c0833d68d3
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Add required packages to integration test

Added `ellama` and `ert` requires to the integration test file.
---
 tests/integration-test-ellama.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/integration-test-ellama.el b/tests/integration-test-ellama.el
index 23334e1bd5..ab329dbc70 100644
--- a/tests/integration-test-ellama.el
+++ b/tests/integration-test-ellama.el
@@ -24,6 +24,9 @@
 
 ;;; Code:
 
+(require 'ellama)
+(require 'ert)
+
 (ert-deftest ellama-extract-sting-list-test ()
   "Check if `ellama-extract-string-list' works correctly."
   (should (equal-including-properties



[elpa] externals/ellama a9df949586 3/7: Add integration tests for Ellama

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit a9df94958677e83be760f10a71173db345d61d8e
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Add integration tests for Ellama

Added new integration test file `integration-test-ellama.el` with
tests for `ellama-extract-string-list` and
`ellama-semantic-similar-p`. Updated copyright year in
`test-ellama.el`.
---
 tests/integration-test-ellama.el | 50 
 tests/test-ellama.el |  2 +-
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/tests/integration-test-ellama.el b/tests/integration-test-ellama.el
new file mode 100644
index 00..23334e1bd5
--- /dev/null
+++ b/tests/integration-test-ellama.el
@@ -0,0 +1,50 @@
+;;; integration-test-ellama.el --- Ellama integration tests -*- 
lexical-binding: t; package-lint-main-file: "../ellama.el"; -*-
+
+;; Copyright (C) 2023-2025  Free Software Foundation, Inc.
+
+;; Author: Sergey Kostyaev 
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see .
+
+;;; Commentary:
+;;
+;; Ellama tests.
+;;
+
+;;; Code:
+
+(ert-deftest ellama-extract-sting-list-test ()
+  "Check if `ellama-extract-string-list' works correctly."
+  (should (equal-including-properties
+  (ellama-extract-string-list
+   "fruits"
+   "Here is the fruits: apple, banana, dragon fruit. I like it.")
+  '("apple" "banana" "dragon fruit"
+
+(ert-deftest ellama-semantic-similar-test ()
+  "Check if `ellama-semantic-similar-p' works correctly."
+  (should (equal-including-properties
+  (let ((res))
+(dolist (el '("How many r's in strawberry?"
+  "How many times letter r appears in word strawberry?"
+  "How many r's in strawberry?"
+  "How many times letter e appears in word 
strawberry?"))
+  (cl-pushnew el res :test #'ellama-semantic-similar-p))
+(reverse res))
+  '("How many r's in strawberry?"
+"How many times letter e appears in word strawberry?"
+
+(provide 'integration-test-ellama)
+
+;;; integration-test-ellama.el ends here
diff --git a/tests/test-ellama.el b/tests/test-ellama.el
index 39af77314a..8c93f6ee03 100644
--- a/tests/test-ellama.el
+++ b/tests/test-ellama.el
@@ -1,6 +1,6 @@
 ;;; test-ellama.el --- Ellama tests -*- lexical-binding: t; 
package-lint-main-file: "../ellama.el"; -*-
 
-;; Copyright (C) 2023  Free Software Foundation, Inc.
+;; Copyright (C) 2023-2025  Free Software Foundation, Inc.
 
 ;; Author: Sergey Kostyaev 
 



[elpa] externals/ellama 82ed968e1e 1/7: Add Emacs 29.4 to MELPA workflow

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit 82ed968e1eebab32c4a1dd21ff43a922cff50102
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Add Emacs 29.4 to MELPA workflow

Added Emacs 29.4 to the list of tested versions in the MELPA GitHub
Actions workflow.
---
 .github/workflows/melpa.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/melpa.yml b/.github/workflows/melpa.yml
index 4b61dce6a5..9a34a8e9f4 100644
--- a/.github/workflows/melpa.yml
+++ b/.github/workflows/melpa.yml
@@ -58,6 +58,7 @@ jobs:
   - 29.1
   - 29.2
   - 29.3
+  - 29.4
 ignore_warnings:
   - false
 warnings_as_errors:



[elpa] externals/ellama cddea3d08e 2/7: Add semantic similarity check functionality

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit cddea3d08e72e234a2745678123abd84b82165a8
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Add semantic similarity check functionality

Added a new function `ellama-semantic-similar-p` to check if two texts
have the same meaning using an LLM. Also, added a custom variable
`ellama-semantic-identity-template` for defining the template used in
this semantic identity check.
---
 ellama.el | 29 +
 1 file changed, 29 insertions(+)

diff --git a/ellama.el b/ellama.el
index 4b94bfd3c3..4c6f7e30d8 100644
--- a/ellama.el
+++ b/ellama.el
@@ -367,6 +367,20 @@ is not changed.
   :group 'ellama
   :type 'string)
 
+(defcustom ellama-semantic-identity-template "Determine if two texts have the 
same meaning. If they are similar but differ in key aspects, they are not the 
same. Return the answer as a JSON object.
+
+%s
+
+
+%s
+
+
+{\"same\": true}
+"
+  "Extract string list template."
+  :group 'ellama
+  :type 'string)
+
 (defcustom ellama-extraction-provider nil
   "LLM provider for data extraction."
   :group 'ellama
@@ -2197,6 +2211,21 @@ otherwise prompt user for URL to summarize."
   (kill-region (point) (point-max))
   (ellama-summarize
 
+(defun ellama-semantic-similar-p (text1 text2)
+  "Check if TEXT1 means the same as TEXT2."
+  (plist-get
+   (json-parse-string
+(llm-chat
+ (or ellama-extraction-provider ellama-provider)
+ (llm-make-chat-prompt
+  (format ellama-semantic-identity-template text1 text2)
+  :response-format '(:type object :properties
+  (:same (:type boolean))
+  :required (same
+:object-type 'plist
+:false-object nil)
+   :same))
+
 (defun ellama--make-extract-string-list-prompt (elements input)
   "Create LLM prompt for list of ELEMENTS extraction from INPUT."
   (llm-make-chat-prompt



[elpa] externals/ellama cc436ef525 7/7: Bump version

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit cc436ef525b15015b99becb032bffb2c71a77e58
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Bump version
---
 NEWS.org  | 2 ++
 ellama.el | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS.org b/NEWS.org
index 5d26fce647..4c0e047f4f 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,5 @@
+* Version 0.13.7
+- Add missing requires for integration tests.
 * Version 0.13.6
 - Add function ~ellama-semantic-similar-p~. It can be useful for
   creating lists without duplicates by meaning.
diff --git a/ellama.el b/ellama.el
index b2866c8d5d..775895d626 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (spinner "1.7.4") 
(transient "0.7") (compat "29.1"))
-;; Version: 0.13.6
+;; Version: 0.13.7
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 



[elpa] externals/modus-themes de57a78821 1/2: Simplify modus-themes--retrieve-palette-value

2025-02-08 Thread ELPA Syncer
branch: externals/modus-themes
commit de57a78821959ae5b18fc4a5a541a460fd1b9461
Author: Basil L. Contovounesios 
Commit: Basil L. Contovounesios 

Simplify modus-themes--retrieve-palette-value

If the value is not contained in the palette, the recursive call to
modus-themes--retrieve-palette-value will return unspecified anyway,
thanks to the alist-get at the start of the function.

This saves a list allocation per recursive call, at the expense of
an additional funcall.

An alternative that avoids both the list allocation and the extra
funcall is to use (assq value palette) instead, at the expense of
more (and repetitive) typing.
---
 modus-themes.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modus-themes.el b/modus-themes.el
index e675f9e19d..ea3299cd67 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -1154,7 +1154,7 @@ This function is used in the macros `modus-themes-theme',
   (eq value 'unspecified))
   value)
  ((and (symbolp value)
-   (memq value (mapcar #'car palette)))
+   value)
   (modus-themes--retrieve-palette-value value palette))
  (t
   'unspecified



[elpa] externals/ellama 375daa66e7 5/7: Bump version

2025-02-08 Thread ELPA Syncer
branch: externals/ellama
commit 375daa66e7ccb476ae28005f690e0f0d08ca5455
Author: Sergey Kostyaev 
Commit: Sergey Kostyaev 

Bump version
---
 NEWS.org  | 4 
 ellama.el | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS.org b/NEWS.org
index 3d1dd0a67a..5d26fce647 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,7 @@
+* Version 0.13.6
+- Add function ~ellama-semantic-similar-p~. It can be useful for
+  creating lists without duplicates by meaning.
+- Add integration tests.
 * Version 0.13.5
 - Fix defcustom validation. Remove unnecessary quote.
 * Version 0.13.4
diff --git a/ellama.el b/ellama.el
index 4c6f7e30d8..b2866c8d5d 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.22.0") (spinner "1.7.4") 
(transient "0.7") (compat "29.1"))
-;; Version: 0.13.5
+;; Version: 0.13.6
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 



[elpa] externals/modus-themes 610ae60123 2/2: Merge branch 'blc/loop' into 'main'

2025-02-08 Thread ELPA Syncer
branch: externals/modus-themes
commit 610ae60123707c4669651b8da3308e9c54b83620
Merge: 4b10426687 de57a78821
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Merge branch 'blc/loop' into 'main'

Simplify modus-themes--retrieve-palette-value

See merge request protesilaos/modus-themes!60
---
 modus-themes.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modus-themes.el b/modus-themes.el
index e675f9e19d..ea3299cd67 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -1154,7 +1154,7 @@ This function is used in the macros `modus-themes-theme',
   (eq value 'unspecified))
   value)
  ((and (symbolp value)
-   (memq value (mapcar #'car palette)))
+   value)
   (modus-themes--retrieve-palette-value value palette))
  (t
   'unspecified



[nongnu] elpa/helm updated (3f46171208 -> 80d5c9e68f)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch elpa/helm.

  from  3f46171208 Merge pull request #2706 from 
pkryger/package-vc-affixations
   new  6eba3d69bd New user var helm-ff-show-dot-file-path (#2693)
   new  80d5c9e68f Fix set function for helm-ff-show-dot-file-path


Summary of changes:
 helm-files.el | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)



[nongnu] elpa/helm 80d5c9e68f 2/2: Fix set function for helm-ff-show-dot-file-path

2025-02-08 Thread ELPA Syncer
branch: elpa/helm
commit 80d5c9e68f7ce162967f0818ea8c9abb7d24594f
Author: Thierry Volpiatto 
Commit: Thierry Volpiatto 

Fix set function for helm-ff-show-dot-file-path
---
 helm-files.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index d0fffdf0dd..d01a212d6b 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -905,8 +905,7 @@ to nil to avoid error messages when using 
`helm-find-files'."
   :type 'boolean
   :set (lambda (var val)
 (set-default var val)
- (cl-loop for dir being the hash-keys of helm-ff--file-notify-watchers
-  do (remhash dir helm-ff--list-directory-cache
+ (clrhash helm-ff--list-directory-cache)))
 
 (defcustom helm-ff-inotify-unsupported-methods '("adb")
   "Tramp methods unsupported by file-notify."



[nongnu] elpa/helm 6eba3d69bd 1/2: New user var helm-ff-show-dot-file-path (#2693)

2025-02-08 Thread ELPA Syncer
branch: elpa/helm
commit 6eba3d69bd64935fc972e0fb8d09fb0f34f72658
Author: Thierry Volpiatto 
Commit: Thierry Volpiatto 

New user var helm-ff-show-dot-file-path (#2693)
---
 helm-files.el | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/helm-files.el b/helm-files.el
index c41f84f756..d0fffdf0dd 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -900,6 +900,14 @@ to nil to avoid error messages when using 
`helm-find-files'."
(cl-loop for dir being the hash-keys of 
helm-ff--file-notify-watchers
 do (remhash dir helm-ff--list-directory-cache)
 
+(defcustom helm-ff-show-dot-file-path nil
+  "Show full path of dotted directories when non nil."
+  :type 'boolean
+  :set (lambda (var val)
+(set-default var val)
+ (cl-loop for dir being the hash-keys of helm-ff--file-notify-watchers
+  do (remhash dir helm-ff--list-directory-cache
+
 (defcustom helm-ff-inotify-unsupported-methods '("adb")
   "Tramp methods unsupported by file-notify."
   :type '(repeat string))
@@ -4248,7 +4256,8 @@ If SKIP-BORING-CHECK is non nil don't filter boring 
files."
;; Filename with cntrl chars e.g. foo^J
(replace-regexp-in-string
 "[[:cntrl:]]" "?"
-(if (or reverse urlp) file basename
+(if (or reverse urlp (and dot helm-ff-show-dot-file-path))
+file basename
  (len (length disp))
  (backup (backup-file-name-p disp)))
 (when (string-match "/\\'" file)



[elpa] externals/standard-themes 4eaea72366: Simplify ef-themes--retrieve-palette-value

2025-02-08 Thread ELPA Syncer
branch: externals/standard-themes
commit 4eaea72366f0d589efc11f7223c355147c951196
Author: Protesilaos Stavrou 
Commit: Protesilaos Stavrou 

Simplify ef-themes--retrieve-palette-value

This is the same change that Basil L. Contovounesios contributed to
the Modus themes Git repository, in commit de57a78.
---
 standard-themes.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/standard-themes.el b/standard-themes.el
index 118fb66b0b..d3eac4c528 100644
--- a/standard-themes.el
+++ b/standard-themes.el
@@ -484,8 +484,7 @@ This function is used in the macros `standard-themes-theme',
  ((or (stringp value)
   (eq value 'unspecified))
   value)
- ((and (symbolp value)
-   (memq value (mapcar #'car palette)))
+ ((and (symbolp value) value)
   (standard-themes--retrieve-palette-value value palette))
  (t
   'unspecified



[elpa] externals/scanner d52d1acf01 19/54: add options and commands for setting brightness and contrast

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit d52d1acf014207aaef9d50da604f13463fbd1ed4
Author: Raffael Stocker 
Commit: Raffael Stocker 

add options and commands for setting brightness and contrast

* scanner.el (scanner-set-brightness): new function
 (scanner-set-contrast): new function
---
 scanner.el | 60 +---
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/scanner.el b/scanner.el
index 7e71222903..66f2d4d0f1 100644
--- a/scanner.el
+++ b/scanner.el
@@ -88,6 +88,16 @@
   "Resolutions for images and documents."
   :type '(plist :value-type number))
 
+(defcustom scanner-brightness
+  20
+  "Brightness setting for the scan."
+  :type '(const integer))
+
+(defcustom scanner-contrast
+  50
+  "Contrast setting for the scan."
+  :type '(const integer))
+
 (defcustom scanner-paper-sizes
   '(:a3
 (297 420)
@@ -378,6 +388,12 @@ border-scan."
 (define-key map [image-size]
   '(menu-item "Select image size" scanner-select-image-size
  :help "Select a size for image scanning."))
+   (define-key map [contrast]
+ '(menu-item "Set contrast" scanner-set-contrast
+ :help "Set the scanner's contrast."))
+   (define-key map [brightness]
+ '(menu-item "Set brightness" scanner-set-brightness
+ :help "Set the scanner's brightness."))
 (define-key map [img-res]
   '(menu-item "Set image resolution" scanner-set-image-resolution
  :help "Set the resolution for image 
scanning."))
@@ -429,7 +445,7 @@ name.")
 
 (eval-and-compile
   (defconst scanner--device-specific-switches
-'("--mode" "--resolution" "-x" "-y")
+'("--mode" "--resolution" "-x" "-y" "--brightness" "--contrast")
 "List of required device specific options.
 
 These options are necessary for the full set of features offered
@@ -474,19 +490,29 @@ y-dimension.  If no size is configured, return nil."
  (plist-get 
scanner-image-format
 
(plist-get args :scan-type
"--mode=" (lambda (args)
-   (scanner--when-switch "--mode" args
- (plist-get scanner-scan-mode
-(plist-get 
args :scan-type
+   (scanner--when-switch
+"--mode" args
+(plist-get scanner-scan-mode
+   (plist-get args 
:scan-type
"--resolution=" (lambda (args)
- (scanner--when-switch 
"--resolution" args
-(plist-get 
scanner-resolution
-   
(plist-get args :scan-type
+ (scanner--when-switch
+  "--resolution" args
+  (plist-get scanner-resolution
+ 
(plist-get args :scan-type
"-x" (lambda (args)
-  (scanner--when-switch "-x" args
-(scanner--size (plist-get args :scan-type) 
#'car)))
+  (scanner--when-switch
+   "-x" args
+   (scanner--size (plist-get args :scan-type) 
#'car)))
"-y" (lambda (args)
-  (scanner--when-switch "-y" args
-(scanner--size (plist-get args :scan-type) 
#'cadr)))
+  (scanner--when-switch
+   "-y" args
+   (scanner--size (plist-get args :scan-type) 
#'cadr)))
+   "--brightness=" (lambda (args)
+ (scanner--when-switch 
"--brightness" args
+   
scanner-brightness))
+   "--contrast=" (lambda (args)
+ (scanner--when-switch 
"--contrast" args
+   
scanner-contrast))
'user-switches 'scanner-scanimage-switches)
   "The arguments list specification for scanimage.")
 
@@ -733,6 +759,18 @@ them.  Otherwise, return nil."
   (setq scanner-resolution
(plist-put scanner-resolution :doc resolution)))
 
+;;;###autoload
+(defun scanner-set-brigh

[elpa] externals/scanner eaa6deba0f 07/54: add more option and command documentation

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit eaa6deba0fb9511c1c51050c37e9d4e55bdce97d
Author: Raffael Stocker 
Commit: Raffael Stocker 

add more option and command documentation
---
 .gitignore   |   5 +
 scanner.texi | 407 ---
 2 files changed, 309 insertions(+), 103 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0381e802c3..6a7296b1ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,8 @@ TAGS
 *.png
 *.pdf
 *.txt
+*.aux
+*.cp
+*.cps
+*.toc
+*.info
diff --git a/scanner.texi b/scanner.texi
index d99c9080ae..4c62296e67 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -63,7 +63,6 @@ The document was typeset with
 * User Options::
 * Improving Scan Quality::
 * Reporting Bugs::
-* Hacking::
 * GNU Free Documentation License::
 * Index::
 @end menu
@@ -76,10 +75,8 @@ The document was typeset with
 
 @menu
 * Introduction::
-* Principle of Operation::
 * Basic Setup::
-* Scanning Documents::
-* Scanning Images::
+* Scanning Documents and Images::
 @end menu
 
 @node Introduction
@@ -139,20 +136,6 @@ uses the customization system of GNU Emacs
 necessary settings and takes care of processing using the
 abovementioned programs.
 
-
-@node Principle of Operation
-@section Principle of Operation
-@cindex principle of operation
-@cindex operation, principle of
-
-@c sequence of program calls
-@c use of temporary files
-@c re-entrancy (but maybe mangled log)
-@c log buffer for diagnosis
-@c data and configuration files/directories needed by the programs
-@c use of more than one device: select new device between scans
-
-
 @node Basic Setup
 @section Basic Setup
 @cindex basic setup
@@ -160,41 +143,127 @@ abovementioned programs.
 @cindex configuration, basic
 @cindex installation
 
-Basic setup items:
-- program executables
-- paper/image size
-- nothing with unpaper
-- file formats and outputs
+To get started with Scanner, make sure the following programs are
+installed:
+@table @command
+@item scanimage
+Scanimage comes with the sane-backends distribution, see
+@url{http://sane-project.org/}. 
+
+@item tesseract
+Tesseract is used for OCR and PDF generation in document scans.  The
+source is available at @url{https://github.com/tesseract-ocr/tesseract}.
+
+@item unpaper
+Unpaper is used for post-processing the scans obtained from
+@command{scanimage} before feeding them into @command{tesseract}.  This
+is optional, but highly recommended.  The source is available at
+@url{https://github.com/unpaper/unpaper}. 
+@end table
 
-Just name the important items, refer to the detailed chapter for more
-information.
+Tesseract is usually provided without the language data files as they
+are very large.  The full set of language files is over 4@dmn{GB}.  Some
+GNU/Linux distributions offer individual language packages; if yours
+does not, you can download the language data files from
+@url{https://github.com/tesseract-ocr/tessdata}.
 
-@node Scanning Documents
-@section Scanning Documents
-@cindex scanning documents
-@cindex documents, scanning
+Make sure the options @code{scanner-scanimage-program},
+@code{scanner-tesseract-program}, and @code{scanner-unpaper-program} are
+set correctly.  Also, the options @code{scanner-tessdata-dir} and
+@code{scanner-tesseract-configdir} must be set correctly so
+@command{tesseract} can find the language data files and output
+configurations. 
 
-describe functions for document scanning
-refer also to menu entries
+Customize the basic options like @code{scanner-doc-papersize},
+@code{scanner-resolution}, @code{scanner-tesseract-languages}, and
+@code{scanner-tesseract-outputs}.  See @ref{User Options} for a detailed
+discussion of all the available options.
 
 
+@node Scanning Documents and Images
+@section Scanning Documents and Images
+@cindex scanning documents and images
+
+The Scanner package provides two commands for scanning documents and
+images.  These are described below.
+
 @table @kbd
 @item M-x scanner-scan-document
-Scan a document.
+@itemx C-u M-x scanner-scan-document
+@itemx C-u N M-x scanner-scan-document
+Scan a document.  When called without a prefix argument, this command
+will scan only one page.  When called with the default prefix argument
+(as @kbd{C-u M-x scanner-scan-document}), it will ask after each scanned
+page whether another pages should be scanned.  With a numeric prefix
+argument, it will scan that many pages, waiting a number of seconds
+between each page, as configured in @code{scanner-scan-delay}.
+
+The scan will use the resolution configured in
+@code{scanner-resolution} with the @code{:doc} key.
+
+This command interactively reads a file name that will
+be used as the base name of the output file(s).  The extension of the
+file name is ignored as it is instead specified by the
+@command{tesseract} output formats as configured with the option
+@code{scanner-tesseract-outputs} or the command
+@code{scanner-select-outputs}.
+If the specified file already exists, @code{scanner-scan-document} 

[elpa] externals/scanner 56a5e17c40 27/54: show use-unpaper status after toggling

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 56a5e17c40d14aebb032e8bf2aa022f8d8406dd4
Author: Raffael Stocker 
Commit: Raffael Stocker 

show use-unpaper status after toggling
---
 scanner.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index e74319fcea..bb1b0a17f6 100644
--- a/scanner.el
+++ b/scanner.el
@@ -854,7 +854,9 @@ selection is made."
 (defun scanner-toggle-use-unpaper ()
   "Toggle use of unpaper."
   (interactive)
-  (setq scanner-use-unpaper (not scanner-use-unpaper)))
+  (setq scanner-use-unpaper (not scanner-use-unpaper))
+  (message "Processing with unpaper is %sabled"
+  (if scanner-use-unpaper "en" "dis")))
 
 ;;;###autoload
 (defun scanner-select-page-layout (layout)



[elpa] externals/scanner 67bebbc113 34/54: silence compile warnings about scanner-show-config

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 67bebbc113993de7baacc0db41d210ad2e95f73a
Author: Raffael Stocker 
Commit: Raffael Stocker 

silence compile warnings about scanner-show-config
---
 scanner.el | 41 +
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/scanner.el b/scanner.el
index 3fa38a5431..08305191b2 100644
--- a/scanner.el
+++ b/scanner.el
@@ -961,26 +961,27 @@ selection is made."
 (defun scanner-show-config ()
   "Show the current configuration."
   (interactive)
-  (with-current-buffer-window "*scanner-config*" nil nil
-   (let ((variables (mapcar (lambda (variable)
-  (cons (car variable)
-
(replace-regexp-in-string "-" " "
-   
   (symbol-name (car variable))
-   
   nil nil nil
-   
   (length "scanner-"
-(custom-group-members 
'scanner nil
- (widget-create 'push-button
-:notify (lambda (&rest ignore)
-  (customize-group 
'scanner))
-"Customize scanner")
- (insert "\n\nCurrent configuration:\n\n")
- (mapc (lambda (variable)
- (insert (format "%25s: %s\n"
- (cdr variable)
- (symbol-value (car 
variable)
-   variables)
- (use-local-map widget-keymap)
- (widget-setup
+  (when (functionp 'custom-group-members)
+   (with-current-buffer-window "*scanner-config*" nil nil
+ (let ((variables (mapcar (lambda (variable)
+(cons (car 
variable)
+  
(replace-regexp-in-string "-" " "
+   
 (symbol-name (car variable))
+   
 nil nil nil
+   
 (length "scanner-"
+  
(custom-group-members 'scanner nil
+   (widget-create 'push-button
+  :notify (lambda (&rest _)
+
(customize-group 'scanner))
+  "Customize scanner")
+   (insert "\n\nCurrent configuration:\n\n")
+   (mapc (lambda (variable)
+   (insert (format "%25s: %s\n"
+   (cdr variable)
+   (symbol-value 
(car variable)
+ variables)
+   (use-local-map widget-keymap)
+   (widget-setup)
 
 ;;;###autoload
 (defun scanner-scan-document (npages filename)



[elpa] externals/scanner 9eb4666522 49/54: improve error handling in size calculations

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 9eb4666522a4563ef10f93702c4d1ecaaa34af8e
Author: Raffael Stocker 
Commit: Raffael Stocker 

improve error handling in size calculations
---
 scanner-test.el | 22 ++
 scanner.el  | 31 +--
 2 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/scanner-test.el b/scanner-test.el
index 18f4deef40..efb62d2004 100644
--- a/scanner-test.el
+++ b/scanner-test.el
@@ -139,24 +139,38 @@
   "Test the cm to pixel conversion."
   (should (= 100 (scanner--cm-to-pixels 2.54 100)))
   (should (= 600 (scanner--cm-to-pixels 2.54 600)))
+  (should (= -600 (scanner--cm-to-pixels -2.54 600)))
+  (should (= -600 (scanner--cm-to-pixels 2.54 -600)))
   (should (= 0 (scanner--cm-to-pixels 2.54 0)))
+  (should (= 0 (scanner--cm-to-pixels 0 30)))
   (should (= 354 (scanner--cm-to-pixels 3 300)))
-  (should (= 300 (scanner--cm-to-pixels 2.54508 300
+  (should (= 300 (scanner--cm-to-pixels 2.54508 300)))
+  (should-error (= 300 (scanner--cm-to-pixels 'a 300
 
 (ert-deftest scanner--corner-pixels ()
   "Test the paper size to corner coordinates conversion."
-  (should (equal '(0 0 35078 25393) (scanner--corner-pixels '(297 215) 300
+  (should (equal '(0 0 35078 25393) (scanner--corner-pixels '(297 215) 300)))
+  (should-error (equal '(0 0 35078 25393) (scanner--corner-pixels 'a 300)))
+  (should-error (equal '(0 0 35078 25393)
+   (scanner--corner-pixels '(a b) 300)))
+  (should-error (equal '(0 0 35078 25393)
+   (scanner--corner-pixels '(-297 210) 300
 
 (ert-deftest scanner--keyword-string ()
   "Test the keyword to string conversion."
   (should (string= "keyword" (scanner--keyword-string :keyword)))
-  (should (string= "" (scanner--keyword-string :
+  (should (string= "" (scanner--keyword-string :)))
+  (should (string= "keyword" (scanner--keyword-string "keyword"
 
 (ert-deftest scanner--process-unpaper-size ()
   "Test paper size parsing."
   (should (eq nil (scanner--process-unpaper-size "none")))
   (should (eq :the-size (scanner--process-unpaper-size ":the-size")))
-  (should (string= "297cm,210cm" (scanner--process-unpaper-size 
"297cm,210cm"
+  (should (string= "297cm,210cm"
+   (scanner--process-unpaper-size "297cm,210cm")))
+  (should-error (scanner--process-unpaper-size "297cm"))
+  (should-error (scanner--process-unpaper-size "297cm,"))
+  (should-error (scanner--process-unpaper-size '(297 210
 
 (provide 'scanner-test)
 
diff --git a/scanner.el b/scanner.el
index 52f010eed6..8664112326 100644
--- a/scanner.el
+++ b/scanner.el
@@ -620,7 +620,7 @@ y-dimension.  If no size is configured, return nil."
'user-switches 'scanner-scanimage-switches)
   "The arguments list used for preview scans.")
 
-(defun scanner--size-cm (size)
+(defun scanner--size-in-cm (size)
   (cond ((and (keywordp size)
  (plist-member scanner-paper-sizes size))
 (mapcar (lambda (num) (/ num 10.0))
@@ -629,8 +629,8 @@ y-dimension.  If no size is configured, return nil."
  (let ((idx 
(string-match

  "\\([[:digit:]]+\\(\\.[[:digit:]]+\\)?\\)cm"

  size-str)))
-   (if idx 
(string-to-number
-   
 (match-string 1 size-str))
+   (if idx
+   
(string-to-number (match-string 1 size-str))
  
(user-error "Unknown size format: %s" size-str
(split-string 
size ",")))
(t (error "Unknown paper size: %s" size
@@ -639,10 +639,13 @@ y-dimension.  If no size is configured, return nil."
   (floor (* (/ cm 2.54) resolution)))
 
 (defun scanner--corner-pixels (size resolution)
-  (list 0
-   0
-   (scanner--cm-to-pixels (car size) resolution)
-   (scanner--cm-to-pixels (cadr size) resolution)))
+  (let ((coords (list 0
+ 0
+ (scanner--cm-to-pixels (car size) 
resolution)
+ (scanner--cm-to-pixels (cadr size) 
resolution
+   (unless (cl-notany #'cl-minusp coords)
+ (user-error "Size must be non-negative: %s" size))
+   coords))
 
 (defun scanner--program-args (argspec &rest args)
   "Return an arguments list as specified in ARGSPEC, assuming ARGS.
@@ -765,7 +768,7 @@ construct a 

[elpa] externals/scanner 6dd070098e 51/54: add .elpaignore

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 6dd070098e7867c26c0ef095fc3bebfee589f4e0
Author: Raffael Stocker 
Commit: Raffael Stocker 

add .elpaignore
---
 .elpaignore | 4 
 1 file changed, 4 insertions(+)

diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 00..26095d3c0f
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1,4 @@
+Makefile
+fdl.texi
+scanner.texi
+scanner-test.el



[elpa] externals/scanner df5f0da750 21/54: lift restrictions on brightness and contrast settings

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit df5f0da750548714cc5774016b212e243c490f30
Author: Raffael Stocker 
Commit: Raffael Stocker 

lift restrictions on brightness and contrast settings

* scanner.el (scanner-set-brightness): don't limit setting
 (scanner-set-contrast): don't limit setting
---
 scanner.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scanner.el b/scanner.el
index 048958a1e3..479eecd02e 100644
--- a/scanner.el
+++ b/scanner.el
@@ -766,13 +766,13 @@ them.  Otherwise, return nil."
 (defun scanner-set-brightness (brightness)
   "Set the BRIGHTNESS."
   (interactive "NBrightness: ")
-  (setq scanner-brightness (min  (max brightness 0) 100)))
+  (setq scanner-brightness brightness))
 
 ;;;###autoload
 (defun scanner-set-contrast (contrast)
   "Set the CONTRAST."
   (interactive "NContrast: ")
-  (setq scanner-contrast (min (max contrast 0) 100)))
+  (setq scanner-contrast contrast))
 
 ;;;###autoload
 (defun scanner-set-scan-delay (delay)



[elpa] externals/scanner 5bb4eac741 11/54: add the unpaper process and clean up the scanner--log calls

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 5bb4eac7412914408c04ab8e51da3ce04e09a8a4
Author: Raffael Stocker 
Commit: Raffael Stocker 

add the unpaper process and clean up the scanner--log calls
---
 scanner.el | 48 
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/scanner.el b/scanner.el
index c22e913b23..33fd868fae 100644
--- a/scanner.el
+++ b/scanner.el
@@ -545,7 +545,13 @@ construct a shell command."
"--border" (lambda (_) (mapconcat #'number-to-string
 
scanner-unpaper-border
 ","))
-   'user-switches 'scanner-unpaper-switches)
+   'user-switches 'scanner-unpaper-switches
+   'input (lambda (args) (concat (file-name-as-directory
+ (plist-get 
args :tmp-dir))
+
"input%04d.pnm"))
+   'output (lambda (args) (concat (file-name-as-directory
+ (plist-get 
args :tmp-dir))
+
"output%04d.pnm")))
   "The arguments list specification for unpaper.")
 
 (defun scanner--ensure-init ()
@@ -733,21 +739,19 @@ performing OCR."
(page-num 0))
 (cl-labels ((scanimage
 ()
-(let* ((img-file (concat 
(file-name-as-directory tmp-dir)
-   
  "input"
-   
  (number-to-string (cl-incf page-num))
-   
  "."
+(let* ((img-file (format "%sinput%04d.%s"
+   
  (file-name-as-directory tmp-dir)
+   
  (cl-incf page-num)

  fmt))
(scanimage-args 
(scanner--program-args

 scanner--scanimage-argspec

 :scan-type :doc
-   
 :img-type fmt
+   
 :img-fmt fmt

 :device-dependent switches))
(scanimage-command 
(scanner--make-scanimage-command

scanimage-args img-file)))
   (push img-file file-list)
-  (scanner--log (format "scanimage command: %s"
-   
 scanimage-command))
+  (scanner--log "scanimage command: %s" 
scanimage-command)
   (make-process :name "Scanner (scanimage)"
 :command 
scanimage-command
 :sentinel 
#'scan-or-process
@@ -767,15 +771,36 @@ performing OCR."
 ((> num-pages 1)
  (cl-decf num-pages)
  (run-at-time 
scanner-scan-delay nil #'scanimage))
-(t (tesseract
+(t (if 
scanner-use-unpaper
+   
(unpaper)
+ 
(tesseract)
   (error
(cleanup)
(signal (car err) (cdr err)
(unpaper
 ()
 (cl-assert scanner-unpaper-program)
+(let ((unpaper-args (scanner--program-args
+ 
scanner--unpaper-argspec
+ 
:tmp-dir tmp-dir)))
+  (scanner--log "unpaper a

[elpa] externals/scanner d6530e4d2b 12/54: choose better unpaper defaults and allow empty paper sizes

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit d6530e4d2bb111921dd4a4cb7ca49ceb3199342f
Author: Raffael Stocker 
Commit: Raffael Stocker 

choose better unpaper defaults and allow empty paper sizes
---
 scanner.el | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scanner.el b/scanner.el
index 33fd868fae..809f812f2f 100644
--- a/scanner.el
+++ b/scanner.el
@@ -238,14 +238,13 @@ plugged in.  For these, auto-detection will always be 
done."
   "Delay in seconds between document scans in multi-page mode."
   :type '(number))
 
-
 (defcustom scanner-use-unpaper
   nil
   "Use unpaper(1) for post-processing of the scans before OCR."
   :type '(boolean))
 
 (defcustom scanner-unpaper-page-layout
-  "single"
+  "none"
   "Page layout to assume in post-processing."
   :type '(choice (const "single")
 (const "double")
@@ -254,12 +253,14 @@ plugged in.  For these, auto-detection will always be 
done."
 (defcustom scanner-unpaper-input-pages
   1
   "Input pages per sheet."
-  :type '(integer))
+  :type '(choice (const 1)
+(const 2)))
 
 (defcustom scanner-unpaper-output-pages
   1
   "Output pages per sheet."
-  :type '(integer))
+  :type '(choice (const 1)
+(const 2)))
 
 (defcustom scanner-unpaper-pre-rotation
   nil
@@ -287,6 +288,7 @@ Either choose one of the pre-defined options (see
 ‘scanner--unpaper-sizes’), or enter width and height values as a
 string; e.g. ‘\"21cm,29.7cm\"’."
   :type `(choice (string)
+(const :tag "none" nil)
 ,@(mapcar (lambda (x) (list 'const x))
   scanner--unpaper-sizes)))
 
@@ -297,11 +299,12 @@ Either choose one of the pre-defined options (see
 ‘scanner--unpaper-sizes’), or enter width and height values as a
 string; e.g. ‘\"21cm,29.7cm\"’."
   :type `(choice (string)
+(const :tag "none" nil)
 ,@(mapcar (lambda (x) (list 'const x))
   scanner--unpaper-sizes)))
 
 (defcustom scanner-unpaper-border
-  '(0 0 0 0)
+  '(10 10 10 10)
   "Define a border at the sheet edges to be set to white.
 The border is specified as a list of four integers (widths in
 pixels) for left, top, right, and bottom edge, respectively.



[elpa] externals/scanner b35d929101 29/54: reorganise the menu

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit b35d929101e80ac16fe00099440aaabcefcbee05
Author: Raffael Stocker 
Commit: Raffael Stocker 

reorganise the menu
---
 scanner.el | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/scanner.el b/scanner.el
index 0809e293c4..b01bd6389f 100644
--- a/scanner.el
+++ b/scanner.el
@@ -380,7 +380,7 @@ border-scan."
  :enable (and (boundp 'scanner-use-unpaper)
   
scanner-use-unpaper)))
(define-key map [use-unpaper]
- '(menu-item "Use unpaper for scan enhancement"
+ '(menu-item "Use unpaper to enhance document scans"
  scanner-toggle-use-unpaper
  :help "Enable scan post-processing using 
unpaper."
  :button (:toggle . (and (boundp 
'scanner-use-unpaper)
@@ -393,16 +393,12 @@ border-scan."
 (define-key map [image-size]
   '(menu-item "Select image size" scanner-select-image-size
  :help "Select a size for image scanning."))
-   (define-key map [contrast]
- '(menu-item "Set contrast" scanner-set-contrast
- :help "Set the scanner's contrast."))
-   (define-key map [brightness]
- '(menu-item "Set brightness" scanner-set-brightness
- :help "Set the scanner's brightness."))
-(define-key map [img-res]
+   (define-key map [img-res]
   '(menu-item "Set image resolution" scanner-set-image-resolution
  :help "Set the resolution for image 
scanning."))
-(define-key map [languages]
+   (define-key map [seperator4]
+  '(menu-item "--"))
+   (define-key map [languages]
   '(menu-item "Select OCR languages" scanner-select-languages
  :help "Select languages for OCR."))
 (define-key map [outputs]
@@ -414,6 +410,14 @@ border-scan."
 (define-key map [doc-res]
   '(menu-item "Set document resolution" scanner-set-document-resolution
  :help "Set the resolution for document 
scanning."))
+(define-key map [seperator3]
+  '(menu-item "--"))
+   (define-key map [contrast]
+ '(menu-item "Set contrast" scanner-set-contrast
+ :help "Set the scanner's contrast."))
+(define-key map [brightness]
+ '(menu-item "Set brightness" scanner-set-brightness
+ :help "Set the scanner's brightness."))
(define-key map [scan-delay]
  '(menu-item "Set delay between scans" scanner-set-scan-delay
  :help "Set the delay between multi-page 
scans."))
@@ -441,7 +445,7 @@ border-scan."
 
 ;;;###autoload
 (define-key-after menu-bar-tools-menu [scanner]
-  (list 'menu-item "Scanner" scanner-menu))
+  (list 'menu-item "Scan" scanner-menu))
 
 
  internal variables and functions



[elpa] externals/scanner 59cc1b70cd 38/54: use keywords instead of strings in paper sizes for ‘unpaper’

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 59cc1b70cd9627d9aae3312f6885684837a43022
Author: Raffael Stocker 
Commit: Raffael Stocker 

use keywords instead of strings in paper sizes for ‘unpaper’
---
 scanner.el | 40 +---
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/scanner.el b/scanner.el
index 2c462a30db..fac6310a30 100644
--- a/scanner.el
+++ b/scanner.el
@@ -293,12 +293,12 @@ plugged in.  For these, auto-detection will always be 
done."
 (const :tag "none" nil)))
 
 (defconst scanner--unpaper-sizes
-  '("a5" "a4" "a3" "letter" "legal" "a5-landscape" "a4-landscape"
-   "a3-landscape" "letter-landscape" "legal-landscape")
+  '(:a5 :a4 :a3 :letter :legal :a5-landscape :a4-landscape
+   :a3-landscape :letter-landscape :legal-landscape)
   "Paper size names understood by unpaper.")
 
 (defcustom scanner-unpaper-pre-size
-  "a4"
+  :a4
   "Change sheet size before post-processing.
 Either choose one of the pre-defined options (see
 ‘scanner--unpaper-sizes’), or enter width and height values as a
@@ -309,7 +309,7 @@ string; e.g. ‘\"21cm,29.7cm\"’."
   scanner--unpaper-sizes)))
 
 (defcustom scanner-unpaper-post-size
-  "a4"
+  :a4
   "Change sheet size after post-processing.
 Either choose one of the pre-defined options (see
 ‘scanner--unpaper-sizes’), or enter width and height values as a
@@ -675,6 +675,11 @@ construct a shell command."
'outputs 'scanner-tesseract-outputs)
   "The arguments list specification for tesseract.")
 
+(defun scanner--keyword-string (arg)
+  (if (keywordp arg)
+ (substring (symbol-name arg) 1)
+   arg))
+
 (defvar scanner--unpaper-argspec
   (list "--layout" 'scanner-unpaper-page-layout
"--dpi" (lambda (_) (plist-get scanner-resolution :doc))
@@ -682,8 +687,10 @@ construct a shell command."
"--output-pages" 'scanner-unpaper-output-pages
"--pre-rotate" 'scanner-unpaper-pre-rotation
"--post-rotate" 'scanner-unpaper-post-rotation
-   "--size" 'scanner-unpaper-pre-size
-   "--post-size" 'scanner-unpaper-post-size
+   "--size" (lambda (_)
+  (scanner--keyword-string 
scanner-unpaper-pre-size))
+   "--post-size" (lambda (_)
+   (scanner--keyword-string 
scanner-unpaper-post-size))
"--pre-border" (lambda (_) (mapconcat #'number-to-string

 scanner-unpaper-border

 ","))
@@ -790,9 +797,7 @@ them.  Otherwise, return nil."
   "Select the papersize SIZE for document scanning."
   (interactive
(let ((choices (append (delq nil
-   (mapcar (lambda 
(x)
-   
  (and (keywordp x)
-   
   (substring (symbol-name x) 1)))
+   (mapcar 
#'scanner--keyword-string

scanner-paper-sizes))
  '("whatever"
  (list (intern (concat ":"
@@ -937,6 +942,14 @@ selection is made."
   (interactive (scanner--select-rotation "Select post-rotation: "))
   (setq scanner-unpaper-post-rotation rotation))
 
+
+(defun scanner--process-unpaper-size (size)
+  (if (string= "none" size)
+ nil
+   (if (string= ":" (substring size 0 1))
+   (intern size)
+ size)))
+
 ;;;###autoload
 (defun scanner-select-pre-size (size)
   "Select the page SIZE before processing."
@@ -944,9 +957,7 @@ selection is made."
  (cons 
"none"

scanner--unpaper-sizes)
  nil 
'confirm)))
-  (setq scanner-unpaper-pre-size (if (string= "none" size)
-nil
-  size)))
+  (setq scanner-unpaper-pre-size (scanner--process-unpaper-size size)))
 
 ;;;###autoload
 (defun scanner-select-post-size (size)
@@ -955,9 +966,8 @@ selection is made."
  (cons 
"none"

scanner--unpaper-sizes)
  nil 
'confirm)))
-  (setq 

[elpa] externals/scanner 3e862c7fd8 26/54: use "Gray" mode in preview scans

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 3e862c7fd825e8d9248c8e818d8232de339d8f8a
Author: Raffael Stocker 
Commit: Raffael Stocker 

use "Gray" mode in preview scans
---
 scanner.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scanner.el b/scanner.el
index ca76f4f76a..e74319fcea 100644
--- a/scanner.el
+++ b/scanner.el
@@ -525,6 +525,9 @@ y-dimension.  If no size is configured, return nil."
 (defvar scanner--scanimage-preview-argspec
   (list "-d" 'scanner-device-name
"--format=" "pnm"
+   "--mode" (lambda (args)
+  (scanner--when-switch "--mode" args
+"Gray"))
"--resolution=" (lambda (args)
  (scanner--when-switch 
"--resolution" args

scanner-preview-resolution))



[elpa] externals/scanner ac3ff71475 17/54: add a chapter for news

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit ac3ff714750e5f2ad783d39a927150f369ae8845
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a chapter for news
---
 scanner.texi | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/scanner.texi b/scanner.texi
index 94a8480eae..d4b5a176aa 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -62,6 +62,7 @@ The document was typeset with
 * Overview::
 * User Options::
 * Improving Scan Quality::
+* News::
 * Reporting Bugs::
 * GNU Free Documentation License::
 * Index::
@@ -858,8 +859,38 @@ for detailed information on how to use unpaper
 @end itemize
 
 
+@node News
+@chapter News
+@cindex news
+
+This chapter lists the changes made in new releases of Scanner.
+
+@menu
+* Changes in Version 0.3::
+@end menu
+
+@node Changes in Version 0.3
+@section Changes in Version 0.3
+@cindex changes in version 0.3
+
+@itemize
+@item
+@command{unpaper} has been added as a new backend; it allows scan
+enhancement in document scans; see @ref{Configuring unpaper} for options.
+@item
+older @command{scanimage} versions (before 1.0.28) are now supported as well.
+@item
+a new page size @code{:whatever} allows @command{scanimage} to select
+the page size based on the available scan area.
+@item
+Scanner now comes with a manual.
+@end itemize
+
+
+
 @node Reporting Bugs
 @chapter Reporting Bugs
+@cindex reporting bugs
 
 Refer to @uref{https://www.gitlab.com/rstocker/scanner/}
 mention *Scanner* log buffer



[elpa] externals/scanner c5c965410e 28/54: correct defcustom data types

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit c5c965410e8b604cd9eb5861b51901cdb8f11034
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct defcustom data types
---
 scanner.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scanner.el b/scanner.el
index bb1b0a17f6..0809e293c4 100644
--- a/scanner.el
+++ b/scanner.el
@@ -90,18 +90,18 @@
 
 (defcustom scanner-preview-resolution
   75
-  "Resolutions for preview scans"
-  :type '(const integer))
+  "Resolutions for preview scans."
+  :type '(integer))
 
 (defcustom scanner-brightness
   20
   "Brightness setting for the scan."
-  :type '(const integer))
+  :type '(integer))
 
 (defcustom scanner-contrast
   50
   "Contrast setting for the scan."
-  :type '(const integer))
+  :type '(integer))
 
 (defcustom scanner-paper-sizes
   '(:a3



[elpa] externals/scanner updated (43cf030c73 -> 44eab47963)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/scanner.

  from  43cf030c73 explicitly set variables modified with plist-put
   new  a2b9ca492d add unpaper customizations
   new  bbfbdae070 change to tmp directory instead of files, force pnm
   new  37941bf3d8 add unpaper stub to the scan fsm
   new  f7e66f39ad Merge branch 'master' into develop/unpaper
   new  d549ca5c36 make generation of program option lists table-driven
   new  5fd67b523d remove old -args functions
   new  bb385e94a6 add unpaper argspec and simplify handling of numeric args
   new  5bb4eac741 add the unpaper process and clean up the scanner--log 
calls
   new  d6530e4d2b choose better unpaper defaults and allow empty paper 
sizes
   new  f54542cff9 add configuration functions
   new  91f6cc3ef1 add scan enhancement menu
   new  1e907a6883 adjust copyright years
   new  0f42a12f3a correct a docstring
   new  d52d1acf01 add options and commands for setting brightness and 
contrast
   new  25e9bfc9ff add a command and menu item for setting the scan delay
   new  df5f0da750 lift restrictions on brightness and contrast settings
   new  97b246929c correct an indentation accident
   new  3ad04a5a5f add a command and configuration for preview scans
   new  3e862c7fd8 use "Gray" mode in preview scans
   new  56a5e17c40 show use-unpaper status after toggling
   new  c5c965410e correct defcustom data types
   new  b35d929101 reorganise the menu
   new  4715000dce improve a docstring
   new  5864ed7c6f add a keymap
   new  d9fcf1a159 change unpaper border switch to --pre-border as needed 
for deskewing
   new  054a56b688 add a command to show the current configuration
   new  67bebbc113 silence compile warnings about scanner-show-config
   new  c7c252078c use ‘fboundp’ instead of ‘functionp’ in 
scanner-show-config
   new  3de9ddefc7 require cus-edit for scanner-show-config
   new  3f83066fc6 add info manual stub
   new  a9d3e0357b Merge branch 'master' into documentation
   new  eaa6deba0f add more option and command documentation
   new  4fd44f213f add documentation of unpaper commands and options
   new  ac3ff71475 add a chapter for news
   new  e49b4ae7fb add recommendations for improving scan and OCR quality
   new  599cecc8a6 add scan preview and brightness, contrast, delay 
commands/options
   new  b5dbefbc12 Merge branch 'documentation' into develop/unpaper
   new  59cc1b70cd use keywords instead of strings in paper sizes for 
‘unpaper’
   new  e3c40a0dc0 add landscape paper sizes
   new  efe6d3658f add conversion function from paper size to corner pixel 
coordinates
   new  39c2494fd5 add a mask customization option
   new  1b1d40b026 add tests for size conversion functions
   new  2e00e710bd log stdout and stderr
   new  e265498ee5 allow program switches without arguments
   new  9a93e82540 add size parsing function
   new  53c3862b6f add deskewing customization and program switches
   new  d2d2d709db correct doc-string of scanner--program-args
   new  07ac936fec clean up preview code
   new  9eb4666522 improve error handling in size calculations
   new  89b9159321 fix typos in documentation
   new  6dd070098e add .elpaignore
   new  6febfbf0c9 update readme and headers in scanner.el
   new  38e320dcaa add link to unpaper sources
   new  44eab47963 bump version


Summary of changes:
 .elpaignore |4 +
 .gitignore  |5 +
 README  |   88 +
 Readme.org  |   23 +-
 fdl.texi|  505 ++
 scanner-test.el |  171 -
 scanner.el  |  920 ++-
 scanner.texi| 1058 +++
 8 files changed, 2505 insertions(+), 269 deletions(-)
 create mode 100644 .elpaignore
 create mode 100644 README
 create mode 100644 fdl.texi
 create mode 100644 scanner.texi



[elpa] externals/scanner bbfbdae070 03/54: change to tmp directory instead of files, force pnm

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit bbfbdae070a8981ee3c9422ecbd3339f6f919993
Author: Raffael Stocker 
Commit: Raffael Stocker 

change to tmp directory instead of files, force pnm

Unpaper requires input and output files to be specified with a number
format (e.g. input%d.pnm) so separation of pages in double-page scans will
work.  Therefore, we change from individual temporary files to a temporary
directory to have more control over the file names.  Also, unpaper requires
the input files to be in the PNM format, so we force this.
* scanner.el (scanner-scan-document): force PNM, use tmp directories
---
 scanner.el | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/scanner.el b/scanner.el
index d1cdb5cec9..89729dc65b 100644
--- a/scanner.el
+++ b/scanner.el
@@ -654,19 +654,31 @@ argument, e.g. ‘\\[universal-argument] 3
 
 If ‘scanner-device-name’ is nil or this device is unavailable,
 attempt auto-detection.  If more than one scanning device is
-available, ask for a selection interactively."
+available, ask for a selection interactively.
+
+If ‘scanner-use-unpaper’ is non-nil, silenty force the image
+format to \"pnm\" and post-process the scans using unpaper before
+performing OCR."
   (interactive "P\nFDocument file name: ")
   (cl-assert scanner-scanimage-program)
   (cl-assert scanner-tesseract-program)
   (let ((doc-file (file-name-sans-extension filename))
(num-pages (prefix-numeric-value npages))
-   (fmt (plist-get scanner-image-format :doc))
+   (fmt (if scanner-use-unpaper
+"pnm"
+  (plist-get scanner-image-format :doc)))
(switches (scanner--ensure-init))
(file-list '())
-   (fl-file nil))
+   (fl-file nil)
+   (tmp-dir (make-temp-file "scanner" t))
+   (page-num 0))
 (cl-labels ((scanimage
 ()
-(let* ((img-file (make-temp-file "scanner" nil 
(concat "." fmt)))
+(let* ((img-file (concat 
(file-name-as-directory tmp-dir)
+   
  "input"
+   
  (number-to-string (cl-incf page-num))
+   
  "."
+   
  fmt))
(scanimage-args 
(scanner--scanimage-args :doc

 switches

 fmt))
@@ -699,7 +711,10 @@ available, ask for a selection interactively."
 ()
 (unless scanner-reverse-pages
   (setq file-list (nreverse file-list)))
-(setq fl-file (make-temp-file "scanlist" nil 
".txt"
+(setq fl-file (make-temp-file (concat 
(file-name-as-directory
+   
tmp-dir)
+   
   "scanlist")
+   
   nil ".txt"

   (mapconcat #'identity

  file-list

  "\n")))
@@ -721,9 +736,7 @@ available, ask for a selection interactively."
   (cleanup)))
(cleanup
 ()
-(and file-list (dolist (file file-list)
- (delete-file 
file)))
-(and fl-file (delete-file fl-file
+(and tmp-dir (delete-directory tmp-dir t
  (when (scanner--confirm-filenames doc-file scanner-tesseract-outputs)
(scanner--log "Scanning document to file(s) \"%s.*\"" doc-file)
(scanimage)



[elpa] externals/scanner bb385e94a6 10/54: add unpaper argspec and simplify handling of numeric args

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit bb385e94a6a39a22e0bc6dfab24147da0243fe15
Author: Raffael Stocker 
Commit: Raffael Stocker 

add unpaper argspec and simplify handling of numeric args

* scanner.el (scanner--unpaper-argspec): new variable
 (scanner--program-args): now handles numeric arguments directly
---
 scanner.el | 70 ++
 1 file changed, 43 insertions(+), 27 deletions(-)

diff --git a/scanner.el b/scanner.el
index 92a0aaeaa4..c22e913b23 100644
--- a/scanner.el
+++ b/scanner.el
@@ -284,9 +284,9 @@ plugged in.  For these, auto-detection will always be done."
   "a4"
   "Change sheet size before post-processing.
 Either choose one of the pre-defined options (see
-‘scanner--unpaper-sizes’), or enter a list of width and height
-values as strings; e.g. ‘(\"21cm\" \"29.7cm\")’."
-  :type `(choice (list string string)
+‘scanner--unpaper-sizes’), or enter width and height values as a
+string; e.g. ‘\"21cm,29.7cm\"’."
+  :type `(choice (string)
 ,@(mapcar (lambda (x) (list 'const x))
   scanner--unpaper-sizes)))
 
@@ -294,9 +294,9 @@ values as strings; e.g. ‘(\"21cm\" \"29.7cm\")’."
   "a4"
   "Change sheet size after post-processing.
 Either choose one of the pre-defined options (see
-‘scanner--unpaper-sizes’), or enter a list of width and height
-values as strings; e.g. ‘(\"21cm\" \"29.7cm\")’."
-  :type `(choice (list string string)
+‘scanner--unpaper-sizes’), or enter width and height values as a
+string; e.g. ‘\"21cm,29.7cm\"’."
+  :type `(choice (string)
 ,@(mapcar (lambda (x) (list 'const x))
   scanner--unpaper-sizes)))
 
@@ -406,15 +406,17 @@ name, the device type, and the vendor and model names."
   `(when (member ,switch (plist-get ,args :device-dependent))
 ,form))
 
-(defun scanner--size (scan-type)
-  "Return the size information appropriate for SCAN-TYPE.
-SCAN-TYPE may be either ‘:doc’ or ‘:image’.  If no size is
-configured, return nil."
-  (cl-case scan-type
-   (:doc (plist-get scanner-paper-sizes
-scanner-doc-papersize))
-   (:image scanner-image-size)
-   (t nil)))
+(defun scanner--size (scan-type selector)
+  "Return the size for SCAN-TYPE as given by SELECTOR.
+SCAN-TYPE may be either ‘:doc’ or ‘:image’.  Use ‘car’ as
+selector for the x-dimension and ‘cadr’ as selector for the
+y-dimension.  If no size is configured, return nil."
+  (-when-let (size (cl-case scan-type
+(:doc (plist-get scanner-paper-sizes
+ 
scanner-doc-papersize))
+(:image scanner-image-size)
+(t nil)))
+   (funcall selector size)))
 
 (defvar scanner--scanimage-argspec
   (list "-d" 'scanner-device-name
@@ -428,17 +430,14 @@ configured, return nil."
 (plist-get 
args :scan-type
"--resolution=" (lambda (args)
  (scanner--when-switch 
"--resolution" args
-   (number-to-string
 (plist-get 
scanner-resolution
-   
(plist-get args :scan-type)
+   
(plist-get args :scan-type
"-x" (lambda (args)
   (scanner--when-switch "-x" args
-(-when-let (size (scanner--size (plist-get 
args :scan-type)))
-  (number-to-string (car size)
+(scanner--size (plist-get args :scan-type) 
#'car)))
"-y" (lambda (args)
   (scanner--when-switch "-y" args
-(-when-let (size (scanner--size (plist-get 
args :scan-type)))
-  (number-to-string (cadr size)
+(scanner--size (plist-get args :scan-type) 
#'cadr)))
'user-switches 'scanner-scanimage-switches)
   "The arguments list specification for scanimage.")
 
@@ -458,11 +457,14 @@ translated into the arguments list:
\"quux\")"
   (cl-labels ((make-option (sw val)
   (when val
-(if (stringp sw)
-(if 
(string-match ".=\\'" sw)
-(list 
(concat sw val))
-  

[elpa] externals/scanner a2b9ca492d 02/54: add unpaper customizations

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit a2b9ca492d2adc3b5044aad6ea58674cbd890573
Author: Raffael Stocker 
Commit: Raffael Stocker 

add unpaper customizations
---
 scanner.el | 81 ++
 1 file changed, 81 insertions(+)

diff --git a/scanner.el b/scanner.el
index 9f3df3c440..d1cdb5cec9 100644
--- a/scanner.el
+++ b/scanner.el
@@ -142,6 +142,11 @@ use whatever scanimage thinks is right."
   "Path and file name of the tesseract(1) program."
   :type '(string))
 
+(defcustom scanner-unpaper-program
+  (executable-find "unpaper")
+  "Path and file name of the unpaper(1) program."
+  :type '(string))
+
 (defun scanner--widget-validate-subset (error-msg widget set)
   "Issue ERROR-MSG if the value of WIDGET is a not subset of SET.
 ERROR-MSG is passed to ‘format’ with two string arguments: the
@@ -233,6 +238,82 @@ plugged in.  For these, auto-detection will always be 
done."
   "Delay between document scans in multi-page mode."
   :type '(number))
 
+
+(defcustom scanner-use-unpaper
+  nil
+  "Use unpaper(1) for post-processing of the scans before OCR."
+  :type '(boolean))
+
+(defcustom scanner-unpaper-page-layout
+  "single"
+  "Page layout to assume in post-processing."
+  :type '(choice (const "single")
+(const "double")
+(const "none")))
+
+(defcustom scanner-unpaper-input-pages
+  1
+  "Input pages per sheet."
+  :type '(integer))
+
+(defcustom scanner-unpaper-output-pages
+  1
+  "Output pages per sheet."
+  :type '(integer))
+
+(defcustom scanner-unpaper-pre-rotation
+  nil
+  "Pre-rotation to apply before post-processing."
+  :type '(choice (const :tag "clockwise" 90)
+(const :tag "counter-clockwise" -90)
+(const :tag "none" nil)))
+
+(defcustom scanner-unpaper-post-rotation
+  nil
+  "Post-rotation to apply after post-processing."
+  :type '(choice (const :tag "clockwise" 90)
+(const :tag "counter-clockwise" -90)
+(const :tag "none" nil)))
+
+(defconst scanner--unpaper-sizes
+  '("a5" "a4" "a3" "letter" "legal" "a5-landscape" "a4-landscape"
+   "a3-landscape" "letter-landscape" "legal-landscape")
+  "Paper size names understood by unpaper.")
+
+(defcustom scanner-unpaper-pre-size
+  "a4"
+  "Change sheet size before post-processing.
+Either choose one of the pre-defined options (see
+‘scanner--unpaper-sizes’), or enter a list of width and height
+values as strings; e.g. ‘(\"21cm\" \"29.7cm\")’."
+  :type `(choice (list string string)
+,@(mapcar (lambda (x) (list 'const x))
+  scanner--unpaper-sizes)))
+
+(defcustom scanner-unpaper-post-size
+  "a4"
+  "Change sheet size after post-processing.
+Either choose one of the pre-defined options (see
+‘scanner--unpaper-sizes’), or enter a list of width and height
+values as strings; e.g. ‘(\"21cm\" \"29.7cm\")’."
+  :type `(choice (list string string)
+,@(mapcar (lambda (x) (list 'const x))
+  scanner--unpaper-sizes)))
+
+(defcustom scanner-unpaper-border
+  '(0 0 0 0)
+  "Define a border at the sheet edges to be set to white.
+The border is specified as a list of four integers (widths in
+pixels) for left, top, right, and bottom edge, respectively.
+This border is applied after deskewing and before automatic
+border-scan."
+  :type '(list integer integer integer integer))
+
+(defcustom scanner-unpaper-switches
+  '()
+  "Additional options to be passed to unpaper(1)."
+  :type '(repeat string))
+
 
  menu
 ;;;###autoload



[elpa] externals/scanner 37941bf3d8 04/54: add unpaper stub to the scan fsm

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 37941bf3d8764233c6e86e6d910c77579b44a105
Author: Raffael Stocker 
Commit: Raffael Stocker 

add unpaper stub to the scan fsm

* scanner.el (scanner-scan-document): add local function ‘unpaper’
---
 scanner.el | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/scanner.el b/scanner.el
index 89729dc65b..f4c7eb4b30 100644
--- a/scanner.el
+++ b/scanner.el
@@ -697,9 +697,12 @@ performing OCR."
 (let ((ev (string-trim event)))
   (unless (string= "finished" ev)
 (error "%s: %s" process ev))
-  (cond ((consp npages) (if (y-or-n-p 
"Scan another page? ")
-   
 (scanimage)
-   
   (tesseract)))
+  (cond ((consp npages)
+ (if (y-or-n-p "Scan 
another page? ")
+ (scanimage)
+   (if 
scanner-use-unpaper
+   
(unpaper)
+ (tesseract
 ((> num-pages 1)
  (cl-decf num-pages)
  (run-at-time 
scanner-scan-delay nil #'scanimage))
@@ -707,6 +710,14 @@ performing OCR."
   (error
(cleanup)
(signal (car err) (cdr err)
+   (unpaper
+()
+(cl-assert scanner-unpaper-program)
+(condition-case err
+()
+  (error
+   (cleanup)
+   (signal (car err) (cdr err)
(tesseract
 ()
 (unless scanner-reverse-pages



[elpa] externals/scanner 5fd67b523d 09/54: remove old -args functions

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 5fd67b523d18c5cbd2d2b7eb486399b0acea5624
Author: Raffael Stocker 
Commit: Raffael Stocker 

remove old -args functions

The old -args functions are now replaced by scanner--program-args:
* scanner.el (scanner--scanimage-args): removed
 (scanner--tesseract-args): removed
---
 scanner-test.el | 129 +++-
 scanner.el  |  65 ++--
 2 files changed, 47 insertions(+), 147 deletions(-)

diff --git a/scanner-test.el b/scanner-test.el
index 46645c99c6..b8b5fd0891 100644
--- a/scanner-test.el
+++ b/scanner-test.el
@@ -50,135 +50,54 @@
 (require 'dash)
 (require 'ert)
 
-(ert-deftest scanner-test-scanimage-args ()
-  "Test the argument list construction for scanimage."
-  ;; minimum args list (no device-specific options are available)
-  (let ((switches nil)
-   (scanner-device-name "devname")
-   (scanner-image-size '(200 250))
-   (-compare-fn #'string=))
-;; known values are included with their switches
-(should (-is-infix-p '("-d" "devname") (scanner--scanimage-args :image
-   switches
-   "jpeg")))
-(should (-contains-p (scanner--scanimage-args :image switches "jpeg")
-"--format=jpeg"))
-;; device-specific options are not included in the argument list
-(should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")
-"--mode"))
-(should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")  
 "--resolution"))
-(should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")
-"-x"))
-(should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")
-"-y"))
-(should-not (-contains-p (scanner--scanimage-args :doc switches "jpeg")
-"-x"))
-(should-not (-contains-p (scanner--scanimage-args :doc switches "jpeg")
-"-y"))
-;; without format and device name, these are not in the args list
-(let ((scanner-image-format nil)
- (scanner-device-name nil))
-  (should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")
-  "--format="))
-  (should-not (-contains-p (scanner--scanimage-args :image switches "jpeg")
-  "-d"
-  ;; image args list with device-specific args
-  (let ((switches '("--resolution" "-x" "-y" "--mode"))
-   (scanner-resolution '(:doc 300 :image 600))
-   (scanner-scan-mode '(:image "Color" :doc "Gray"))
-   (scanner-doc-papersize :a4)
-   (scanner-paper-sizes '(:a4 (210 297)))
-   (scanner-image-size '(200 250))
-   (scanner-image-format '(:doc "pnm" :image "tiff"))
-   (-compare-fn #'string=))
-(should (-contains-p (scanner--scanimage-args  :image switches "jpeg")
-"--format=jpeg"))
-(should (-contains-p (scanner--scanimage-args  :image switches "jpeg")
-"--mode=Color"))
-(should (-contains-p (scanner--scanimage-args  :image switches "jpeg")
-"--resolution=600"))
-(should (-is-infix-p '("-x" "210") (scanner--scanimage-args  :doc
-switches 
"jpeg")))
-(should (-is-infix-p '("-y" "297") (scanner--scanimage-args  :doc
-switches 
"jpeg")))
-(should (-is-infix-p '("-x" "200") (scanner--scanimage-args  :image
-switches 
"jpeg")))
-(should (-is-infix-p '("-y" "250") (scanner--scanimage-args  :image
-switches 
"jpeg")))
-(should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
-"--format=pnm"))
-(should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
-"--mode=Gray"))
-(should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
-"--resolution=300"))
-(let ((scanner-image-size nil))
-  (should-not (-contains-p (scanner--scanimage-args  :image
-switches "jpeg")
-  "-x"))
-  (should-not (-contains-p (scanner--scanimage-args :image
-   switches "jpeg")
-  "-y")))
-(let ((scanner-doc-papersize :whatever))
-  (should-not (-contains-p (scanner--scanimage-args  :doc
-switches "jpeg")
-  "-x"))
-  (should-not (-contains-p (scanner--scan

[elpa] externals/scanner e265498ee5 44/54: allow program switches without arguments

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit e265498ee5da23adb5287cc29b28e88e0a442a23
Author: Raffael Stocker 
Commit: Raffael Stocker 

allow program switches without arguments
---
 scanner.el | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scanner.el b/scanner.el
index 46f6c6c99b..b35e42acf0 100644
--- a/scanner.el
+++ b/scanner.el
@@ -626,6 +626,7 @@ ARGSPEC is expected to be a list of the form:
(\"--switch1\" 'argument1
 \"--switch2=\" (lambda (args) \"bar\"))
 \"--never-used\" nil
+\"--switch-without-argument\" t
 'symbol \"--always-there\"
 'other-symbol (\"baz\" \"quux\"))
 
@@ -639,9 +640,11 @@ translated into the arguments list:

 (number-to-string val)

   val)))
   (if (stringp sw)
-  (if 
(string-match ".=\\'" sw)
-  
(list (concat sw sval))
-(list 
sw sval))
+  (if (stringp 
sval)
+  (if 
(string-match ".=\\'" sw)
+   
   (list (concat sw sval))
+   
 (list sw sval))
+(list 
sw))
 (list sval)
  (process-option (switch value)
  (cond ((functionp 
value)



[elpa] externals/scanner 5864ed7c6f 31/54: add a keymap

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 5864ed7c6fb35c01d10b6bb0b45ad3e60548d0bf
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a keymap
---
 scanner.el | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index a15590279a..0d95def5f8 100644
--- a/scanner.el
+++ b/scanner.el
@@ -333,7 +333,7 @@ border-scan."
   :type '(repeat string))
 
 
- menu
+ menu and keymap
 ;;;###autoload
 (defvar scanner-enhancement-menu
   (let ((map (make-sparse-keymap "Scan Enhancement")))
@@ -447,6 +447,35 @@ border-scan."
 (define-key-after menu-bar-tools-menu [scanner]
   (list 'menu-item "Scan" scanner-menu))
 
+;;;###autoload
+(defvar scanner-map
+  (let ((map (make-sparse-keymap)))
+   (define-key map "d" #'scanner-scan-document)
+   (define-key map "i" #'scanner-scan-image)
+   (define-key map "D" #'scanner-scan-multi-doc)
+   (define-key map "I" #'scanner-scan-multi-images)
+   (define-key map "p" #'scanner-scan-preview)
+   (define-key map "r" #'scanner-set-document-resolution)
+   (define-key map "R" #'scanner-set-image-resolution)
+   (define-key map "s" #'scanner-select-papersize)
+   (define-key map "S" #'scanner-select-image-size)
+   (define-key map "u" #'scanner-toggle-use-unpaper)
+   (define-key map "l" #'scanner-select-languages)
+   (define-key map "o" #'scanner-select-outputs)
+   (define-key map "cd" #'scanner-select-device)
+   (define-key map "ct" #'scanner-set-scan-delay)
+   (define-key map "ci" #'scanner-select-input-pages)
+   (define-key map "co" #'scanner-select-output-pages)
+   (define-key map "cl" #'scanner-select-page-layout)
+   (define-key map "cr" #'scanner-select-pre-rotation)
+   (define-key map "cR" #'scanner-select-post-rotation)
+   (define-key map "cs" #'scanner-select-pre-size)
+   (define-key map "cS" #'scanner-select-post-size)
+   (define-key map "cb" #'scanner-set-brightness)
+   (define-key map "cc" #'scanner-set-contrast)
+   map)
+  "The scanner keymap.")
+
 
  internal variables and functions
 (defvar scanner--detected-devices



[elpa] externals/scanner 97b246929c 22/54: correct an indentation accident

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 97b246929c07dbcdc61e86b17fc5d649e2fb4387
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct an indentation accident
---
 scanner.el | 30 +-
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/scanner.el b/scanner.el
index 479eecd02e..4ef4051bc9 100644
--- a/scanner.el
+++ b/scanner.el
@@ -493,29 +493,25 @@ y-dimension.  If no size is configured, return nil."
  (plist-get 
scanner-image-format
 
(plist-get args :scan-type
"--mode=" (lambda (args)
-   (scanner--when-switch
-"--mode" args
-(plist-get scanner-scan-mode
-   (plist-get args 
:scan-type
+   (scanner--when-switch "--mode" args
+ (plist-get scanner-scan-mode
+(plist-get 
args :scan-type
"--resolution=" (lambda (args)
- (scanner--when-switch
-  "--resolution" args
-  (plist-get scanner-resolution
- 
(plist-get args :scan-type
+ (scanner--when-switch 
"--resolution" args
+   (plist-get 
scanner-resolution
+  
(plist-get args :scan-type
"-x" (lambda (args)
-  (scanner--when-switch
-   "-x" args
-   (scanner--size (plist-get args :scan-type) 
#'car)))
+  (scanner--when-switch "-x" args
+(scanner--size (plist-get args :scan-type) 
#'car)))
"-y" (lambda (args)
-  (scanner--when-switch
-   "-y" args
-   (scanner--size (plist-get args :scan-type) 
#'cadr)))
+  (scanner--when-switch "-y" args
+(scanner--size (plist-get args :scan-type) 
#'cadr)))
"--brightness=" (lambda (args)
  (scanner--when-switch 
"--brightness" args
-   
scanner-brightness))
+   scanner-brightness))
"--contrast=" (lambda (args)
- (scanner--when-switch 
"--contrast" args
-   
scanner-contrast))
+   (scanner--when-switch 
"--contrast" args
+ scanner-contrast))
'user-switches 'scanner-scanimage-switches)
   "The arguments list specification for scanimage.")
 



[elpa] externals/scanner d549ca5c36 08/54: make generation of program option lists table-driven

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit d549ca5c36f78e6f44cc3e0ecbc9ca5b5bf01635
Author: Raffael Stocker 
Commit: Raffael Stocker 

make generation of program option lists table-driven

This commit simplifies the generation of program option lists.  This is in
preparation of adding unpaper as a new backend.
Program options (switches and their arguments) are now specified as a table
instead of in the -args functions.
* scanner.el (scanner--when-switch): new function
 (scanner--size): new function
 (scanner--scanimage-args): now just calls scanner--program-args
 (scanner--tesseract-args): now just calls scanner--program-args
 (scanner--scanimage-argspec): new variable
 (scanner--tesseract-argspec): new variable
 (scanner--program-args): new function
---
 scanner-test.el |   7 +--
 scanner.el  | 130 ++--
 2 files changed, 101 insertions(+), 36 deletions(-)

diff --git a/scanner-test.el b/scanner-test.el
index 64668c92b3..46645c99c6 100644
--- a/scanner-test.el
+++ b/scanner-test.el
@@ -89,6 +89,7 @@
(scanner-doc-papersize :a4)
(scanner-paper-sizes '(:a4 (210 297)))
(scanner-image-size '(200 250))
+   (scanner-image-format '(:doc "pnm" :image "tiff"))
(-compare-fn #'string=))
 (should (-contains-p (scanner--scanimage-args  :image switches "jpeg")
 "--format=jpeg"))
@@ -105,7 +106,7 @@
 (should (-is-infix-p '("-y" "250") (scanner--scanimage-args  :image
 switches 
"jpeg")))
 (should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
-"--format=jpeg"))
+"--format=pnm"))
 (should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
 "--mode=Gray"))
 (should (-contains-p (scanner--scanimage-args  :doc switches "jpeg")
@@ -136,7 +137,7 @@
 (scanner--make-scanimage-command
  (scanner--scanimage-args :doc nil "pnm")
  "outfile")))
-(should-not (string-match " > outfile$"
+(should-not (string-match " > outfile\\'"
  (car (last (scanner--make-scanimage-command
  (scanner--scanimage-args :doc nil "pnm")
  "outfile"))
@@ -149,7 +150,7 @@
 (scanner--make-scanimage-command
  (scanner--scanimage-args :doc nil "pnm")
  "outfile")))
-(should (string-match " > outfile$"
+(should (string-match " > outfile\\'"
  (car (last (scanner--make-scanimage-command
  (scanner--scanimage-args :doc nil "pnm")
  "outfile")))
diff --git a/scanner.el b/scanner.el
index e282ddf3f7..5d3e996ad2 100644
--- a/scanner.el
+++ b/scanner.el
@@ -400,6 +400,83 @@ name, the device type, and the vendor and model names."
  (--filter (= 3 (length it))
(mapcar (lambda (x) (split-string x 
"|")) scanners)
 
+(defmacro scanner--when-switch (switch args form)
+  "Evaluate FORM if SWITCH is in ‘(plist-get ARGS :device-dependent)’."
+  (declare (indent 2))
+  `(when (member ,switch (plist-get ,args :device-dependent))
+,form))
+
+(defun scanner--size (scan-type)
+  "Return the size information appropriate for SCAN-TYPE.
+SCAN-TYPE may be either ‘:doc’ or ‘:image’.  If no size is
+configured, return nil."
+  (cl-case scan-type
+   (:doc (plist-get scanner-paper-sizes
+scanner-doc-papersize))
+   (:image scanner-image-size)
+   (t nil)))
+
+(defvar scanner--scanimage-argspec
+  (list "-d" 'scanner-device-name
+   "--format=" (lambda (args)
+ (if (eq :doc (plist-get args 
:scan-type))
+ (plist-get 
scanner-image-format :doc)
+   (or (plist-get args :img-fmt)
+   (plist-get 
scanner-image-format :image
+   "--mode=" (lambda (args)
+   (scanner--when-switch "--mode" args
+ (plist-get scanner-scan-mode
+(plist-get 
args :scan-type
+   "--resolution=" (lambda (args)
+ (scanner--when-switch 
"--resolution" args
+   (number-to-string
+(plist-get 
scanner-resolution
+   

[elpa] externals/scanner 4fd44f213f 16/54: add documentation of unpaper commands and options

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 4fd44f213fa2f515053f4129061ef6ce35769d59
Author: Raffael Stocker 
Commit: Raffael Stocker 

add documentation of unpaper commands and options
---
 scanner.texi | 207 ++-
 1 file changed, 204 insertions(+), 3 deletions(-)

diff --git a/scanner.texi b/scanner.texi
index 4c62296e67..94a8480eae 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -71,7 +71,10 @@ The document was typeset with
 @c Insert new nodes with `C-c C-c n'.
 @node Overview
 @chapter Overview
-@cindex Overview
+@cindex overview
+
+This chapter gives provides you with the most important information to
+get started using Scanner.
 
 @menu
 * Introduction::
@@ -81,7 +84,7 @@ The document was typeset with
 
 @node Introduction
 @section Introduction
-@cindex Introduction
+@cindex introduction
 
 If you want to scan a document at high quality with @acronym{OCR,
 optical character recognition} and not use one of the available free
@@ -191,6 +194,7 @@ images.  These are described below.
 @item M-x scanner-scan-document
 @itemx C-u M-x scanner-scan-document
 @itemx C-u N M-x scanner-scan-document
+@findex scanner-scan-document
 Scan a document.  When called without a prefix argument, this command
 will scan only one page.  When called with the default prefix argument
 (as @kbd{C-u M-x scanner-scan-document}), it will ask after each scanned
@@ -233,6 +237,7 @@ for a multi-page scan.
 @item M-x scanner-scan-image
 @itemx C-u M-x scanner-scan-image
 @itemx C-u n M-x scanner-scan-image
+@findex scanner-scan-image
 Scan an image.  When called without a prefix argument, this command
 will scan only one image.  When called with the default prefix argument
 (as @kbd{C-u M-x scanner-scan-image}), it will ask after each scanned
@@ -287,7 +292,7 @@ Scanner menu (@clicksequence{Tools @click{} Scanner}).
 
 @node Configuration Commands
 @section Configuration Commands
-@cindex Configuration Commands
+@cindex configuration commands
 
 The following commands help you configure some of the more-often used
 options.  They only change the options for the running session; if you
@@ -297,6 +302,7 @@ Emacs sessions, use the customization interface.
 @table @kbd
 @item M-x scanner-set-image-resolution
 @item M-x scanner-set-document-resolution
+@findex scanner-set-document-resolution
 These commands interactively asks for a resolution (in @acronym{DPI,
 dots per inch}) to be used in subsequent image and document scans,
 respectively.  The corresponding user options is
@@ -310,6 +316,7 @@ and@*
 document resolution}.
 
 @item M-x scanner-select-papersize
+@findex scanner-select-papersize
 Select a paper size from @code{scanner-paper-sizes} or
 @code{:whatever}.  See also @code{scanner-doc-papersize}.
 
@@ -317,6 +324,7 @@ This command is available in the Scanner menu as@*
 @clicksequence{Tools @click{} Scanner @click{} Select paper size}.
 
 @item M-x scanner-select-image-size
+@findex scanner-select-image-size
 Select an image size.  This command interactively reads x and y
 dimensions in millimeter from the minibuffer and sets
 @code{scanner-image-size} accordingly.
@@ -325,6 +333,7 @@ This command is also available in the Scanner menu as@*
 @clicksequence{Tools @click{} Scanner @click{} Select image size}.
 
 @item M-x scanner-select-outputs
+@findex scanner-select-outputs
 Select the document outputs.  This command reads a list of document
 output formats.  See also @code{scanner-tesseract-outputs}.
 
@@ -332,6 +341,7 @@ This command is also available in the Scanner menu as@*
 @clicksequence{Tools @click{} Scanner @click{} Select document outputs}.
 
 @item M-x scanner-select-languages
+@findex scanner-select-languages
 Select the languages assumed for OCR.  This command reads a list of
 languages used for OCR.  The necessary @command{tesseract} data files
 must be available.  See @code{scanner-tesseract-languages}.
@@ -341,6 +351,7 @@ This command is also available in the Scanner menu as@*
 
 @item M-x scanner-select-device
 @itemx C-u M-x scanner-select-device
+@findex scanner-select-device
 Select a device, possibly triggering auto-detection.  Normally, manual
 device selection is not necessary as @command{scanimage} will
 auto-detect.  However, if you have multiple devices and want to change
@@ -353,6 +364,133 @@ This command is also available in the Scanner menu as@*
 @clicksequence{Tools @click{} Scanner @click{} Select scanning device}
 @end table
 
+The following commands can be found in the ``Scan Enhancement'' submenu
+of the Scanner menu (@clicksequence{Tools @click{} Scanner @click{} Scan
+Enhancement}).  They require @command{unpaper} to be installed.  Scan
+enhancement allows such post-processing operations as rotation,
+de-noising, and deskewing, among others.  It is highly recommended as a
+preparatory step before OCR.  The descriptions of the commands below
+give a few hints on the usage of @command{unpaper}.  For more details,
+see its man-page or web-site.
+
+

[elpa] externals/scanner 1b1d40b026 42/54: add tests for size conversion functions

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 1b1d40b026fadd831b7433580a2d9b4d5031a988
Author: Raffael Stocker 
Commit: Raffael Stocker 

add tests for size conversion functions
---
 scanner-test.el | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/scanner-test.el b/scanner-test.el
index c408c57a1a..18f4deef40 100644
--- a/scanner-test.el
+++ b/scanner-test.el
@@ -135,6 +135,29 @@
 (should (equal '("txt") (scanner-select-outputs '("txt"
 (should (equal '("pdf" "txt") (scanner-select-outputs '("pdf" "txt"))
 
+(ert-deftest scanner--cm-to-pixels ()
+  "Test the cm to pixel conversion."
+  (should (= 100 (scanner--cm-to-pixels 2.54 100)))
+  (should (= 600 (scanner--cm-to-pixels 2.54 600)))
+  (should (= 0 (scanner--cm-to-pixels 2.54 0)))
+  (should (= 354 (scanner--cm-to-pixels 3 300)))
+  (should (= 300 (scanner--cm-to-pixels 2.54508 300
+
+(ert-deftest scanner--corner-pixels ()
+  "Test the paper size to corner coordinates conversion."
+  (should (equal '(0 0 35078 25393) (scanner--corner-pixels '(297 215) 300
+
+(ert-deftest scanner--keyword-string ()
+  "Test the keyword to string conversion."
+  (should (string= "keyword" (scanner--keyword-string :keyword)))
+  (should (string= "" (scanner--keyword-string :
+
+(ert-deftest scanner--process-unpaper-size ()
+  "Test paper size parsing."
+  (should (eq nil (scanner--process-unpaper-size "none")))
+  (should (eq :the-size (scanner--process-unpaper-size ":the-size")))
+  (should (string= "297cm,210cm" (scanner--process-unpaper-size 
"297cm,210cm"
+
 (provide 'scanner-test)
 
 



[elpa] externals/scanner 91f6cc3ef1 14/54: add scan enhancement menu

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 91f6cc3ef1ab051099fbee9cf413304640759d3d
Author: Raffael Stocker 
Commit: Raffael Stocker 

add scan enhancement menu

* scanner.el (scanner-enhancement-menu): new variable
---
 scanner.el | 78 +-
 1 file changed, 62 insertions(+), 16 deletions(-)

diff --git a/scanner.el b/scanner.el
index d58dc4facc..801a7f17cf 100644
--- a/scanner.el
+++ b/scanner.el
@@ -319,51 +319,97 @@ border-scan."
 
 
  menu
+;;;###autoload
+(defvar scanner-enhancement-menu
+  (let ((map (make-sparse-keymap "Scan Enhancement")))
+   (define-key map [post-size]
+ '(menu-item "Select page size after processing"
+ scanner-select-post-size
+ :help "Stretch to a page size after 
processing is done."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [pre-size]
+ '(menu-item "Select page size before processing"
+ scanner-select-pre-size
+ :help "Stretch to a page size before all 
other processing."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [post-rotation]
+ '(menu-item "Select page rotation after processing"
+ scanner-select-post-rotation
+ :help "Rotate the page after processing is 
done."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [pre-rotation]
+ '(menu-item "Select page rotation before processing"
+ scanner-select-pre-rotation
+ :help "Rotate the page before all other 
processing."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [output-pages]
+ '(menu-item "Select number of output pages"
+ scanner-select-output-pages
+ :help "Select the number of output pages (to 
split pages)."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [input-pages]
+ '(menu-item "Select number of input pages"
+ scanner-select-input-pages
+ :help "Select the number of input pages (to 
combine pages)."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [page-layout]
+ '(menu-item "Select page layout"
+ scanner-select-page-layout
+ :help "Select the page layout (pages per 
scanned sheet)."
+ :enable (and (boundp 'scanner-use-unpaper)
+  
scanner-use-unpaper)))
+   (define-key map [use-unpaper]
+ '(menu-item "Use unpaper for scan enhancement"
+ scanner-toggle-use-unpaper
+ :help "Enable scan post-processing using 
unpaper."
+ :button (:toggle . (and (boundp 
'scanner-use-unpaper)
+   
  scanner-use-unpaper
+   map))
+
 ;;;###autoload
 (defvar scanner-menu
   (let ((map (make-sparse-keymap)))
 (define-key map [image-size]
   '(menu-item "Select image size" scanner-select-image-size
- :key-sequence nil
  :help "Select a size for image scanning."))
 (define-key map [img-res]
   '(menu-item "Set image resolution" scanner-set-image-resolution
- :key-sequence nil
  :help "Set the resolution for image 
scanning."))
 (define-key map [languages]
   '(menu-item "Select OCR languages" scanner-select-languages
- :key-sequence nil
  :help "Select languages for OCR."))
 (define-key map [outputs]
   '(menu-item "Select document outputs" scanner-select-outputs
- :key-sequence nil
  :help "Select document output formats."))
 (define-key map [papersize]
   '(menu-item "Select paper size" scanner-select-p

[elpa] externals/scanner f54542cff9 13/54: add configuration functions

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit f54542cff97a5ef7e08fd47fef6b55fd24fb8fb5
Author: Raffael Stocker 
Commit: Raffael Stocker 

add configuration functions

* scanner.el (scanner-toggle-use-unpaper):new function
 (scanner-select-page-layout):new function
 (scanner-select-input-pages):new function
 (scanner-select-output-pages):   new function
 (scanner--select-rotation):  new function
 (scanner-select-pre-rotation):   new function
 (scanner-select-post-rotation):  new function
 (scanner-select-pre-size):   new function
 (scanner-select-post-size):  new function
---
 scanner.el | 74 --
 1 file changed, 72 insertions(+), 2 deletions(-)

diff --git a/scanner.el b/scanner.el
index 809f812f2f..d58dc4facc 100644
--- a/scanner.el
+++ b/scanner.el
@@ -606,8 +606,6 @@ MSG is a format string, with ARGS passed to ‘format’."
   "Return scanner log buffer or create it."
   (get-buffer-create "*Scanner*"))
 
-
-
 (defun scanner--confirm-filenames (file &optional formats)
   "Confirm that FILE using the provided list of FORMATS may be overwritten.
 If no formats are provided, FILE is used as-is.  Return t either
@@ -624,6 +622,8 @@ them.  Otherwise, return nil."
   t))
  (confirm file
 
+
+
  commands
 ;;;###autoload
 (defun scanner-select-papersize (size)
@@ -709,6 +709,76 @@ selection is made."
  "(" t ")")
   (setq scanner-device-name device))
 
+;;;###autoload
+(defun scanner-toggle-use-unpaper ()
+  "Toggle use of unpaper."
+  (interactive)
+  (setq scanner-use-unpaper (not scanner-use-unpaper)))
+
+;;;###autoload
+(defun scanner-select-page-layout (layout)
+  "Select the page layout."
+  (interactive (list (completing-read "Select page layout: "
+ 
'("single" "double" "none")
+ nil 
t)))
+  (setq scanner-unpaper-page-layout layout))
+
+;;;###autoload
+(defun scanner-select-input-pages (pages)
+  "Select the number of input PAGES."
+  (interactive "NSelect the number of input pages: ")
+  (setq scanner-unpaper-input-pages (min (max pages 1) 2)))
+
+;;;###autoload
+(defun scanner-select-output-pages (pages)
+  "Select the number of output PAGES."
+  (interactive "NSelect the number of output pages: ")
+  (setq scanner-unpaper-output-pages (min (max pages 1) 2)))
+
+(defun scanner--select-rotation (prompt)
+  "Select rotation displaying PROMPT."
+  (let ((choice (completing-read prompt
+'("clockwise" 
"counter-clockwise"
+  "none")
+nil t)))
+   (list (cond ((string= choice "clockwise") 90)
+   ((string= choice "counter-clockwise") -90)
+   (t nil)
+
+;;;###autoload
+(defun scanner-select-pre-rotation (rotation)
+  "Select the pre-rotation ROTATION (cw, ccw, none)."
+  (interactive (scanner--select-rotation "Select pre-rotation: "))
+  (setq scanner-unpaper-pre-rotation rotation))
+
+;;;###autoload
+(defun scanner-select-post-rotation (rotation)
+  "Select the post-rotation ROTATION (cw, ccw, none)."
+  (interactive (scanner--select-rotation "Select post-rotation: "))
+  (setq scanner-unpaper-post-rotation rotation))
+
+;;;###autoload
+(defun scanner-select-pre-size (size)
+  "Select the page SIZE before processing."
+  (interactive (list (completing-read "Select a pre-processing page size: "
+ (cons 
"none"
+   
scanner--unpaper-sizes)
+ nil 
'confirm)))
+  (setq scanner-unpaper-pre-size (if (string= "none" size)
+nil
+  size)))
+
+;;;###autoload
+(defun scanner-select-post-size (size)
+  "Select the page SIZE after processing."
+  (interactive (list (completing-read "Select a post-processing page size: "
+ (cons 
"none"
+   
scanner--unpaper-sizes)
+ nil 
'confirm)))
+  (setq scanner-unpaper-post-size (if (string= "none" size)
+nil
+   

[elpa] externals/scanner 3ad04a5a5f 23/54: add a command and configuration for preview scans

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 3ad04a5a5fad85c82d8eecfce3d36076754e585b
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a command and configuration for preview scans

* scanner.el (scanner-scan-preview): new function
 (scanner-preview-resolution): new user option
 (scanner--scanimage-preview-argspec): new variable
 (scanner--unpaper-preview-argspec): new variable
---
 scanner.el | 134 -
 1 file changed, 132 insertions(+), 2 deletions(-)

diff --git a/scanner.el b/scanner.el
index 4ef4051bc9..ca76f4f76a 100644
--- a/scanner.el
+++ b/scanner.el
@@ -86,7 +86,12 @@
 (defcustom scanner-resolution
   '(:image 600 :doc 300)
   "Resolutions for images and documents."
-  :type '(plist :value-type number))
+  :type '(plist :value-type integer))
+
+(defcustom scanner-preview-resolution
+  75
+  "Resolutions for preview scans"
+  :type '(const integer))
 
 (defcustom scanner-brightness
   20
@@ -421,7 +426,9 @@ border-scan."
  (list 'menu-item "Scan enhancement" scanner-enhancement-menu))
(define-key map [seperator1]
   '(menu-item "--"))
-(define-key map [image-multi]
+   (define-key map [preview]
+  '(menu-item "Make a preview scan" scanner-scan-preview))
+   (define-key map [image-multi]
   '(menu-item "Scan multiple images" scanner-scan-multi-images))
 (define-key map [image]
   '(menu-item "Scan an image" scanner-scan-image))
@@ -515,6 +522,27 @@ y-dimension.  If no size is configured, return nil."
'user-switches 'scanner-scanimage-switches)
   "The arguments list specification for scanimage.")
 
+(defvar scanner--scanimage-preview-argspec
+  (list "-d" 'scanner-device-name
+   "--format=" "pnm"
+   "--resolution=" (lambda (args)
+ (scanner--when-switch 
"--resolution" args
+   
scanner-preview-resolution))
+   "-x" (lambda (args)
+  (scanner--when-switch "-x" args
+(scanner--size (plist-get args :scan-type) 
#'car)))
+   "-y" (lambda (args)
+  (scanner--when-switch "-y" args
+(scanner--size (plist-get args :scan-type) 
#'cadr)))
+   "--brightness=" (lambda (args)
+ (scanner--when-switch 
"--brightness" args
+   scanner-brightness))
+   "--contrast=" (lambda (args)
+   (scanner--when-switch 
"--contrast" args
+ scanner-contrast))
+   'user-switches 'scanner-scanimage-switches)
+  "The arguments list used for preview scans.")
+
 (defun scanner--program-args (argspec &rest args)
   "Return an arguments list as specified in ARGSPEC, assuming ARGS.
 
@@ -628,6 +656,27 @@ construct a shell command."
 
"output%04d.pnm")))
   "The arguments list specification for unpaper.")
 
+(defvar scanner--unpaper-preview-argspec
+  (list "--layout" 'scanner-unpaper-page-layout
+   "--dpi" 'scanner-preview-resolution
+   "--input-pages" 'scanner-unpaper-input-pages
+   "--output-pages" 'scanner-unpaper-output-pages
+   "--pre-rotate" 'scanner-unpaper-pre-rotation
+   "--post-rotate" 'scanner-unpaper-post-rotation
+   "--size" 'scanner-unpaper-pre-size
+   "--post-size" 'scanner-unpaper-post-size
+   "--border" (lambda (_) (mapconcat #'number-to-string
+
scanner-unpaper-border
+","))
+   'user-switches 'scanner-unpaper-switches
+   'input (lambda (args) (concat (file-name-as-directory
+ (plist-get 
args :tmp-dir))
+
"input%04d.pnm"))
+   'output (lambda (args) (concat (file-name-as-directory
+ (plist-get 
args :tmp-dir))
+
"output%04d.pnm")))
+  "The arguments list specification for unpaper.")
+
 (defun scanner--ensure-init ()
   "Ensure that scanning device is initialized.
 If no scanning device has been configured or the configured
@@ -1084,6 +1133,87 @@ A numerical suffix is added to FILENAME for each scanned 
image."
   (interactive "FImage file name: ")
   (scanner-scan-image (list 4) filename))
 
+
+;;;###autoload
+(defun scanner-scan-preview ()
+  "Make a preview scan.
+If ‘

[elpa] externals/scanner e49b4ae7fb 24/54: add recommendations for improving scan and OCR quality

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit e49b4ae7fbf404937b5459661e307f388812ec79
Author: Raffael Stocker 
Commit: Raffael Stocker 

add recommendations for improving scan and OCR quality
---
 scanner.texi | 134 +++
 1 file changed, 108 insertions(+), 26 deletions(-)

diff --git a/scanner.texi b/scanner.texi
index d4b5a176aa..12c3c91b88 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -828,35 +828,117 @@ format as for @code{scanner-scanimage-switches}.  The 
default is nil.
 @cindex scan quality, improving
 @cindex quality, improving
 
-include tips for improving quality, ask for contributions
+This chapter comprises recommendations for improving the scan or OCR
+quality.  If you know about any additional tips and tricks to improve
+quality, please let the author know about them.
 
-@itemize
-@item
-tesseract v4
-@item
-see @url{https://tesseract-ocr.github.io/tessdoc/} for tesseract documentation
-@item
-set left and top margin in scanimage
-@item
-use brightness and contrast for scanimage
-@item
-use at least 300 DPI for OCR, but more than 600 only increase document
-size without improving OCR
-@item
-use the right language, not multiple languages for a single-language document
-@item
-use unpaper to deskew the page
-@item
-use unpaper deskewing options
-@item
-use unpaper middle wipe etc.
-@item
-have a look at
+Besides checking the following sections, you might also want to consult
+the documentation for @command{tesseract},
+@url{https://tesseract-ocr.github.io/tessdoc/}, and @command{unpaper},
 @url{https://github.com/unpaper/unpaper/blob/main/doc/basic-concepts.md}
-and
+(basics) and
 @url{https://github.com/unpaper/unpaper/blob/main/doc/image-processing.md}
-for detailed information on how to use unpaper
-@end itemize
+(details).
+
+
+@menu
+* Improving General Scan Quality::
+* Improving OCR::
+@end menu
+
+@node Improving General Scan Quality
+@section Improving General Scan Quality
+@cindex improving general scan quality
+
+@table @asis
+@item Image format
+As a lossy format, JPEG is not a good basis for later OCR.  Therefore,
+use PNG, PNM, or TIFF for document scanning.  If you also use
+@command{unpaper}, the image format is forced to PNM, as required by
+this tool.
+
+@item Scan area
+Besides setting the size of the scan area, @command{scanimage} allows
+you to specify offsets to the top and left edges.  The device-specific
+switches @option{-l} and @option{-t}, if available, allow you to specify
+the top-left x and y positions, respectively.  This can be used to get
+rid of some blacked out parts in corners due to the mis-alignment of
+scan area and scanned sheet.
+
+@item Resolution
+For document scans, use at least 300 DPI to achieve acceptable OCR
+results.  A resolution above 600 DPI will not enhance OCR quality any
+further and only leads to larger files.  For most documents, 300 DPI
+should be ok.
+
+@item Brightness and contrast
+Good document quality (and especially good OCR results) require
+sufficient contrast and a good reproduction of the document's background
+color.  If the defaults of your device are inadequate, use the
+brightness and contrast settings of @command{scanimage} to provide
+sensible values.  See @ref{Configuring scanimage} and the options
+@code{scanner-brightness} and @code{scanner-contrast} there.  You may
+want to try a low brightness setting (for example, 20) and a medium
+contrast setting (for example, 50) as a start.
+
+Note that the underlying parameters to @command{scanimage} are
+device-specific.  If the two mentioned options are not supported by your
+device, you may be able to use @code{scanner-scanimage-switches} to
+supply the specific switches to @command{scanimage}.
+
+@item Dark areas and shadows
+If your scan shows dark (black/gray) areas or shadows, for example in
+the fold when scanning a book, use @command{unpaper} to remove them.  If
+it cannot remove these areas automatically, you can manually specify an
+area to be wiped out using the @option{--wipe} switch of
+@command{unpaper}.  If you scan a page with the ``double'' layout and
+want to remove the shadow of a book fold, use the @option{--middle-wipe}
+switch.  You can put these switches into the
+@code{scanner-unpaper-switches} option.  See also the @command{unpaper}
+documentation.
+
+@item Page borders
+If you use @command{unpaper}, it will try to remove dark areas around
+the edges of the page.  If this does not work automatically, use the
+@code{scanner-unpaper-border} option to specify a border (in pixels)
+around the edges of the page that is to be wiped, see @ref{Configuring
+unpaper}.
+
+@end table
+
+@node Improving OCR
+@section Improving OCR
+@cindex improving ocr
+
+@table @asis
+@item Tesseract version
+Use version 4 or higher of @command{tesseract}.  This version includes a
+new OCR engine that delivers better results than the previous one.
+Also, @command{tesseract} is multithreaded starting from version 4 and
+is therefor

[elpa] externals/scanner 25e9bfc9ff 20/54: add a command and menu item for setting the scan delay

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 25e9bfc9ff3a451ebd38ecac33407745f7ecbc08
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a command and menu item for setting the scan delay

* scanner.el (scanner-set-scan-delay): new function
---
 scanner.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/scanner.el b/scanner.el
index 66f2d4d0f1..048958a1e3 100644
--- a/scanner.el
+++ b/scanner.el
@@ -409,6 +409,9 @@ border-scan."
 (define-key map [doc-res]
   '(menu-item "Set document resolution" scanner-set-document-resolution
  :help "Set the resolution for document 
scanning."))
+   (define-key map [scan-delay]
+ '(menu-item "Set delay between scans" scanner-set-scan-delay
+ :help "Set the delay between multi-page 
scans."))
 (define-key map [select-dev]
   '(menu-item "Select scanning device" scanner-select-device
  :help "Select a scanning device."))
@@ -771,6 +774,12 @@ them.  Otherwise, return nil."
   (interactive "NContrast: ")
   (setq scanner-contrast (min (max contrast 0) 100)))
 
+;;;###autoload
+(defun scanner-set-scan-delay (delay)
+  "Set the scan DELAY."
+  (interactive "NDelay between page scans: ")
+  (setq scanner-scan-delay (max delay 0)))
+
 ;;;###autoload
 (defun scanner-select-device (device)
   "Select a scanning DEVICE.



[elpa] externals/scanner e3c40a0dc0 39/54: add landscape paper sizes

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit e3c40a0dc00e54d825022d3b32908c0f5e7a469a
Author: Raffael Stocker 
Commit: Raffael Stocker 

add landscape paper sizes
---
 scanner.el | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index fac6310a30..dce56d60df 100644
--- a/scanner.el
+++ b/scanner.el
@@ -118,7 +118,21 @@
 :legal
 (215.9 355.6)
 :letter
-(215.9 279.4))
+(215.9 279.4)
+   :a3-landscape
+(420 297)
+:a4-landscape
+(297 210)
+:a5-landscape
+(210 148)
+:a6-landscape
+(148 105)
+:tabloid-landscape
+(431.8 279.4)
+:legal-landscape
+(355.6 215.9)
+:letter-landscape
+(279.4 215.9))
   "List of paper sizes for documents.
 The first of each pair of numbers is the paper width in mm,
 the second is the height in mm."



[elpa] externals/scanner 53c3862b6f 46/54: add deskewing customization and program switches

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 53c3862b6ff00ab8e2eec95b46f84e4cbe2852f4
Author: Raffael Stocker 
Commit: Raffael Stocker 

add deskewing customization and program switches
---
 scanner.el | 32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index 13c45be9c1..38aaa66612 100644
--- a/scanner.el
+++ b/scanner.el
@@ -306,6 +306,21 @@ plugged in.  For these, auto-detection will always be 
done."
 (const :tag "counter-clockwise" -90)
 (const :tag "none" nil)))
 
+(defcustom scanner-unpaper-scan-direction
+  "left,bottom"
+  "Edges from which to scan for rotation."
+  :type '(string))
+
+(defcustom scanner-unpaper-scan-size
+  3000
+  "Size of virtual line for rotation detection."
+  :type '(number))
+
+(defcustom scanner-unpaper-scan-step
+  0.01
+  "Steps between single rotation-angle detections."
+  :type '(number))
+
 (defconst scanner--unpaper-sizes
   '(:a5 :a4 :a3 :letter :legal :a5-landscape :a4-landscape
:a3-landscape :letter-landscape :legal-landscape)
@@ -341,7 +356,7 @@ pixels) for left, top, right, and bottom edge, respectively.
 This border is before any further processing."
   :type '(list integer integer integer integer))
 
-(defcustom scanner-unpaper-mask
+(defcustom scanner-unpaper-mask-size
   nil
   "Define the mask size to be used if ‘scanner-unpaper-page-layout’
   is \"none\".  The mask is necessary for deskewing; any pixel
@@ -748,6 +763,20 @@ construct a shell command."
"--pre-border" (lambda (_) (mapconcat #'number-to-string

 scanner-unpaper-border

 ","))
+   "--no-mask-scan" (lambda (_) (string= "none" 
scanner-unpaper-page-layout))
+   "--mask" (lambda (_)
+  (when (string= "none" 
scanner-unpaper-page-layout)
+(mapconcat #'number-to-string
+   (if 
scanner-unpaper-mask-size
+   
scanner-unpaper-mask-size
+ 
(scanner--corner-pixels
+  
(scanner--size-cm
+   
scanner-unpaper-pre-size)
+  (plist-get 
scanner-resolution :doc)))
+   ",")))
+   "--deskew-scan-direction" 'scanner-unpaper-scan-direction
+   "--deskew-scan-size" 'scanner-unpaper-scan-size
+   "--deskew-scan-step" 'scanner-unpaper-scan-step
'user-switches 'scanner-unpaper-switches
'input (lambda (args) (concat (file-name-as-directory
  (plist-get 
args :tmp-dir))
@@ -757,6 +786,7 @@ construct a shell command."
  
"output%04d.pnm")))
   "The arguments list specification for unpaper.")
 
+;; FIXME remove this--only the resolution must be adjusted compared to the 
above
 (defvar scanner--unpaper-preview-argspec
   (list "--layout" 'scanner-unpaper-page-layout
"--dpi" 'scanner-preview-resolution



[elpa] externals/scanner 38e320dcaa 53/54: add link to unpaper sources

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 38e320dcaa901bef9e8487729beb539ee75ffc26
Author: Raffael Stocker 
Commit: Raffael Stocker 

add link to unpaper sources
---
 scanner.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index bfbd0f9b9f..48c93f4590 100644
--- a/scanner.el
+++ b/scanner.el
@@ -26,7 +26,8 @@
 ;;; Commentary:
 
 ;; Scan documents and images using scanimage(1) from the SANE distribution and
-;; tesseract(1) for OCR and PDF export.  Enhance the scan with unpaper(1).
+;; tesseract(1) for OCR and PDF export.  Enhance the scan with unpaper(1), see
+;; https://github.com/unpaper/unpaper.
 
 ;;; Code:
 



[elpa] externals/scanner c7c252078c 35/54: use ‘fboundp’ instead of ‘functionp’ in scanner-show-config

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit c7c252078ce9802761dd2c1d8e58660e97db6b04
Author: Raffael Stocker 
Commit: Raffael Stocker 

use ‘fboundp’ instead of ‘functionp’ in scanner-show-config
---
 scanner.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index 08305191b2..3571b535a6 100644
--- a/scanner.el
+++ b/scanner.el
@@ -961,7 +961,7 @@ selection is made."
 (defun scanner-show-config ()
   "Show the current configuration."
   (interactive)
-  (when (functionp 'custom-group-members)
+  (when (fboundp 'custom-group-members)
(with-current-buffer-window "*scanner-config*" nil nil
  (let ((variables (mapcar (lambda (variable)
 (cons (car 
variable)



[elpa] externals/scanner f7e66f39ad 05/54: Merge branch 'master' into develop/unpaper

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit f7e66f39ad4037fd703955529c0dfe62a1159bf4
Merge: 37941bf3d8 43cf030c73
Author: Raffael Stocker 
Commit: Raffael Stocker 

Merge branch 'master' into develop/unpaper
---
 scanner.el | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/scanner.el b/scanner.el
index f4c7eb4b30..e282ddf3f7 100644
--- a/scanner.el
+++ b/scanner.el
@@ -235,7 +235,7 @@ plugged in.  For these, auto-detection will always be done."
 
 (defcustom scanner-scan-delay
   3
-  "Delay between document scans in multi-page mode."
+  "Delay in seconds between document scans in multi-page mode."
   :type '(number))
 
 
@@ -422,10 +422,10 @@ simply dropped."
 ("--mode" (concat 
"--mode="

   (plist-get scanner-scan-mode

  scan-type)))
-("--resolution" 
(concat "--resolution="
-   
 (number-to-string
-   
  (plist-get scanner-resolution
-   
 scan-type
+("--resolution"
+ (concat 
"--resolution="
+ 
(number-to-string
+  
(plist-get scanner-resolution scan-type
 ((and "-x" (guard 
size))
  (list "-x" 
(number-to-string (car size
 ((and "-y" (guard 
size))
@@ -463,9 +463,7 @@ scanimage this will construct a shell command."
shell-command-switch
(concat scanner-scanimage-program
" "
-   (mapconcat 'identity
-  args
-  " ")
+   (mapconcat 'identity args " ")
" > "
outfile))
`(,scanner-scanimage-program "-o" ,outfile ,@args)))
@@ -603,7 +601,8 @@ them.  Otherwise, return nil."
(let ((configs (condition-case err
  (directory-files 
scanner-tesseract-configdir nil "[^.]")
(error
-(error "Could not find output 
configurations %s" (cdr err))
+(error "Could not find output 
configurations %s"
+   (cdr err))
  (list (completing-read-multiple "Outputs: " configs nil t
   (setq scanner-tesseract-outputs outputs))
 
@@ -611,13 +610,15 @@ them.  Otherwise, return nil."
 (defun scanner-set-image-resolution (resolution)
   "Set the RESOLUTION for scanning images."
   (interactive "NImage scan resolution: ")
-  (plist-put scanner-resolution :image resolution))
+  (setq scanner-resolution
+   (plist-put scanner-resolution :image resolution)))
 
 ;;;###autoload
 (defun scanner-set-document-resolution (resolution)
   "Set the RESOLUTION for scanning documents."
   (interactive "NDocument scan resolution: ")
-  (plist-put scanner-resolution :doc resolution))
+  (setq scanner-resolution
+   (plist-put scanner-resolution :doc resolution)))
 
 ;;;###autoload
 (defun scanner-select-device (device)



[elpa] externals/scanner efe6d3658f 40/54: add conversion function from paper size to corner pixel coordinates

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit efe6d3658f9a120bb672c9ed3907b39ba5b0f763
Author: Raffael Stocker 
Commit: Raffael Stocker 

add conversion function from paper size to corner pixel coordinates
---
 scanner.el | 9 +
 1 file changed, 9 insertions(+)

diff --git a/scanner.el b/scanner.el
index dce56d60df..cd99954a85 100644
--- a/scanner.el
+++ b/scanner.el
@@ -597,6 +597,15 @@ y-dimension.  If no size is configured, return nil."
'user-switches 'scanner-scanimage-switches)
   "The arguments list used for preview scans.")
 
+(defun scanner--cm-to-pixels (cm resolution)
+  (floor (* (/ cm 2.54) resolution)))
+
+(defun scanner--corner-pixels (size resolution)
+  (list 0
+   0
+   (scanner--cm-to-pixels (car size) resolution)
+   (scanner--cm-to-pixels (cadr size) resolution)))
+
 (defun scanner--program-args (argspec &rest args)
   "Return an arguments list as specified in ARGSPEC, assuming ARGS.
 



[elpa] externals/scanner 0f42a12f3a 18/54: correct a docstring

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 0f42a12f3a50e1576d1c4597160029912e8d1d25
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct a docstring
---
 scanner.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index 112389b3f8..7e71222903 100644
--- a/scanner.el
+++ b/scanner.el
@@ -763,7 +763,7 @@ selection is made."
 
 ;;;###autoload
 (defun scanner-select-page-layout (layout)
-  "Select the page layout."
+  "Select the page LAYOUT."
   (interactive (list (completing-read "Select page layout: "
  
'("single" "double" "none")
  nil 
t)))



[elpa] externals/scanner a9d3e0357b 06/54: Merge branch 'master' into documentation

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit a9d3e0357b64c2bc445cf6e6556fd2f224736d34
Merge: 3f83066fc6 43cf030c73
Author: Raffael Stocker 
Commit: Raffael Stocker 

Merge branch 'master' into documentation
---
 scanner.el | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/scanner.el b/scanner.el
index 9f3df3c440..422b652199 100644
--- a/scanner.el
+++ b/scanner.el
@@ -230,7 +230,7 @@ plugged in.  For these, auto-detection will always be done."
 
 (defcustom scanner-scan-delay
   3
-  "Delay between document scans in multi-page mode."
+  "Delay in seconds between document scans in multi-page mode."
   :type '(number))
 
 
@@ -341,10 +341,10 @@ simply dropped."
 ("--mode" (concat 
"--mode="

   (plist-get scanner-scan-mode

  scan-type)))
-("--resolution" 
(concat "--resolution="
-   
 (number-to-string
-   
  (plist-get scanner-resolution
-   
 scan-type
+("--resolution"
+ (concat 
"--resolution="
+ 
(number-to-string
+  
(plist-get scanner-resolution scan-type
 ((and "-x" (guard 
size))
  (list "-x" 
(number-to-string (car size
 ((and "-y" (guard 
size))
@@ -382,9 +382,7 @@ scanimage this will construct a shell command."
shell-command-switch
(concat scanner-scanimage-program
" "
-   (mapconcat 'identity
-  args
-  " ")
+   (mapconcat 'identity args " ")
" > "
outfile))
`(,scanner-scanimage-program "-o" ,outfile ,@args)))
@@ -522,7 +520,8 @@ them.  Otherwise, return nil."
(let ((configs (condition-case err
  (directory-files 
scanner-tesseract-configdir nil "[^.]")
(error
-(error "Could not find output 
configurations %s" (cdr err))
+(error "Could not find output 
configurations %s"
+   (cdr err))
  (list (completing-read-multiple "Outputs: " configs nil t
   (setq scanner-tesseract-outputs outputs))
 
@@ -530,13 +529,15 @@ them.  Otherwise, return nil."
 (defun scanner-set-image-resolution (resolution)
   "Set the RESOLUTION for scanning images."
   (interactive "NImage scan resolution: ")
-  (plist-put scanner-resolution :image resolution))
+  (setq scanner-resolution
+   (plist-put scanner-resolution :image resolution)))
 
 ;;;###autoload
 (defun scanner-set-document-resolution (resolution)
   "Set the RESOLUTION for scanning documents."
   (interactive "NDocument scan resolution: ")
-  (plist-put scanner-resolution :doc resolution))
+  (setq scanner-resolution
+   (plist-put scanner-resolution :doc resolution)))
 
 ;;;###autoload
 (defun scanner-select-device (device)



[elpa] externals/scanner 4715000dce 30/54: improve a docstring

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 4715000dce1870ab050f73d7a21d0b7928cb56e6
Author: Raffael Stocker 
Commit: Raffael Stocker 

improve a docstring
---
 scanner.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index b01bd6389f..a15590279a 100644
--- a/scanner.el
+++ b/scanner.el
@@ -682,7 +682,7 @@ construct a shell command."
'output (lambda (args) (concat (file-name-as-directory
  (plist-get 
args :tmp-dir))
 
"output%04d.pnm")))
-  "The arguments list specification for unpaper.")
+  "The arguments list specification for unpaper in preview scans.")
 
 (defun scanner--ensure-init ()
   "Ensure that scanning device is initialized.



[elpa] externals/scanner 3de9ddefc7 36/54: require cus-edit for scanner-show-config

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 3de9ddefc7016a726092412f873a23fde1fffcf3
Author: Raffael Stocker 
Commit: Raffael Stocker 

require cus-edit for scanner-show-config
---
 scanner.el | 42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/scanner.el b/scanner.el
index 3571b535a6..2c462a30db 100644
--- a/scanner.el
+++ b/scanner.el
@@ -74,6 +74,7 @@
 
 (require 'dash)
 (require 'cl-lib)
+(require 'cus-edit)
 (eval-when-compile (require 'subr-x))
 (require 'menu-bar)
 
@@ -961,27 +962,26 @@ selection is made."
 (defun scanner-show-config ()
   "Show the current configuration."
   (interactive)
-  (when (fboundp 'custom-group-members)
-   (with-current-buffer-window "*scanner-config*" nil nil
- (let ((variables (mapcar (lambda (variable)
-(cons (car 
variable)
-  
(replace-regexp-in-string "-" " "
-   
 (symbol-name (car variable))
-   
 nil nil nil
-   
 (length "scanner-"
-  
(custom-group-members 'scanner nil
-   (widget-create 'push-button
-  :notify (lambda (&rest _)
-
(customize-group 'scanner))
-  "Customize scanner")
-   (insert "\n\nCurrent configuration:\n\n")
-   (mapc (lambda (variable)
-   (insert (format "%25s: %s\n"
-   (cdr variable)
-   (symbol-value 
(car variable)
- variables)
-   (use-local-map widget-keymap)
-   (widget-setup)
+  (with-current-buffer-window "*scanner-config*" nil nil
+   (let ((variables (mapcar (lambda (variable)
+  (cons (car variable)
+
(replace-regexp-in-string "-" " "
+   
   (symbol-name (car variable))
+   
   nil nil nil
+   
   (length "scanner-"
+(custom-group-members 
'scanner nil
+ (widget-create 'push-button
+:notify (lambda (&rest _)
+  (customize-group 
'scanner))
+"Customize scanner")
+ (insert "\n\nCurrent configuration:\n\n")
+ (mapc (lambda (variable)
+ (insert (format "%25s: %s\n"
+ (cdr variable)
+ (symbol-value (car 
variable)
+   variables)
+ (use-local-map widget-keymap)
+ (widget-setup
 
 ;;;###autoload
 (defun scanner-scan-document (npages filename)



[nongnu] elpa/gptel ae1cc57247: gptel-transient: unmark before editing crowdsourced prompt (#618)

2025-02-08 Thread ELPA Syncer
branch: elpa/gptel
commit ae1cc572475214f383d90269125283ca79c5874b
Author: Henrik Ahlgren 
Commit: GitHub 

gptel-transient: unmark before editing crowdsourced prompt (#618)

* gptel-transient.el (gptel--read-crowdsourced-prompt,
gptel--edit-directive, gptel--suffix-system-message): Deactivate the
mark after entering the prompt-edit buffer for a crowdsourced
prompt (#616). This behaviour was introduced in commit cc53a81c, but
it did not actually work since `deactivate-mark' was called after
returning from `gptel--read-crowdsourced-prompt', when it was too
late.

* gptel-rewrite.el (gptel--suffix-rewrite-directive): Call
`gptel--rewrite-directive' with mark activation enabled.
---
 gptel-rewrite.el   |  2 +-
 gptel-transient.el | 16 
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gptel-rewrite.el b/gptel-rewrite.el
index afffaf40ae..df1fbceca1 100644
--- a/gptel-rewrite.el
+++ b/gptel-rewrite.el
@@ -587,7 +587,7 @@ generated from functions."
 "Rewrite directive is dynamically generated: Edit its current 
value instead?")
   (if cancel (progn (message "Edit canceled")
 (call-interactively #'gptel-rewrite))
-(gptel--edit-directive 'gptel--rewrite-directive #'gptel-rewrite)))
+(gptel--edit-directive 'gptel--rewrite-directive #'gptel-rewrite t)))
 
 (transient-define-suffix gptel--suffix-rewrite (&optional rewrite-message 
dry-run)
   "Rewrite or refactor region contents."
diff --git a/gptel-transient.el b/gptel-transient.el
index c3f04462d6..dab79b2d1a 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -1304,10 +1304,9 @@ This uses the prompts in the variable
   (complete-with-action action gptel--crowdsourced-prompts str 
pred)))
   nil t)))
 (when-let ((prompt (gethash choice gptel--crowdsourced-prompts)))
-(gptel--set-with-scope
- 'gptel--system-message prompt gptel--set-buffer-locally)
-(gptel--edit-directive 'gptel--system-message)
-(deactivate-mark)))
+  (gptel--set-with-scope
+   'gptel--system-message prompt gptel--set-buffer-locally)
+  (gptel--edit-directive 'gptel--system-message)))
 (message "No prompts available.")))
 
 (transient-define-suffix gptel--suffix-system-message (&optional cancel)
@@ -1325,15 +1324,16 @@ generated from functions."
 "Active directive is dynamically generated: Edit its 
current value instead?")
   (if cancel (progn (message "Edit canceled")
 (call-interactively #'gptel-menu))
-(gptel--edit-directive 'gptel--system-message)))
+(gptel--edit-directive 'gptel--system-message nil t)))
 
 ;; MAYBE: Eventually can be simplified with string-edit, after we drop support
 ;; for Emacs 28.2.
-(defun gptel--edit-directive (sym &optional callback-cmd)
+(defun gptel--edit-directive (sym &optional callback-cmd activate)
   "Edit a gptel directive in a dedicated buffer.
 
 Store the result in SYM, a symbol.  If CALLBACK-CMD is specified,
-it is run after exiting the edit."
+it is run after exiting the edit.  If ACTIVATE is specified,
+activate the mark."
   (let ((orig-buf (current-buffer))
 (msg-start (make-marker))
 (directive (symbol-value sym)))
@@ -1365,7 +1365,7 @@ it is run after exiting the edit."
   ;; If it's a list, insert only the system message part
   (insert (car-safe (gptel--parse-directive directive 'raw)))
   (push-mark nil 'nomsg))
-(activate-mark)
+(when activate (activate-mark))
(visual-line-mode 1))
   (display-buffer (current-buffer)
   `((display-buffer-below-selected)



[elpa] externals/scanner b5dbefbc12 37/54: Merge branch 'documentation' into develop/unpaper

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit b5dbefbc12530523069389814260601fd4881288
Merge: 3de9ddefc7 599cecc8a6
Author: Raffael Stocker 
Commit: Raffael Stocker 

Merge branch 'documentation' into develop/unpaper
---
 .gitignore   |5 +
 fdl.texi |  505 
 scanner.texi | 1053 ++
 3 files changed, 1563 insertions(+)

diff --git a/.gitignore b/.gitignore
index 0381e802c3..6a7296b1ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,8 @@ TAGS
 *.png
 *.pdf
 *.txt
+*.aux
+*.cp
+*.cps
+*.toc
+*.info
diff --git a/fdl.texi b/fdl.texi
new file mode 100644
index 00..eaf3da0e92
--- /dev/null
+++ b/fdl.texi
@@ -0,0 +1,505 @@
+@c The GNU Free Documentation License.
+@center Version 1.3, 3 November 2008
+
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
+@display
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, 
Inc.
+@uref{https://fsf.org/}
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License.  Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein.  The ``Document'', below,
+refers to any such manual or work.  Any member of the public is a
+licensee, and is addressed as ``you''.  You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject.  (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.  If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant.  The Document may contain zero
+Invariant Sections.  If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.  A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a

[elpa] externals/scanner 6febfbf0c9 52/54: update readme and headers in scanner.el

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 6febfbf0c9e9221ea7ef8aa403a6c3defee5226d
Author: Raffael Stocker 
Commit: Raffael Stocker 

update readme and headers in scanner.el
---
 README | 88 ++
 Readme.org | 23 +---
 scanner.el | 48 +++---
 3 files changed, 111 insertions(+), 48 deletions(-)

diff --git a/README b/README
new file mode 100644
index 00..a867b4e67b
--- /dev/null
+++ b/README
@@ -0,0 +1,88 @@
+Raffael Stocker
+
+
+Table of Contents
+─
+
+1. Scanner: scan documents and images with Emacs
+2. Configuration
+3. Bugs
+
+
+1 Scanner: scan documents and images with Emacs
+═══
+
+  Scan documents and images using `scanimage(1)' from the SANE
+  distribution and `tesseract(1)' for OCR and PDF export.  Additionally,
+  `unpaper(1)' can now be used for post-processing the scans obtained
+  from `scanimage' before feeding them into `tesseract'.  This is
+  optional, but highly recommended.  The source to unpaper is available
+  at .
+
+  The scanner package uses two sets of customizations for image mode and
+  document mode, with the former usually configured to use high
+  resolution and an image file format, like JPEG, and the latter to use
+  lower resolution and a document format, like PDF or text.  The
+  available file formats are provided by `scanimage(1)' for image mode
+  and `tesseract(1)' for document mode.  The scanner package uses
+  `tesseract(1)' to provide optical character recognition (OCR).  You
+  can select the language plugins with `scanner-tesseract-languages'.
+  See also the remark about the data directories below.
+
+  In document mode, you can scan one or multiple pages that are then
+  written in a customizable output format, e.g. (searchable) PDF or
+  text, or whatever tesseract provides.  You can also customize
+  resolution, intermediate image format, and paper size.  The command
+  `scanner-scan-document' starts a document scan.  Without a prefix
+  argument, it scans one page.  With a non-numeric argument, it asks the
+  user after each scanned page for confirmation to scan another page.
+  With a numeric argument, it scans that many pages.  In the latter
+  case, it observes a delay between scans that is customizable using
+  `scanner-scan-delay'.
+
+  The `scanner-scan-image' command performs one scan or multiple scans
+  in image mode.  This function tries to guess the file format from the
+  chosen file name or falls back to the configured default, see
+  `scanner-image-format'.  The prefix argument works as in document
+  mode.
+
+  The scanning commands are also available in the Tools->Scanner menu.
+
+  For both images and documents, you can customize the scan mode
+  (e.g. "Color" or "Gray") if your scanning device supports it.
+
+  You can pass additional options to the backends using the
+  customization variables `scanner-scanimage-switches' and
+  `scanner-tesseract-switches'.  The former variable is helpful for
+  tuning brightness and contrast, for instance.
+
+  Finally, the customization options `scanner-tessdata-dir' and
+  `scanner-tessdata-configdir' must be set to point to tesseract's data
+  directory containing the language definitions (usually something like
+  `/usr/share/tessdata/') and tesseract's configs directory containing
+  the output configurations (usually something like
+  `/usr/share/tessdata/configs/').
+
+
+2 Configuration
+═══
+
+  To use `unpaper', set the customization option `scanner-use-unpaper'
+  to t.
+
+  Scanner defines a keymap that is best bound to some convenient key,
+  for example with `(keymap-global-set "s-s" scanner-map)' or when using
+  `use-package' with `:bind-keymap ("s-s" . scanner-map)' in the
+  use-package specification.
+
+  Most package options are customizations and can but configured in the
+  usual ways.
+
+
+3 Bugs
+══
+
+  • This package doesn't support document feeders yet.
+  • This package doesn't support authentication.
+  • If a new document scan is started while another is still running,
+the log will be messed up a bit.
diff --git a/Readme.org b/Readme.org
index 2b750e199d..b3761b530c 100644
--- a/Readme.org
+++ b/Readme.org
@@ -1,8 +1,13 @@
-* Scanner: scan documents and images with Emacs
+#+EXPORT_FILE_NAME: README
 
-  Scan documents and images using =scanimage(1)= from the SANE distribution
-  and =tesseract(1)= for OCR and PDF export.
+* Scanner: scan documents and images with Emacs
 
+  Scan documents and images using =scanimage(1)= from the SANE distribution and
+  =tesseract(1)= for OCR and PDF export.  Additionally, =unpaper(1)= can now be
+  used for post-processing the scans obtained from =scanimage= before feeding
+  them into =tesseract=.  This is optional, but highly recommended.  The source
+  to unpaper is available at https://github.com/unpaper/unpaper.
+  
   

[elpa] externals/scanner 07ac936fec 48/54: clean up preview code

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 07ac936fec11eb5ec78858cd59275dc8c65739f8
Author: Raffael Stocker 
Commit: Raffael Stocker 

clean up preview code
---
 scanner.el | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/scanner.el b/scanner.el
index f5292e49c7..52f010eed6 100644
--- a/scanner.el
+++ b/scanner.el
@@ -85,15 +85,10 @@
   :group 'multimedia)
 
 (defcustom scanner-resolution
-  '(:image 600 :doc 300)
+  '(:image 600 :doc 300 :preview 75)
   "Resolutions for images and documents."
   :type '(plist :value-type integer))
 
-(defcustom scanner-preview-resolution
-  75
-  "Resolutions for preview scans."
-  :type '(integer))
-
 (defcustom scanner-brightness
   20
   "Brightness setting for the scan."
@@ -243,7 +238,7 @@ in ‘scanner-tesseract-configdir’."
   :type '(repeat string))
 
 (defcustom scanner-scan-mode
-  '(:image "Color" :doc "Color")
+  '(:image "Color" :doc "Color" :preview "Gray")
   "Scan modes for images and documents.
 This is usually \"Color\" or \"Gray\", but depends on your
 scanning device."
@@ -609,7 +604,7 @@ y-dimension.  If no size is configured, return nil."
 "Gray"))
"--resolution=" (lambda (args)
  (scanner--when-switch 
"--resolution" args
-   
scanner-preview-resolution))
+   (plist-get 
scanner-resolution :preview)))
"-x" (lambda (args)
   (scanner--when-switch "-x" args
 (scanner--size (plist-get args :scan-type) 
#'car)))
@@ -786,10 +781,9 @@ construct a shell command."
  
"output%04d.pnm")))
   "The arguments list specification for unpaper.")
 
-;; FIXME remove this--only the resolution must be adjusted compared to the 
above
 (defvar scanner--unpaper-preview-argspec
   (list "--layout" 'scanner-unpaper-page-layout
-   "--dpi" 'scanner-preview-resolution
+   "--dpi" (lambda (_) (plist-get scanner-resolution :preview))
"--input-pages" 'scanner-unpaper-input-pages
"--output-pages" 'scanner-unpaper-output-pages
"--pre-rotate" 'scanner-unpaper-pre-rotation



[elpa] externals/scanner 3f83066fc6 01/54: add info manual stub

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 3f83066fc6a471051c31a2d005530e146339383d
Author: Raffael Stocker 
Commit: Raffael Stocker 

add info manual stub

* fdl.texi: new file (GNU FDL)
* scanner.texi: new file (manual)
---
 fdl.texi | 505 +++
 scanner.texi | 481 
 2 files changed, 986 insertions(+)

diff --git a/fdl.texi b/fdl.texi
new file mode 100644
index 00..eaf3da0e92
--- /dev/null
+++ b/fdl.texi
@@ -0,0 +1,505 @@
+@c The GNU Free Documentation License.
+@center Version 1.3, 3 November 2008
+
+@c This file is intended to be included within another document,
+@c hence no sectioning command or @node.
+
+@display
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, 
Inc.
+@uref{https://fsf.org/}
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License.  Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein.  The ``Document'', below,
+refers to any such manual or work.  Any member of the public is a
+licensee, and is addressed as ``you''.  You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject.  (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.  If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant.  The Document may contain zero
+Invariant Sections.  If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.  A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arra

[elpa] externals/scanner 2e00e710bd 43/54: log stdout and stderr

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 2e00e710bd439591299a70bc817c0670dca12b55
Author: Raffael Stocker 
Commit: Raffael Stocker 

log stdout and stderr
---
 scanner.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scanner.el b/scanner.el
index d8df871bd4..46f6c6c99b 100644
--- a/scanner.el
+++ b/scanner.el
@@ -1078,7 +1078,8 @@ performing OCR."
   (make-process :name "Scanner (scanimage)"
 :command 
scanimage-command
 :sentinel 
#'scan-or-process
-:stderr 
(scanner--log-buffer
+:buffer 
(scanner--log-buffer)
+:std-err nil)))
(scan-or-process
 (process event)
 (condition-case err
@@ -,7 +1112,8 @@ performing OCR."
 :command 
`(,scanner-unpaper-program

,@unpaper-args)
 :sentinel 
#'unpaper-sentinel
-:std-err 
(scanner--log-buffer
+:buffer 
(scanner--log-buffer)
+:std-err nil)))
(unpaper-sentinel
 (process event)
 (condition-case err
@@ -1146,7 +1148,8 @@ performing OCR."
 :command 
`(,scanner-tesseract-program

,@tesseract-args)
 :sentinel 
#'finish
-:stderr 
(scanner--log-buffer
+:buffer 
(scanner--log-buffer)
+:std-err nil)))
(finish
 (process event)
 (unwind-protect
@@ -1225,7 +1228,8 @@ available, ask for a selection interactively."
 (make-process :name "Scanner 
(scanimage)"
   :command 
scanimage-command
   :sentinel 
#'scan-or-finish
-  :stderr 
(scanner--log-buffer)
+  :buffer 
(scanner--log-buffer)
+  :std-err 
nil
(scan-or-finish
 (process event)
 (let ((ev (string-trim event)))



[elpa] externals/scanner d9fcf1a159 32/54: change unpaper border switch to --pre-border as needed for deskewing

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit d9fcf1a159e844d3f77556e91d227a09dc078ae6
Author: Raffael Stocker 
Commit: Raffael Stocker 

change unpaper border switch to --pre-border as needed for deskewing
---
 scanner.el | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/scanner.el b/scanner.el
index 0d95def5f8..03da3dbf62 100644
--- a/scanner.el
+++ b/scanner.el
@@ -323,8 +323,7 @@ string; e.g. ‘\"21cm,29.7cm\"’."
   "Define a border at the sheet edges to be set to white.
 The border is specified as a list of four integers (widths in
 pixels) for left, top, right, and bottom edge, respectively.
-This border is applied after deskewing and before automatic
-border-scan."
+This border is before any further processing."
   :type '(list integer integer integer integer))
 
 (defcustom scanner-unpaper-switches
@@ -680,16 +679,16 @@ construct a shell command."
"--post-rotate" 'scanner-unpaper-post-rotation
"--size" 'scanner-unpaper-pre-size
"--post-size" 'scanner-unpaper-post-size
-   "--border" (lambda (_) (mapconcat #'number-to-string
-
scanner-unpaper-border
-","))
+   "--pre-border" (lambda (_) (mapconcat #'number-to-string
+   
 scanner-unpaper-border
+   
 ","))
'user-switches 'scanner-unpaper-switches
'input (lambda (args) (concat (file-name-as-directory
  (plist-get 
args :tmp-dir))
 
"input%04d.pnm"))
'output (lambda (args) (concat (file-name-as-directory
- (plist-get 
args :tmp-dir))
-
"output%04d.pnm")))
+  (plist-get 
args :tmp-dir))
+ 
"output%04d.pnm")))
   "The arguments list specification for unpaper.")
 
 (defvar scanner--unpaper-preview-argspec
@@ -701,16 +700,16 @@ construct a shell command."
"--post-rotate" 'scanner-unpaper-post-rotation
"--size" 'scanner-unpaper-pre-size
"--post-size" 'scanner-unpaper-post-size
-   "--border" (lambda (_) (mapconcat #'number-to-string
-
scanner-unpaper-border
-","))
+   "--pre-border" (lambda (_) (mapconcat #'number-to-string
+   
 scanner-unpaper-border
+   
 ","))
'user-switches 'scanner-unpaper-switches
'input (lambda (args) (concat (file-name-as-directory
  (plist-get 
args :tmp-dir))
 
"input%04d.pnm"))
'output (lambda (args) (concat (file-name-as-directory
- (plist-get 
args :tmp-dir))
-
"output%04d.pnm")))
+  (plist-get 
args :tmp-dir))
+ 
"output%04d.pnm")))
   "The arguments list specification for unpaper in preview scans.")
 
 (defun scanner--ensure-init ()



[elpa] externals/scanner 39c2494fd5 41/54: add a mask customization option

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 39c2494fd5040a402e87ac5e6bcf6a5c835a1652
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a mask customization option
---
 scanner.el | 13 +
 1 file changed, 13 insertions(+)

diff --git a/scanner.el b/scanner.el
index cd99954a85..d8df871bd4 100644
--- a/scanner.el
+++ b/scanner.el
@@ -341,6 +341,19 @@ pixels) for left, top, right, and bottom edge, 
respectively.
 This border is before any further processing."
   :type '(list integer integer integer integer))
 
+(defcustom scanner-unpaper-mask
+  nil
+  "Define the mask size to be used if ‘scanner-unpaper-page-layout’
+  is \"none\".  The mask is necessary for deskewing; any pixel
+  outside the mask will be set to white.  If nil, attempt to set
+  the mask from ‘scanner-unpaper-pre-size’, otherwise this option
+  must be set to a list ‘(x1 y1 x2 y2)’ specifying the corners of
+  the mask in pixels, e.g. ‘(0 0 300 300)’ specifies a mask of
+  one square inch in the upper left corner, if the resolution is
+  300 dpi."
+  :type '(choice (const :tag "From paper size" nil)
+(list integer integer integer integer)))
+
 (defcustom scanner-unpaper-switches
   '()
   "Additional options to be passed to unpaper(1)."



[elpa] externals/scanner 89b9159321 50/54: fix typos in documentation

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 89b91593211525869f96d0b80c297d5ce52a0b52
Author: Raffael Stocker 
Commit: Raffael Stocker 

fix typos in documentation
---
 scanner.texi | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scanner.texi b/scanner.texi
index 957e7f809b..bb99c901e5 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -57,6 +57,11 @@ The document was typeset with
 @insertcopying
 @end ifnottex
 
+@c TODO Organize the manual not as a list of features or options, but
+@c instead logically by subtopics.  Address the user's questions, say
+@c why a feature is there, what it is good for and how to use it to do a
+@c certain job.
+
 @c Generate the nodes for this menu with `C-c C-u C-a'.
 @menu
 * Overview::
@@ -125,7 +130,7 @@ the document may have to be rotated,
 some scan artifacts, like shadows, may have to be removed,
 
 @item
-the page may need deskewing,
+the page may need de-skewing,
 
 @item
 the language for OCR must be selected,
@@ -216,7 +221,7 @@ If the specified file already exists, 
@code{scanner-scan-document} will
 ask for confirmation to overwrite it.
 
 This command will trigger auto-detection if no device has been
-configured.  If more than one device are available, it will offer ask
+configured.  If more than one device are available, it will ask
 you to select one.
 
 If you configured Scanner to use @command{unpaper}, this command will
@@ -310,8 +315,8 @@ Scanner menu (@clicksequence{Tools @click{} Scanner}).
 
 The following commands help you configure some of the more-often used
 options.  They only change the options for the running session; if you
-want to permanently set an option, so it will be remembered between
-Emacs sessions, use the customization interface.
+want to permanently set an option, so Emacs will remember them between
+sessions, use the customization interface.
 
 @table @kbd
 @item M-x scanner-set-image-resolution



[elpa] externals/scanner 054a56b688 33/54: add a command to show the current configuration

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 054a56b688cd34829014786de9b6e6299264545e
Author: Raffael Stocker 
Commit: Raffael Stocker 

add a command to show the current configuration

* scanner.el (scanner-show-config): new command
---
 scanner.el | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index 03da3dbf62..3fa38a5431 100644
--- a/scanner.el
+++ b/scanner.el
@@ -389,7 +389,10 @@ This border is before any further processing."
 ;;;###autoload
 (defvar scanner-menu
   (let ((map (make-sparse-keymap)))
-(define-key map [image-size]
+(define-key map [show-config]
+  '(menu-item "Show current configuration" scanner-show-config
+ :help "Show the current configuration."))
+   (define-key map [image-size]
   '(menu-item "Select image size" scanner-select-image-size
  :help "Select a size for image scanning."))
(define-key map [img-res]
@@ -461,6 +464,7 @@ This border is before any further processing."
(define-key map "u" #'scanner-toggle-use-unpaper)
(define-key map "l" #'scanner-select-languages)
(define-key map "o" #'scanner-select-outputs)
+   (define-key map "C" #'scanner-show-config)
(define-key map "cd" #'scanner-select-device)
(define-key map "ct" #'scanner-set-scan-delay)
(define-key map "ci" #'scanner-select-input-pages)
@@ -953,6 +957,30 @@ selection is made."
   (setq scanner-unpaper-post-size (if (string= "none" size)
 nil
   size)))
+;;;###autoload
+(defun scanner-show-config ()
+  "Show the current configuration."
+  (interactive)
+  (with-current-buffer-window "*scanner-config*" nil nil
+   (let ((variables (mapcar (lambda (variable)
+  (cons (car variable)
+
(replace-regexp-in-string "-" " "
+   
   (symbol-name (car variable))
+   
   nil nil nil
+   
   (length "scanner-"
+(custom-group-members 
'scanner nil
+ (widget-create 'push-button
+:notify (lambda (&rest ignore)
+  (customize-group 
'scanner))
+"Customize scanner")
+ (insert "\n\nCurrent configuration:\n\n")
+ (mapc (lambda (variable)
+ (insert (format "%25s: %s\n"
+ (cdr variable)
+ (symbol-value (car 
variable)
+   variables)
+ (use-local-map widget-keymap)
+ (widget-setup
 
 ;;;###autoload
 (defun scanner-scan-document (npages filename)



[elpa] externals/scanner 44eab47963 54/54: bump version

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 44eab47963a61e67cd4aa3a96a6762764367de5f
Author: Raffael Stocker 
Commit: Raffael Stocker 

bump version
---
 scanner.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanner.el b/scanner.el
index 48c93f4590..9debb7b4b9 100644
--- a/scanner.el
+++ b/scanner.el
@@ -5,7 +5,7 @@
 ;; Author: Raffael Stocker 
 ;; Maintainer: Raffael Stocker 
 ;; Created: 05. Feb 2020
-;; Version: 0.2
+;; Version: 0.3
 ;; Package-Requires: ((emacs "25.1") (dash "2.12.0"))
 ;; Keywords: hardware, multimedia
 ;; URL: https://codeberg.org/rstocker/scanner.git



[elpa] externals/scanner 1e907a6883 15/54: adjust copyright years

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 1e907a68835ddbe145fafd8e0ce5131a9ef46dd4
Author: Raffael Stocker 
Commit: Raffael Stocker 

adjust copyright years
---
 scanner-test.el | 2 +-
 scanner.el  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scanner-test.el b/scanner-test.el
index b8b5fd0891..c408c57a1a 100644
--- a/scanner-test.el
+++ b/scanner-test.el
@@ -1,6 +1,6 @@
 ;;; scanner-test.el --- Scan documents and images -*- lexical-binding: t -*-
 
-;; Copyright (C) 2020  Free Software Foundation, Inc
+;; Copyright (C) 2020, 2021  Free Software Foundation, Inc
 
 ;; Author: Raffael Stocker 
 ;; Maintainer: Raffael Stocker 
diff --git a/scanner.el b/scanner.el
index 801a7f17cf..112389b3f8 100644
--- a/scanner.el
+++ b/scanner.el
@@ -1,6 +1,6 @@
 ;;; scanner.el --- Scan documents and images -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2020  Free Software Foundation, Inc
+;; Copyright (C) 2020, 2021  Free Software Foundation, Inc
 
 ;; Author: Raffael Stocker 
 ;; Maintainer: Raffael Stocker 



[elpa] externals/scanner d2d2d709db 47/54: correct doc-string of scanner--program-args

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit d2d2d709db037f20a47be2513464eef17224b0e8
Author: Raffael Stocker 
Commit: Raffael Stocker 

correct doc-string of scanner--program-args
---
 scanner.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scanner.el b/scanner.el
index 38aaa66612..f5292e49c7 100644
--- a/scanner.el
+++ b/scanner.el
@@ -653,12 +653,12 @@ y-dimension.  If no size is configured, return nil."
   "Return an arguments list as specified in ARGSPEC, assuming ARGS.
 
 ARGSPEC is expected to be a list of the form:
-   (\"--switch1\" 'argument1
+   (\"--switch1\" \\='argument1
 \"--switch2=\" (lambda (args) \"bar\"))
 \"--never-used\" nil
 \"--switch-without-argument\" t
-'symbol \"--always-there\"
-'other-symbol (\"baz\" \"quux\"))
+\\='symbol \"--always-there\"
+\\='other-symbol (\"baz\" \"quux\"))
 
 Assuming ‘argument1’ is ‘\"foo\"’, this specification will be
 translated into the arguments list:



[elpa] externals/scanner 9a93e82540 45/54: add size parsing function

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 9a93e82540994e7bf3194549bb7ff54ae94c7d50
Author: Raffael Stocker 
Commit: Raffael Stocker 

add size parsing function
---
 scanner.el | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/scanner.el b/scanner.el
index b35e42acf0..13c45be9c1 100644
--- a/scanner.el
+++ b/scanner.el
@@ -610,6 +610,21 @@ y-dimension.  If no size is configured, return nil."
'user-switches 'scanner-scanimage-switches)
   "The arguments list used for preview scans.")
 
+(defun scanner--size-cm (size)
+  (cond ((and (keywordp size)
+ (plist-member scanner-paper-sizes size))
+(mapcar (lambda (num) (/ num 10.0))
+(plist-get scanner-paper-sizes size)))
+   ((stringp size) (mapcar (lambda (size-str)
+ (let ((idx 
(string-match
+   
  "\\([[:digit:]]+\\(\\.[[:digit:]]+\\)?\\)cm"
+   
  size-str)))
+   (if idx 
(string-to-number
+   
 (match-string 1 size-str))
+ 
(user-error "Unknown size format: %s" size-str
+   (split-string 
size ",")))
+   (t (error "Unknown paper size: %s" size
+
 (defun scanner--cm-to-pixels (cm resolution)
   (floor (* (/ cm 2.54) resolution)))
 



[elpa] externals/scanner 599cecc8a6 25/54: add scan preview and brightness, contrast, delay commands/options

2025-02-08 Thread ELPA Syncer
branch: externals/scanner
commit 599cecc8a6ccaae7c4cab985a0119403fdc78401
Author: Raffael Stocker 
Commit: Raffael Stocker 

add scan preview and brightness, contrast, delay commands/options
---
 scanner.texi | 79 +++-
 1 file changed, 68 insertions(+), 11 deletions(-)

diff --git a/scanner.texi b/scanner.texi
index 12c3c91b88..957e7f809b 100644
--- a/scanner.texi
+++ b/scanner.texi
@@ -268,6 +268,19 @@ This command is also available from the Scanner menu as@*
 for a single-page scan and@*
 @clicksequence{Tools @click{} Scanner @click{} Scan multiple images}@*
 for a multi-image scan.
+
+@item M-x scanner-scan-preview
+Make a preview scan.  This command makes a preview scan assuming
+document scan settings.  The resolution of the scan is changed to
+@code{scanner-preview-resolution} and the scan mode is set to ``Gray'',
+otherwise all options stay in effect.  If @code{scanner-use-unpaper} is
+non-@code{nil}, post-processing with unpaper is done as well.  The
+resulting scan is shown in an image window, unless Emacs can't display
+images, in which case a Dired buffer is created showing the files
+generated by the scan.
+
+This command is also available from the Scanner menu as@*
+@clicksequence{Tools @click{} Scanner @click{} Make a preview scan}@*
 @end table
 
 
@@ -304,6 +317,7 @@ Emacs sessions, use the customization interface.
 @item M-x scanner-set-image-resolution
 @item M-x scanner-set-document-resolution
 @findex scanner-set-document-resolution
+@findex scanner-set-image-resolution
 These commands interactively asks for a resolution (in @acronym{DPI,
 dots per inch}) to be used in subsequent image and document scans,
 respectively.  The corresponding user options is
@@ -363,6 +377,29 @@ devices have already been detected before.
 
 This command is also available in the Scanner menu as@*
 @clicksequence{Tools @click{} Scanner @click{} Select scanning device}
+
+@item M-x scanner-set-scan-delay
+Set the delay in seconds between scans in multi-page mode.  This
+commands sets the variable @code{scanner-scan-delay}.
+
+This command is also available in the Scanner menu as@*
+@clicksequence{Tools @click{} Scanner @click{} Set delay between scans}
+
+@item M-x scanner-set-brightness
+Set the brightness of the scans.  The available range is
+device-specific.
+
+This command is also available in the Scanner menu as@*
+@clicksequence{Tools @click{} Scanner @click{} Set brightness}
+
+@item M-x scanner-set-contrast
+Set the contrast of the scans.  The available range is
+device-specific.
+
+This command is also available in the Scanner menu as@*
+@clicksequence{Tools @click{} Scanner @click{} Set contrast}
+
+
 @end table
 
 The following commands can be found in the ``Scan Enhancement'' submenu
@@ -511,6 +548,27 @@ This option can be set per-session with the commands
 @code{scanner-select-document-resolution}.
 @end defopt
 
+@defopt scanner-preview-resolution
+This option specifies the resolution in DPI used in preview scans.  The
+default is 75.
+@end defopt
+
+@defopt scanner-brightness
+This option specifies the brightness setting for scans.  The default is
+20.  This option assumes the @command{scanimage} switch
+@option{--brightness} is available, which is device-specific.
+
+This option can be set with the command @code{scanner-set-brightness}.
+@end defopt
+
+@defopt scanner-contrast
+This option specifies the contrast setting for scans.  The default is
+50.  This option assumes the @command{scanimage} switch
+@option{--contrast} is available, which is device-specific.
+
+This option can be set with the command @code{scanner-set-contrast}.
+@end defopt
+
 @defopt scanner-paper-sizes
 This option holds paper sizes for document scans as a property list with
 the name of the page format as the key (e.g. @code{:a4}) and a list of
@@ -654,14 +712,6 @@ list of switch/value pairs, such as:
 ("--switch1" "value1" "-s" "2")
 @end lisp
 The default is nil.
-
-For example, some devices may need some tweaking of brightness and
-contrast to provide adequate scans.  Something like
-@lisp
-("--brightness" "20" "--contrast" "50")
-@end lisp
-might do the trick.  Note, however, that the switches in this example
-are device-dependent.
 @end defopt
 
 
@@ -958,11 +1008,18 @@ This chapter lists the changes made in new releases of 
Scanner.
 @itemize
 @item
 @command{unpaper} has been added as a new backend; it allows scan
-enhancement in document scans; see @ref{Configuring unpaper} for options.
+enhancement in document scans; see @ref{Configuring unpaper} for
+options.  There is a new ``Scan Enhancement'' sub-menu for this backend.
+@item
+A command for making a preview scan has been added.
+@item
+Menu items and user options for brightness and contrast have been added.
+@item
+A menu item for setting the scan delay has been added.
 @item
-older @command{scanimage} versions (before 1.0.28) are now supported as well.
+Older @command{scanimage} versions (before 

[elpa] elpa-admin d9d9c87a01: (elpaa--worktree-sync): Don't assume we used `no-follow-links`

2025-02-08 Thread Stefan Monnier via
branch: elpa-admin
commit d9d9c87a01068b1f9357d1006f774383668f686a
Author: Stefan Monnier 
Commit: Stefan Monnier 

(elpaa--worktree-sync): Don't assume we used `no-follow-links`

* elpa-admin.el (elpaa--parent-package): New function, extracted from
`elpaa--local-branch-name`.
(elpaa--local-branch-name): Use it.
(elpaa--worktree-sync): Use it in case we're called with a pkg-spec
that's been read without `no-follow-links`.
---
 elpa-admin.el | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/elpa-admin.el b/elpa-admin.el
index 4be856520f..c127f50dcc 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -665,6 +665,11 @@ returns.  Return the selected revision."
  "\n\n## The current error output was the following:\n\n"
  txt
 
+(defun elpaa--parent-package (pkg-spec)
+  (or (elpaa--spec-get pkg-spec  :parent--package)
+  (let ((url (elpaa--spec-get pkg-spec :url)))
+(and (symbolp url) url
+
 (defun elpaa--local-branch-name (pkg-spec &optional releasep)
   "Return the name of the branch in which the package is kept.
 This is the name of the branch as used in the (Non)GNU ELPA repository
@@ -673,11 +678,8 @@ as well as in the local clone, not upstream."
   (if (and releasep (elpaa--spec-get pkg-spec :release-branch))
   elpaa--release-branch-prefix
 elpaa--branch-prefix)
-  (or (elpaa--spec-get pkg-spec  :parent--package)
-  (let ((url (elpaa--spec-get pkg-spec :url)))
-(if (and url (symbolp url))
-url
-  (car pkg-spec))
+  (or (elpaa--parent-package pkg-spec)
+  (car pkg-spec
 
 (defun elpaa--check-sync-failures (pkg-spec metadata)
   (let* ((pkg (car pkg-spec))
@@ -2332,14 +2334,14 @@ If WITH-CORE is non-nil, it means we manage :core 
packages as well."
   "Sync worktree of PKG-SPEC."
   (let* ((pkg (car pkg-spec))
  (name (format "%s" pkg))
- (url (nth 2 pkg-spec))
+ (parent (elpaa--parent-package pkg-spec))
  (default-directory (expand-file-name "packages/")))
 (unless (file-directory-p default-directory)
   (make-directory default-directory))
-(cond ((and url (symbolp url))
+(cond (parent
(unless (file-exists-p name)
- (message "Symlinking %s to %S" name url)
- (make-symbolic-link (symbol-name url) name)))
+ (message "Symlinking %s to %S" name parent)
+ (make-symbolic-link (symbol-name parent) name)))
   ((not (file-exists-p name))
   (message "Cloning branch %s:" pkg)
(let* ((branch (elpaa--local-branch-name pkg-spec))



[nongnu] elpa/gptel 2dd3e317bf: gptel: Linting and minor documentation tweaks

2025-02-08 Thread ELPA Syncer
branch: elpa/gptel
commit 2dd3e317bf4af82cddfa1d1b127c04c17589c878
Author: Karthik Chikmagalur 
Commit: Karthik Chikmagalur 

gptel: Linting and minor documentation tweaks

* gptel.el (gptel--display-tool-calls, gptel-request,
gptel-response-separator): Minor documentation and linting
changes.

* gptel-openai-extras.el (gptel-make-perplexity,
gptel--parse-response, gptel-curl--parse-stream): Linting changes.

* gptel-curl.el (gptel-curl-get-response,
ptel-curl--parse-response): Linting changes.  Remove unused
let-bindings.
---
 gptel-curl.el  |  4 +---
 gptel-openai-extras.el | 52 +-
 gptel.el   |  8 +---
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/gptel-curl.el b/gptel-curl.el
index 03e748b464..b3ba128c82 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -118,7 +118,6 @@ the response is inserted into the current buffer after 
point."
  (info (gptel-fsm-info fsm))
  (args (gptel-curl--get-args info token))
  (stream (plist-get info :stream))
- (backend (plist-get info :backend))
  (process (apply #'start-process "gptel-curl"
  (generate-new-buffer "*gptel-curl*") "curl" args)))
 (when (memq system-type '(windows-nt ms-dos))
@@ -337,8 +336,7 @@ PROCESS and _STATUS are process parameters."
   "Parse the buffer BUF with curl's response.
 
 PROC-INFO is a plist with contextual information."
-  (let ((token (plist-get proc-info :token))
-(parser (plist-get proc-info :parser)))
+  (let ((token (plist-get proc-info :token)))
 (goto-char (point-max))
 (search-backward token)
 (backward-char)
diff --git a/gptel-openai-extras.el b/gptel-openai-extras.el
index c335e8f807..f9ef2cad6d 100644
--- a/gptel-openai-extras.el
+++ b/gptel-openai-extras.el
@@ -179,15 +179,23 @@ for."
(:copier nil)
(:include gptel-openai)))
 
-(cl-defmethod gptel--parse-response ((_backend gptel-perplexity) response info)
-  "Parse Perplexity response RESPONSE with INFO."
+(defsubst gptel--perplexity-parse-citations (citations)
+  (let ((counter 0))
+(concat "\n\nCitations:\n"
+(mapconcat (lambda (url)
+ (setq counter (1+ counter))
+ (format "[%d] %s" counter url))
+   citations "\n"
+
+(cl-defmethod gptel--parse-response ((_backend gptel-perplexity) response 
_info)
+  "Parse Perplexity response RESPONSE."
   (let ((response-string (map-nested-elt response '(:choices 0 :message 
:content)))
 (citations-string (when-let ((citations (map-elt response :citations)))
(gptel--perplexity-parse-citations citations
 (concat response-string citations-string)))
 
-(cl-defmethod gptel-curl--parse-stream ((backend gptel-perplexity) info)
-  "Parse a Perplexity API data stream for BACKEND with INFO.
+(cl-defmethod gptel-curl--parse-stream ((_backend gptel-perplexity) info)
+  "Parse a Perplexity API data stream with INFO.
 
 If available, collect citations at the end and include them with
 the response."
@@ -208,20 +216,12 @@ the response."
  citations)
 resp))
 
-(defsubst gptel--perplexity-parse-citations (citations)
-  (let ((counter 0))
-(concat "\n\nCitations:\n"
-(mapconcat (lambda (url)
- (setq counter (1+ counter))
- (format "[%d] %s" counter url))
-   citations "\n"
-
 ;;;###autoload
 (cl-defun gptel-make-perplexity
 (name &key curl-args stream key
   (header 
(lambda () (when-let (key (gptel--get-api-key))
-   `(("Authorization" . ,(concat "Bearer " key))
+   `(("Authorization" . ,(concat "Bearer " key))
   (host "api.perplexity.ai")
   (protocol "https")
   (models '(sonar sonar-pro))
@@ -254,19 +254,19 @@ REQUEST-PARAMS (optional) is a plist of additional HTTP 
request
 parameters."
   (declare (indent 1))
   (let ((backend (gptel--make-perplexity
- :curl-args curl-args
- :name name
- :host host
- :header header
- :key key
- :models models
- :protocol protocol
- :endpoint endpoint
- :stream stream
- :request-params request-params
- :url (if protocol
- (concat protocol "://" host endpoint)
-   (concat host endpoint)
+  :curl-args curl-args
+  :name name
+  :host host
+  :header header
+  :key key
+  :models models
+  :protocol protocol
+  :endpoint endpoin

[elpa] externals/debbugs af445940e3: Refine the debbugs-gnu-summary-keep-subject regexp, again.

2025-02-08 Thread Michael Albinus via
branch: externals/debbugs
commit af445940e35a7d60799832a907b9d24197d4a996
Author: Maxim Cournoyer 
Commit: Michael Albinus 

Refine the debbugs-gnu-summary-keep-subject regexp, again.

Modify the regexp so that lines containing just "[PATCH]" are also
matched.

* debbugs-gnu.el (debbugs-gnu-summary-keep-subject): Refine regexp
and comments.
---
 debbugs-gnu.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 3046243dc3..a75274c17e 100644
--- a/debbugs-gnu.el
+++ b/debbugs-gnu.el
@@ -1921,10 +1921,10 @@ MERGED is the list of bugs merged with this one."
   ;; --subject-prefix='PATCH trailing-prefix' as well as
   ;; --reroll-count=n.
   (rx "[" (? (1+ (not space)) space);leading prefix?
-  "PATCH "
+  "PATCH" (? space)
   (? (1+ (not space)) space);trailing prefix?
   (? "v" (1+ digit) space)  ;optional reroll count
-  (1+ digit) "/" (1+ digit) "]");patch number
+  (? (1+ digit) "/" (1+ digit)) "]") ;optional patch number
   "Regular expression which keeps the original message subject in replies."
   :version "30.1"
   :type 'regexp)



[nongnu] elpa/vm 47f60c5f14 2/2: Merge branch 'main' into 'main'

2025-02-08 Thread ELPA Syncer
branch: elpa/vm
commit 47f60c5f1447dfe7778c2a26c3c64403203dd48a
Merge: c7591796ef 70a1db8b8d
Author: Mark Diekhans 
Commit: Mark Diekhans 

Merge branch 'main' into 'main'

add copyright for VM Developers to cover new development (closes #497)

See merge request emacs-vm/vm!38
---
 configure.ac|  3 ++-
 contrib/org-html-mail.el|  1 +
 contrib/org-vm.el   |  1 +
 contrib/vm-bogofilter.el|  1 +
 contrib/vm-mime-display-internal-application.el |  1 +
 contrib/vm-sumurg.el|  1 +
 example.vm  |  1 +
 info/vm-pcrisis.texinfo |  8 +---
 info/vm.texinfo | 10 ++
 lisp/tapestry.el|  1 +
 lisp/u-vm-color.el  |  3 ++-
 lisp/vcard.el   |  1 +
 lisp/vm-avirtual.el |  1 +
 lisp/vm-biff.el |  1 +
 lisp/vm-crypto.el   |  1 +
 lisp/vm-delete.el   |  1 +
 lisp/vm-digest.el   |  1 +
 lisp/vm-dired.el|  1 +
 lisp/vm-edit.el |  1 +
 lisp/vm-folder.el   |  1 +
 lisp/vm-grepmail.el |  1 +
 lisp/vm-imap.el |  1 +
 lisp/vm-license.el  |  1 +
 lisp/vm-macro.el|  1 +
 lisp/vm-mark.el |  1 +
 lisp/vm-menu.el |  1 +
 lisp/vm-message-history.el  |  1 +
 lisp/vm-message.el  |  1 +
 lisp/vm-mime.el |  2 ++
 lisp/vm-minibuf.el  |  1 +
 lisp/vm-misc.el |  1 +
 lisp/vm-motion.el   |  1 +
 lisp/vm-mouse.el|  1 +
 lisp/vm-page.el |  1 +
 lisp/vm-pcrisis.el  |  5 +++--
 lisp/vm-pgg.el  |  1 +
 lisp/vm-pine.el |  1 +
 lisp/vm-pop.el  |  1 +
 lisp/vm-ps-print.el |  1 +
 lisp/vm-reply.el|  2 ++
 lisp/vm-rfaddons.el |  1 +
 lisp/vm-save.el |  1 +
 lisp/vm-search.el   |  1 +
 lisp/vm-serial.el   |  1 +
 lisp/vm-smime.el|  1 +
 lisp/vm-sort.el |  1 +
 lisp/vm-summary-faces.el|  1 +
 lisp/vm-summary.el  |  1 +
 lisp/vm-thread.el   |  1 +
 lisp/vm-toolbar.el  |  1 +
 lisp/vm-undo.el |  1 +
 lisp/vm-user.el |  1 +
 lisp/vm-vars.el |  1 +
 lisp/vm-vcard.el|  1 +
 lisp/vm-version.el  |  1 +
 lisp/vm-virtual.el  |  1 +
 lisp/vm-w3.el   |  1 +
 lisp/vm-w3m.el  |  3 ++-
 lisp/vm-window.el   |  1 +
 lisp/vm.el  |  1 +
 src/vm-mail |  1 +
 61 files changed, 77 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1afbfed296..e26f37a19c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,7 @@
 
 # Copyright (C) 2006-2007  Robert Widhopf-Fenk 
 # Copyright (C) 2010   Uday S Reddy 
+# Copyright (C) 2024-2025  The VM Developers
 
 # VM is free software; you can redistribute it and/or modify it under the
 # terms of the GNU Library General Public License as published by the Free
@@ -241,7 +242,7 @@ AC_INIT([VM],[8.3.x],[viewmail-i...@nongnu.org])
 # Version (release) number
 # Contact address
 
-AC_COPYRIGHT([Copyright (C) 2009-2010 VM Development Team 
])
+AC_COPYRIGHT([Copyright (C) 2024-2025 The VM Developers])
 
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_FILES([Makefile lisp/Makefile info/Makefile pixmaps/Makefile 
vm-load.el])
diff --git a/contrib/org-html-mail.el b/contrib/org-html-mail.el
index 4a09a11ee3..3fd3136243 100644
--- a/contrib/org-html-mail.el
+++ b/contrib/org-html-mail.el
@@ -1,4 +1,5 @@
 ;; Copyright © 2008  Eric Schulte  -*- lexical-binding: t; -*-
+;; Copyright © 2024-2025 The VM Developers
 ;;
 ;; WYSWYG, html mail composition using orgmode
 ;;
diff --git a/contrib/org-vm.el b/contrib/org-vm.el
index a21e24eaf1..f7

[nongnu] elpa/vm 70a1db8b8d 1/2: add copyright for VM Developers to cover new development (closes #497)

2025-02-08 Thread ELPA Syncer
branch: elpa/vm
commit 70a1db8b8d277e09b9f1aa9382f376678d240db6
Author: Mark Diekhans 
Commit: Mark Diekhans 

add copyright for VM Developers to cover new development (closes #497)
---
 configure.ac|  3 ++-
 contrib/org-html-mail.el|  1 +
 contrib/org-vm.el   |  1 +
 contrib/vm-bogofilter.el|  1 +
 contrib/vm-mime-display-internal-application.el |  1 +
 contrib/vm-sumurg.el|  1 +
 example.vm  |  1 +
 info/vm-pcrisis.texinfo |  8 +---
 info/vm.texinfo | 10 ++
 lisp/tapestry.el|  1 +
 lisp/u-vm-color.el  |  3 ++-
 lisp/vcard.el   |  1 +
 lisp/vm-avirtual.el |  1 +
 lisp/vm-biff.el |  1 +
 lisp/vm-crypto.el   |  1 +
 lisp/vm-delete.el   |  1 +
 lisp/vm-digest.el   |  1 +
 lisp/vm-dired.el|  1 +
 lisp/vm-edit.el |  1 +
 lisp/vm-folder.el   |  1 +
 lisp/vm-grepmail.el |  1 +
 lisp/vm-imap.el |  1 +
 lisp/vm-license.el  |  1 +
 lisp/vm-macro.el|  1 +
 lisp/vm-mark.el |  1 +
 lisp/vm-menu.el |  1 +
 lisp/vm-message-history.el  |  1 +
 lisp/vm-message.el  |  1 +
 lisp/vm-mime.el |  2 ++
 lisp/vm-minibuf.el  |  1 +
 lisp/vm-misc.el |  1 +
 lisp/vm-motion.el   |  1 +
 lisp/vm-mouse.el|  1 +
 lisp/vm-page.el |  1 +
 lisp/vm-pcrisis.el  |  5 +++--
 lisp/vm-pgg.el  |  1 +
 lisp/vm-pine.el |  1 +
 lisp/vm-pop.el  |  1 +
 lisp/vm-ps-print.el |  1 +
 lisp/vm-reply.el|  2 ++
 lisp/vm-rfaddons.el |  1 +
 lisp/vm-save.el |  1 +
 lisp/vm-search.el   |  1 +
 lisp/vm-serial.el   |  1 +
 lisp/vm-smime.el|  1 +
 lisp/vm-sort.el |  1 +
 lisp/vm-summary-faces.el|  1 +
 lisp/vm-summary.el  |  1 +
 lisp/vm-thread.el   |  1 +
 lisp/vm-toolbar.el  |  1 +
 lisp/vm-undo.el |  1 +
 lisp/vm-user.el |  1 +
 lisp/vm-vars.el |  1 +
 lisp/vm-vcard.el|  1 +
 lisp/vm-version.el  |  1 +
 lisp/vm-virtual.el  |  1 +
 lisp/vm-w3.el   |  1 +
 lisp/vm-w3m.el  |  3 ++-
 lisp/vm-window.el   |  1 +
 lisp/vm.el  |  1 +
 src/vm-mail |  1 +
 61 files changed, 77 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1afbfed296..e26f37a19c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,7 @@
 
 # Copyright (C) 2006-2007  Robert Widhopf-Fenk 
 # Copyright (C) 2010   Uday S Reddy 
+# Copyright (C) 2024-2025  The VM Developers
 
 # VM is free software; you can redistribute it and/or modify it under the
 # terms of the GNU Library General Public License as published by the Free
@@ -241,7 +242,7 @@ AC_INIT([VM],[8.3.x],[viewmail-i...@nongnu.org])
 # Version (release) number
 # Contact address
 
-AC_COPYRIGHT([Copyright (C) 2009-2010 VM Development Team 
])
+AC_COPYRIGHT([Copyright (C) 2024-2025 The VM Developers])
 
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_FILES([Makefile lisp/Makefile info/Makefile pixmaps/Makefile 
vm-load.el])
diff --git a/contrib/org-html-mail.el b/contrib/org-html-mail.el
index 4a09a11ee3..3fd3136243 100644
--- a/contrib/org-html-mail.el
+++ b/contrib/org-html-mail.el
@@ -1,4 +1,5 @@
 ;; Copyright © 2008  Eric Schulte  -*- lexical-binding: t; -*-
+;; Copyright © 2024-2025 The VM Developers
 ;;
 ;; WYSWYG, html mail composition using orgmode
 ;;
diff --git a/contrib/org-vm.el b/contrib/org-vm.el
index a21e24eaf1..f772d1a325 100644
--- a/contrib/org-vm.el
+++ b/contrib/org-vm.el
@@ -1,6 +1,7 @@
 ;;; org-vm.el --- Support for l

[elpa] elpa-admin ee6c970480: elpa-admin.el (elpaa--supported-keywords): Add `:parent--package`

2025-02-08 Thread Stefan Monnier via
branch: elpa-admin
commit ee6c9704803790e4288f438d7863034d9af3d351
Author: Stefan Monnier 
Commit: Stefan Monnier 

elpa-admin.el (elpaa--supported-keywords): Add `:parent--package`
---
 elpa-admin.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/elpa-admin.el b/elpa-admin.el
index c6be1c1b44..4be856520f 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1049,7 +1049,9 @@ SPECS is the list of package specifications."
   '(:url :core :auto-sync :ignored-files :release-branch :release
 :readme :news :doc :renames :version-map :make :shell-command
 :branch :lisp-dir :main-file :merge :excludes :rolling-release
-:maintainer :manual-sync)
+:maintainer :manual-sync
+;; Internal use only.
+:parent--package)
   "List of keywords that can appear in a spec.")
 
 (defun elpaa--publish-package-spec (spec)



[elpa] externals/breadcrumb c06c1c6b6d 1/2: * breadcrumb.el (bc--summarize): Fix docstring.

2025-02-08 Thread ELPA Syncer
branch: externals/breadcrumb
commit c06c1c6b6d001562a19a5942569576b80117a40a
Author: João Távora 
Commit: João Távora 

* breadcrumb.el (bc--summarize): Fix docstring.
---
 breadcrumb.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/breadcrumb.el b/breadcrumb.el
index 2bca424336..174d6f3f46 100644
--- a/breadcrumb.el
+++ b/breadcrumb.el
@@ -307,11 +307,11 @@ These structures don't have a `breadcrumb-region' 
property on."
 
 (defun bc--summarize (crumbs cutoff separator)
   "Return a string that summarizes CRUMBS, a list of strings.
-\"Summarization\" consists of truncating some CRUMBS to 1
-character.  Rightmost members of CRUMBS are summarized last.
-Members with a `breadcrumb-dont-shorten' are never truncated.
-Aim for a return string that is at most CUTOFF characters long.
-Join the crumbs with SEPARATOR."
+\"Summarization\" consists of truncating some CRUMBS to 1 character.
+Rightmost members of CRUMBS are summarized last.  Members with a non-nil
+`breadcrumb-dont-shorten' property are never truncated.  Aim for a
+return string that is at most CUTOFF characters long.  Join the crumbs
+with SEPARATOR."
   (let ((rcrumbs
  (cl-loop
   for available = (- cutoff used)



[elpa] externals/breadcrumb da34d030e6 2/2: Don't shorten non-file buffer names

2025-02-08 Thread ELPA Syncer
branch: externals/breadcrumb
commit da34d030e6d01db2bba45b30080204b23a714c9f
Author: João Távora 
Commit: João Távora 

Don't shorten non-file buffer names

* breadcrumb.el (breadcrumb-project-crumbs): Don't shorten non-file
buffer names.
---
 breadcrumb.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/breadcrumb.el b/breadcrumb.el
index 174d6f3f46..dc0bbc0549 100644
--- a/breadcrumb.el
+++ b/breadcrumb.el
@@ -371,7 +371,9 @@ propertized crumbs."
   "Describing the current file inside project."
   (bc--summarize
(if buffer-file-name (bc--project-crumbs-1 buffer-file-name)
- (list (propertize (buffer-name) 'face 'bc-project-leaf-face)))
+ (list (propertize (buffer-name)
+   'face 'bc-project-leaf-face
+   'bc-dont-shorten t)))
(bc--length bc-project-max-length)
(propertize bc-project-crumb-separator
'face 'bc-project-crumbs-face)))



[elpa] externals/breadcrumb updated (dcb6e2e82d -> da34d030e6)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/breadcrumb.

  from  dcb6e2e82d Close #24: Fix autoloaded 'register-definition-prefixes'
   new  c06c1c6b6d * breadcrumb.el (bc--summarize): Fix docstring.
   new  da34d030e6 Don't shorten non-file buffer names


Summary of changes:
 breadcrumb.el | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)



[elpa] externals/yaml 09e46d563f 2/2: bump version number

2025-02-08 Thread ELPA Syncer
branch: externals/yaml
commit 09e46d563f1f3ff948852e08360c7d3c76e2acba
Author: Zachary Romero 
Commit: Zachary Romero 

bump version number
---
 yaml.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/yaml.el b/yaml.el
index f66aa56594..fe3c42f277 100644
--- a/yaml.el
+++ b/yaml.el
@@ -3,7 +3,7 @@
 ;; Copyright © 2021-2025  Free Software Foundation, Inc.
 
 ;; Author: Zachary Romero 
-;; Version: 1.1.0
+;; Version: 1.2.0
 ;; Homepage: https://github.com/zkry/yaml.el
 ;; Package-Requires: ((emacs "25.1"))
 ;; Keywords: tools



[elpa] externals/yaml updated (73a9f53562 -> 09e46d563f)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/yaml.

  from  73a9f53562 Merge pull request #59 from 
zkry/speed-up-byte-compilation
  adds  e952d1f88e (yaml--parse-from-grammar): Simplify a bit further
  adds  9d6749b2a7 Expose functions to the byte compiler
  adds  dfa6115520 Use symbols rather than strings for parser states
   new  f2c202a064 Merge pull request #60 from zkry/scratch/yaml
   new  09e46d563f bump version number


Summary of changes:
 yaml.el | 3257 ++-
 1 file changed, 1542 insertions(+), 1715 deletions(-)



[elpa] externals/yaml f2c202a064 1/2: Merge pull request #60 from zkry/scratch/yaml

2025-02-08 Thread ELPA Syncer
branch: externals/yaml
commit f2c202a0648e9245302c2e1187b0112f75ff7f8d
Merge: 73a9f53562 dfa6115520
Author: Zachary Romero 
Commit: GitHub 

Merge pull request #60 from zkry/scratch/yaml

patches from ELPA by Stefan Monnier
---
 yaml.el | 3255 ++-
 1 file changed, 1541 insertions(+), 1714 deletions(-)

diff --git a/yaml.el b/yaml.el
index 2b830b9464..f66aa56594 100644
--- a/yaml.el
+++ b/yaml.el
@@ -1,6 +1,6 @@
 ;;; yaml.el --- YAML parser for Elisp -*- lexical-binding: t -*-
 
-;; Copyright © 2021-2024  Free Software Foundation, Inc.
+;; Copyright © 2021-2025  Free Software Foundation, Inc.
 
 ;; Author: Zachary Romero 
 ;; Version: 1.1.0
@@ -50,21 +50,21 @@
 
 This flag is intended for development purposes.")
 
-(defconst yaml--tracing-ignore '("s-space"
- "s-tab"
- "s-white"
- "l-comment"
- "b-break"
- "b-line-feed"
- "b-carriage-return"
- "s-b-comment"
- "b-comment"
- "l-comment"
- "ns-char"
- "nb-char"
- "b-char"
- "c-printable"
- "b-as-space"))
+(defconst yaml--tracing-ignore '(s-space
+ s-tab
+ s-white
+ l-comment
+ b-break
+ b-line-feed
+ b-carriage-return
+ s-b-comment
+ b-comment
+ l-comment
+ ns-char
+ nb-char
+ b-char
+ c-printable
+ b-as-space))
 
 (defvar yaml--parsing-input ""
   "The string content of the current item being processed.")
@@ -83,7 +83,7 @@ This flag is intended for development purposes.")
 
 (cl-defstruct (yaml--state (:constructor yaml--state-create)
(:copier nil))
-  doc tt m name lvl beg end)
+  doc tt m (name nil :type symbol) lvl beg end)
 
 (defmacro yaml--parse (data &rest forms)
   "Parse DATA according to FORMS."
@@ -100,7 +100,7 @@ This flag is intended for development purposes.")
:name nil :doc nil :lvl 0 :beg 0 :end 0 :m nil :tt nil)))
 
 (defun yaml--state-set-m (val)
-  "Set the current value of t to VAL."
+  "Set the current value of `m' to VAL."
   (let* ((states yaml--states))
 (while states
   (let* ((top-state (car states))
@@ -185,7 +185,7 @@ This flag is intended for development purposes.")
   :end nil
 
 (defconst yaml--grammar-resolution-rules
-  '(("ns-plain" . literal))
+  '((ns-plain . literal))
   "Alist determining how to resolve grammar rule.")
 
 ;;; Receiver Functions
@@ -481,82 +481,82 @@ reverse order."
   (setcar yaml--object-stack (reverse (car yaml--object-stack
 
 (defconst yaml--grammar-events-in
-  '(("l-yaml-stream" . (lambda ()
- (yaml--stream-start-event)
- (setq yaml--document-start-version nil)
- (setq yaml--document-start-explicit nil)
- (setq yaml--tag-map (make-hash-table
-("c-flow-mapping" . (lambda ()
-  (yaml--mapping-start-event t)))
-("c-flow-sequence" . (lambda ()
+  `((l-yaml-stream . ,(lambda ()
+(yaml--stream-start-event)
+(setq yaml--document-start-version nil)
+(setq yaml--document-start-explicit nil)
+(setq yaml--tag-map (make-hash-table
+(c-flow-mapping . ,(lambda ()
+ (yaml--mapping-start-event t)))
+(c-flow-sequence . ,(lambda ()
+  (yaml--sequence-start-event nil)))
+(l+block-mapping . ,(lambda ()
+  (yaml--mapping-start-event nil)))
+(l+block-sequence . ,(lambda ()
(yaml--sequence-start-event nil)))
-("l+block-mapping" . (lambda ()
-   (yaml--mapping-start-event nil)))
-("l+block-sequence" . (lambda ()
-(yaml--sequence-start-event nil)))
-("ns-l-compact-mapping" . (lambda ()
-(yaml--mapping-start-event nil)))
-("ns-l-compact-sequence" . (lambda ()
- (yaml--sequence-start-event nil)))
-("ns-flow-pair" . (lambda ()
-(yaml--mapping-start-event t)))
-("ns-l-block-map-implicit-entry" 

[nongnu] elpa/loopy 10aee83acf: Note that Loopy is available from Non-GNU ELPA. (#228)

2025-02-08 Thread ELPA Syncer
branch: elpa/loopy
commit 10aee83acf1ac4eb3b871c19512cae1185f7daf8
Author: okamsn <28612288+oka...@users.noreply.github.com>
Commit: GitHub 

Note that Loopy is available from Non-GNU ELPA. (#228)

Update README.org to show this with new links and badges.
---
 README.org | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index bc514cb99d..6af181fb66 100644
--- a/README.org
+++ b/README.org
@@ -5,8 +5,11 @@
 # Some parsers require this option to export footnotes.
 #+options: f:t
 
-# MELPA Badges
-=loopy=: 
[[https://melpa.org/#/loopy][file:https://melpa.org/packages/loopy-badge.svg]] 
\\
+# Badges
+[[https://elpa.nongnu.org/nongnu/loopy.html][file:https://elpa.nongnu.org/nongnu/loopy.svg]]
+[[https://elpa.nongnu.org/nongnu-devel/loopy.html][file:https://elpa.nongnu.org/nongnu-devel/loopy.svg]]
+[[https://melpa.org/#/loopy][file:https://melpa.org/packages/loopy-badge.svg]]
+[[https://stable.melpa.org/#/loopy][file:https://stable.melpa.org/packages/loopy-badge.svg]]
 
 -
 
@@ -216,9 +219,9 @@ more niche features of ~cl-loop~ and ~iterate~ are still 
being added.
 
 * How to Install
 
-Loopy can be installed from [[https://melpa.org/#/loopy][MELPA]] as the 
package =loopy=.  The optional package
-=loopy-dash= can be installed to enable using the Dash library for 
destructuring
-(instead of other methods).
+Loopy can be installed from 
[[https://elpa.nongnu.org/nongnu/loopy.html][Non-GNU ELPA]] and 
[[https://melpa.org/#/loopy][MELPA]] as the package =loopy=.  The
+optional package =loopy-dash= can be installed to enable using the Dash library
+for destructuring (instead of other methods).
 
 #+begin_src emacs-lisp
   (use-package loopy)



[elpa] externals/llm 1d2250805d: Add Gemini 2.0 Pro model, and use 2.0 flash as a default (#152)

2025-02-08 Thread ELPA Syncer
branch: externals/llm
commit 1d2250805db9e71d7d004cc0a86077ae4e498213
Author: Andrew Hyatt 
Commit: GitHub 

Add Gemini 2.0 Pro model, and use 2.0 flash as a default (#152)
---
 NEWS.org  | 2 ++
 llm-gemini.el | 2 +-
 llm-models.el | 5 +
 llm-test.el   | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 15646e6bb9..b4668d0fa7 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,5 @@
+* Version 0.23.1
+- Add Gemini 2.0 pro experimental model, default to 2.0 flash
 * Version 0.23.0
 - Add GitHub's GitHub Models
 - Accept lists as nonstandard
diff --git a/llm-gemini.el b/llm-gemini.el
index cedcbe3bf2..e7b8e6030e 100644
--- a/llm-gemini.el
+++ b/llm-gemini.el
@@ -37,7 +37,7 @@
 
 KEY is the API key for the client.
 You can get this at https://makersuite.google.com/app/apikey.";
-  key (embedding-model "embedding-001") (chat-model "gemini-1.5-pro"))
+  key (embedding-model "embedding-001") (chat-model "gemini-2.0-flash-001"))
 
 (cl-defmethod llm-nonfree-message-info ((_ llm-gemini))
   "Return nonfree terms of service for Gemini."
diff --git a/llm-models.el b/llm-models.el
index 8470fffa6d..72b2c7b275 100644
--- a/llm-models.el
+++ b/llm-models.el
@@ -132,6 +132,11 @@ REGEX is a regular expression that can be used to identify 
the model, uniquely (
 :capabilities '(generation)
 :context-length 32768
 :regex "gemini-2\\.0-flash-thinking")
+   (make-llm-model
+:name "Gemini 2.0 Pro" :symbol 'gemini-2.0-pro
+:capabilities '(generation tool-use image-input audio-input video-input)
+:context-length 1048576
+:regex "gemini-2\\.0-pro")
(make-llm-model
 :name "Gemini 1.5 Flash" :symbol 'gemini-1.5-flash
 :capabilities '(generation tool-use image-input audio-input video-input)
diff --git a/llm-test.el b/llm-test.el
index ea7bd5a061..32f6dcbc00 100644
--- a/llm-test.el
+++ b/llm-test.el
@@ -308,7 +308,7 @@
   (should-not (member 'embeddings (llm-capabilities 
(make-llm-openai-compatible :chat-model "llama-3")
 
 (ert-deftest llm-test-chat-token-limit-gemini ()
-  (should (= 2097152 (llm-chat-token-limit (make-llm-gemini
+  (should (= 1048576 (llm-chat-token-limit (make-llm-gemini
   (should (= 1048576 (llm-chat-token-limit
   (make-llm-gemini :chat-model "gemini-1.5-flash"
   (should (= 4096 (llm-chat-token-limit



[nongnu] elpa/gptel 2da449ebad: gptel-transient: Fix read-only behaviour in gptel--edit-directive (#622)

2025-02-08 Thread ELPA Syncer
branch: elpa/gptel
commit 2da449ebade2425fbf43e5648350e7a907462a18
Author: Henrik Ahlgren 
Commit: GitHub 

gptel-transient: Fix read-only behaviour in gptel--edit-directive (#622)

* gptel-transient.el (gptel--edit-directive): Ensure that the example
comment or provided prompt is fully read-only (before and after). Drop
comment about `make-separator-line'.
---
 gptel-transient.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gptel-transient.el b/gptel-transient.el
index fb91a3c870..ae7f2e5a73 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -1361,10 +1361,8 @@ setting up the buffer."
   "# Example: You are a poet. Reply only in verse."))
  "\n\n")
 (add-text-properties
- (point-min) (1- (point))
- (list 'read-only t 'face 'font-lock-comment-face))
-;; TODO: make-separator-line requires Emacs 28.1+.
-;; (insert (propertize (make-separator-line) 'rear-nonsticky t))
+ (point-min) (point)
+ (list 'read-only t 'face 'font-lock-comment-face 'front-sticky t 
'rear-nonsticky t))
 (set-marker msg-start (point))
 (save-excursion
   ;; If it's a list, insert only the system message part



[elpa] externals/colorful-mode c57656d937: Refactorize code

2025-02-08 Thread ELPA Syncer
branch: externals/colorful-mode
commit c57656d9376125df9e58016a7dbbdf346d67055e
Author: Elijah Gabe P. 
Commit: Elijah Gabe P. 

Refactorize code

Thanks to Stefan Monnier for the suggestions.

* test/latex.tex: Fix typo.

* colorful-mode.el:
Remove autoload cookies.

(colorful-extra-color-keyword-functions, global-colorful-mode):
Remove duplicated modes.

(colorful--change-color): Use `pcase' instead `cond'.

(colorful--delete-overlay): Replace this function...
(colorful--delete-overlays): ... to this.

(colorful--colorize-match): Remove overlay hooks and unnecessary code.
Add overlay tag for kind of color.

(colorful--colorize): Add new function `arg' and use `pcase' instead `cond'.

(colorful-hex-font-lock-keywords)
(colorful-color-name-font-lock-keywords)
(colorful-rgb-font-lock-keywords, colorful-hsl-font-lock-keywords)
(colorful-latex-keywords): Remove unnecessary regex and add identifier
as function arg for colorful--colorize.

(colorful--turn-on, colorful--turn-off): Clarify Code.
---
 colorful-mode.el | 249 +--
 test/latex.tex   |   4 +-
 2 files changed, 115 insertions(+), 138 deletions(-)

diff --git a/colorful-mode.el b/colorful-mode.el
index bc34bb7378..667ace50fe 100644
--- a/colorful-mode.el
+++ b/colorful-mode.el
@@ -1,9 +1,10 @@
 ;;; colorful-mode.el --- Preview any color in your buffer in real time -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2024 Free Software Foundation, Inc
+;; Copyright (C) 2024-2025 Free Software Foundation, Inc
 
 ;; Author: Elias G. Perez 
 ;; Maintainer: Shen, Jen-Chieh 
+;; Elias G. Perez 
 ;; Created: 2024-04-10
 ;; Package-Requires: ((emacs "28.1") (compat "29.1.4.4"))
 ;; Homepage: https://github.com/DevelopmentCool2449/colorful-mode
@@ -212,7 +213,7 @@ Each entry should have the form (COLOR-NAME . 
HEXADECIMAL-COLOR)."
 
 (defcustom colorful-extra-color-keyword-functions
   '((emacs-lisp-mode . colorful-add-color-names)
-((mhtml-mode html-ts-mode css-mode css-ts-mode)
+((html-mode css-mode)
  . (colorful-add-rgb-colors colorful-add-hsl-colors 
colorful-add-color-names))
 (latex-mode . colorful-add-latex-colors)
 colorful-add-hex-colors)
@@ -370,14 +371,15 @@ DIGIT specifies which how much digits per component must 
have return value."
   (if (overlay-get ov 'colorful--overlay)
   (throw 'val ov)
 
-(defun colorful--delete-overlay (overlay &rest _)
-  "Helper function for delete OVERLAY."
-  (delete-overlay overlay))
+(defun colorful--delete-overlays (limit)
+  "Font-lock matcher that flushes our overlays before we install new ones."
+  (remove-overlays (point) limit 'colorful--overlay t)
+  ;; Tell font-lock we did not find any "match", so it doesn't call us back.
+  nil)
 
 
  User Interactive Functions
 
-;;;###autoload
 (defun colorful-convert-and-change-color ()
   "Convert color to a valid format and replace color at current cursor 
position."
   (interactive "*")
@@ -393,7 +395,6 @@ DIGIT specifies which how much digits per component must 
have return value."
 ;; Otherwise throw error.
 (user-error "No color found")))
 
-;;;###autoload
 (defun colorful-convert-and-copy-color ()
   "Convert color to a valid format and copy it at current cursor position."
   (interactive)
@@ -413,7 +414,6 @@ DIGIT specifies which how much digits per component must 
have return value."
 ;; Otherwise throw error.
 (user-error "No color found")))
 
-;;;###autoload
 (defun colorful-change-or-copy-color ()
   "Change or copy color to a converted format at current cursor position."
   (interactive)
@@ -441,6 +441,7 @@ COLOR, BEG, and END are only used for recursive purposes, 
not intended to
 be used externally."
   (let* ((beg (or beg (overlay-start ov))) ; Find positions.
  (end (or end (overlay-end ov)))
+ (kind (overlay-get ov 'colorful--overlay-kind))
  ;; If not COLOR string then get it from buffer.
  (color (or color (buffer-substring-no-properties beg end)))
  (prompt (format prompt color))
@@ -450,65 +451,59 @@ be used externally."
  (choice (alist-get
   (completing-read prompt choices nil t nil nil)
   choices nil nil 'equal)))
+
 (pcase choice ; Check and convert color to any of the options:
   ('hex ; COLOR to HEX
-   (if (not (or (string-prefix-p "#" color) ; Ensure is not already a hex.
-(string-prefix-p "0x" color)))
-   (cond
-;; Is COLOR a Name?
-((or (member color (defined-colors))
- (assoc-string color colorful-html-colors-alist))
- (list (colorful--name-to-hex
-color colorful-short-hex-conversions)
-   beg end))
-;; Is COLOR a CSS rgb?
-((string-match-p (rx (one-or-more "rgb" (opt "a") "(")) c

[elpa] externals/hyperbole 3558ba50f3 1/2: Return hasht when rebuilding from load data (#666)

2025-02-08 Thread ELPA Syncer
branch: externals/hyperbole
commit 3558ba50f37a66a44d49b26508a2f370bc6f48ff
Author: Mats Lidell 
Commit: GitHub 

Return hasht when rebuilding from load data (#666)
---
 ChangeLog|  9 
 hywiki.el|  8 +++
 test/hywiki-tests.el | 60 +++-
 3 files changed, 72 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c813676b3a..aa5dee1109 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-02-07  Mats Lidell  
+
+* test/hywiki-tests.el (hywiki-tests--save-referent)
+(hywiki-tests--save-referent-use-hyperbole-menu): Tests for using the
+cached page and referent data.
+
+* hywiki.el (hywiki-make-referent-hasht): Return hasht when rebuilding from
+load data.
+
 2025-02-05  Mats Lidell  
 
 * hywiki.el (hywiki-add-org-id): Suppress byte compile warnings for calling 
org-id-get with
diff --git a/hywiki.el b/hywiki.el
index eec6d973ab..094a05fedb 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:   Bob Weiner
 ;;
 ;; Orig-Date:21-Acpr-24 at 22:41:13
-;; Last-Mod:  5-Feb-25 at 22:21:38 by Mats Lidell
+;; Last-Mod:  6-Feb-25 at 23:35:41 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -2455,10 +2455,10 @@ save and potentially set `hywiki--directory-mod-time' 
and
   (progn (eval (read (buffer-string)))
  t)
 (error nil)))
-  (if (and hywiki-loaded-flag (not (hywiki-directory-modified-p)))
+(if (and hywiki-loaded-flag (not (hywiki-directory-modified-p)))
;; Rebuild from loaded data
-   (setq hywiki--referent-hasht (hash-make hywiki--referent-alist t)
- hywiki--referent-alist nil)
+(prog1 (setq hywiki--referent-hasht (hash-make hywiki--referent-alist 
t))
+ (setq hywiki--referent-alist nil))
   ;; Read `hywiki-directory' for current page files and merge with
   ;; non-page referents
   (let* ((page-files (hywiki-get-page-files))
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 5731b97463..90180f4000 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -3,7 +3,7 @@
 ;; Author:   Mats Lidell
 ;;
 ;; Orig-Date:18-May-24 at 23:59:48
-;; Last-Mod: 26-Jan-25 at 18:22:58 by Bob Weiner
+;; Last-Mod:  7-Feb-25 at 10:01:25 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -922,5 +922,63 @@ Note special meaning of `hywiki-allow-plurals-flag'."
 ;;  (hywiki-get-referent wikiword
 ;;   (hy-delete-dir-and-buffer hywiki-directory
 
+(ert-deftest hywiki-tests--save-referent ()
+  "Verify saving and loading a referent works."
+  (let* ((hywiki-directory (make-temp-file "hywiki" t))
+ (wiki-page (cdr (hywiki-add-page "WikiPage" )))
+(wiki-referent "WikiReferent"))
+(unwind-protect
+(progn
+  (find-file wiki-page)
+  (insert wiki-referent)
+  (goto-char 4)
+  (with-simulated-input "ABC RET"
+   (hywiki-add-key-series wiki-referent))
+ (should (equal '(key-series . "{ABC}") (hywiki-get-referent 
wiki-referent)))
+  (should (string= wiki-referent (buffer-string)))
+  (should (file-exists-p (hywiki-cache-default-file)))
+
+  ;; Simulate reload from cache
+  (setq hywiki--referent-hasht nil)
+  (hywiki-make-referent-hasht)
+  (should (equal '(key-series . "{ABC}") (hywiki-get-referent 
wiki-referent
+  (hy-delete-files-and-buffers (list wiki-page 
(hywiki-cache-default-file)))
+  (hy-delete-dir-and-buffer hywiki-directory
+
+(ert-deftest hywiki-tests--save-referent-use-hyperbole-menu ()
+  "Verify saving and loading a referent works when using Hyperbole's menu."
+  :expected-result :failed
+  ;; The entered key series is inserted into the WikiWord file. See
+  ;; comment below.
+  (skip-unless (not noninteractive))
+  (let* ((hywiki-directory (make-temp-file "hywiki" t))
+ (wiki-page (cdr (hywiki-add-page "WikiPage" )))
+(wiki-referent "WikiReferent"))
+(unwind-protect
+(progn
+  (find-file wiki-page)
+  (insert wiki-referent)
+  (goto-char 4)
+
+  (should (hact 'kbd-key "C-u C-h hhck{ABC} RET"))
+  (hy-test-helpers:consume-input-events)
+
+  ;; The buffer contents is changed and now reads
+  ;; "Wik{ABC}iReferent" as the next should verifies. The
+  ;; second should is the expected behavior. No change in the
+  ;; WikiPage buffer.
+  (should (string= "Wik{ABC}iReferent" (buffer-substring-no-properties 
(point-min) (point-max
+  (should (string= wiki-referent (buffer-substring-no-properties 
(point-min) (point-max
+
+  (should (file-exists-p (hywiki-cache-default-file)))
+ (should (equal '(key-series . "{ABC}") (hywiki-get-re

[nongnu] elpa/diff-ansi 463efc61b4: Fix #4: messages from site-file causes multi-process diff to fail

2025-02-08 Thread ELPA Syncer
branch: elpa/diff-ansi
commit 463efc61b44bb34f34e44a1cb028f5f69ac1bed4
Author: Campbell Barton 
Commit: Campbell Barton 

Fix #4: messages from site-file causes multi-process diff to fail
---
 changelog.rst | 3 ++-
 diff-ansi.el  | 5 -
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/changelog.rst b/changelog.rst
index fc7a421daa..45befd9f33 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -3,8 +3,9 @@
 Change Log
 ##
 
-- Development (2024-08-19)
+- Development (2025-02-09)
 
+  - Fix #4: Message in site-file causes multi-process diff to fail.
   - Fix ``ydiff`` defaulting to 80 column width.
   - Fix an error, attempting to use a closed buffer when ``diff-ansi-method`` 
is set to ``'progressive``.
 
diff --git a/diff-ansi.el b/diff-ansi.el
index 78782719e5..b6044fee1d 100644
--- a/diff-ansi.el
+++ b/diff-ansi.el
@@ -801,7 +801,10 @@ Store the result in TARGET-BUF when non-nil."
 
 (let ((output (concat temp-dir (number-to-string i
   (write-region point-prev (point) output nil 0)
-  (push (list emacs-bin "--batch" output "--eval" 
emacs-eval-arg) per-chunk-args))
+  ;; The "site-file" can cause messages that break our logic
+  ;; which requires predictable process output, see: #4.
+  (push (list emacs-bin "--no-site-file" "--batch" output 
"--eval" emacs-eval-arg)
+per-chunk-args))
 (setq i (1+ i)))
 
   (setq per-chunk-args (nreverse per-chunk-args



[elpa] externals/hyperbole c3ff71d9ce 2/2: Fix hywiki publishing (#667)

2025-02-08 Thread ELPA Syncer
branch: externals/hyperbole
commit c3ff71d9ce31a333470ab8d73fe13ab84ad8af66
Author: Mats Lidell 
Commit: GitHub 

Fix hywiki publishing (#667)

Highlight wiki page names before looking for overlays to turn into
org-links. Let org handle the sitemap file.
---
 ChangeLog |  8 
 hywiki.el | 10 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index aa5dee1109..5c0ed49ae6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-02-08  Mats Lidell  
+
+* hywiki.el (hywiki--sitemap-file): Helper function for getting the sitemap
+file-name.
+(hywiki-org-export-function): Only use org publishing for the sitemap file.
+(hywiki-convert-words-to-org-links): Highlight wiki page names so overlays
+are defined before looking for them.
+
 2025-02-07  Mats Lidell  
 
 * test/hywiki-tests.el (hywiki-tests--save-referent)
diff --git a/hywiki.el b/hywiki.el
index 094a05fedb..04190ac5fc 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:   Bob Weiner
 ;;
 ;; Orig-Date:21-Acpr-24 at 22:41:13
-;; Last-Mod:  6-Feb-25 at 23:35:41 by Mats Lidell
+;; Last-Mod:  8-Feb-25 at 22:56:32 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1409,6 +1409,7 @@ per file to the absolute value of MAX-MATCHES, if given 
and not 0.  If
 (defun hywiki-convert-words-to-org-links ()
   "Convert all highlighted HyWiki words in current buffer to Org links."
   (barf-if-buffer-read-only)
+  (hywiki-maybe-highlight-page-names)
   (let ((make-index (hywiki-org-get-publish-property :makeindex))
wiki-word)
 (hywiki-map-words (lambda (overlay)
@@ -2482,11 +2483,18 @@ save and potentially set `hywiki--directory-mod-time' 
and
 (defun hywiki-non-page-elt (val-key)
   (unless (eq (caar val-key) 'page) val-key))
 
+(defun hywiki--sitemap-file ()
+  "Return file name for the sitemap file."
+  (expand-file-name
+   (org-publish-property :sitemap-filename (hywiki-org-get-publish-project))
+   (org-publish-property :base-directory (hywiki-org-get-publish-project
+
 (defun hywiki-org-export-function (&rest _)
   "Add to `write-contents-functions' to convert HyWikiWord links to Org links.
 This is done automatically by loading HyWiki."
   (require 'org-element)
   (when (and (derived-mode-p 'org-mode)
+ (not (string= (hywiki--sitemap-file) (buffer-file-name)))
 (hyperb:stack-frame '(org-export-copy-buffer)))
 (hywiki-convert-words-to-org-links)
 (hywiki-org-maybe-add-title)))



[elpa] externals/hyperbole updated (e81710d378 -> c3ff71d9ce)

2025-02-08 Thread ELPA Syncer
elpasync pushed a change to branch externals/hyperbole.

  from  e81710d378 Suppress byte compile warnings calling org-id-get (#665)
   new  3558ba50f3 Return hasht when rebuilding from load data (#666)
   new  c3ff71d9ce Fix hywiki publishing (#667)


Summary of changes:
 ChangeLog| 17 +++
 hywiki.el| 16 ++
 test/hywiki-tests.el | 60 +++-
 3 files changed, 88 insertions(+), 5 deletions(-)



[nongnu] elpa/gptel 43e7c330d8: gptel-transient: Make gptel--edit-directive more flexible

2025-02-08 Thread ELPA Syncer
branch: elpa/gptel
commit 43e7c330d809e123946b62efc590527ca510b2a2
Author: Karthik Chikmagalur 
Commit: Karthik Chikmagalur 

gptel-transient: Make gptel--edit-directive more flexible

* gptel-transient.el (gptel--edit-directive,
gptel--read-with-prefix-help): Convert to a cl-defun with keyword
arguments for the heading, initial text, setup and callback
functions.  The setup function can tweak the buffer state as
appropriate to the (usually Transient suffix) command.  Make
`gptel--read-with-prefix-help' shorter, in preparation for adding
descriptions of more actions.

* gptel-rewrite.el (gptel--infix-rewrite-extra): Allow the rewrite
instruction to be edited in a buffer.  This action is currently
undocumented as it is experimental, and bound to `C-c C-e'. (#623)
---
 gptel-rewrite.el   | 23 ---
 gptel-transient.el | 85 +-
 2 files changed, 64 insertions(+), 44 deletions(-)

diff --git a/gptel-rewrite.el b/gptel-rewrite.el
index df1fbceca1..00b8a7a67e 100644
--- a/gptel-rewrite.el
+++ b/gptel-rewrite.el
@@ -552,13 +552,27 @@ By default, gptel uses the directive associated with the 
`rewrite'
 (let* ((rewrite-directive
 (car-safe (gptel--parse-directive gptel--rewrite-directive
   'raw)))
+   (cb (current-buffer))
(cycle-prefix
 (lambda () (interactive)
   (gptel--read-with-prefix rewrite-directive)))
+   (edit-in-buffer
+(lambda () (interactive)
+  (let ((offset (- (point) (minibuffer-prompt-end
+(gptel--edit-directive 'gptel--rewrite-message
+  :prompt rewrite-directive :initial 
(minibuffer-contents)
+  :buffer cb :setup (lambda () (ignore-errors 
(forward-char offset)))
+  :callback
+  (lambda ()
+(run-at-time 0 nil #'transient-setup 
'gptel-rewrite)
+(push (buffer-local-value 'gptel--rewrite-message 
cb)
+  (alist-get 'gptel--infix-rewrite-extra 
transient-history))
+(when (minibufferp) 
(minibuffer-quit-recursive-edit)))
(minibuffer-local-map
-(make-composed-keymap
- (define-keymap "TAB" cycle-prefix "" cycle-prefix)
- minibuffer-local-map)))
+(make-composed-keymap (define-keymap
+"TAB" cycle-prefix "" 
cycle-prefix
+"C-c C-e" edit-in-buffer)
+  minibuffer-local-map)))
   (minibuffer-with-setup-hook cycle-prefix
 (read-string
  prompt (or gptel--rewrite-message "Rewrite: ")
@@ -587,7 +601,8 @@ generated from functions."
 "Rewrite directive is dynamically generated: Edit its current 
value instead?")
   (if cancel (progn (message "Edit canceled")
 (call-interactively #'gptel-rewrite))
-(gptel--edit-directive 'gptel--rewrite-directive #'gptel-rewrite t)))
+(gptel--edit-directive 'gptel--rewrite-directive
+  :callback #'gptel-rewrite :setup #'activate-mark)))
 
 (transient-define-suffix gptel--suffix-rewrite (&optional rewrite-message 
dry-run)
   "Rewrite or refactor region contents."
diff --git a/gptel-transient.el b/gptel-transient.el
index dab79b2d1a..fb91a3c870 100644
--- a/gptel-transient.el
+++ b/gptel-transient.el
@@ -112,11 +112,11 @@ Meant to be called when `gptel-menu' is active."
   (concat
(propertize "(" 'face 'default)
(propertize "TAB" 'face 'help-key-binding)
-   (propertize " to expand, " 'face 'default)
+   (propertize ": expand, " 'face 'default)
(propertize "M-n" 'face 'help-key-binding)
(propertize "/" 'face 'default)
(propertize "M-p" 'face 'help-key-binding)
-   (propertize " for next/previous): " 'face 'default))
+   (propertize ": next/previous) " 'face 'default))
   "Help string ;TODO: ")
 
 (defun gptel--read-with-prefix (prefix)
@@ -1324,37 +1324,42 @@ generated from functions."
 "Active directive is dynamically generated: Edit its 
current value instead?")
   (if cancel (progn (message "Edit canceled")
 (call-interactively #'gptel-menu))
-(gptel--edit-directive 'gptel--system-message nil t)))
+(gptel--edit-directive 'gptel--system-message :setup #'activate-mark)))
 
 ;; MAYBE: Eventually can be simplified with string-edit, after we drop support
 ;; for Emacs 28.2.
-(defun gptel--edit-directive (sym &optional callback-cmd activate)
+(cl-defun gptel--edit-directive (sym &key prompt initial callback setup buffer)
   "Edit a g