1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

; Fix doc strings in lisp/image/ directory

* lisp/image/wallpaper.el (wallpaper-setter)
(wallpaper--find-command, wallpaper--x-monitor-name)
(wallpaper--format-arg):
* lisp/image/image-dired-util.el
(image-dired-associated-dired-buffer)
(image-dired--with-dired-buffer):
* lisp/image/image-dired-tags.el (image-dired--with-db-file)
(image-dired-remove-tag, image-dired-list-tags)
(image-dired-tag-files, image-dired-write-comments)
(image-dired-update-property):
* lisp/image/image-dired-external.el (image-dired-cmd-pngnq-options)
(image-dired-cmd-pngcrush-program)
(image-dired-cmd-pngcrush-options)
(image-dired-cmd-optipng-options)
(image-dired-cmd-create-standard-thumbnail-options)
(image-dired-cmd-rotate-original-program)
(image-dired-cmd-rotate-original-options)
(image-dired-cmd-write-exif-data-options, image-dired-queue)
(image-dired-queue-active-limit, image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-thumb-queue-run, image-dired-get-exif-file-name)
(image-dired-thumbnail-set-image-description):
* lisp/image/image-dired.el (image-dired-thumbnail-storage)
(image-dired-tags-db-file)
(image-dired-rotate-original-ask-before-overwrite)
(image-dired-line-up-method, image-dired-track-movement)
(image-dired-display-properties-format)
(image-dired-external-viewer)
(image-dired-show-all-from-dir-max-files)
(image-dired-insert-image)
(image-dired-dired-with-window-configuration)
(image-dired-restore-window-configuration)
(image-dired-track-original-file)
(image-dired-toggle-movement-tracking)
(image-dired-format-properties-string)
(image-dired--on-file-in-dired-buffer)
(image-dired-thumbnail-display-external)
(image-dired-display-image, image-dired-copy-filename-as-kill):
* lisp/image/image-dired-dired.el
(image-dired-dired-toggle-marked-thumbs)
(image-dired-dired-after-readin-hook)
(image-dired-next-line-and-display)
(image-dired-previous-line-and-display)
(image-dired-mark-and-display-next, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-dired-display-external)
(image-dired-copy-with-exif-file-name)
(image-dired-mark-tagged-files)
(image-dired-dired-display-properties):
* lisp/image/image-crop.el (image-crop-exif-rotate)
(image-crop-resize-command, image-crop-cut-command)
(image-crop-crop-command, image-crop-rotate-command)
(image-crop-buffer-text-function, image-cut-color):
* lisp/image/image-converter.el (image-converter)
(image-convert-to-format, image-converter-regexp)
(image-converter--converters, image-convert-p, image-convert)
(image-converter--value, image-converter--probe)
(image-converter--find-converter, image-converter--convert)
(image-converter-add-handler):
* lisp/image/exif.el (exif-parse-buffer, exif-field)
(exif-orientation, exif--direct-ascii-value)
(exif--process-value, exif--read-chunk, exif--read-number-be)
(exif--read-number-le, exif--read-number): Fix doc strings.
This commit is contained in:
Eli Zaretskii 2023-02-11 16:49:54 +02:00
parent 2d1e43436d
commit 074008ee2d
9 changed files with 197 additions and 181 deletions

View File

@ -110,7 +110,7 @@ from the return value of this function."
(exif-parse-buffer)))
(defun exif-parse-buffer (&optional buffer)
"Parse BUFFER (which should be a JPEG file) and return the Exif data, if any.
"Parse BUFFER (which should visit a JPEG file) and return Exif data, if any.
The return value is a list of Exif items.
If the data is invalid, an `exif-error' is signaled.
@ -134,17 +134,17 @@ from the return value of this function."
(exif--parse-exif-chunk app1))))))
(defun exif-field (field data)
"Return raw FIELD from EXIF.
"Return raw FIELD from Exif DATA.
If FIELD is not present in the data, return nil.
FIELD is a symbol in the cdr of `exif-tag-alist'.
DATA is the result of calling `exif-parse-file'."
DATA is the result of calling `exif-parse-file' or `exif-parse-buffer'."
(plist-get (seq-find (lambda (e)
(eq field (plist-get e :tag-name)))
data)
:value))
(defun exif-orientation (exif)
"Return the orientation (in degrees) in EXIF.
"Return the orientation (in degrees) in EXIF data.
If the orientation isn't present in the data, return nil."
(let ((code (exif-field 'orientation exif)))
(cadr (assq code exif--orientation))))
@ -254,21 +254,24 @@ If the orientation isn't present in the data, return nil."
;; We've reached the end of the directories.
dir))))
(defun exif--direct-ascii-value (value bytes le)
"Make VALUE into a zero-terminated string.
VALUE is an integer representing BYTES characters."
(defun exif--direct-ascii-value (value nbytes le)
"Make a string representing VALUE with NBYTES bytes according to LE endianness.
VALUE is an integer value of NBYTES bytes.
The return value is a null-terminated unibyte string whose length is
NBYTES+1 bytes. If LE is non-nil, the returned string representation of
VALUE is little-endian, otherwise it is big-endian."
(with-temp-buffer
(set-buffer-multibyte nil)
(if le
(dotimes (i bytes)
(dotimes (i nbytes)
(insert (logand (ash value (* i -8)) 255)))
(dotimes (i bytes)
(insert (logand (ash value (* (- (1- bytes) i) -8)) 255))))
(dotimes (i nbytes)
(insert (logand (ash value (* (- (1- nbytes) i) -8)) 255))))
(insert 0)
(buffer-string)))
(defun exif--process-value (value type le)
"Do type-based post-processing of the value."
"Do type-based post-processing of the VALUE whose endianness is per LE."
(cl-case type
;; Chop off trailing zero byte.
(ascii (substring value 0 (1- (length value))))
@ -281,7 +284,8 @@ VALUE is an integer representing BYTES characters."
(otherwise value)))
(defun exif--read-chunk (bytes)
"Return BYTES octets from the buffer and advance point that much."
"Return BYTES octets from the current buffer and advance point that much.
This function assumes that the current buffer is unibyte."
(when (> (+ (point) bytes) (point-max))
(signal 'exif-error "Premature end of file"))
(prog1
@ -289,8 +293,9 @@ VALUE is an integer representing BYTES characters."
(forward-char bytes)))
(defun exif--read-number-be (bytes)
"Read BYTES octets from the buffer as a chunk of big-endian bytes.
Advance point to after the read bytes."
"Read BYTES octets from the current buffer as a chunk of big-endian bytes.
Advance point to after the read bytes.
This function assumes that the current buffer is unibyte."
(when (> (+ (point) bytes) (point-max))
(signal 'exif-error "Premature end of file"))
(let ((sum 0))
@ -300,8 +305,9 @@ Advance point to after the read bytes."
sum))
(defun exif--read-number-le (bytes)
"Read BYTES octets from the buffer as a chunk of low-endian bytes.
Advance point to after the read bytes."
"Read BYTES octets from the current buffer as a chunk of little-endian bytes.
Advance point to after the read bytes.
This function assumes that the current buffer is unibyte."
(when (> (+ (point) bytes) (point-max))
(signal 'exif-error "Premature end of file"))
(let ((sum 0))
@ -310,10 +316,11 @@ Advance point to after the read bytes."
(forward-char 1))
sum))
(defun exif--read-number (bytes lower-endian)
"Read BYTES octets from the buffer with endianness determined by LOWER-ENDIAN.
Advance point to after the read bytes."
(if lower-endian
(defun exif--read-number (bytes little-endian)
"Read BYTES octets from current buffer with endianness given by LITTLE-ENDIAN.
Advance point to after the read bytes.
This function assumes that the current buffer is unibyte."
(if little-endian
(exif--read-number-le bytes)
(exif--read-number-be bytes)))

View File

@ -38,9 +38,9 @@ If nil, Emacs will try to find one of the supported converters
installed on the system.
The actual range of image formats that will be converted depends
on what image formats the chosen converter reports being able to
handle. `auto-mode-alist' is then used to further filter what
formats that are to be supported: Only the suffixes that map to
on the image formats which the chosen converter is able to
handle. `auto-mode-alist' is then used to further filter the
formats that are to be supported: only the suffixes that map to
`image-mode' will be handled."
:group 'image
:type 'symbol
@ -48,16 +48,16 @@ formats that are to be supported: Only the suffixes that map to
(defcustom image-convert-to-format "png"
"The image format to convert to.
This should be a string like \"png\" or \"ppm\" or some
This should be a string like \"png\" or \"ppm\", or some
other (preferably lossless) format that Emacs understands
natively. The converter chosen has to support the format, and if
not, conversion will fail."
natively. The converter chosen has to support this format; if
not, the conversion will fail."
:group 'image
:version "29.1"
:type 'string)
(defvar image-converter-regexp nil
"A regexp that matches the file name suffixes that can be converted.")
"A regexp that matches the file name suffixes which can be converted.")
(defvar image-converter-file-name-extensions nil
"A list of file name suffixes that can be converted.")
@ -66,7 +66,7 @@ not, conversion will fail."
'((graphicsmagick :command ("gm" "convert") :probe ("-list" "format"))
(ffmpeg :command "ffmpeg" :probe "-decoders")
(imagemagick :command "convert" :probe ("-list" "format")))
"List of supported image converters to try.")
"List of supported image converters to try and required command-line switches.")
(defvar image-converter--extra-converters (make-hash-table :test #'equal))
@ -80,8 +80,8 @@ This also determines which external formats we can parse."
"Return `image-convert' if SOURCE is an image that can be converted.
SOURCE can either be a file name or a string containing image
data. In the latter case, DATA-P should be non-nil. If DATA-P
is a string, it should be a MIME format string like
\"image/gif\"."
is a string, it should be a MIME format string specifying the image type,
like \"image/gif\"."
(image-converter-initialize)
;; When image-converter was customized
(when (and image-converter (not image-converter-regexp))
@ -101,22 +101,21 @@ is a string, it should be a MIME format string like
'image-convert))
(defun image-convert (image &optional image-format)
"Convert IMAGE file to an image format Emacs understands.
This will usually be \"png\", but this is controlled by the
`image-convert-to-format' user option.
"Convert IMAGE to an image format which Emacs understands.
This will usually be \"png\", but is controlled by the value
of the `image-convert-to-format' user option.
IMAGE can either be a file name or image data.
To pass in image data, IMAGE should a string containing the image
data, and IMAGE-FORMAT should be a symbol with a MIME format name
like \"image/webp\". For instance:
IMAGE can either be a file name, an image object returned
by `create-image', or a string with image data. In the latter
case, IMAGE-FORMAT should be a symbol whose name is a MIME
specification of image format, such as \"image/webp\".
For instance:
(image-convert data-string \\='image/bmp)
IMAGE can also be an image object as returned by `create-image'.
This function converts the image the preferred format, and the
converted image data is returned as a string."
This function converts the image to the preferred format, per
the value of `image-convert-to-format', and returns the
converted image data as a string."
(image-converter-initialize)
(unless image-converter
(error "No external image converters available"))
@ -152,14 +151,14 @@ converted image data is returned as a string."
(buffer-string))))
(defun image-converter--value (type elem)
"Return the value of ELEM of image converter TYPE."
"Return the value of property ELEM for image converter TYPE."
(let ((value (plist-get (cdr (assq type image-converter--converters)) elem)))
(if (stringp value)
(list value)
value)))
(cl-defmethod image-converter--probe ((type (eql 'graphicsmagick)))
"Check whether the system has GraphicsMagick installed."
"Check whether the system has GraphicsMagick installed that's usable converter."
(with-temp-buffer
(let ((command (image-converter--value type :command))
formats)
@ -177,7 +176,7 @@ converted image data is returned as a string."
(nreverse formats)))))
(cl-defmethod image-converter--probe ((type (eql 'imagemagick)))
"Check whether the system has ImageMagick installed."
"Check whether the system has ImageMagick installed that's a usable converter."
(with-temp-buffer
(let ((command (image-converter--value type :command))
formats)
@ -197,7 +196,7 @@ converted image data is returned as a string."
(nreverse formats))))
(cl-defmethod image-converter--probe ((type (eql 'ffmpeg)))
"Check whether the system has ffmpeg installed."
"Check whether the system has ffmpeg installed that's a usable converter."
(with-temp-buffer
(let ((command (image-converter--value type :command))
formats)
@ -215,7 +214,7 @@ converted image data is returned as a string."
(nreverse formats)))))
(defun image-converter--find-converter ()
"Find an installed image converter."
"Find an installed image converter Emacs can use."
(catch 'done
(dolist (elem image-converter--converters)
(when-let ((formats (image-converter--filter-formats
@ -239,12 +238,12 @@ Only suffixes that map to `image-mode' are returned."
(cl-defmethod image-converter--convert ((type (eql 'graphicsmagick)) source
image-format)
"Convert using GraphicsMagick."
"Convert image in SOURCE using GraphicsMagick."
(image-converter--convert-magick type source image-format))
(cl-defmethod image-converter--convert ((type (eql 'imagemagick)) source
image-format)
"Convert using ImageMagick."
"Convert image in SOURCE using ImageMagick."
(image-converter--convert-magick type source image-format))
(defun image-converter--mime-type (image-format)
@ -281,7 +280,7 @@ Only suffixes that map to `image-mode' are returned."
(cl-defmethod image-converter--convert ((type (eql 'ffmpeg)) source
image-format)
"Convert using ffmpeg."
"Convert image in SOURCE using ffmpeg."
(let ((command (image-converter--value type :command))
(coding-system-for-read 'no-conversion))
(unless (zerop (if image-format
@ -308,12 +307,12 @@ Only suffixes that map to `image-mode' are returned."
;;;###autoload
(defun image-converter-add-handler (suffix converter)
"Make Emacs use CONVERTER to parse image files that end with SUFFIX.
CONVERTER is a function with two parameters, where the first is
the file name or a string with the image data, and the second is
non-nil if the first parameter is image data. The converter
should output the image in the current buffer, converted to
`image-convert-to-format'."
"Make Emacs use CONVERTER to parse image files whose names end with SUFFIX.
CONVERTER is a function with two arguments, the file name or a string
with the image data, and a non-nil value if the first argument is image data.
The converter should produce the image in the current buffer, converted to
the format given by `image-convert-to-format'.
SUFFIX should not include the leading dot."
(cl-pushnew suffix image-converter-file-name-extensions :test #'equal)
(setq image-converter-file-name-extensions
(sort image-converter-file-name-extensions #'string<))

View File

@ -41,71 +41,71 @@
:group 'image)
(defvar image-crop-exif-rotate nil
"If non-nil, rotate images by updating exif data.
"If non-nil, rotate images by updating Exif data.
If nil, rotate the images \"physically\".")
(defcustom image-crop-resize-command '("convert" "-resize" "%wx" "-" "%f:-")
"Command to resize an image.
The following `format-spec' elements are allowed:
"List of command and command-line arguments to resize an image.
The following `format-spec' elements are allowed in the value:
%w: Width.
%f: Result file type."
%f: File type to produce."
:type '(repeat string)
:version "29.1")
(defcustom image-crop-cut-command '("convert" "-draw" "rectangle %l,%t %r,%b"
"-fill" "%c"
"-" "%f:-")
"Command to cut a rectangle out of an image.
"List of command and its command-line arguments to cut a rectangle out of image.
The following `format-spec' elements are allowed:
The following `format-spec' elements are allowed in the value:
%l: Left.
%t: Top.
%r: Right.
%b: Bottom.
%c: Color.
%f: Result file type."
%f: File type to produce."
:type '(repeat string)
:version "29.1")
(defcustom image-crop-crop-command '("convert" "+repage" "-crop" "%wx%h+%l+%t"
"-" "%f:-")
"Command to crop an image.
"List of command and its command-line arguments to crop an image.
The following `format-spec' elements are allowed:
The following `format-spec' elements are allowed in the value:
%l: Left.
%t: Top.
%w: Width.
%h: Height.
%f: Result file type."
%f: File type to produce."
:type '(repeat string)
:version "29.1")
(defcustom image-crop-rotate-command '("convert" "-rotate" "%r" "-" "%f:-")
"Command to rotate an image.
"List of command and its command-line arguments to rotate an image.
The following `format-spec' elements are allowed:
The following `format-spec' elements are allowed in the value:
%r: Rotation (in degrees).
%f: Result file type."
%f: File type to produce."
:type '(repeat string)
:version "29.1")
(defvar image-crop-buffer-text-function #'image-crop--default-buffer-text
"Function to return the buffer text for the cropped image.
After cropping an image, the displayed image will be updated to
show the cropped image in the buffer. Different modes will have
different ways to represent this image data in a buffer. For
instance, an HTML-based mode might want to represent the image
with <img src=\"data:...base64...\">, but that's up to the mode.
"Function to return the buffer text corresponding to the cropped image.
After cropping an image, the displayed image in the buffer will be updated
to show the cropped image. Different modes will have different ways to
represent this image data in a buffer, but that's up to the mode. For
instance, an HTML-based mode might want to represent the image with
<img src=\"data:...base64...\">.
The default action is to not alter the buffer text at all.
The default action is to not alter the image's text in the buffer, and
just return it.
The function is called with two arguments: The first is the
original buffer text, and the second parameter is the cropped
image data.")
The function is called with two arguments: the original buffer text,
and the cropped image data.")
(defcustom image-cut-color "black"
"Color to use for the rectangle cut from the image."
"Color to use for the rectangle that was cut from the image."
:type 'string
:version "29.1")

View File

@ -57,11 +57,12 @@ Dired and you might want to turn it off."
;;;###autoload
(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
"Toggle thumbnails in front of file names in the Dired buffer.
If no marked file could be found, insert or hide thumbnails on the
current line. ARG, if non-nil, specifies the files to use instead
of the marked files. If ARG is an integer, use the next ARG (or
previous -ARG, if ARG<0) files."
"Toggle thumbnails in front of marked file names in the Dired buffer.
If no file is marked, toggle display of thumbnail on the current file's line.
ARG, if non-nil (interactively, the prefix argument), specifies the files
whose thumbnail display to toggle instead of the marked files: if ARG is an
integer, use the next ARG (or previous -ARG, if ARG<0) files; any other
value of ARG means toggle thumbnail display of the current line's file."
(interactive "P" dired-mode)
(setq image-dired--generate-thumbs-start (current-time))
(dired-map-over-marks
@ -91,8 +92,8 @@ previous -ARG, if ARG<0) files."
(defun image-dired-dired-after-readin-hook ()
"Relocate existing thumbnail overlays in Dired buffer after reverting.
Move them to their corresponding files if they still exist.
Otherwise, delete overlays.
Move each overlay to its corresponding file if it still exists.
Otherwise, delete the overlay.
Used by `image-dired-dired-toggle-marked-thumbs'."
(mapc (lambda (overlay)
(when (overlay-get overlay 'put-image)
@ -104,7 +105,7 @@ Used by `image-dired-dired-toggle-marked-thumbs'."
(overlays-in (point-min) (point-max))))
(defun image-dired-next-line-and-display ()
"Move to next Dired line and display thumbnail image."
"Move to next Dired line and display its thumbnail image."
(interactive nil dired-mode)
(dired-next-line 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@ -112,7 +113,7 @@ Used by `image-dired-dired-toggle-marked-thumbs'."
(image-dired-dired-display-properties)))
(defun image-dired-previous-line-and-display ()
"Move to previous Dired line and display thumbnail image."
"Move to previous Dired line and display its thumbnail image."
(interactive nil dired-mode)
(dired-previous-line 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@ -130,7 +131,7 @@ Used by `image-dired-dired-toggle-marked-thumbs'."
"off")))
(defun image-dired-mark-and-display-next ()
"Mark current file in Dired and display next thumbnail image."
"Mark current file in Dired and display the next thumbnail image."
(interactive nil dired-mode)
(dired-mark 1)
(image-dired-display-thumbs t image-dired-dired-append-when-browsing t)
@ -148,7 +149,7 @@ Used by `image-dired-dired-toggle-marked-thumbs'."
"off")))
(defun image-dired-track-thumbnail ()
"Track current Dired file's thumb in `image-dired-thumbnail-buffer'.
"Move to thumbnail of the current Dired file in `image-dired-thumbnail-buffer'.
This is almost the same as what `image-dired-track-original-file' does,
but the other way around."
(let ((file (dired-get-filename))
@ -170,18 +171,18 @@ but the other way around."
(image-dired--update-header-line))))))
(defun image-dired-dired-next-line (&optional arg)
"Call `dired-next-line', then track thumbnail.
"Call `dired-next-line', while tracking the file's thumbnail.
This can safely replace `dired-next-line'.
With prefix argument, move ARG lines."
With prefix argument ARG, move that many lines."
(interactive "P" dired-mode)
(dired-next-line (or arg 1))
(if image-dired-track-movement
(image-dired-track-thumbnail)))
(defun image-dired-dired-previous-line (&optional arg)
"Call `dired-previous-line', then track thumbnail.
"Call `dired-previous-line', while tracking the file's thumbnail.
This can safely replace `dired-previous-line'.
With prefix argument, move ARG lines."
With prefix argument ARG, move that many lines."
(interactive "P" dired-mode)
(dired-previous-line (or arg 1))
(if image-dired-track-movement
@ -307,7 +308,8 @@ With prefix argument ARG, create thumbnails even if they already exist
;;;###autoload
(defun image-dired-dired-display-external ()
"Display file at point using an external viewer."
"Display file at point using an external viewer.
The viewer is specified by the value of `image-dired-external-viewer'."
(interactive nil dired-mode)
(let ((file (dired-get-filename)))
(start-process "image-dired-external" nil
@ -323,15 +325,15 @@ See documentation for `image-dired-display-image' for more information."
(defun image-dired-copy-with-exif-file-name ()
"Copy file with unique name to main image directory.
Copy current or all marked files in Dired to a new file in your
main image directory, using a file name generated by
Copy current or all files marked in Dired to new file(s) in your
main image directory, using file name(s) generated by
`image-dired-get-exif-file-name'. A typical usage for this if when
copying images from a digital camera into the image directory.
Typically, you would open up the folder with the incoming
Typically, you would open up the folder with the incoming
digital images, mark the files to be copied, and execute this
function. The result is a couple of new files in
`image-dired-main-image-directory' called
command. The result is one or more new files in
`image-dired-main-image-directory', named like
2005_05_08_12_52_00_dscn0319.jpg,
2005_05_08_14_27_45_dscn0320.jpg etc."
(interactive nil dired-mode)
@ -350,11 +352,11 @@ function. The result is a couple of new files in
;;;###autoload
(defun image-dired-mark-tagged-files (regexp)
"Use REGEXP to mark files with matching tag.
"Mark files whose tag matches REGEXP.
A `tag' is a keyword, a piece of meta data, associated with an
image file and stored in image-dired's database file. This command
lets you input a regexp and this will be matched against all tags
on all image files in the database file. The files that have a
promts for a regexp, and then matches it against all the tags
of all the image files in the database file. The files that have a
matching tag will be marked in the Dired buffer."
(interactive "sMark tagged files (regexp): " dired-mode)
(image-dired-sane-db-file)
@ -386,7 +388,7 @@ matching tag will be marked in the Dired buffer."
(message "%d files with matching tag marked" hits)))
(defun image-dired-dired-display-properties ()
"Display properties for Dired file in the echo area."
"Show in the echo area the image-related properties of a file in Dired buffer."
(interactive nil dired-mode)
(let* ((file-name (dired-get-filename))
(dired-buf (buffer-name (current-buffer)))

View File

@ -86,15 +86,15 @@ using the NeuQuant algorithm."
(if (executable-find "pngquant")
'("--ext" "-nq8.png" "%t") ; same extension as "pngnq"
'("-f" "%t"))
"Arguments to pass `image-dired-cmd-pngnq-program'.
Available format specifiers are the same as in
"Arguments to pass to `image-dired-cmd-pngnq-program'.
Value can use the same format specifiers as in
`image-dired-cmd-create-thumbnail-options'."
:type '(repeat (string :tag "Argument"))
:version "29.1")
(defcustom image-dired-cmd-pngcrush-program (executable-find "pngcrush")
"The file name of the `pngcrush' program.
It optimizes the compression of PNG images. Also it adds PNG textual chunks
It optimizes the compression of PNG images. It also adds PNG textual chunks
with the information required by the Thumbnail Managing Standard."
:type '(choice (const :tag "Not Set" nil) file))
@ -110,7 +110,7 @@ with the information required by the Thumbnail Managing Standard."
"-text" "b" "Thumb::URI" "file://%f"
"%q" "%t")
"Arguments for `image-dired-cmd-pngcrush-program'.
The available %-format specifiers are the same as in
The value can use the same %-format specifiers as in
`image-dired-cmd-create-thumbnail-options', with \"%q\" for a
temporary file name (typically generated by pnqnq)."
:version "26.1"
@ -123,7 +123,7 @@ temporary file name (typically generated by pnqnq)."
(defcustom image-dired-cmd-optipng-options '("-o5" "%t")
"Arguments passed to `image-dired-cmd-optipng-program'.
Available format specifiers are described in
The value can use format specifiers described in
`image-dired-cmd-create-thumbnail-options'."
:version "26.1"
:type '(repeat (string :tag "Argument"))
@ -139,14 +139,14 @@ Available format specifiers are described in
"-thumbnail" "%wx%h>" "png:%t")))
(if (executable-find "gm") (cons "convert" opts) opts))
"Options for creating thumbnails according to the Thumbnail Managing Standard.
The available %-format specifiers are the same as in
The value can use the same %-format specifiers as in
`image-dired-cmd-create-thumbnail-options', with \"%m\" for file
modification time."
:type '(repeat (string :tag "Argument"))
:version "29.1")
(defcustom image-dired-cmd-rotate-original-program "jpegtran"
"Executable used to rotate original image.
"Executable program used to rotate original image.
Used together with `image-dired-cmd-rotate-original-options'."
:type 'file)
@ -154,11 +154,11 @@ Used together with `image-dired-cmd-rotate-original-options'."
'("-rotate" "%d" "-copy" "all" "-outfile" "%t" "%o")
"Arguments of command used to rotate original image.
Used with `image-dired-cmd-rotate-original-program'.
Available format specifiers are: %d which is replaced by the
number of (positive) degrees to rotate the image, normally 90 or
270 \(for 90 degrees right and left), %o which is replaced by the
original image file name and %t which is replaced by
`image-dired-temp-image-file'."
The value can use the following format specifiers:
%d which is replaced by the number of (positive) degrees
to rotate the image, normally 90 or 270 (for 90 degrees right and left),
%o which is replaced by the original image file name
and %t which is replaced by `image-dired-temp-image-file'."
:version "26.1"
:type '(repeat (string :tag "Argument")))
@ -176,9 +176,10 @@ Used together with `image-dired-cmd-write-exif-data-options'."
(defcustom image-dired-cmd-write-exif-data-options '("-%t=%v" "%f")
"Arguments of command used to write EXIF data.
Used with `image-dired-cmd-write-exif-data-program'.
Available format specifiers are: %f which is replaced by
the image file name, %t which is replaced by the tag name and %v
which is replaced by the tag value."
The value can use the following format specifiers are:
%f which is replaced by the image file name,
%t which is replaced by the tag name
and %v which is replaced by the tag value."
:version "26.1"
:type '(repeat (string :tag "Argument")))
@ -206,7 +207,7 @@ which is replaced by the tag value."
"Time when `display-thumbs' was called.")
(defvar image-dired-queue nil
"List of items in the queue.
"List of items in the Image-Dired queue.
Each item has the form (ORIGINAL-FILE TARGET-FILE).")
(defvar image-dired-queue-active-jobs 0
@ -214,13 +215,13 @@ Each item has the form (ORIGINAL-FILE TARGET-FILE).")
(defvar image-dired-queue-active-limit (min 4 (max 2 (/ (num-processors) 2)))
"Maximum number of concurrent jobs permitted for generating images.
Increase at own risk. If you want to experiment with this,
Increase at your own risk. If you want to experiment with this,
consider setting `image-dired-debug' to a non-nil value to see
the time spent on generating thumbnails. Run `clear-image-cache'
and remove the cached thumbnail files between each trial run.")
(defun image-dired-pngnq-thumb (spec)
"Quantize thumbnail described by format SPEC with pngnq(1)."
"Quantize thumbnail described by format SPEC with command `pngnq'."
(let ((process
(apply #'start-process "image-dired-pngnq" nil
image-dired-cmd-pngnq-program
@ -243,7 +244,7 @@ and remove the cached thumbnail files between each trial run.")
process))
(defun image-dired-pngcrush-thumb (spec)
"Optimize thumbnail described by format SPEC with pngcrush(1)."
"Optimize thumbnail described by format SPEC with command `pngcrush'."
;; If pngnq wasn't run, then the THUMB-nq8.png file does not exist.
;; pngcrush needs an infile and outfile, so we just copy THUMB to
;; THUMB-nq8.png and use the latter as a temp file.
@ -268,7 +269,7 @@ and remove the cached thumbnail files between each trial run.")
process))
(defun image-dired-optipng-thumb (spec)
"Optimize thumbnail described by format SPEC with optipng(1)."
"Optimize thumbnail described by format SPEC with command `optipng'."
(let ((process
(apply #'start-process "image-dired-optipng" nil
image-dired-cmd-optipng-program
@ -354,7 +355,8 @@ and remove the cached thumbnail files between each trial run.")
(defun image-dired-thumb-queue-run ()
"Run a queued job if one exists and not too many jobs are running.
Queued items live in `image-dired-queue'."
Queued items live in `image-dired-queue'.
Number of simultaneous jobs is limited by `image-dired-queue-active-limit'."
(while (and image-dired-queue
(< image-dired-queue-active-jobs
image-dired-queue-active-limit))
@ -414,7 +416,7 @@ The new file will be named THUMBNAIL-FILE."
The file name should be unique as long as you do not take more than
one picture per second. The original file name is suffixed at the end
for traceability. The format of the returned file name is
YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from
YYYY_MM_DD_HH_MM_ss_ORIG_FILE_NAME.jpg. Used from
`image-dired-copy-with-exif-file-name'."
(let (data no-exif-data-found)
(if (not (eq 'jpeg (image-type (expand-file-name file))))
@ -434,7 +436,7 @@ YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from
(file-name-nondirectory file))))
(defun image-dired-thumbnail-set-image-description ()
"Set the ImageDescription EXIF tag for the original image.
"Set the ImageDescription EXIF tag for the original image at point.
If the image already has a value for this tag, it is used as the
default value at the prompt."
(interactive nil image-dired-thumbnail-mode)

View File

@ -39,7 +39,7 @@
(defmacro image-dired--with-db-file (&rest body)
"Run BODY in a temp buffer containing `image-dired-tags-db-file'.
Return the last form in BODY."
Return the value of last form in BODY."
(declare (indent 0) (debug t))
`(with-temp-buffer
(if (file-exists-p image-dired-tags-db-file)
@ -91,7 +91,8 @@ FILE-TAGS is an alist in the following form:
(save-buffer))))
(defun image-dired-remove-tag (files tag)
"For all FILES, remove TAG from the image database."
"For each file in FILES, remove TAG from the image database.
FILES can be a name of a single file (a string) or a list of file names."
(image-dired-sane-db-file)
(image-dired--with-db-file
(setq buffer-file-name image-dired-tags-db-file)
@ -119,7 +120,8 @@ FILE-TAGS is an alist in the following form:
(save-buffer)))
(defun image-dired-list-tags (file)
"Read all tags for image FILE from the image database."
"Read all tags for image FILE from the image database.
Value is a list of all tags for FILE."
(image-dired-sane-db-file)
(image-dired--with-db-file
(let (end (tags ""))
@ -136,7 +138,8 @@ FILE-TAGS is an alist in the following form:
;;;###autoload
(defun image-dired-tag-files (arg)
"Tag marked file(s) in Dired. With prefix ARG, tag file at point."
"Tag file(s) which are marked in a Dired buffer.
With prefix ARG, tag the file at point."
(interactive "P" dired-mode)
(let ((tag (completing-read
"Tags to add (separate tags with a semicolon): "
@ -187,8 +190,7 @@ With prefix argument ARG, remove tag from file at point."
'tags (image-dired-list-tags (image-dired-original-file-name))))))
(defun image-dired-write-comments (file-comments)
"Write file comments to database.
Write file comments to one or more files.
"Write file comments specified by FILE-COMMENTS comments to database.
FILE-COMMENTS is an alist on the following form:
((FILE . COMMENT) ... )"
(image-dired-sane-db-file)
@ -224,7 +226,7 @@ FILE-COMMENTS is an alist on the following form:
(save-buffer))))
(defun image-dired-update-property (prop value)
"Update text property PROP with value VALUE at point."
"Set text property PROP of text at point to have the given VALUE."
(let ((inhibit-read-only t))
(put-text-property
(point) (1+ (point))

View File

@ -110,11 +110,11 @@ See also `image-dired-thumbnail-storage'."
(abbreviate-file-name f)))
(defun image-dired-associated-dired-buffer ()
"Get associated Dired buffer at point."
"Get associated Dired buffer for thumbnail at point."
(get-text-property (point) 'associated-dired-buffer))
(defmacro image-dired--with-dired-buffer (&rest body)
"Run BODY in associated Dired buffer.
"Run BODY in the Dired buffer associated with thumbnail at point.
Should be used by commands in `image-dired-thumbnail-mode'."
(declare (indent defun) (debug t))
(let ((file (make-symbol "file"))

View File

@ -171,7 +171,7 @@ thumbnails:
sharing of thumbnails across different programs. Thumbnails
will be stored in \"$XDG_CACHE_HOME/thumbnails/\"
Set this user option to one of the following values:
To use this way, set this user option to one of the following values:
- `standard' means use thumbnails sized 128x128.
- `standard-large' means use thumbnails sized 256x256.
@ -181,20 +181,20 @@ thumbnails:
2. In the Image-Dired specific directory indicated by
`image-dired-dir'.
Set this user option to `image-dired' to use it (or
`use-image-dired-dir', which means the same thing for
backwards-compatibility reasons).
To use this way, set this user option to `image-dired' (or
to `use-image-dired-dir', which means the same thing for
backward-compatibility reasons).
3. In a subdirectory \".image-dired\" in the same directory
where the image files are.
Set this user option to `per-directory' to use it.
To use this way, set this user option to `per-directory'.
To change the default size of thumbnails with (2) and (3) above,
customize `image-dired-thumb-size'.
To control the default size of thumbnails for alternatives (2)
and (3) above, customize the value of `image-dired-thumb-size'.
With Thumbnail Managing Standard, save thumbnails in the PNG
format, as mandated by that standard, and otherwise as JPEG.
format, as mandated by that standard; otherwise save them as JPEG.
For more information on the Thumbnail Managing Standard, see:
https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html"
@ -216,13 +216,13 @@ https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html
'image-dired-tags-db-file "29.1")
(defcustom image-dired-tags-db-file
(expand-file-name ".image-dired_db" image-dired-dir)
"Database file where file names and their associated tags are stored."
"Database file where image-dired file names and associated tags are stored."
:type 'file)
(defcustom image-dired-rotate-original-ask-before-overwrite t
"Confirm overwrite of original file after rotate operation.
"Confirm overwriting of original file after image-rotate operation.
If non-nil, ask user for confirmation before overwriting the
original file with `image-dired-temp-rotate-image-file'."
original image file by `image-dired-temp-rotate-image-file'."
:type 'boolean)
(defcustom image-dired-thumb-size
@ -261,11 +261,12 @@ deletion."
(defcustom image-dired-line-up-method 'dynamic
"Default method for line-up of thumbnails in thumbnail buffer.
Used by `image-dired-display-thumbs' and other functions that needs
to line-up thumbnails. Dynamic means to use the available width of
the window containing the thumbnail buffer, Fixed means to use
`image-dired-thumbs-per-row', Interactive is for asking the user,
and No line-up means that no automatic line-up will be done."
Used by `image-dired-display-thumbs' and other functions that need
to line-up thumbnails. The value `dynamic' means to use the
available width of the window containing the thumbnail buffer,
the value `fixed' means to use `image-dired-thumbs-per-row',
the value `interactive' means ask the user, and the
value `none' means that no automatic line-up will be done."
:type '(choice :tag "Default line-up method"
(const :tag "Dynamic" dynamic)
(const :tag "Fixed" fixed)
@ -277,8 +278,8 @@ and No line-up means that no automatic line-up will be done."
:type 'natnum)
(defcustom image-dired-track-movement t
"The current state of the tracking and mirroring.
For more information, see the documentation for
"The current state of the Image-Dired tracking and mirroring of thumbnails.
For more information, see the documentation of
`image-dired-toggle-movement-tracking'."
:type 'boolean)
@ -286,14 +287,14 @@ For more information, see the documentation for
"Display format for thumbnail properties.
This is used for the header line in the Image-Dired buffer.
The following %-specs are replaced by `format-spec' before
The following %-specs in the value are replaced by `format-spec' before
displaying:
\"%f\" The file name (without a directory) of the
original image file.
\"%n\" The number of this image out of the total (e.g. 1/10).
\"%b\" The associated Dired buffer name.
\"%d\" The name of the directory that the file is in.
\"%d\" The name of the file's directory.
\"%s\" The image file size.
\"%t\" The list of tags (from the Image-Dired database).
\"%c\" The comment (from the Image-Dired database)."
@ -310,9 +311,9 @@ displaying:
((executable-find "xli") "xli")
((executable-find "qiv") "qiv -t")
((executable-find "xloadimage") "xloadimage"))
"Name of external viewer.
Including parameters. Used when displaying original image from
`image-dired-thumbnail-mode'."
"Shell command to invoke the external image viewer program.
Should include command-line arguments if needed. Used when displaying
original image from `image-dired-thumbnail-mode'."
:version "29.1"
:type '(choice string
(const :tag "Not Set" nil)))
@ -325,14 +326,14 @@ Used by `image-dired-copy-with-exif-file-name'."
:version "29.1")
(defcustom image-dired-show-all-from-dir-max-files 1000
"Maximum number of files in directory before prompting.
"Maximum number of files in directory to show before prompting.
If there are more image files than this in a selected directory,
If there are more image files in a selected directory than this number,
the `image-dired-show-all-from-dir' command will ask for
confirmation before creating the thumbnail buffer. If this
variable is nil, it will never ask."
variable is nil, never ask."
:type '(choice integer
(const :tag "Disable warning" nil))
(const :tag "Don't ask for confirmation" nil))
:version "29.1")
(defcustom image-dired-marking-shows-next t
@ -401,7 +402,7 @@ This affects the following commands:
(image-file-name-regexp)))
(defun image-dired-insert-image (file type relief margin)
"Insert image FILE of image TYPE, using RELIEF and MARGIN, at point."
"Insert at point image FILE of image TYPE, using RELIEF and MARGIN."
(let ((i `(image :type ,type
:file ,file
:relief ,relief
@ -495,9 +496,9 @@ by exactly one space or one newline character."
Convenience command that:
- Opens Dired in folder DIR
- Splits windows in most useful (?) way
- Sets `truncate-lines' to t
- opens Dired in folder DIR;
- splits windows in most useful (?) way; and
- sets `truncate-lines' to t
After the command has finished, you would typically mark some
image files in Dired and type
@ -525,7 +526,7 @@ calling `image-dired-restore-window-configuration'."
(other-window -2)))))
(defun image-dired-restore-window-configuration ()
"Restore window configuration.
"Restore window configuration altered by Image-Dired.
Restore any changes to the window configuration made by calling
`image-dired-dired-with-window-configuration'."
(interactive nil image-dired-thumbnail-mode)
@ -632,7 +633,7 @@ never ask for confirmation."
;;; Movement tracking
(defun image-dired-track-original-file ()
"Track the original file in the associated Dired buffer.
"Track in the associated Dired buffer the file that corresponds to thumbnail.
See `image-dired-toggle-movement-tracking'. Interactive use is
only useful if `image-dired-track-movement' is nil."
(interactive nil image-dired-thumbnail-mode image-dired-image-mode)
@ -646,8 +647,8 @@ only useful if `image-dired-track-movement' is nil."
(defun image-dired-toggle-movement-tracking ()
"Turn on and off `image-dired-track-movement'.
Tracking of the movements between thumbnail and Dired buffer so that
they are \"mirrored\" in the dired buffer. When this is on, moving
around in the thumbnail or dired buffer will find the matching
the movements are \"mirrored\" in the Dired buffer. When this is on,
moving around in the thumbnail or Dired buffer will move to the matching
position in the other buffer."
(interactive nil image-dired-thumbnail-mode image-dired-image-mode)
(setq image-dired-track-movement (not image-dired-track-movement))
@ -751,7 +752,9 @@ On reaching end or beginning of buffer, stop and show a message."
;;; Header line
(defun image-dired-format-properties-string (buf file image-count props comment)
"Format display properties.
"Format display properties for Image-Dired.
The properties are formatted according to specification
in `image-dired-display-properties-format', which see.
BUF is the associated Dired buffer, FILE is the original image
file name, IMAGE-COUNT is a string like \"N/M\" where N is the
number of this image and M is the total number of images, PROPS
@ -816,7 +819,7 @@ for. The default is to look for `dired-marker-char'."
(image-dired-dired-file-marked-p dired-del-marker))
(defmacro image-dired--on-file-in-dired-buffer (&rest body)
"Run BODY with point on file at point in Dired buffer.
"Run BODY in associated Dired buffer with point on current file's line.
Should be called from commands in `image-dired-thumbnail-mode'."
(declare (indent defun) (debug t))
`(if-let ((file-name (image-dired-original-file-name)))
@ -1192,7 +1195,8 @@ Ask user how many thumbnails should be displayed per row."
;;; Display image from thumbnail buffer
(defun image-dired-thumbnail-display-external ()
"Display original image for thumbnail at point using external viewer."
"Display original image for thumbnail at point using external viewer.
The viewer command is specified by `image-dired-external-viewer'."
(interactive nil image-dired-thumbnail-mode)
(let ((file (image-dired-original-file-name)))
(if (not (image-dired-image-at-point-p))
@ -1205,7 +1209,7 @@ Ask user how many thumbnails should be displayed per row."
(defun image-dired-display-image (file &optional _ignored)
"Display image FILE in the image buffer window.
If it is an image, the window will use `image-dired-image-mode'
If FILE is an image, the window will use `image-dired-image-mode'
which is based on `image-mode'."
(declare (advertised-calling-convention (file) "29.1"))
(setq file (expand-file-name file))
@ -1293,7 +1297,7 @@ overwritten. This confirmation can be turned off using
(defun image-dired-copy-filename-as-kill (&optional arg)
"Copy names of marked (or next ARG) files into the kill ring.
This works as `dired-copy-filename-as-kill' (which see)."
This works like `dired-copy-filename-as-kill' (which see)."
(interactive "P" image-dired-thumbnail-mode)
(image-dired--with-dired-buffer
(dired-copy-filename-as-kill arg)))

View File

@ -109,7 +109,7 @@ COMMAND is the executable to run to set the wallpaper.
ARGS is the default list of command line arguments for COMMAND.
PREDICATE is a function that will be called without any arguments
and returns non-nil if this setter should be used.
and should return non-nil if this setter should be used.
INIT-ACTION is a function that will be called without any
arguments before trying to set the wallpaper.
@ -304,7 +304,7 @@ order in which they appear.")
(throw 'found setter))))))))
(defun wallpaper--find-command ()
"Return a valid command to set the wallpaper in this environment."
"Return the appropriate command to set the wallpaper."
(when-let ((setter (wallpaper--find-setter)))
(wallpaper-setter-command setter)))
@ -437,7 +437,7 @@ See also `wallpaper-default-width'.")
On a graphical display, try using the same monitor as the current
frame.
On a non-graphical display, try to get the name by connecting to
the display server directly, and run \"xrandr\" if that doesn't
the display server directly, or run \"xrandr\" if that doesn't
work. Prompt for the monitor name if neither method works.
This function is meaningful only on X and is used only there."
@ -469,7 +469,7 @@ This function is meaningful only on X and is used only there."
(read-string (format-prompt "Monitor name" nil)))))
(defun wallpaper--format-arg (format file)
"Format a `wallpaper-command-args' argument ARG.
"Format a `wallpaper-command-args' argument ARG using FORMAT.
FILE is the image file name."
(format-spec
format