;; TODO
;; ====
;;
-;; * Support gallery creation when using per-directory thumbnail
-;; storage.
-;;
;; * Some sort of auto-rotate function based on rotate info in the
;; EXIF data.
;;
;; respectively. Update: This is partly done; some bindings have
;; now been added to Dired.
;;
-;; * Enhanced gallery creation with basic CSS-support and pagination
-;; of tag pages with many pictures.
-;;
;; * In some way keep track of buffers and windows and stuff so that
;; it works as the user expects.
;;
"Database file where file names and their associated tags are stored."
:type 'file)
-(defcustom image-dired-gallery-dir
- (expand-file-name ".image-dired_gallery" image-dired-dir)
- "Directory to store generated gallery html pages.
-This path needs to be \"shared\" to the public so that it can access
-the index.html page that image-dired creates."
- :type 'directory)
-(defcustom image-dired-gallery-image-root-url
- "https://example.org/image-diredpics"
- "URL where the full size images are to be found on your web server.
-Note that this path has to be configured on your web server.
-Image-Dired expects to find pictures in this directory.
-This is used by `image-dired-gallery-generate'."
- :type 'string
- :version "29.1")
-
-(defcustom image-dired-gallery-thumb-image-root-url
- "https://example.org/image-diredthumbs"
- "URL where the thumbnail images are to be found on your web server.
-Note that this path has to be configured on your web server.
-Image-Dired expects to find pictures in this directory.
-This is used by `image-dired-gallery-generate'."
- :type 'string
- :version "29.1")
(defcustom image-dired-cmd-create-thumbnail-program
(if (executable-find "gm") "gm" "convert")
:version "26.1"
:type '(repeat (string :tag "Argument")))
-(defcustom image-dired-gallery-hidden-tags
- (list "private" "hidden" "pending")
- "List of \"hidden\" tags.
-Used by `image-dired-gallery-generate' to leave out \"hidden\" images."
- :type '(repeat string))
-
(defcustom image-dired-thumb-size
(cond
((eq 'standard image-dired-thumbnail-storage) 128)
props
comment)))))
+\f
+;;;; Gallery support
+
+;; TODO:
+;; * Support gallery creation when using per-directory thumbnail
+;; storage.
+;; * Enhanced gallery creation with basic CSS-support and pagination
+;; of tag pages with many pictures.
+
+(defgroup image-dired-gallery nil
+ "Image-Dired support for generating a HTML gallery."
+ :prefix "image-dired-"
+ :group 'image-dired
+ :version "29.1")
+
+(defcustom image-dired-gallery-dir
+ (expand-file-name ".image-dired_gallery" image-dired-dir)
+ "Directory to store generated gallery html pages.
+This path needs to be \"shared\" to the public so that it can access
+the index.html page that image-dired creates."
+ :type 'directory)
+
+(defcustom image-dired-gallery-image-root-url
+ "https://example.org/image-diredpics"
+ "URL where the full size images are to be found on your web server.
+Note that this path has to be configured on your web server.
+Image-Dired expects to find pictures in this directory.
+This is used by `image-dired-gallery-generate'."
+ :type 'string
+ :version "29.1")
+
+(defcustom image-dired-gallery-thumb-image-root-url
+ "https://example.org/image-diredthumbs"
+ "URL where the thumbnail images are to be found on your web server.
+Note that this path has to be configured on your web server.
+Image-Dired expects to find pictures in this directory.
+This is used by `image-dired-gallery-generate'."
+ :type 'string
+ :version "29.1")
+
+(defcustom image-dired-gallery-hidden-tags
+ (list "private" "hidden" "pending")
+ "List of \"hidden\" tags.
+Used by `image-dired-gallery-generate' to leave out \"hidden\" images."
+ :type '(repeat string))
+
(defvar image-dired-tag-file-list nil
"List to store tag-file structure.")
(defvar image-dired-file-comment-list nil
"List to store file comments.")
-(defun image-dired-add-to-tag-file-list (tag file)
- "Add relation between TAG and FILE."
- (let (curr)
- (if image-dired-tag-file-list
- (if (setq curr (assoc tag image-dired-tag-file-list))
- (if (not (member file curr))
- (setcdr curr (cons file (cdr curr))))
- (setcdr image-dired-tag-file-list
- (cons (list tag file) (cdr image-dired-tag-file-list))))
- (setq image-dired-tag-file-list (list (list tag file))))))
-
-(defun image-dired-add-to-tag-file-lists (tag file)
- "Helper function used from `image-dired-create-gallery-lists'.
+(defun image-dired--add-to-tag-file-lists (tag file)
+ "Helper function used from `image-dired--create-gallery-lists'.
Add TAG to FILE in one list and FILE to TAG in the other.
(cons (list tag file) (cdr image-dired-tag-file-list))))
(setq image-dired-tag-file-list (list (list tag file))))))
-(defun image-dired-add-to-file-comment-list (file comment)
- "Helper function used from `image-dired-create-gallery-lists'.
+(defun image-dired--add-to-file-comment-list (file comment)
+ "Helper function used from `image-dired--create-gallery-lists'.
For FILE, add COMMENT to list.
(cdr image-dired-file-comment-list))))
(setq image-dired-file-comment-list (list (cons file comment)))))
-(defun image-dired-create-gallery-lists ()
+(defun image-dired--create-gallery-lists ()
"Create temporary lists used by `image-dired-gallery-generate'."
(image-dired-sane-db-file)
(image-dired--with-db-file
(setq file (car row-tags))
(dolist (x (cdr row-tags))
(if (not (string-match "^comment:\\(.*\\)" x))
- (image-dired-add-to-tag-file-lists x file)
- (image-dired-add-to-file-comment-list file (match-string 1 x)))))))
+ (image-dired--add-to-tag-file-lists x file)
+ (image-dired--add-to-file-comment-list file (match-string 1 x)))))))
;; Sort tag-file list
(setq image-dired-tag-file-list
(sort image-dired-tag-file-list
(lambda (x y)
(string< (car x) (car y))))))
-(defun image-dired-hidden-p (file)
+(defun image-dired--hidden-p (file)
"Return t if image FILE has a \"hidden\" tag."
(cl-loop for tag in (cdr (assoc file image-dired-file-tag-list))
if (member tag image-dired-gallery-hidden-tags) return t))
(if (eq 'per-directory image-dired-thumbnail-storage)
(error "Currently, gallery generation is not supported \
when using per-directory thumbnail file storage"))
- (image-dired-create-gallery-lists)
+ (image-dired--create-gallery-lists)
(let ((tags image-dired-tag-file-list)
(index-file (format "%s/index.html" image-dired-gallery-dir))
count tag tag-file
(insert " </body>\n")
(insert "</html>"))))
+\f
+;;;; Tag support
+
(defvar image-dired-widget-list nil
"List to keep track of meta data in edit buffer.")
(image-dired-display-image file))
(error "No original file name at point"))))
+(defun image-dired-add-to-tag-file-list (tag file)
+ "Add relation between TAG and FILE."
+ (declare (obsolete nil "29.1"))
+ (let (curr)
+ (if image-dired-tag-file-list
+ (if (setq curr (assoc tag image-dired-tag-file-list))
+ (if (not (member file curr))
+ (setcdr curr (cons file (cdr curr))))
+ (setcdr image-dired-tag-file-list
+ (cons (list tag file) (cdr image-dired-tag-file-list))))
+ (setq image-dired-tag-file-list (list (list tag file))))))
+
(define-obsolete-function-alias 'image-dired-create-display-image-buffer
#'ignore "29.1")
+(define-obsolete-function-alias 'image-dired-create-gallery-lists
+ #'image-dired--create-gallery-lists "29.1")
+(define-obsolete-function-alias 'image-dired-add-to-file-comment-list
+ #'image-dired--add-to-file-comment-list "29.1")
+(define-obsolete-function-alias 'image-dired-add-to-tag-file-lists
+ #'image-dired--add-to-tag-file-lists "29.1")
+(define-obsolete-function-alias 'image-dired-hidden-p
+ #'image-dired--hidden-p "29.1")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; TEST-SECTION ;;;;;;;;;;;