[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/scanner 4596ed9 09/56: add autoloads, minor refactoring
From: |
Stefan Monnier |
Subject: |
[elpa] externals/scanner 4596ed9 09/56: add autoloads, minor refactoring |
Date: |
Fri, 10 Apr 2020 13:55:59 -0400 (EDT) |
branch: externals/scanner
commit 4596ed96b7a63c4fba9cea79366f3e4662e532be
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>
add autoloads, minor refactoring
---
scanner.el | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/scanner.el b/scanner.el
index dfd1538..5fa1d96 100644
--- a/scanner.el
+++ b/scanner.el
@@ -284,7 +284,7 @@ selected output options, see ‘scanner-tesseract-outputs’."
""
(let ((ev (string-trim event)))
(unless (string= "finished" ev)
- (message (format "%s: %s" process ev)))))
+ (message "%s: %s" process ev))))
(defun scanner--ensure-init ()
"Ensure that scanning device is initialized.
@@ -306,6 +306,7 @@ availability of required options."
(t (scanner-select-device)))))
(scanner--check-device-options)))
+;;;###autoload
(defun scanner-scan-document ()
"Scan a document named FILENAME."
(interactive)
@@ -319,30 +320,32 @@ availability of required options."
;; functional programming is possible
;; write tests using ert
(scanner--ensure-init)
- (let* ((filename (file-name-sans-extension
+ (let* ((doc-file (file-name-sans-extension
(read-file-name "Document file name: ")))
(fmt (plist-get scanner-image-format :doc))
- (infile (make-temp-file "scanner" nil (concat "." fmt)))
- (scanimage-args (scanner--scanimage-args infile :doc fmt))
- (tesseract-args (scanner--tesseract-args infile filename)))
+ (img-file (make-temp-file "scanner" nil (concat "." fmt)))
+ (scanimage-args (scanner--scanimage-args img-file :doc fmt))
+ (tesseract-args (scanner--tesseract-args img-file doc-file)))
(cl-labels ((cleanup (process event)
(let ((ev (string-trim event)))
(unless (string= "finished" ev)
- (message (format "%s: %s" process ev)))
- (delete-file infile)))
+ (message "%s: %s" process ev))
+ (delete-file img-file)))
(tesseract (process event)
(let ((ev (string-trim event)))
(if (string= "finished" ev)
(make-process :name "Scanner (tesseract)"
- :command
`(,scanner-tesseract-program
- ,@tesseract-args)
+ :command
+ `(,scanner-tesseract-program
+ ,@tesseract-args)
:sentinel #'cleanup)
- (message (format "%s: %s" process ev))))))
+ (message "%s: %s" process ev)))))
(make-process :name "Scanner (scanimage)"
:command `(,scanner-scanimage-program ,@scanimage-args)
:sentinel #'tesseract))))
;; TODO add batch scanning
+;;;###autoload
(defun scanner-scan-image ()
"Scan an image, reading a file name interactively.
If ‘scanner-device-name’ is nil or this device is unavailable,
@@ -350,11 +353,11 @@ attempt auto-detection. If more than one scanning
devices are
available, ask for a selection interactively."
(interactive)
(scanner--ensure-init)
- (let* ((filename (read-file-name "Image file name: "))
- (fmt (scanner--determine-image-format filename))
- (fname (if (file-name-extension filename)
- filename
- (concat (file-name-sans-extension filename) "." fmt)))
+ (let* ((img-file (read-file-name "Image file name: "))
+ (fmt (scanner--determine-image-format img-file))
+ (fname (if (file-name-extension img-file)
+ img-file
+ (concat (file-name-sans-extension img-file) "." fmt)))
(args (scanner--scanimage-args fname :image fmt)))
(make-process :name "Scanner (scanimage)"
:command `(,scanner-scanimage-program ,@args)
- [elpa] branch externals/scanner created (now 72ecf43), Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 704f055 04/56: add compile dependencies to check target, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 027658b 06/56: ignore image files, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 4596ed9 09/56: add autoloads, minor refactoring,
Stefan Monnier <=
- [elpa] externals/scanner 30b97d3 05/56: add implementation of image scanning and first test case, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 9665335 10/56: add a menu and configuration functions, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner d5be7b8 12/56: clean up resolution setters, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 1e60cd2 03/56: add test and check targets to Makefile, gitignore dep, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 5bc37ff 02/56: add more customizations and validations, arglist functions, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner c952d0d 15/56: rename -options to -switches, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner e5c74e6 11/56: implement multi-page scan modes, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner dbb0ee4 14/56: add commentary, correct docstrings, Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 3e0398c 22/56: correct to eval-and-compile (scanner--device-specific-switches), Stefan Monnier, 2020/04/10
- [elpa] externals/scanner 5f06a4a 21/56: implement correct cleanup and error handling (scanner-scan-document), Stefan Monnier, 2020/04/10