(defvar image-dired-dir)
(defvar image-dired-main-image-directory)
(defvar image-dired-rotate-original-ask-before-overwrite)
-(defvar image-dired-thumb-height)
-(defvar image-dired-thumb-width)
(defvar image-dired-thumbnail-storage)
(defgroup image-dired-external nil
(if (executable-find "gm") (cons "convert" opts) opts))
"Options of command used to create thumbnail image.
Used with `image-dired-cmd-create-thumbnail-program'.
-Available format specifiers are: %w which is replaced by
-`image-dired-thumb-width', %h which is replaced by `image-dired-thumb-height',
-%f which is replaced by the file name of the original image and %t
-which is replaced by the file name of the thumbnail file."
- :version "29.1"
- :type '(repeat (string :tag "Argument")))
+Available format specifiers are:
+ %s, %w and %h, which are replaced by `image-dired-thumb-size'
+ %f which is replaced by the file name of the original image and
+ %t which is replaced by the file name of the thumbnail file."
+ :type '(repeat (string :tag "Argument"))
+ :version "29.1")
(defcustom image-dired-cmd-pngnq-program
;; Prefer pngquant to pngnq-s9 as it is faster on my machine.
\f
;;; Creating thumbnails
-(defun image-dired-thumb-size (dimension)
- "Return thumb size depending on `image-dired-thumbnail-storage'.
-DIMENSION should be either the symbol `width' or `height'."
- (cond
- ((eq 'standard image-dired-thumbnail-storage) 128)
- ((eq 'standard-large image-dired-thumbnail-storage) 256)
- ((eq 'standard-x-large image-dired-thumbnail-storage) 512)
- ((eq 'standard-xx-large image-dired-thumbnail-storage) 1024)
- (t (cl-ecase dimension
- (width image-dired-thumb-width)
- (height image-dired-thumb-height)))))
+(defun image-dired--thumb-size (&optional _)
+ "Return thumb size depending on `image-dired-thumbnail-storage'."
+ (declare (advertised-calling-convention () "29.1"))
+ (pcase image-dired-thumbnail-storage
+ ('standard 128)
+ ('standard-large 256)
+ ('standard-x-large 512)
+ ('standard-xx-large 1024)
+ (_ image-dired-thumb-size)))
(defvar image-dired--generate-thumbs-start nil
"Time when `display-thumbs' was called.")
"For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
(image-dired--check-executable-exists
'image-dired-cmd-create-thumbnail-program)
- (let* ((width (int-to-string (image-dired-thumb-size 'width)))
- (height (int-to-string (image-dired-thumb-size 'height)))
+ (let* ((size (number-to-string (image-dired--thumb-size)))
(modif-time (format-time-string
"%s" (file-attribute-modification-time
(file-attributes original-file))))
(thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
thumbnail-file))
- (spec
- (list
- (cons ?w width)
- (cons ?h height)
- (cons ?m modif-time)
- (cons ?f original-file)
- (cons ?q thumbnail-nq8-file)
- (cons ?t thumbnail-file)))
+ (spec `((?s ,size) (?w ,size) (?h ,size)
+ (?m ,modif-time)
+ (?f ,original-file)
+ (?q ,thumbnail-nq8-file)
+ (?t ,thumbnail-file)))
(thumbnail-dir (file-name-directory thumbnail-file))
process)
(when (not (file-exists-p thumbnail-dir))
(mapcar (lambda (arg) (format-spec arg spec))
image-dired-cmd-write-exif-data-options))))
+(define-obsolete-function-alias 'image-dired-thumb-size #'image-dired--thumb-size "29.1")
+
(provide 'image-dired-external)
;; Local Variables:
original file with `image-dired-temp-rotate-image-file'."
:type 'boolean)
-(defcustom image-dired-thumb-size
- (cond
- ((eq 'standard image-dired-thumbnail-storage) 128)
- ((eq 'standard-large image-dired-thumbnail-storage) 256)
- ((eq 'standard-x-large image-dired-thumbnail-storage) 512)
- ((eq 'standard-xx-large image-dired-thumbnail-storage) 1024)
- (t 100))
- "Size of thumbnails, in pixels.
-This is the default size for both `image-dired-thumb-width'
-and `image-dired-thumb-height'.
-
-The value of this option will be ignored if Image-Dired is
-customized to use the Thumbnail Managing Standard; the standard
-sizes will be used instead. See `image-dired-thumbnail-storage'."
- :type 'integer)
-
-(defcustom image-dired-thumb-width image-dired-thumb-size
- "Width of thumbnails, in pixels."
- :type 'integer)
-
-(defcustom image-dired-thumb-height image-dired-thumb-size
- "Height of thumbnails, in pixels."
+(defcustom image-dired--thumb-size
+ ;; This is ignored when using the Thumbnail Managing Standard, but
+ ;; this provides a better default (e.g., when 'image-dired-thumbnail-storage'
+ ;; is `image-dired' in a directory local variables).
+ (pcase image-dired-thumbnail-storage
+ ('standard 128)
+ ('standard-large 256)
+ ('standard-x-large 512)
+ ('standard-xx-large 1024)
+ (_ 100))
+ "Default size of thumbnails in pixels.
+The value of this option is ignored if Image-Dired is customized
+to use the Thumbnail Managing Standard; the standard sizes will
+be used instead. See `image-dired-thumbnail-storage'."
:type 'integer)
(defcustom image-dired-thumb-relief 2
(thumb-width-chars
(ceiling (/ (+ (* 2 image-dired-thumb-relief)
(* 2 image-dired-thumb-margin)
- (image-dired-thumb-size 'width))
+ (image-dired--thumb-size))
(float (frame-char-width))))))
(while (not (eobp))
(forward-char)
(/ width
(+ (* 2 image-dired-thumb-relief)
(* 2 image-dired-thumb-margin)
- (image-dired-thumb-size 'width)
+ (image-dired--thumb-size)
char-width))))
(image-dired-line-up)))
(define-obsolete-function-alias 'image-dired-setup-dired-keybindings
#'image-dired-minor-mode "26.1")
+(make-obsolete-variable 'image-dired-thumb-width
+ 'image-dired-thumb-size "29.1")
+(defcustom image-dired-thumb-width image-dired-thumb-size
+ "Width of thumbnails, in pixels."
+ :type 'integer)
+
+(make-obsolete-variable 'image-dired-thumb-height
+ 'image-dired-thumb-size "29.1")
+(defcustom image-dired-thumb-height image-dired-thumb-size
+ "Height of thumbnails, in pixels."
+ :type 'integer)
+
(defcustom image-dired-temp-image-file
(expand-file-name ".image-dired_temp" image-dired-dir)
"Name of temporary image file used by various commands."