2016-12-16 00:58:33 +00:00
|
|
|
|
;;; image-dired.el --- use dired to browse and manipulate your images -*- lexical-binding: t -*-
|
2021-10-24 16:36:09 +00:00
|
|
|
|
|
2022-01-01 07:45:51 +00:00
|
|
|
|
;; Copyright (C) 2005-2022 Free Software Foundation, Inc.
|
2021-10-24 16:36:09 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; Version: 0.4.11
|
|
|
|
|
;; Keywords: multimedia
|
|
|
|
|
;; Author: Mathias Dahl <mathias.rem0veth1s.dahl@gmail.com>
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs 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
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
2021-10-24 16:36:09 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; BACKGROUND
|
|
|
|
|
;; ==========
|
|
|
|
|
;;
|
|
|
|
|
;; I needed a program to browse, organize and tag my pictures. I got
|
|
|
|
|
;; tired of the old gallery program I used as it did not allow
|
|
|
|
|
;; multi-file operations easily. Also, it put things out of my
|
|
|
|
|
;; control. Image viewing programs I tested did not allow multi-file
|
|
|
|
|
;; operations or did not do what I wanted it to.
|
|
|
|
|
;;
|
|
|
|
|
;; So, I got the idea to use the wonderful functionality of Emacs and
|
|
|
|
|
;; `dired' to do it. It would allow me to do almost anything I wanted,
|
|
|
|
|
;; which is basically just to browse all my pictures in an easy way,
|
|
|
|
|
;; letting me manipulate and tag them in various ways. `dired' already
|
|
|
|
|
;; provide all the file handling and navigation facilities; I only
|
|
|
|
|
;; needed to add some functions to display the images.
|
|
|
|
|
;;
|
|
|
|
|
;; I briefly tried out thumbs.el, and although it seemed more
|
|
|
|
|
;; powerful than this package, it did not work the way I wanted to. It
|
2021-12-10 01:33:48 +00:00
|
|
|
|
;; was too slow to create thumbnails of all files in a directory (I
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; currently keep all my 2000+ images in the same directory) and
|
|
|
|
|
;; browsing the thumbnail buffer was slow too. image-dired.el will not
|
|
|
|
|
;; create thumbnails until they are needed and the browsing is done
|
2021-10-27 02:53:41 +00:00
|
|
|
|
;; quickly and easily in Dired. I copied a great deal of ideas and
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; code from there though... :)
|
|
|
|
|
;;
|
|
|
|
|
;; `image-dired' stores the thumbnail files in `image-dired-dir'
|
|
|
|
|
;; using the file name format ORIGNAME.thumb.ORIGEXT. For example
|
|
|
|
|
;; ~/.emacs.d/image-dired/myimage01.thumb.jpg. The "database" is for
|
|
|
|
|
;; now just a plain text file with the following format:
|
|
|
|
|
;;
|
|
|
|
|
;; file-name-non-directory;comment:comment-text;tag1;tag2;tag3;...;tagN
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; PREREQUISITES
|
|
|
|
|
;; =============
|
|
|
|
|
;;
|
2021-10-25 01:50:04 +00:00
|
|
|
|
;; * The GraphicsMagick or ImageMagick package; Image-Dired uses
|
|
|
|
|
;; whichever is available.
|
|
|
|
|
;;
|
|
|
|
|
;; A) For GraphicsMagick, `gm' is used.
|
|
|
|
|
;; Find it here: http://www.graphicsmagick.org/
|
|
|
|
|
;;
|
|
|
|
|
;; B) For ImageMagick, `convert' and `mogrify' are used.
|
|
|
|
|
;; Find it here: https://www.imagemagick.org.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * For non-lossy rotation of JPEG images, the JpegTRAN program is
|
2021-10-25 01:50:04 +00:00
|
|
|
|
;; needed.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
2021-10-23 04:49:09 +00:00
|
|
|
|
;; * For `image-dired-set-exif-data' to work, the command line tool `exiftool' is
|
2021-10-25 01:50:04 +00:00
|
|
|
|
;; needed. It can be found here: https://exiftool.org/. This
|
|
|
|
|
;; function is, among other things, used for writing comments to
|
|
|
|
|
;; image files using `image-dired-thumbnail-set-image-description'.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; USAGE
|
|
|
|
|
;; =====
|
|
|
|
|
;;
|
|
|
|
|
;; This information has been moved to the manual. Type `C-h r' to open
|
|
|
|
|
;; the Emacs manual and go to the node Thumbnails by typing `g
|
2016-12-13 16:47:21 +00:00
|
|
|
|
;; Image-Dired RET'.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Quickstart: M-x image-dired RET DIRNAME RET
|
|
|
|
|
;;
|
|
|
|
|
;; where DIRNAME is a directory containing image files.
|
|
|
|
|
;;
|
|
|
|
|
;; LIMITATIONS
|
|
|
|
|
;; ===========
|
|
|
|
|
;;
|
|
|
|
|
;; * Supports all image formats that Emacs and convert supports, but
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; the thumbnails are hard-coded to JPEG or PNG format. It uses
|
|
|
|
|
;; JPEG by default, but can optionally follow the Thumbnail Managing
|
2021-10-25 00:12:48 +00:00
|
|
|
|
;; Standard (v0.9.0, Dec 2020), which mandates PNG. See the user
|
|
|
|
|
;; option `image-dired-thumbnail-storage'.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * WARNING: The "database" format used might be changed so keep a
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; backup of `image-dired-db-file' when testing new versions.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; TODO
|
|
|
|
|
;; ====
|
|
|
|
|
;;
|
|
|
|
|
;; * Investigate if it is possible to also write the tags to the image
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; files.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * From thumbs.el: Add an option for clean-up/max-size functionality
|
|
|
|
|
;; for thumbnail directory.
|
|
|
|
|
;;
|
|
|
|
|
;; * From thumbs.el: Add setroot function.
|
|
|
|
|
;;
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; * Add `image-dired-display-thumbs-ring' and functions to cycle that. Find out
|
|
|
|
|
;; which is best, saving old batch just before inserting new, or
|
|
|
|
|
;; saving the current batch in the ring when inserting it. Adding
|
|
|
|
|
;; it probably needs rewriting `image-dired-display-thumbs' to be more general.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * Find some way of toggling on and off really nice keybindings in
|
2021-10-27 20:10:04 +00:00
|
|
|
|
;; Dired (for example, using C-n or <down> instead of C-S-n).
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; Richard suggested that we could keep C-t as prefix for
|
2021-10-27 20:10:04 +00:00
|
|
|
|
;; image-dired commands as it is currently not used in Dired. He
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; also suggested that `dired-next-line' and `dired-previous-line'
|
|
|
|
|
;; figure out if image-dired is enabled in the current buffer and,
|
|
|
|
|
;; if it is, call `image-dired-dired-next-line' and `image-dired-dired-previous-line',
|
|
|
|
|
;; respectively. Update: This is partly done; some bindings have
|
2021-10-27 20:10:04 +00:00
|
|
|
|
;; now been added to Dired.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
|
|
|
|
;; * In some way keep track of buffers and windows and stuff so that
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; it works as the user expects.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;
|
2021-10-24 16:36:09 +00:00
|
|
|
|
;; * More/better documentation.
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'dired)
|
2021-10-23 04:49:09 +00:00
|
|
|
|
(require 'exif)
|
2016-12-15 18:49:38 +00:00
|
|
|
|
(require 'image-mode)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(require 'widget)
|
2021-10-25 04:44:30 +00:00
|
|
|
|
(require 'xdg)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(eval-when-compile
|
2016-12-03 18:05:39 +00:00
|
|
|
|
(require 'cl-lib)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(require 'wid-edit))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Customizable variables
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defgroup image-dired nil
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Use Dired to browse your images as thumbnails, and more."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
:prefix "image-dired-"
|
2016-12-15 18:25:08 +00:00
|
|
|
|
:link '(info-link "(emacs) Image-Dired")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
:group 'multimedia)
|
|
|
|
|
|
2008-10-24 09:39:27 +00:00
|
|
|
|
(defcustom image-dired-dir (locate-user-emacs-file "image-dired/")
|
2021-10-25 00:12:34 +00:00
|
|
|
|
"Directory where thumbnail images are stored.
|
|
|
|
|
|
2021-10-27 20:10:04 +00:00
|
|
|
|
The value of this option will be ignored if Image-Dired is
|
2021-10-25 00:12:34 +00:00
|
|
|
|
customized to use the Thumbnail Managing Standard; they will be
|
|
|
|
|
saved in \"$XDG_CACHE_HOME/thumbnails/\" instead. See
|
|
|
|
|
`image-dired-thumbnail-storage'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'directory)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumbnail-storage 'use-image-dired-dir
|
2021-10-24 16:36:09 +00:00
|
|
|
|
"How `image-dired' stores thumbnail files.
|
2021-10-27 20:10:04 +00:00
|
|
|
|
There are two ways that Image-Dired can store and generate
|
2021-10-24 16:36:09 +00:00
|
|
|
|
thumbnails. If you set this variable to one of the two following
|
|
|
|
|
values, they will be stored in the JPEG format:
|
|
|
|
|
|
|
|
|
|
- `use-image-dired-dir' means that the thumbnails are stored in a
|
|
|
|
|
central directory.
|
|
|
|
|
|
|
|
|
|
- `per-directory' means that each thumbnail is stored in a
|
|
|
|
|
subdirectory called \".image-dired\" in the same directory
|
|
|
|
|
where the image file is.
|
|
|
|
|
|
|
|
|
|
It can also use the \"Thumbnail Managing Standard\", which allows
|
2021-10-25 00:12:48 +00:00
|
|
|
|
sharing of thumbnails across different programs. Thumbnails will
|
|
|
|
|
be stored in \"$XDG_CACHE_HOME/thumbnails/\" instead of in
|
|
|
|
|
`image-dired-dir'. Thumbnails are saved in the PNG format, and
|
|
|
|
|
can be one of the following sizes:
|
2021-10-24 16:36:09 +00:00
|
|
|
|
|
|
|
|
|
- `standard' means use thumbnails sized 128x128.
|
|
|
|
|
- `standard-large' means use thumbnails sized 256x256.
|
2021-10-25 00:12:48 +00:00
|
|
|
|
- `standard-x-large' means use thumbnails sized 512x512.
|
|
|
|
|
- `standard-xx-large' means use thumbnails sized 1024x1024.
|
2021-10-24 16:36:09 +00:00
|
|
|
|
|
2021-10-25 00:12:48 +00:00
|
|
|
|
For more information on the Thumbnail Managing Standard, see:
|
2021-10-24 16:36:09 +00:00
|
|
|
|
https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
:type '(choice :tag "How to store thumbnail files"
|
|
|
|
|
(const :tag "Use image-dired-dir" use-image-dired-dir)
|
2021-10-25 00:12:48 +00:00
|
|
|
|
(const :tag "Thumbnail Managing Standard (normal 128x128)"
|
|
|
|
|
standard)
|
|
|
|
|
(const :tag "Thumbnail Managing Standard (large 256x256)"
|
|
|
|
|
standard-large)
|
|
|
|
|
(const :tag "Thumbnail Managing Standard (larger 512x512)"
|
|
|
|
|
standard-x-large)
|
|
|
|
|
(const :tag "Thumbnail Managing Standard (extra large 1024x1024)"
|
|
|
|
|
standard-xx-large)
|
|
|
|
|
(const :tag "Per-directory" per-directory))
|
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
|
|
(defconst image-dired--thumbnail-standard-sizes
|
|
|
|
|
'( standard standard-large
|
|
|
|
|
standard-x-large standard-xx-large)
|
|
|
|
|
"List of symbols representing thumbnail sizes in Thumbnail Managing Standard.")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2007-06-13 00:05:24 +00:00
|
|
|
|
(defcustom image-dired-db-file
|
2010-12-06 19:45:31 +00:00
|
|
|
|
(expand-file-name ".image-dired_db" image-dired-dir)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Database file where file names and their associated tags are stored."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-create-thumbnail-program
|
2021-10-25 01:50:04 +00:00
|
|
|
|
(if (executable-find "gm") "gm" "convert")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Executable used to create thumbnail.
|
|
|
|
|
Used together with `image-dired-cmd-create-thumbnail-options'."
|
2021-10-25 01:50:04 +00:00
|
|
|
|
:type 'file
|
|
|
|
|
:version "29.1")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-create-thumbnail-options
|
2021-10-25 01:50:04 +00:00
|
|
|
|
(let ((opts '("-size" "%wx%h" "%f[0]"
|
|
|
|
|
"-resize" "%wx%h>"
|
|
|
|
|
"-strip" "jpeg:%t")))
|
|
|
|
|
(if (executable-find "gm") (cons "convert" opts) opts))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
"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
|
2007-04-22 13:44:05 +00:00
|
|
|
|
`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."
|
2021-10-25 01:50:04 +00:00
|
|
|
|
:version "29.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2016-12-14 21:34:12 +00:00
|
|
|
|
(defcustom image-dired-cmd-pngnq-program
|
2021-10-24 16:28:20 +00:00
|
|
|
|
;; Prefer pngquant to pngnq-s9 as it is faster on my machine.
|
|
|
|
|
;; The project also seems more active than the alternatives.
|
|
|
|
|
;; Prefer pngnq-s9 to pngnq as it fixes bugs in pngnq.
|
|
|
|
|
;; The pngnq project seems dead (?) since 2011 or so.
|
|
|
|
|
(or (executable-find "pngquant")
|
|
|
|
|
(executable-find "pngnq-s9")
|
|
|
|
|
(executable-find "pngnq"))
|
|
|
|
|
"The file name of the `pngquant' or `pngnq' program.
|
2016-12-14 21:34:12 +00:00
|
|
|
|
It quantizes colors of PNG images down to 256 colors or fewer
|
2016-12-22 18:13:46 +00:00
|
|
|
|
using the NeuQuant algorithm."
|
2021-10-24 16:28:20 +00:00
|
|
|
|
:version "29.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(choice (const :tag "Not Set" nil) file))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-pngnq-options
|
2021-10-24 16:28:20 +00:00
|
|
|
|
(if (executable-find "pngquant")
|
|
|
|
|
'("--ext" "-nq8.png" "%t") ; same extension as "pngnq"
|
|
|
|
|
'("-f" "%t"))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
"Arguments to pass `image-dired-cmd-pngnq-program'.
|
|
|
|
|
Available format specifiers are the same as in
|
|
|
|
|
`image-dired-cmd-create-thumbnail-options'."
|
2021-10-27 00:07:35 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument"))
|
|
|
|
|
:version "29.1")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
with the information required by the Thumbnail Managing Standard."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(choice (const :tag "Not Set" nil) file))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(defcustom image-dired-cmd-pngcrush-options
|
|
|
|
|
`("-q"
|
|
|
|
|
"-text" "b" "Description" "Thumbnail of file://%f"
|
|
|
|
|
"-text" "b" "Software" ,(emacs-version)
|
|
|
|
|
;; "-text b \"Thumb::Image::Height\" \"%oh\" "
|
|
|
|
|
;; "-text b \"Thumb::Image::Mimetype\" \"%mime\" "
|
|
|
|
|
;; "-text b \"Thumb::Image::Width\" \"%ow\" "
|
|
|
|
|
"-text" "b" "Thumb::MTime" "%m"
|
|
|
|
|
;; "-text b \"Thumb::Size\" \"%b\" "
|
|
|
|
|
"-text" "b" "Thumb::URI" "file://%f"
|
|
|
|
|
"%q" "%t")
|
|
|
|
|
"Arguments for `image-dired-cmd-pngcrush-program'.
|
|
|
|
|
Available format specifiers are the same as in
|
|
|
|
|
`image-dired-cmd-create-thumbnail-options', with %q for a
|
lisp/*.el: Fix typos and other trivial doc fixes
* lisp/allout-widgets.el (allout-widgets-auto-activation)
(allout-current-decorated-p):
* lisp/auth-source.el (auth-source-protocols):
* lisp/autorevert.el (auto-revert-set-timer):
* lisp/battery.el (battery-mode-line-limit):
* lisp/calc/calcalg3.el (math-map-binop):
* lisp/calendar/cal-dst.el (calendar-dst-find-startend):
* lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute):
* lisp/calendar/calendar.el (calendar-date-echo-text)
(calendar-generate-month, calendar-string-spread)
(calendar-cursor-to-date, calendar-read, calendar-read-date)
(calendar-mark-visible-date, calendar-dayname-on-or-before):
* lisp/calendar/diary-lib.el (diary-ordinal-suffix):
* lisp/cedet/ede/autoconf-edit.el (autoconf-new-program)
(autoconf-find-last-macro, autoconf-parameter-strip):
* lisp/cedet/ede/config.el (ede-target-with-config-build):
* lisp/cedet/ede/linux.el (ede-linux--detect-architecture)
(ede-linux--get-architecture):
* lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache)
(semantic-displayer-abstract, semantic-displayer-point-position):
* lisp/cedet/semantic/format.el (semantic-format-face-alist)
(semantic-format-tag-short-doc):
* lisp/cedet/semantic/fw.el (semantic-find-file-noselect):
* lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time)
(semantic-idle-breadcrumbs-display-function)
(semantic-idle-breadcrumbs-format-tag-list-function):
* lisp/cedet/semantic/lex.el (semantic-lex-map-types)
(define-lex, define-lex-block-type-analyzer):
* lisp/cedet/semantic/senator.el (senator-search-default-tag-filter):
* lisp/cedet/semantic/symref.el (semantic-symref-result)
(semantic-symref-hit-to-tag-via-db):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-new-variable)
(semantic-tag-new-include, semantic-tag-new-package)
(semantic-tag-set-faux, semantic-create-tag-proxy)
(semantic-tag-function-parent)
(semantic-tag-components-with-overlays):
* lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces)
(srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict):
* lisp/cedet/srecode/dictionary.el (srecode-create-dictionary)
(srecode-dictionary-add-entries, srecode-dictionary-lookup-name)
(srecode-create-dictionaries-from-tags):
* lisp/cmuscheme.el (scheme-compile-region):
* lisp/color.el (color-lab-to-lch):
* lisp/doc-view.el (doc-view-image-width)
(doc-view-set-up-single-converter):
* lisp/dynamic-setting.el (font-setting-change-default-font)
(dynamic-setting-handle-config-changed-event):
* lisp/elec-pair.el (electric-pair-text-pairs)
(electric-pair-skip-whitespace-function)
(electric-pair-string-bound-function):
* lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance)
(avl-tree-member, avl-tree-mapcar, avl-tree-iter):
* lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree):
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag)
(checkdoc-spellcheck-documentation-flag, checkdoc-ispell)
(checkdoc-ispell-current-buffer, checkdoc-ispell-interactive)
(checkdoc-ispell-message-interactive)
(checkdoc-ispell-message-text, checkdoc-ispell-start)
(checkdoc-ispell-continue, checkdoc-ispell-comments)
(checkdoc-ispell-defun):
* lisp/emacs-lisp/cl-generic.el (cl--generic-search-method):
* lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group):
* lisp/emacs-lisp/lisp.el (forward-sexp, up-list):
* lisp/emacs-lisp/package-x.el (package--archive-contents-from-file):
* lisp/emacs-lisp/package.el (package-desc)
(package--make-autoloads-and-stuff, package-hidden-regexps):
* lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup):
* lisp/emacs-lisp/testcover.el (testcover-nohits)
(testcover-1value):
* lisp/epg.el (epg-receive-keys, epg-start-edit-key):
* lisp/erc/erc-backend.el (erc-server-processing-p)
(erc-split-line-length, erc-server-coding-system)
(erc-server-send, erc-message):
* lisp/erc/erc-button.el (erc-button-face, erc-button-alist)
(erc-browse-emacswiki):
* lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login):
* lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation):
* lisp/erc/erc-log.el (erc-current-logfile):
* lisp/erc/erc-match.el (erc-log-match-format)
(erc-text-matched-hook):
* lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug):
* lisp/erc/erc-networks.el (erc-server-alist)
(erc-networks-alist, erc-current-network):
* lisp/erc/erc-ring.el (erc-input-ring-index):
* lisp/erc/erc-speedbar.el (erc-speedbar)
(erc-speedbar-update-channel):
* lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag):
* lisp/erc/erc-track.el (erc-track-position-in-mode-line)
(erc-track-remove-from-mode-line, erc-modified-channels-update)
(erc-track-last-non-erc-buffer, erc-track-sort-by-importance)
(erc-track-get-active-buffer):
* lisp/erc/erc.el (erc-get-channel-user-list)
(erc-echo-notice-hook, erc-echo-notice-always-hook)
(erc-wash-quit-reason, erc-format-@nick):
* lisp/ffap.el (ffap-latex-mode):
* lisp/files.el (abort-if-file-too-large)
(dir-locals--get-sort-score, buffer-stale--default-function):
* lisp/filesets.el (filesets-tree-max-level, filesets-data)
(filesets-update-pre010505):
* lisp/gnus/gnus-agent.el (gnus-agent-flush-cache):
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-prefer-mid-or-mail):
* lisp/gnus/gnus-cus.el (gnus-group-parameters):
* lisp/gnus/gnus-demon.el (gnus-demon-handlers)
(gnus-demon-run-callback):
* lisp/gnus/gnus-dired.el (gnus-dired-print):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer):
* lisp/gnus/gnus-range.el (gnus-range-normalize):
* lisp/gnus/gnus-spec.el (gnus-pad-form):
* lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud)
(gnus-server-opened, gnus-server-closed, gnus-server-denied)
(gnus-server-offline):
* lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir)
(gnus-refer-thread-limit-to-thread)
(gnus-summary-limit-include-thread, gnus-summary-refer-thread)
(gnus-summary-find-matching):
* lisp/gnus/gnus-util.el (gnus-rescale-image):
* lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server):
* lisp/gnus/mail-source.el (mail-source-incoming-file-prefix):
* lisp/gnus/message.el (message-cite-reply-position)
(message-cite-style-outlook, message-cite-style-thunderbird)
(message-cite-style-gmail, message--send-mail-maybe-partially):
* lisp/gnus/mm-extern.el (mm-inline-external-body):
* lisp/gnus/mm-partial.el (mm-inline-partial):
* lisp/gnus/mml-sec.el (mml-secure-message-sign)
(mml-secure-message-sign-encrypt, mml-secure-message-encrypt):
* lisp/gnus/mml2015.el (mml2015-epg-key-image)
(mml2015-epg-key-image-to-string):
* lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail):
* lisp/gnus/nnheader.el (nnheader-directory-files-is-safe):
* lisp/gnus/nnir.el (nnir-search-history)
(nnir-imap-search-other, nnir-artlist-length)
(nnir-artlist-article, nnir-artitem-group, nnir-artitem-number)
(nnir-artitem-rsv, nnir-article-group, nnir-article-number)
(nnir-article-rsv, nnir-article-ids, nnir-categorize)
(nnir-retrieve-headers-override-function)
(nnir-imap-default-search-key, nnir-hyrex-additional-switches)
(gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms)
(nnir-read-parm, nnir-read-server-parm, nnir-search-thread):
* lisp/gnus/nnmairix.el (nnmairix-default-group)
(nnmairix-propagate-marks):
* lisp/gnus/smime.el (smime-keys, smime-crl-check)
(smime-verify-buffer, smime-noverify-buffer):
* lisp/gnus/spam-report.el (spam-report-url-ping-mm-url):
* lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header)
(spam-spamassassin-spam-status-header, spam-sa-learn-rebuild)
(spam-classifications, spam-check-stat, spam-spamassassin-score):
* lisp/help.el (describe-minor-mode-from-symbol):
* lisp/hippie-exp.el (hippie-expand-ignore-buffers):
* lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face)
(hfy-begin-span):
* lisp/ibuf-ext.el (ibuffer-update-saved-filters-format)
(ibuffer-saved-filters, ibuffer-old-saved-filters-warning)
(ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters)
(eval, ibuffer-unary-operand, file-extension, directory):
* lisp/image-dired.el (image-dired-cmd-pngcrush-options):
* lisp/image-mode.el (image-toggle-display):
* lisp/international/ccl.el (ccl-compile-read-multibyte-character)
(ccl-compile-write-multibyte-character):
* lisp/international/kkc.el (kkc-save-init-file):
* lisp/international/latin1-disp.el (latin1-display):
* lisp/international/ogonek.el (ogonek-name-encoding-alist)
(ogonek-information, ogonek-lookup-encoding)
(ogonek-deprefixify-region):
* lisp/isearch.el (isearch-filter-predicate)
(isearch--momentary-message):
* lisp/jsonrpc.el (jsonrpc-connection-send)
(jsonrpc-process-connection, jsonrpc-shutdown)
(jsonrpc--async-request-1):
* lisp/language/tibet-util.el (tibetan-char-p):
* lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date)
(feedmail-last-chance-hook, feedmail-before-fcc-hook)
(feedmail-send-it-immediately-wrapper, feedmail-find-eoh):
* lisp/mail/hashcash.el (hashcash-generate-payment)
(hashcash-generate-payment-async, hashcash-insert-payment)
(hashcash-verify-payment):
* lisp/mail/rmail.el (rmail-movemail-variant-in-use)
(rmail-get-attr-value):
* lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime):
* lisp/mail/rmailsum.el (rmail-summary-show-message):
* lisp/mail/supercite.el (sc-raw-mode-toggle):
* lisp/man.el (Man-start-calling):
* lisp/mh-e/mh-acros.el (mh-do-at-event-location)
(mh-iterate-on-messages-in-region, mh-iterate-on-range):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases)
(mh-alias-reload, mh-alias-ali)
(mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file)
(mh-alias-add-alias):
* lisp/mouse.el (mouse-save-then-kill):
* lisp/net/browse-url.el (browse-url-default-macosx-browser):
* lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value)
(eudc-variable-server-value, eudc-update-variable)
(eudc-expand-inline):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result):
* lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list):
* lisp/net/pop3.el (pop3-list):
* lisp/net/soap-client.el (soap-namespace-put)
(soap-xs-parse-sequence, soap-parse-envelope):
* lisp/net/soap-inspect.el (soap-inspect-xs-complex-type):
* lisp/nxml/rng-xsd.el (rng-xsd-date-to-days):
* lisp/org/ob-C.el (org-babel-prep-session:C)
(org-babel-load-session:C):
* lisp/org/ob-J.el (org-babel-execute:J):
* lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote):
* lisp/org/ob-awk.el (org-babel-execute:awk):
* lisp/org/ob-core.el (org-babel-process-file-name):
* lisp/org/ob-ebnf.el (org-babel-execute:ebnf):
* lisp/org/ob-forth.el (org-babel-execute:forth):
* lisp/org/ob-fortran.el (org-babel-execute:fortran)
(org-babel-prep-session:fortran, org-babel-load-session:fortran):
* lisp/org/ob-groovy.el (org-babel-execute:groovy):
* lisp/org/ob-io.el (org-babel-execute:io):
* lisp/org/ob-js.el (org-babel-execute:js):
* lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond)
(org-babel-lilypond-compile-post-tangle)
(org-babel-lilypond-display-pdf-post-tangle)
(org-babel-lilypond-tangle)
(org-babel-lilypond-execute-tangled-ly)
(org-babel-lilypond-compile-lilyfile)
(org-babel-lilypond-check-for-compile-error)
(org-babel-lilypond-process-compile-error)
(org-babel-lilypond-mark-error-line)
(org-babel-lilypond-parse-error-line)
(org-babel-lilypond-attempt-to-open-pdf)
(org-babel-lilypond-attempt-to-play-midi)
(org-babel-lilypond-switch-extension)
(org-babel-lilypond-set-header-args):
* lisp/org/ob-lua.el (org-babel-prep-session:lua):
* lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
* lisp/org/ob-processing.el (org-babel-prep-session:processing):
* lisp/org/ob-python.el (org-babel-prep-session:python):
* lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message)
(org-babel-scheme-execute-with-geiser, org-babel-execute:scheme):
* lisp/org/ob-shen.el (org-babel-execute:shen):
* lisp/org/org-agenda.el (org-agenda-entry-types)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-time-grid, org-agenda-sorting-strategy)
(org-agenda-filter-by-category, org-agenda-forward-block):
* lisp/org/org-colview.el (org-columns--overlay-text):
* lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces):
* lisp/org/org-indent.el (org-indent-set-line-properties):
* lisp/org/org-macs.el (org-get-limited-outline-regexp):
* lisp/org/org-mobile.el (org-mobile-files):
* lisp/org/org.el (org-use-fast-todo-selection)
(org-extend-today-until, org-use-property-inheritance)
(org-refresh-effort-properties, org-open-at-point-global)
(org-track-ordered-property-with-tag, org-shiftright):
* lisp/org/ox-html.el (org-html-checkbox-type):
* lisp/org/ox-man.el (org-man-source-highlight)
(org-man-verse-block):
* lisp/org/ox-publish.el (org-publish-sitemap-default):
* lisp/outline.el (outline-head-from-level):
* lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1)
(dcl-calc-command-indent, dcl-indent-to):
* lisp/progmodes/flymake.el (flymake-make-diagnostic)
(flymake--overlays, flymake-diagnostic-functions)
(flymake-diagnostic-types-alist, flymake--backend-state)
(flymake-is-running, flymake--collect, flymake-mode):
* lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop)
(gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer):
* lisp/progmodes/grep.el (grep-error-screen-columns):
* lisp/progmodes/gud.el (gud-prev-expr):
* lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column)
(ps-run-goto-error):
* lisp/progmodes/python.el (python-eldoc-get-doc)
(python-eldoc-function-timeout-permanent, python-eldoc-function):
* lisp/shadowfile.el (shadow-make-group):
* lisp/speedbar.el (speedbar-obj-do-check):
* lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook):
* lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib):
* lisp/textmodes/reftex-index.el (reftex-index-goto-entry)
(reftex-index-kill, reftex-index-undo):
* lisp/textmodes/reftex-parse.el (reftex-context-substring):
* lisp/textmodes/reftex.el (reftex-TeX-master-file):
* lisp/textmodes/rst.el (rst-next-hdr, rst-toc)
(rst-uncomment-region, rst-font-lock-extend-region-internal):
* lisp/thumbs.el (thumbs-mode):
* lisp/vc/ediff-util.el (ediff-restore-diff):
* lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag):
* lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p):
* lisp/wid-edit.el (widget-field-value-set, string):
* lisp/x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-20 22:27:53 +00:00
|
|
|
|
temporary file name (typically generated by pnqnq)."
|
2016-12-04 18:43:03 +00:00
|
|
|
|
:version "26.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-optipng-program (executable-find "optipng")
|
|
|
|
|
"The file name of the `optipng' program."
|
2017-12-13 07:21:24 +00:00
|
|
|
|
:version "26.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(choice (const :tag "Not Set" nil) file))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-optipng-options '("-o5" "%t")
|
2020-09-23 11:35:55 +00:00
|
|
|
|
"Arguments passed to `image-dired-cmd-optipng-program'.
|
2016-12-20 00:47:06 +00:00
|
|
|
|
Available format specifiers are described in
|
|
|
|
|
`image-dired-cmd-create-thumbnail-options'."
|
2017-12-13 07:21:24 +00:00
|
|
|
|
:version "26.1"
|
2016-12-20 00:47:06 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument"))
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:link '(url-link "man:optipng(1)"))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-create-standard-thumbnail-options
|
2017-02-02 01:51:00 +00:00
|
|
|
|
(append '("-size" "%wx%h" "%f[0]")
|
2016-12-20 16:14:53 +00:00
|
|
|
|
(unless (or image-dired-cmd-pngcrush-program
|
|
|
|
|
image-dired-cmd-pngnq-program)
|
|
|
|
|
(list
|
|
|
|
|
"-set" "Thumb::MTime" "%m"
|
|
|
|
|
"-set" "Thumb::URI" "file://%f"
|
|
|
|
|
"-set" "Description" "Thumbnail of file://%f"
|
|
|
|
|
"-set" "Software" (emacs-version)))
|
|
|
|
|
'("-thumbnail" "%wx%h>" "png:%t"))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
"Options for creating thumbnails according to the Thumbnail Managing Standard.
|
|
|
|
|
Available format specifiers are the same as in
|
|
|
|
|
`image-dired-cmd-create-thumbnail-options', with %m for file modification time."
|
|
|
|
|
:version "26.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-rotate-original-program
|
2016-09-12 19:28:42 +00:00
|
|
|
|
"jpegtran"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Executable used to rotate original image.
|
|
|
|
|
Used together with `image-dired-cmd-rotate-original-options'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-rotate-original-options
|
2016-12-20 00:47:06 +00:00
|
|
|
|
'("-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
|
2007-04-22 13:44:05 +00:00
|
|
|
|
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'."
|
2016-12-20 00:47:06 +00:00
|
|
|
|
:version "26.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-temp-rotate-image-file
|
2010-12-06 19:45:31 +00:00
|
|
|
|
(expand-file-name ".image-dired_rotate_temp" image-dired-dir)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Temporary file for rotate operations."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-rotate-original-ask-before-overwrite t
|
|
|
|
|
"Confirm overwrite of original file after rotate operation.
|
|
|
|
|
If non-nil, ask user for confirmation before overwriting the
|
|
|
|
|
original file with `image-dired-temp-rotate-image-file'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'boolean)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-write-exif-data-program
|
2016-09-12 19:28:42 +00:00
|
|
|
|
"exiftool"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Program used to write EXIF data to image.
|
|
|
|
|
Used together with `image-dired-cmd-write-exif-data-options'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-write-exif-data-options
|
2016-12-20 00:47:06 +00:00
|
|
|
|
'("-%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
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
the image file name, %t which is replaced by the tag name and %v
|
2007-04-22 13:44:05 +00:00
|
|
|
|
which is replaced by the tag value."
|
2016-12-20 00:47:06 +00:00
|
|
|
|
:version "26.1"
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2016-12-15 18:25:08 +00:00
|
|
|
|
(defcustom image-dired-thumb-size
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq 'standard image-dired-thumbnail-storage) 128)
|
|
|
|
|
((eq 'standard-large image-dired-thumbnail-storage) 256)
|
2021-10-25 00:12:48 +00:00
|
|
|
|
((eq 'standard-x-large image-dired-thumbnail-storage) 512)
|
|
|
|
|
((eq 'standard-xx-large image-dired-thumbnail-storage) 1024)
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(t 100))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Size of thumbnails, in pixels.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
This is the default size for both `image-dired-thumb-width'
|
2021-10-25 00:12:34 +00:00
|
|
|
|
and `image-dired-thumb-height'.
|
|
|
|
|
|
2021-10-27 20:10:04 +00:00
|
|
|
|
The value of this option will be ignored if Image-Dired is
|
2021-10-25 00:12:34 +00:00
|
|
|
|
customized to use the Thumbnail Managing Standard; the standard
|
|
|
|
|
sizes will be used instead. See `image-dired-thumbnail-storage'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumb-width image-dired-thumb-size
|
|
|
|
|
"Width of thumbnails, in pixels."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumb-height image-dired-thumb-size
|
|
|
|
|
"Height of thumbnails, in pixels."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumb-relief 2
|
|
|
|
|
"Size of button-like border around thumbnails."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumb-margin 2
|
|
|
|
|
"Size of the margin around thumbnails.
|
|
|
|
|
This is where you see the cursor."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(defcustom image-dired-thumb-visible-marks t
|
2021-11-03 21:34:51 +00:00
|
|
|
|
"Make marks and flags visible in thumbnail buffer.
|
2021-08-11 12:03:23 +00:00
|
|
|
|
If non-nil, apply the `image-dired-thumb-mark' face to marked
|
2021-11-03 21:34:51 +00:00
|
|
|
|
images and `image-dired-thumb-flagged' to images flagged for
|
|
|
|
|
deletion."
|
2021-08-11 12:03:23 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "28.1")
|
|
|
|
|
|
|
|
|
|
(defface image-dired-thumb-mark
|
2021-11-03 21:34:51 +00:00
|
|
|
|
'((((class color) (min-colors 16)) :background "DarkOrange")
|
|
|
|
|
(((class color)) :foreground "yellow"))
|
|
|
|
|
"Face for marked images in thumbnail buffer."
|
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
|
|
(defface image-dired-thumb-flagged
|
|
|
|
|
'((((class color) (min-colors 88) (background light)) :background "Red3")
|
|
|
|
|
(((class color) (min-colors 88) (background dark)) :background "Pink")
|
|
|
|
|
(((class color) (min-colors 16) (background light)) :background "Red3")
|
|
|
|
|
(((class color) (min-colors 16) (background dark)) :background "Pink")
|
|
|
|
|
(((class color) (min-colors 8)) :background "red")
|
|
|
|
|
(t :inverse-video t))
|
|
|
|
|
"Face for images flagged for deletion in thumbnail buffer."
|
2021-11-03 06:14:21 +00:00
|
|
|
|
:version "29.1")
|
2021-08-11 12:03:23 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defcustom image-dired-line-up-method 'dynamic
|
|
|
|
|
"Default method for line-up of thumbnails in thumbnail buffer.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
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."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
:type '(choice :tag "Default line-up method"
|
|
|
|
|
(const :tag "Dynamic" dynamic)
|
|
|
|
|
(const :tag "Fixed" fixed)
|
|
|
|
|
(const :tag "Interactive" interactive)
|
2021-08-13 10:28:55 +00:00
|
|
|
|
(const :tag "No line-up" none)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-thumbs-per-row 3
|
|
|
|
|
"Number of thumbnails to display per row in thumb buffer."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'integer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-track-movement t
|
|
|
|
|
"The current state of the tracking and mirroring.
|
|
|
|
|
For more information, see the documentation for
|
|
|
|
|
`image-dired-toggle-movement-tracking'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'boolean)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-append-when-browsing nil
|
|
|
|
|
"Append thumbnails in thumbnail buffer when browsing.
|
|
|
|
|
If non-nil, using `image-dired-next-line-and-display' and
|
|
|
|
|
`image-dired-previous-line-and-display' will leave a trail of thumbnail
|
|
|
|
|
images in the thumbnail buffer. If you enable this and want to clean
|
2011-11-20 07:30:16 +00:00
|
|
|
|
the thumbnail buffer because it is filled with too many thumbnails,
|
2007-04-22 13:44:05 +00:00
|
|
|
|
just call `image-dired-display-thumb' to display only the image at point.
|
|
|
|
|
This value can be toggled using `image-dired-toggle-append-browsing'."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'boolean)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-dired-disp-props t
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"If non-nil, display properties for Dired file when browsing.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
Used by `image-dired-next-line-and-display',
|
|
|
|
|
`image-dired-previous-line-and-display' and `image-dired-mark-and-display-next'.
|
|
|
|
|
If the database file is large, this can slow down image browsing in
|
2021-10-27 02:53:41 +00:00
|
|
|
|
Dired and you might want to turn it off."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'boolean)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-display-properties-format "%b: %f (%t): %c"
|
|
|
|
|
"Display format for thumbnail properties.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
%b is replaced with associated Dired buffer name, %f with file
|
|
|
|
|
name (without path) of original image file, %t with the list of
|
|
|
|
|
tags and %c with the comment."
|
2021-08-13 10:28:55 +00:00
|
|
|
|
:type 'string)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defcustom image-dired-external-viewer
|
|
|
|
|
;; TODO: Use mailcap, dired-guess-shell-alist-default,
|
|
|
|
|
;; dired-view-command-alist.
|
|
|
|
|
(cond ((executable-find "display"))
|
|
|
|
|
((executable-find "xli"))
|
2021-10-24 10:20:35 +00:00
|
|
|
|
((executable-find "qiv") "qiv -t")
|
|
|
|
|
((executable-find "feh") "feh"))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Name of external viewer.
|
|
|
|
|
Including parameters. Used when displaying original image from
|
|
|
|
|
`image-dired-thumbnail-mode'."
|
2021-10-24 10:20:35 +00:00
|
|
|
|
:version "28.1"
|
2019-10-09 13:28:47 +00:00
|
|
|
|
:type '(choice string
|
2021-08-13 10:28:55 +00:00
|
|
|
|
(const :tag "Not Set" nil)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-10-25 04:44:30 +00:00
|
|
|
|
(defcustom image-dired-main-image-directory
|
|
|
|
|
(or (xdg-user-dir "PICTURES") "~/pics/")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Name of main image directory, if any.
|
|
|
|
|
Used by `image-dired-copy-with-exif-file-name'."
|
2021-10-25 04:44:30 +00:00
|
|
|
|
:type 'string
|
|
|
|
|
:version "29.1")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-10-27 18:39:10 +00:00
|
|
|
|
(defcustom image-dired-show-all-from-dir-max-files 500
|
2021-10-25 03:47:56 +00:00
|
|
|
|
"Maximum number of files in directory before prompting.
|
2021-10-27 18:39:10 +00:00
|
|
|
|
|
|
|
|
|
If there are more image files than this in a selected directory,
|
|
|
|
|
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."
|
|
|
|
|
:type '(choice integer
|
|
|
|
|
(const :tag "Disable warning" nil))
|
2021-10-25 03:47:56 +00:00
|
|
|
|
:version "29.1")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(defcustom image-dired-marking-shows-next t
|
|
|
|
|
"If non-nil, marking, unmarking or flagging an image shows the next image.
|
|
|
|
|
|
|
|
|
|
This affects the following commands:
|
|
|
|
|
\\<image-dired-thumbnail-mode-map>
|
|
|
|
|
`image-dired-flag-thumb-original-file' (bound to \\[image-dired-flag-thumb-original-file])
|
|
|
|
|
`image-dired-mark-thumb-original-file' (bound to \\[image-dired-mark-thumb-original-file])
|
|
|
|
|
`image-dired-unmark-thumb-original-file' (bound to \\[image-dired-unmark-thumb-original-file])"
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:version "29.1")
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Util functions
|
|
|
|
|
|
2021-10-26 23:32:58 +00:00
|
|
|
|
(defvar image-dired-debug nil
|
|
|
|
|
"Non-nil means enable debug messages.")
|
|
|
|
|
|
|
|
|
|
(defun image-dired-debug-message (&rest args)
|
|
|
|
|
"Display debug message ARGS when `image-dired-debug' is non-nil."
|
|
|
|
|
(when image-dired-debug
|
|
|
|
|
(apply #'message args)))
|
|
|
|
|
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(defmacro image-dired--with-db-file (&rest body)
|
|
|
|
|
"Run BODY in a temp buffer containing `image-dired-db-file'.
|
|
|
|
|
Return the last form in BODY."
|
2016-12-13 16:47:21 +00:00
|
|
|
|
(declare (indent 0) (debug t))
|
2011-08-08 18:21:32 +00:00
|
|
|
|
`(with-temp-buffer
|
|
|
|
|
(if (file-exists-p image-dired-db-file)
|
|
|
|
|
(insert-file-contents image-dired-db-file))
|
|
|
|
|
,@body))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-dir ()
|
2021-11-20 10:09:23 +00:00
|
|
|
|
"Return the current thumbnail directory (from variable `image-dired-dir').
|
|
|
|
|
Create the thumbnail directory if it does not exist."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((image-dired-dir (file-name-as-directory
|
2021-11-20 10:09:23 +00:00
|
|
|
|
(expand-file-name image-dired-dir))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(unless (file-directory-p image-dired-dir)
|
2021-10-24 19:20:16 +00:00
|
|
|
|
(with-file-modes #o700
|
|
|
|
|
(make-directory image-dired-dir t))
|
2021-11-20 10:09:23 +00:00
|
|
|
|
(message "Thumbnail directory created: %s" image-dired-dir))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
image-dired-dir))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-insert-image (file type relief margin)
|
|
|
|
|
"Insert image FILE of image TYPE, using RELIEF and MARGIN, at point."
|
|
|
|
|
(let ((i `(image :type ,type
|
|
|
|
|
:file ,file
|
|
|
|
|
:relief ,relief
|
|
|
|
|
:margin ,margin)))
|
|
|
|
|
(insert-image i)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-get-thumbnail-image (file)
|
|
|
|
|
"Return the image descriptor for a thumbnail of image file FILE."
|
2021-12-06 01:53:31 +00:00
|
|
|
|
(unless (string-match-p (image-file-name-regexp) file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(error "%s is not a valid image file" file))
|
2017-10-22 08:04:36 +00:00
|
|
|
|
(let* ((thumb-file (image-dired-thumb-name file))
|
|
|
|
|
(thumb-attr (file-attributes thumb-file)))
|
|
|
|
|
(when (or (not thumb-attr)
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
|
(time-less-p (file-attribute-modification-time thumb-attr)
|
|
|
|
|
(file-attribute-modification-time
|
|
|
|
|
(file-attributes file))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-create-thumb file thumb-file))
|
2021-10-24 10:26:39 +00:00
|
|
|
|
(create-image thumb-file)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-insert-thumbnail (file original-file-name
|
2011-04-19 13:44:55 +00:00
|
|
|
|
associated-dired-buffer)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Insert thumbnail image FILE.
|
|
|
|
|
Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
|
|
|
|
|
(let (beg end)
|
|
|
|
|
(setq beg (point))
|
2021-10-24 16:18:43 +00:00
|
|
|
|
(image-dired-insert-image
|
|
|
|
|
file
|
|
|
|
|
;; Thumbnails are created asynchronously, so we might not yet
|
|
|
|
|
;; have a file. But if it exists, it might have been cached from
|
|
|
|
|
;; before and we should use it instead of our current settings.
|
|
|
|
|
(or (and (file-exists-p file)
|
|
|
|
|
(image-type-from-file-header file))
|
|
|
|
|
(and (memq image-dired-thumbnail-storage
|
2021-10-25 00:12:48 +00:00
|
|
|
|
image-dired--thumbnail-standard-sizes)
|
2021-10-24 16:18:43 +00:00
|
|
|
|
'png)
|
|
|
|
|
'jpeg)
|
|
|
|
|
image-dired-thumb-relief
|
|
|
|
|
image-dired-thumb-margin)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(setq end (point))
|
|
|
|
|
(add-text-properties
|
|
|
|
|
beg end
|
|
|
|
|
(list 'image-dired-thumbnail t
|
|
|
|
|
'original-file-name original-file-name
|
|
|
|
|
'associated-dired-buffer associated-dired-buffer
|
|
|
|
|
'tags (image-dired-list-tags original-file-name)
|
|
|
|
|
'mouse-face 'highlight
|
|
|
|
|
'comment (image-dired-get-comment original-file-name)))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-thumb-name (file)
|
2021-10-24 21:25:07 +00:00
|
|
|
|
"Return absolute file name for thumbnail FILE.
|
|
|
|
|
Depending on the value of `image-dired-thumbnail-storage', the
|
|
|
|
|
file name of the thumbnail will vary:
|
|
|
|
|
- For `use-image-dired-dir', make a SHA1-hash of the image file's
|
|
|
|
|
directory name and add that to make the thumbnail file name
|
|
|
|
|
unique.
|
|
|
|
|
- For `per-directory' storage, just add a subdirectory.
|
|
|
|
|
- For `standard' storage, produce the file name according to the
|
|
|
|
|
Thumbnail Managing Standard. Among other things, an MD5-hash
|
|
|
|
|
of the image file's directory name will be added to the
|
|
|
|
|
filename.
|
|
|
|
|
See also `image-dired-thumbnail-storage'."
|
2021-10-25 00:12:48 +00:00
|
|
|
|
(cond ((memq image-dired-thumbnail-storage
|
|
|
|
|
image-dired--thumbnail-standard-sizes)
|
2021-10-25 04:44:30 +00:00
|
|
|
|
(let ((thumbdir (cl-case image-dired-thumbnail-storage
|
|
|
|
|
(standard "thumbnails/normal")
|
|
|
|
|
(standard-large "thumbnails/large")
|
|
|
|
|
(standard-x-large "thumbnails/x-large")
|
|
|
|
|
(standard-xx-large "thumbnails/xx-large"))))
|
2016-12-14 19:34:21 +00:00
|
|
|
|
(expand-file-name
|
2021-10-24 21:25:07 +00:00
|
|
|
|
;; MD5 is mandated by the Thumbnail Managing Standard.
|
2016-12-14 19:34:21 +00:00
|
|
|
|
(concat (md5 (concat "file://" (expand-file-name file))) ".png")
|
2021-10-25 04:44:30 +00:00
|
|
|
|
(expand-file-name thumbdir (xdg-cache-home)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
((eq 'use-image-dired-dir image-dired-thumbnail-storage)
|
|
|
|
|
(let* ((f (expand-file-name file))
|
2021-10-24 21:25:07 +00:00
|
|
|
|
(hash
|
2022-01-14 15:17:33 +00:00
|
|
|
|
(md5 (file-name-as-directory (file-name-directory f)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(format "%s%s%s.thumb.%s"
|
|
|
|
|
(file-name-as-directory (expand-file-name (image-dired-dir)))
|
* lisp/files.el (file-name-base): New convenience function.
* lisp/autoinsert.el, lisp/cus-dep.el, lisp/doc-view.el, lisp/image-dired.el,
* lisp/woman.el, lisp/eshell/esh-cmd.el, lisp/progmodes/ada-xref.el,
* lisp/progmodes/cc-defs.el, lisp/progmodes/cperl-mode.el,
* lisp/progmodes/flymake.el, lisp/progmodes/gud.el, lisp/progmodes/idlwave.el,
* lisp/textmodes/ispell.el, lisp/textmodes/reftex-ref.el,
* lisp/textmodes/tex-mode.el: Use it.
Did not touch cedet and org because they are maintained elsewhere.
2012-06-26 16:23:01 +00:00
|
|
|
|
(file-name-base f)
|
2021-10-24 21:25:07 +00:00
|
|
|
|
(if hash (concat "_" hash) "")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(file-name-extension f))))
|
|
|
|
|
((eq 'per-directory image-dired-thumbnail-storage)
|
|
|
|
|
(let ((f (expand-file-name file)))
|
|
|
|
|
(format "%s.image-dired/%s.thumb.%s"
|
|
|
|
|
(file-name-directory f)
|
* lisp/files.el (file-name-base): New convenience function.
* lisp/autoinsert.el, lisp/cus-dep.el, lisp/doc-view.el, lisp/image-dired.el,
* lisp/woman.el, lisp/eshell/esh-cmd.el, lisp/progmodes/ada-xref.el,
* lisp/progmodes/cc-defs.el, lisp/progmodes/cperl-mode.el,
* lisp/progmodes/flymake.el, lisp/progmodes/gud.el, lisp/progmodes/idlwave.el,
* lisp/textmodes/ispell.el, lisp/textmodes/reftex-ref.el,
* lisp/textmodes/tex-mode.el: Use it.
Did not touch cedet and org because they are maintained elsewhere.
2012-06-26 16:23:01 +00:00
|
|
|
|
(file-name-base f)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(file-name-extension f))))))
|
|
|
|
|
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(defun image-dired--check-executable-exists (executable)
|
|
|
|
|
(unless (executable-find (symbol-value executable))
|
|
|
|
|
(error "Executable %S not found" executable)))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Creating thumbnails
|
|
|
|
|
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(defun image-dired-thumb-size (dimension)
|
|
|
|
|
"Return thumb size depending on `image-dired-thumbnail-storage'.
|
2019-11-11 18:30:13 +00:00
|
|
|
|
DIMENSION should be either the symbol `width' or `height'."
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(cond
|
|
|
|
|
((eq 'standard image-dired-thumbnail-storage) 128)
|
|
|
|
|
((eq 'standard-large image-dired-thumbnail-storage) 256)
|
2021-10-25 00:12:48 +00:00
|
|
|
|
((eq 'standard-x-large image-dired-thumbnail-storage) 512)
|
|
|
|
|
((eq 'standard-xx-large image-dired-thumbnail-storage) 1024)
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(t (cl-ecase dimension
|
|
|
|
|
(width image-dired-thumb-width)
|
|
|
|
|
(height image-dired-thumb-height)))))
|
|
|
|
|
|
2021-10-26 23:32:58 +00:00
|
|
|
|
(defvar image-dired--generate-thumbs-start nil
|
|
|
|
|
"Time when `display-thumbs' was called.")
|
|
|
|
|
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(defvar image-dired-queue nil
|
|
|
|
|
"List of items in the queue.
|
|
|
|
|
Each item has the form (ORIGINAL-FILE TARGET-FILE).")
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-queue-active-jobs 0
|
|
|
|
|
"Number of active jobs in `image-dired-queue'.")
|
|
|
|
|
|
2021-10-26 23:32:58 +00:00
|
|
|
|
(defvar image-dired-queue-active-limit (min 4 (max 2 (/ (num-processors) 2)))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
"Maximum number of concurrent jobs permitted for generating images.
|
2021-10-26 23:32:58 +00:00
|
|
|
|
Increase at 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 `image-clear-cache'
|
|
|
|
|
and remove the cached thumbnail files between each trial run.")
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-pngnq-thumb (spec)
|
|
|
|
|
"Quantize thumbnail described by format SPEC with pngnq(1)."
|
|
|
|
|
(let ((process
|
|
|
|
|
(apply #'start-process "image-dired-pngnq" nil
|
|
|
|
|
image-dired-cmd-pngnq-program
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-pngnq-options))))
|
|
|
|
|
(setf (process-sentinel process)
|
|
|
|
|
(lambda (process status)
|
|
|
|
|
(if (and (eq (process-status process) 'exit)
|
|
|
|
|
(zerop (process-exit-status process)))
|
|
|
|
|
;; Pass off to pngcrush, or just rename the
|
|
|
|
|
;; THUMB-nq8.png file back to THUMB.png
|
|
|
|
|
(if (and image-dired-cmd-pngcrush-program
|
|
|
|
|
(executable-find image-dired-cmd-pngcrush-program))
|
|
|
|
|
(image-dired-pngcrush-thumb spec)
|
|
|
|
|
(let ((nq8 (cdr (assq ?q spec)))
|
|
|
|
|
(thumb (cdr (assq ?t spec))))
|
|
|
|
|
(rename-file nq8 thumb t)))
|
|
|
|
|
(message "command %S %s" (process-command process)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
|
(string-replace "\n" "" status)))))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
process))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-pngcrush-thumb (spec)
|
2016-12-22 18:13:46 +00:00
|
|
|
|
"Optimize thumbnail described by format SPEC with pngcrush(1)."
|
2016-12-20 00:47:06 +00:00
|
|
|
|
;; 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.
|
|
|
|
|
(when (not image-dired-cmd-pngnq-program)
|
|
|
|
|
(let ((temp (cdr (assq ?q spec)))
|
|
|
|
|
(thumb (cdr (assq ?t spec))))
|
|
|
|
|
(copy-file thumb temp)))
|
|
|
|
|
(let ((process
|
|
|
|
|
(apply #'start-process "image-dired-pngcrush" nil
|
|
|
|
|
image-dired-cmd-pngcrush-program
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-pngcrush-options))))
|
|
|
|
|
(setf (process-sentinel process)
|
|
|
|
|
(lambda (process status)
|
|
|
|
|
(unless (and (eq (process-status process) 'exit)
|
|
|
|
|
(zerop (process-exit-status process)))
|
|
|
|
|
(message "command %S %s" (process-command process)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
|
(string-replace "\n" "" status)))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(when (memq (process-status process) '(exit signal))
|
|
|
|
|
(let ((temp (cdr (assq ?q spec))))
|
|
|
|
|
(delete-file temp)))))
|
|
|
|
|
process))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-optipng-thumb (spec)
|
2016-12-22 18:13:46 +00:00
|
|
|
|
"Optimize thumbnail described by format SPEC with optipng(1)."
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(let ((process
|
|
|
|
|
(apply #'start-process "image-dired-optipng" nil
|
|
|
|
|
image-dired-cmd-optipng-program
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-optipng-options))))
|
|
|
|
|
(setf (process-sentinel process)
|
|
|
|
|
(lambda (process status)
|
|
|
|
|
(unless (and (eq (process-status process) 'exit)
|
|
|
|
|
(zerop (process-exit-status process)))
|
|
|
|
|
(message "command %S %s" (process-command process)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
|
(string-replace "\n" "" status)))))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
process))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-create-thumb-1 (original-file thumbnail-file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(image-dired--check-executable-exists
|
|
|
|
|
'image-dired-cmd-create-thumbnail-program)
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(let* ((width (int-to-string (image-dired-thumb-size 'width)))
|
|
|
|
|
(height (int-to-string (image-dired-thumb-size 'height)))
|
2017-10-22 08:04:36 +00:00
|
|
|
|
(modif-time (format-time-string
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
|
"%s" (file-attribute-modification-time
|
|
|
|
|
(file-attributes original-file))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
|
|
|
|
|
thumbnail-file))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(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)))
|
|
|
|
|
(thumbnail-dir (file-name-directory thumbnail-file))
|
|
|
|
|
process)
|
|
|
|
|
(when (not (file-exists-p thumbnail-dir))
|
2020-02-19 21:47:57 +00:00
|
|
|
|
(with-file-modes #o700
|
2021-11-20 10:09:23 +00:00
|
|
|
|
(make-directory thumbnail-dir t))
|
|
|
|
|
(message "Thumbnail directory created: %s" thumbnail-dir))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
|
2016-12-22 18:13:46 +00:00
|
|
|
|
;; Thumbnail file creation processes begin here and are marshaled
|
2016-12-20 00:47:06 +00:00
|
|
|
|
;; in a queue by `image-dired-create-thumb'.
|
|
|
|
|
(setq process
|
|
|
|
|
(apply #'start-process "image-dired-create-thumbnail" nil
|
|
|
|
|
image-dired-cmd-create-thumbnail-program
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (arg) (format-spec arg spec))
|
|
|
|
|
(if (memq image-dired-thumbnail-storage
|
2021-10-25 00:12:48 +00:00
|
|
|
|
image-dired--thumbnail-standard-sizes)
|
2016-12-20 00:47:06 +00:00
|
|
|
|
image-dired-cmd-create-standard-thumbnail-options
|
|
|
|
|
image-dired-cmd-create-thumbnail-options))))
|
|
|
|
|
|
|
|
|
|
(setf (process-sentinel process)
|
|
|
|
|
(lambda (process status)
|
|
|
|
|
;; Trigger next in queue once a thumbnail has been created
|
|
|
|
|
(cl-decf image-dired-queue-active-jobs)
|
|
|
|
|
(image-dired-thumb-queue-run)
|
2021-10-26 23:32:58 +00:00
|
|
|
|
(when (= image-dired-queue-active-jobs 0)
|
|
|
|
|
(image-dired-debug-message
|
|
|
|
|
(format-time-string
|
|
|
|
|
"Generated thumbnails in %s.%3N seconds"
|
2021-12-06 02:25:46 +00:00
|
|
|
|
(time-subtract nil
|
2021-10-26 23:32:58 +00:00
|
|
|
|
image-dired--generate-thumbs-start))))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(if (not (and (eq (process-status process) 'exit)
|
|
|
|
|
(zerop (process-exit-status process))))
|
|
|
|
|
(message "Thumb could not be created for %s: %s"
|
|
|
|
|
(abbreviate-file-name original-file)
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 16:58:46 +00:00
|
|
|
|
(string-replace "\n" "" status))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(set-file-modes thumbnail-file #o600)
|
|
|
|
|
(clear-image-cache thumbnail-file)
|
|
|
|
|
;; PNG thumbnail has been created since we are
|
|
|
|
|
;; following the XDG thumbnail spec, so try to optimize
|
|
|
|
|
(when (memq image-dired-thumbnail-storage
|
2021-10-25 00:12:48 +00:00
|
|
|
|
image-dired--thumbnail-standard-sizes)
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(cond
|
|
|
|
|
((and image-dired-cmd-pngnq-program
|
|
|
|
|
(executable-find image-dired-cmd-pngnq-program))
|
|
|
|
|
(image-dired-pngnq-thumb spec))
|
|
|
|
|
((and image-dired-cmd-pngcrush-program
|
|
|
|
|
(executable-find image-dired-cmd-pngcrush-program))
|
|
|
|
|
(image-dired-pngcrush-thumb spec))
|
|
|
|
|
((and image-dired-cmd-optipng-program
|
|
|
|
|
(executable-find image-dired-cmd-optipng-program))
|
|
|
|
|
(image-dired-optipng-thumb spec)))))))
|
|
|
|
|
process))
|
|
|
|
|
|
|
|
|
|
(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'."
|
|
|
|
|
(while (and image-dired-queue
|
|
|
|
|
(< image-dired-queue-active-jobs
|
|
|
|
|
image-dired-queue-active-limit))
|
|
|
|
|
(cl-incf image-dired-queue-active-jobs)
|
|
|
|
|
(apply #'image-dired-create-thumb-1 (pop image-dired-queue))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-create-thumb (original-file thumbnail-file)
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Add a job for generating ORIGINAL-FILE thumbnail to `image-dired-queue'.
|
|
|
|
|
The new file will be named THUMBNAIL-FILE."
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(setq image-dired-queue
|
|
|
|
|
(nconc image-dired-queue
|
|
|
|
|
(list (list original-file thumbnail-file))))
|
|
|
|
|
(run-at-time 0 nil #'image-dired-thumb-queue-run))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-08-18 12:53:25 +00:00
|
|
|
|
(defmacro image-dired--with-marked (&rest body)
|
|
|
|
|
"Eval BODY with point on each marked thumbnail.
|
|
|
|
|
If no marked file could be found, execute BODY on the current
|
|
|
|
|
thumbnail."
|
|
|
|
|
`(with-current-buffer image-dired-thumbnail-buffer
|
|
|
|
|
(let (found)
|
|
|
|
|
(save-mark-and-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(when (image-dired-thumb-file-marked-p)
|
|
|
|
|
(setq found t)
|
|
|
|
|
,@body)
|
|
|
|
|
(forward-char)))
|
|
|
|
|
(unless found
|
|
|
|
|
,@body))))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;;###autoload
|
2010-05-25 17:43:58 +00:00
|
|
|
|
(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Toggle thumbnails in front of file names in the Dired buffer.
|
2010-05-25 17:43:58 +00:00
|
|
|
|
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."
|
|
|
|
|
(interactive "P")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(dired-map-over-marks
|
2016-12-03 18:05:39 +00:00
|
|
|
|
(let ((image-pos (dired-move-to-filename))
|
|
|
|
|
(image-file (dired-get-filename nil t))
|
|
|
|
|
thumb-file
|
|
|
|
|
overlay)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(when (and image-file
|
|
|
|
|
(string-match-p (image-file-name-regexp) image-file))
|
2010-05-25 17:43:58 +00:00
|
|
|
|
(setq thumb-file (image-dired-get-thumbnail-image image-file))
|
|
|
|
|
;; If image is not already added, then add it.
|
2016-12-03 18:05:39 +00:00
|
|
|
|
(let ((thumb-ov (cl-loop for ov in (overlays-in (point) (1+ (point)))
|
|
|
|
|
if (overlay-get ov 'thumb-file) return ov)))
|
2013-06-13 05:10:48 +00:00
|
|
|
|
(if thumb-ov
|
|
|
|
|
(delete-overlay thumb-ov)
|
2010-05-25 17:43:58 +00:00
|
|
|
|
(put-image thumb-file image-pos)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(setq overlay
|
2016-12-03 18:05:39 +00:00
|
|
|
|
(cl-loop for ov in (overlays-in (point) (1+ (point)))
|
|
|
|
|
if (overlay-get ov 'put-image) return ov))
|
2010-05-25 17:43:58 +00:00
|
|
|
|
(overlay-put overlay 'image-file image-file)
|
|
|
|
|
(overlay-put overlay 'thumb-file thumb-file)))))
|
|
|
|
|
arg ; Show or hide image on ARG next files.
|
|
|
|
|
'show-progress) ; Update dired display after each image is updated.
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
|
(add-hook 'dired-after-readin-hook
|
|
|
|
|
'image-dired-dired-after-readin-hook nil t))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-dired-after-readin-hook ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Relocate existing thumbnail overlays in Dired buffer after reverting.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
Move them to their corresponding files if they still exist.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
Otherwise, delete overlays."
|
|
|
|
|
(mapc (lambda (overlay)
|
|
|
|
|
(when (overlay-get overlay 'put-image)
|
|
|
|
|
(let* ((image-file (overlay-get overlay 'image-file))
|
|
|
|
|
(image-pos (dired-goto-file image-file)))
|
|
|
|
|
(if image-pos
|
|
|
|
|
(move-overlay overlay image-pos image-pos)
|
|
|
|
|
(delete-overlay overlay)))))
|
|
|
|
|
(overlays-in (point-min) (point-max))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-next-line-and-display ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Move to next Dired line and display thumbnail image."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(dired-next-line 1)
|
|
|
|
|
(image-dired-display-thumbs
|
|
|
|
|
t (or image-dired-append-when-browsing nil) t)
|
|
|
|
|
(if image-dired-dired-disp-props
|
|
|
|
|
(image-dired-dired-display-properties)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-previous-line-and-display ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Move to previous Dired line and display thumbnail image."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(dired-previous-line 1)
|
|
|
|
|
(image-dired-display-thumbs
|
|
|
|
|
t (or image-dired-append-when-browsing nil) t)
|
|
|
|
|
(if image-dired-dired-disp-props
|
|
|
|
|
(image-dired-dired-display-properties)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-toggle-append-browsing ()
|
|
|
|
|
"Toggle `image-dired-append-when-browsing'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq image-dired-append-when-browsing
|
|
|
|
|
(not image-dired-append-when-browsing))
|
2021-11-03 02:00:23 +00:00
|
|
|
|
(message "Append browsing %s"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if image-dired-append-when-browsing
|
|
|
|
|
"on"
|
|
|
|
|
"off")))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-mark-and-display-next ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Mark current file in Dired and display next thumbnail image."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(dired-mark 1)
|
|
|
|
|
(image-dired-display-thumbs
|
|
|
|
|
t (or image-dired-append-when-browsing nil) t)
|
|
|
|
|
(if image-dired-dired-disp-props
|
|
|
|
|
(image-dired-dired-display-properties)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-toggle-dired-display-properties ()
|
|
|
|
|
"Toggle `image-dired-dired-disp-props'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq image-dired-dired-disp-props
|
|
|
|
|
(not image-dired-dired-disp-props))
|
|
|
|
|
(message "Dired display properties %s."
|
|
|
|
|
(if image-dired-dired-disp-props
|
|
|
|
|
"on"
|
|
|
|
|
"off")))
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-thumbnail-buffer "*image-dired*"
|
|
|
|
|
"Image-Dired's thumbnail buffer.")
|
|
|
|
|
|
|
|
|
|
(defun image-dired-create-thumbnail-buffer ()
|
|
|
|
|
"Create thumb buffer and set `image-dired-thumbnail-mode'."
|
|
|
|
|
(let ((buf (get-buffer-create image-dired-thumbnail-buffer)))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
|
(if (not (eq major-mode 'image-dired-thumbnail-mode))
|
|
|
|
|
(image-dired-thumbnail-mode)))
|
|
|
|
|
buf))
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-display-image-buffer "*image-dired-display-image*"
|
|
|
|
|
"Where larger versions of the images are display.")
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-saved-window-configuration nil
|
|
|
|
|
"Saved window configuration.")
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-dired-with-window-configuration (dir &optional arg)
|
|
|
|
|
"Open directory DIR and create a default window configuration.
|
|
|
|
|
|
|
|
|
|
Convenience command that:
|
|
|
|
|
|
2021-10-27 02:53:41 +00:00
|
|
|
|
- Opens Dired in folder DIR
|
2007-04-22 13:44:05 +00:00
|
|
|
|
- Splits windows in most useful (?) way
|
2021-10-27 02:53:41 +00:00
|
|
|
|
- Sets `truncate-lines' to t
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
After the command has finished, you would typically mark some
|
2021-10-27 02:53:41 +00:00
|
|
|
|
image files in Dired and type
|
2007-04-22 13:44:05 +00:00
|
|
|
|
\\[image-dired-display-thumbs] (`image-dired-display-thumbs').
|
|
|
|
|
|
|
|
|
|
If called with prefix argument ARG, skip splitting of windows.
|
|
|
|
|
|
|
|
|
|
The current window configuration is saved and can be restored by
|
|
|
|
|
calling `image-dired-restore-window-configuration'."
|
|
|
|
|
(interactive "DDirectory: \nP")
|
|
|
|
|
(let ((buf (image-dired-create-thumbnail-buffer))
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(buf2 (get-buffer-create image-dired-display-image-buffer)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(setq image-dired-saved-window-configuration
|
|
|
|
|
(current-window-configuration))
|
|
|
|
|
(dired dir)
|
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(when (not arg)
|
2011-10-30 01:56:03 +00:00
|
|
|
|
(split-window-right)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(setq truncate-lines t)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(other-window 1)
|
2016-12-02 21:50:25 +00:00
|
|
|
|
(pop-to-buffer-same-window buf)
|
2011-10-30 01:56:03 +00:00
|
|
|
|
(select-window (split-window-below))
|
2016-12-02 21:50:25 +00:00
|
|
|
|
(pop-to-buffer-same-window buf2)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(other-window -2)))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-restore-window-configuration ()
|
|
|
|
|
"Restore window configuration.
|
|
|
|
|
Restore any changes to the window configuration made by calling
|
|
|
|
|
`image-dired-dired-with-window-configuration'."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if image-dired-saved-window-configuration
|
|
|
|
|
(set-window-configuration image-dired-saved-window-configuration)
|
|
|
|
|
(message "No saved window configuration")))
|
|
|
|
|
|
2021-08-11 16:02:25 +00:00
|
|
|
|
(defun image-dired--line-up-with-method ()
|
|
|
|
|
"Line up thumbnails according to `image-dired-line-up-method'."
|
|
|
|
|
(cond ((eq 'dynamic image-dired-line-up-method)
|
|
|
|
|
(image-dired-line-up-dynamic))
|
|
|
|
|
((eq 'fixed image-dired-line-up-method)
|
|
|
|
|
(image-dired-line-up))
|
|
|
|
|
((eq 'interactive image-dired-line-up-method)
|
|
|
|
|
(image-dired-line-up-interactive))
|
|
|
|
|
((eq 'none image-dired-line-up-method)
|
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
(image-dired-line-up-dynamic))))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-display-thumbs (&optional arg append do-not-pop)
|
|
|
|
|
"Display thumbnails of all marked files, in `image-dired-thumbnail-buffer'.
|
|
|
|
|
If a thumbnail image does not exist for a file, it is created on the
|
|
|
|
|
fly. With prefix argument ARG, display only thumbnail for file at
|
|
|
|
|
point (this is useful if you have marked some files but want to show
|
|
|
|
|
another one).
|
|
|
|
|
|
|
|
|
|
Recommended usage is to split the current frame horizontally so that
|
2021-10-27 02:53:41 +00:00
|
|
|
|
you have the Dired buffer in the left window and the
|
2007-04-22 13:44:05 +00:00
|
|
|
|
`image-dired-thumbnail-buffer' buffer in the right window.
|
|
|
|
|
|
|
|
|
|
With optional argument APPEND, append thumbnail to thumbnail buffer
|
|
|
|
|
instead of erasing it first.
|
|
|
|
|
|
Fix typos in docstrings.
* image-dired.el (image-dired-display-thumbs): Fix typo in docstring.
(image-dired-read-comment): Doc fix.
* json.el (json-object-type, json-array-type, json-key-type, json-false)
(json-null, json-read-number):
* minibuffer.el (completion-in-region-functions):
* calendar/cal-tex.el (cal-tex-daily-end, cal-tex-number-weeks)
(cal-tex-cursor-week):
* emacs-lisp/trace.el (trace-function):
* eshell/em-basic.el (eshell/printnl):
* eshell/em-dirs.el (eshell-last-dir-ring, eshell-parse-drive-letter)
(eshell-read-last-dir-ring, eshell-write-last-dir-ring):
* obsolete/levents.el (allocate-event, event-key, event-object)
(event-point, event-process, event-timestamp, event-to-character)
(event-window, event-x, event-x-pixel, event-y, event-y-pixel):
* textmodes/reftex-vars.el (reftex-index-macros-builtin)
(reftex-section-levels, reftex-auto-recenter-toc, reftex-toc-mode-hook)
(reftex-cite-punctuation, reftex-search-unrecursed-path-first)
(reftex-highlight-selection): Fix typos in docstrings.
2010-03-22 16:50:29 +00:00
|
|
|
|
Optional argument DO-NOT-POP controls if `pop-to-buffer' should be
|
2007-04-22 13:44:05 +00:00
|
|
|
|
used or not. If non-nil, use `display-buffer' instead of
|
|
|
|
|
`pop-to-buffer'. This is used from functions like
|
|
|
|
|
`image-dired-next-line-and-display' and
|
|
|
|
|
`image-dired-previous-line-and-display' where we do not want the
|
|
|
|
|
thumbnail buffer to be selected."
|
|
|
|
|
(interactive "P")
|
2021-10-26 23:32:58 +00:00
|
|
|
|
(setq image-dired--generate-thumbs-start (current-time))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((buf (image-dired-create-thumbnail-buffer))
|
2011-04-19 13:44:55 +00:00
|
|
|
|
thumb-name files dired-buf)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if arg
|
|
|
|
|
(setq files (list (dired-get-filename)))
|
|
|
|
|
(setq files (dired-get-marked-files)))
|
|
|
|
|
(setq dired-buf (current-buffer))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(if (not append)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(goto-char (point-max)))
|
2016-12-04 18:43:03 +00:00
|
|
|
|
(dolist (curr-file files)
|
|
|
|
|
(setq thumb-name (image-dired-thumb-name curr-file))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(when (not (file-exists-p thumb-name))
|
|
|
|
|
(image-dired-create-thumb curr-file thumb-name))
|
|
|
|
|
(image-dired-insert-thumbnail thumb-name curr-file dired-buf)))
|
2016-12-02 21:53:02 +00:00
|
|
|
|
(if do-not-pop
|
|
|
|
|
(display-buffer buf)
|
|
|
|
|
(pop-to-buffer buf))
|
2021-08-11 16:02:25 +00:00
|
|
|
|
(image-dired--line-up-with-method))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-show-all-from-dir (dir)
|
2021-10-27 18:39:10 +00:00
|
|
|
|
"Make a thumbnail buffer for all images in DIR and display it.
|
|
|
|
|
Any file matching `image-file-name-regexp' is considered an image
|
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
If the number of image files in DIR exceeds
|
|
|
|
|
`image-dired-show-all-from-dir-max-files', ask for confirmation
|
|
|
|
|
before creating the thumbnail buffer. If that variable is nil,
|
|
|
|
|
never ask for confirmation."
|
2021-10-27 20:10:04 +00:00
|
|
|
|
(interactive "DImage-Dired: ")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(dired dir)
|
|
|
|
|
(dired-mark-files-regexp (image-file-name-regexp))
|
2021-10-27 19:04:10 +00:00
|
|
|
|
(let ((files (dired-get-marked-files nil nil nil t)))
|
|
|
|
|
(cond ((and (null (cdr files)))
|
|
|
|
|
(message "No image files in directory"))
|
|
|
|
|
((or (not image-dired-show-all-from-dir-max-files)
|
|
|
|
|
(<= (length (cdr files)) image-dired-show-all-from-dir-max-files)
|
|
|
|
|
(and (> (length (cdr files)) image-dired-show-all-from-dir-max-files)
|
|
|
|
|
(y-or-n-p
|
|
|
|
|
(format
|
|
|
|
|
"Directory contains more than %d image files. Proceed?"
|
|
|
|
|
image-dired-show-all-from-dir-max-files))))
|
|
|
|
|
(image-dired-display-thumbs)
|
2021-11-03 06:14:21 +00:00
|
|
|
|
(pop-to-buffer image-dired-thumbnail-buffer)
|
2021-11-04 04:10:28 +00:00
|
|
|
|
(setq default-directory dir)
|
2021-11-03 06:14:21 +00:00
|
|
|
|
(image-dired-unmark-all-marks))
|
2021-10-27 19:04:10 +00:00
|
|
|
|
(t (message "Image-Dired canceled")))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defalias 'image-dired 'image-dired-show-all-from-dir)
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Tags
|
|
|
|
|
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(defun image-dired-sane-db-file ()
|
|
|
|
|
"Check if `image-dired-db-file' exists.
|
|
|
|
|
If not, try to create it (including any parent directories).
|
|
|
|
|
Signal error if there are problems creating it."
|
|
|
|
|
(or (file-exists-p image-dired-db-file)
|
|
|
|
|
(let (dir buf)
|
|
|
|
|
(unless (file-directory-p (setq dir (file-name-directory
|
|
|
|
|
image-dired-db-file)))
|
2021-10-24 19:20:16 +00:00
|
|
|
|
(with-file-modes #o700
|
|
|
|
|
(make-directory dir t)))
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(with-current-buffer (setq buf (create-file-buffer
|
|
|
|
|
image-dired-db-file))
|
2021-10-24 19:20:16 +00:00
|
|
|
|
(with-file-modes #o600
|
|
|
|
|
(write-file image-dired-db-file)))
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(kill-buffer buf)
|
|
|
|
|
(file-exists-p image-dired-db-file))
|
|
|
|
|
(error "Could not create %s" image-dired-db-file)))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
(defvar image-dired-tag-history nil "Variable holding the tag history.")
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-write-tags (file-tags)
|
|
|
|
|
"Write file tags to database.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
Write each file and tag in FILE-TAGS to the database.
|
|
|
|
|
FILE-TAGS is an alist in the following form:
|
2007-04-22 13:44:05 +00:00
|
|
|
|
((FILE . TAG) ... )"
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let (end file tag)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(setq buffer-file-name image-dired-db-file)
|
|
|
|
|
(dolist (elt file-tags)
|
|
|
|
|
(setq file (car elt)
|
|
|
|
|
tag (cdr elt))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (search-forward-regexp (format "^%s.*$" file) nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(when (not (search-forward (format ";%s" tag) end t))
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(insert (format ";%s" tag))))
|
|
|
|
|
(goto-char (point-max))
|
2021-08-17 23:37:43 +00:00
|
|
|
|
(insert (format "%s;%s\n" file tag))))
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(save-buffer))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-remove-tag (files tag)
|
|
|
|
|
"For all FILES, remove TAG from the image database."
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(setq buffer-file-name image-dired-db-file)
|
|
|
|
|
(let (end)
|
|
|
|
|
(unless (listp files)
|
|
|
|
|
(if (stringp files)
|
|
|
|
|
(setq files (list files))
|
|
|
|
|
(error "Files must be a string or a list of strings!")))
|
|
|
|
|
(dolist (file files)
|
|
|
|
|
(goto-char (point-min))
|
2021-08-18 00:02:02 +00:00
|
|
|
|
(when (search-forward-regexp (format "^%s;" file) nil t)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
2021-08-18 00:02:02 +00:00
|
|
|
|
(when (search-forward-regexp
|
|
|
|
|
(format "\\(;%s\\)\\($\\|;\\)" tag) end t)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(delete-region (match-beginning 1) (match-end 1))
|
|
|
|
|
;; Check if file should still be in the database. If
|
|
|
|
|
;; it has no tags or comments, it will be removed.
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(when (not (search-forward ";" end t))
|
2021-08-17 23:37:43 +00:00
|
|
|
|
(kill-line 1))))))
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(save-buffer)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-list-tags (file)
|
|
|
|
|
"Read all tags for image FILE from the image database."
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(let (end (tags ""))
|
|
|
|
|
(when (search-forward-regexp (format "^%s" file) nil t)
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if (search-forward ";" end t)
|
|
|
|
|
(if (search-forward "comment:" end t)
|
|
|
|
|
(if (search-forward ";" end t)
|
|
|
|
|
(setq tags (buffer-substring (point) end)))
|
|
|
|
|
(setq tags (buffer-substring (point) end)))))
|
|
|
|
|
(split-string tags ";"))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-tag-files (arg)
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Tag marked file(s) in Dired. With prefix ARG, tag file at point."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "P")
|
2021-08-18 09:21:51 +00:00
|
|
|
|
(let ((tag (completing-read
|
|
|
|
|
"Tags to add (separate tags with a semicolon): "
|
|
|
|
|
image-dired-tag-history nil nil nil 'image-dired-tag-history))
|
2011-04-19 13:44:55 +00:00
|
|
|
|
files)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if arg
|
|
|
|
|
(setq files (list (dired-get-filename)))
|
|
|
|
|
(setq files (dired-get-marked-files)))
|
|
|
|
|
(image-dired-write-tags
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (x)
|
|
|
|
|
(cons x tag))
|
|
|
|
|
files))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-tag-thumbnail ()
|
2021-08-18 12:53:25 +00:00
|
|
|
|
"Tag current or marked thumbnails."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
2021-08-18 09:21:51 +00:00
|
|
|
|
(let ((tag (completing-read
|
|
|
|
|
"Tags to add (separate tags with a semicolon): "
|
|
|
|
|
image-dired-tag-history nil nil nil 'image-dired-tag-history)))
|
2021-08-18 12:53:25 +00:00
|
|
|
|
(image-dired--with-marked
|
|
|
|
|
(image-dired-write-tags
|
|
|
|
|
(list (cons (image-dired-original-file-name) tag)))
|
|
|
|
|
(image-dired-update-property
|
|
|
|
|
'tags (image-dired-list-tags (image-dired-original-file-name))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-delete-tag (arg)
|
|
|
|
|
"Remove tag for selected file(s).
|
|
|
|
|
With prefix argument ARG, remove tag from file at point."
|
|
|
|
|
(interactive "P")
|
2021-08-18 09:21:51 +00:00
|
|
|
|
(let ((tag (completing-read "Tag to remove: " image-dired-tag-history
|
|
|
|
|
nil nil nil 'image-dired-tag-history))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
files)
|
|
|
|
|
(if arg
|
|
|
|
|
(setq files (list (dired-get-filename)))
|
|
|
|
|
(setq files (dired-get-marked-files)))
|
|
|
|
|
(image-dired-remove-tag files tag)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-tag-thumbnail-remove ()
|
2021-08-18 12:53:25 +00:00
|
|
|
|
"Remove tag from current or marked thumbnails."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
2021-08-18 09:21:51 +00:00
|
|
|
|
(let ((tag (completing-read "Tag to remove: " image-dired-tag-history
|
|
|
|
|
nil nil nil 'image-dired-tag-history)))
|
2021-08-18 12:53:25 +00:00
|
|
|
|
(image-dired--with-marked
|
|
|
|
|
(image-dired-remove-tag (image-dired-original-file-name) tag)
|
|
|
|
|
(image-dired-update-property
|
|
|
|
|
'tags (image-dired-list-tags (image-dired-original-file-name))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Thumbnail mode (cont.)
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-original-file-name ()
|
|
|
|
|
"Get original file name for thumbnail or display image at point."
|
|
|
|
|
(get-text-property (point) 'original-file-name))
|
|
|
|
|
|
2016-12-14 03:56:42 +00:00
|
|
|
|
(defun image-dired-file-name-at-point ()
|
|
|
|
|
"Get abbreviated file name for thumbnail or display image at point."
|
|
|
|
|
(let ((f (image-dired-original-file-name)))
|
|
|
|
|
(when f
|
|
|
|
|
(abbreviate-file-name f))))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-associated-dired-buffer ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Get associated Dired buffer at point."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(get-text-property (point) 'associated-dired-buffer))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-get-buffer-window (buf)
|
|
|
|
|
"Return window where buffer BUF is."
|
|
|
|
|
(get-window-with-predicate
|
|
|
|
|
(lambda (window)
|
|
|
|
|
(equal (window-buffer window) buf))
|
|
|
|
|
nil t))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-track-original-file ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Track the original file in the associated Dired buffer.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
See documentation for `image-dired-toggle-movement-tracking'.
|
|
|
|
|
Interactive use only useful if `image-dired-track-movement' is nil."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
2013-07-20 19:29:02 +00:00
|
|
|
|
(let* ((dired-buf (image-dired-associated-dired-buffer))
|
2013-07-20 19:17:32 +00:00
|
|
|
|
(file-name (image-dired-original-file-name))
|
|
|
|
|
(window (image-dired-get-buffer-window dired-buf)))
|
2013-07-20 19:29:02 +00:00
|
|
|
|
(and (buffer-live-p dired-buf) file-name
|
|
|
|
|
(with-current-buffer dired-buf
|
|
|
|
|
(if (not (dired-goto-file file-name))
|
|
|
|
|
(message "Could not track file")
|
|
|
|
|
(if window (set-window-point window (point))))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-toggle-movement-tracking ()
|
|
|
|
|
"Turn on and off `image-dired-track-movement'.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
Tracking of the movements between thumbnail and Dired buffer so that
|
2007-04-22 13:44:05 +00:00
|
|
|
|
they are \"mirrored\" in the dired buffer. When this is on, moving
|
|
|
|
|
around in the thumbnail or dired buffer will find the matching
|
|
|
|
|
position in the other buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq image-dired-track-movement (not image-dired-track-movement))
|
2021-11-03 02:00:23 +00:00
|
|
|
|
(message "Movement tracking %s" (if image-dired-track-movement "on" "off")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-track-thumbnail ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Track current Dired file's thumb in `image-dired-thumbnail-buffer'.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
This is almost the same as what `image-dired-track-original-file' does,
|
|
|
|
|
but the other way around."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((file (dired-get-filename))
|
2013-07-20 19:29:02 +00:00
|
|
|
|
prop-val found window)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(when (get-buffer image-dired-thumbnail-buffer)
|
2013-07-20 19:29:02 +00:00
|
|
|
|
(with-current-buffer image-dired-thumbnail-buffer
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (and (not (eobp))
|
|
|
|
|
(not found))
|
|
|
|
|
(if (and (setq prop-val
|
|
|
|
|
(get-text-property (point) 'original-file-name))
|
|
|
|
|
(string= prop-val file))
|
|
|
|
|
(setq found t))
|
|
|
|
|
(if (not found)
|
|
|
|
|
(forward-char 1)))
|
|
|
|
|
(when found
|
|
|
|
|
(if (setq window (image-dired-thumbnail-window))
|
|
|
|
|
(set-window-point window (point)))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-dired-next-line (&optional arg)
|
|
|
|
|
"Call `dired-next-line', then track thumbnail.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
This can safely replace `dired-next-line'.
|
|
|
|
|
With prefix argument, move ARG lines."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(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.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
This can safely replace `dired-previous-line'.
|
|
|
|
|
With prefix argument, move ARG lines."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(dired-previous-line (or arg 1))
|
|
|
|
|
(if image-dired-track-movement
|
|
|
|
|
(image-dired-track-thumbnail)))
|
|
|
|
|
|
2021-10-27 01:43:21 +00:00
|
|
|
|
(defun image-dired--display-thumb-properties-fun ()
|
|
|
|
|
(let ((old-buf (current-buffer))
|
|
|
|
|
(old-point (point)))
|
|
|
|
|
(lambda ()
|
|
|
|
|
(when (and (equal (current-buffer) old-buf)
|
|
|
|
|
(= (point) old-point))
|
|
|
|
|
(ignore-errors
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))))))
|
2021-10-27 01:43:21 +00:00
|
|
|
|
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(defun image-dired-forward-image (&optional arg wrap-around)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Move to next image and display properties.
|
2021-11-03 02:34:28 +00:00
|
|
|
|
Optional prefix ARG says how many images to move; the default is
|
|
|
|
|
one image. Negative means move backwards.
|
|
|
|
|
On reaching end or beginning of buffer, stop and show a message.
|
|
|
|
|
|
|
|
|
|
If optional argument WRAP-AROUND is non-nil, wrap around: if
|
|
|
|
|
point is on the last image, move to the last one and vice versa."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "p")
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(setq arg (or arg 1))
|
|
|
|
|
(let (pos)
|
|
|
|
|
(dotimes (_ (abs arg))
|
|
|
|
|
(if (and (not (if (> arg 0) (eobp) (bobp)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(save-excursion
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(forward-char (if (> arg 0) 1 -1))
|
|
|
|
|
(while (and (not (if (> arg 0) (eobp) (bobp)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(not (image-dired-image-at-point-p)))
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(forward-char (if (> arg 0) 1 -1)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(setq pos (point))
|
|
|
|
|
(image-dired-image-at-point-p)))
|
2021-10-27 01:43:21 +00:00
|
|
|
|
(progn (goto-char pos)
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(if wrap-around
|
|
|
|
|
(progn (goto-char (if (> arg 0)
|
|
|
|
|
(point-min)
|
|
|
|
|
;; There are two spaces after the last image.
|
|
|
|
|
(- (point-max) 2)))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(message "At %s image" (if (> arg 0) "last" "first"))
|
|
|
|
|
(run-at-time 1 nil (image-dired--display-thumb-properties-fun))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(when image-dired-track-movement
|
2021-10-27 01:43:21 +00:00
|
|
|
|
(image-dired-track-original-file)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-backward-image (&optional arg)
|
|
|
|
|
"Move to previous image and display properties.
|
2021-11-03 02:34:28 +00:00
|
|
|
|
Optional prefix ARG says how many images to move; the default is
|
|
|
|
|
one image. Negative means move forward.
|
|
|
|
|
On reaching end or beginning of buffer, stop and show a message."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "p")
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(image-dired-forward-image (- (or arg 1))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-next-line ()
|
|
|
|
|
"Move to next line and display properties."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2016-02-27 13:11:02 +00:00
|
|
|
|
(let ((goal-column (current-column)))
|
2016-09-04 13:41:12 +00:00
|
|
|
|
(forward-line 1)
|
|
|
|
|
(move-to-column goal-column))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; If we end up in an empty spot, back up to the next thumbnail.
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(image-dired-backward-image))
|
|
|
|
|
(if image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun image-dired-previous-line ()
|
|
|
|
|
"Move to previous line and display properties."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2016-02-27 13:11:02 +00:00
|
|
|
|
(let ((goal-column (current-column)))
|
2016-09-04 13:41:12 +00:00
|
|
|
|
(forward-line -1)
|
|
|
|
|
(move-to-column goal-column))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; If we end up in an empty spot, back up to the next
|
|
|
|
|
;; thumbnail. This should only happen if the user deleted a
|
|
|
|
|
;; thumbnail and did not refresh, so it is not very common. But we
|
|
|
|
|
;; can handle it in a good manner, so why not?
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(image-dired-backward-image))
|
|
|
|
|
(if image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-10-27 01:23:49 +00:00
|
|
|
|
(defun image-dired-beginning-of-buffer ()
|
|
|
|
|
"Move to the first image in the buffer and display properties."
|
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (and (not (image-at-point-p))
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(when image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2021-10-27 01:23:49 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-end-of-buffer ()
|
|
|
|
|
"Move to the last image in the buffer and display properties."
|
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(while (and (not (image-at-point-p))
|
|
|
|
|
(not (bobp)))
|
|
|
|
|
(forward-char -1))
|
|
|
|
|
(when image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2021-10-27 01:23:49 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-format-properties-string (buf file props comment)
|
|
|
|
|
"Format display properties.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
BUF is the associated Dired buffer, FILE is the original image file
|
2016-12-15 19:40:32 +00:00
|
|
|
|
name, PROPS is a stringified list of tags and COMMENT is the image file's
|
2007-04-22 13:44:05 +00:00
|
|
|
|
comment."
|
|
|
|
|
(format-spec
|
|
|
|
|
image-dired-display-properties-format
|
|
|
|
|
(list
|
|
|
|
|
(cons ?b (or buf ""))
|
|
|
|
|
(cons ?f file)
|
2016-12-15 19:40:32 +00:00
|
|
|
|
(cons ?t (or props ""))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(cons ?c (or comment "")))))
|
|
|
|
|
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(defun image-dired-update-header-line ()
|
|
|
|
|
"Update image information in the header line."
|
|
|
|
|
(when (and (not (eobp))
|
|
|
|
|
(memq major-mode '(image-dired-thumbnail-mode
|
|
|
|
|
image-dired-display-image-mode)))
|
|
|
|
|
(let ((file-name (file-name-nondirectory (image-dired-original-file-name)))
|
|
|
|
|
(dired-buf (buffer-name (image-dired-associated-dired-buffer)))
|
|
|
|
|
(props (mapconcat #'identity (get-text-property (point) 'tags) ", "))
|
|
|
|
|
(comment (get-text-property (point) 'comment))
|
|
|
|
|
(message-log-max nil))
|
|
|
|
|
(if file-name
|
|
|
|
|
(setq header-line-format
|
|
|
|
|
(image-dired-format-properties-string
|
|
|
|
|
dired-buf
|
|
|
|
|
file-name
|
|
|
|
|
props
|
|
|
|
|
comment))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-03 21:34:51 +00:00
|
|
|
|
(defun image-dired-dired-file-marked-p (&optional marker)
|
|
|
|
|
"In Dired, return t if file on current line is marked.
|
|
|
|
|
If optional argument MARKER is non-nil, it is a character to look
|
|
|
|
|
for. The default is to look for `dired-marker-char'."
|
|
|
|
|
(setq marker (or marker dired-marker-char))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
2021-11-03 21:34:51 +00:00
|
|
|
|
(and (looking-at dired-re-mark)
|
|
|
|
|
(= (aref (match-string 0) 0) marker))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-dired-file-flagged-p ()
|
|
|
|
|
"In Dired, return t if file on current line is flagged for deletion."
|
|
|
|
|
(image-dired-dired-file-marked-p dired-del-marker))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(defmacro image-dired--with-thumbnail-buffer (&rest body)
|
|
|
|
|
(declare (indent defun) (debug t))
|
|
|
|
|
`(if-let ((buf (get-buffer image-dired-thumbnail-buffer)))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(if-let ((win (get-buffer-window buf)))
|
|
|
|
|
(with-selected-window win
|
|
|
|
|
,@body)
|
|
|
|
|
,@body))
|
|
|
|
|
(user-error "No such buffer: %s" image-dired-thumbnail-buffer)))
|
|
|
|
|
|
2021-11-03 06:02:13 +00:00
|
|
|
|
(defmacro image-dired--on-file-in-dired-buffer (&rest body)
|
|
|
|
|
"Run BODY with point on file at point in Dired buffer.
|
|
|
|
|
Should be called from commands in `image-dired-thumbnail-mode'."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(declare (indent defun) (debug t))
|
2021-11-03 06:02:13 +00:00
|
|
|
|
`(let ((file-name (image-dired-original-file-name))
|
|
|
|
|
(dired-buf (image-dired-associated-dired-buffer)))
|
|
|
|
|
(if (not (and dired-buf file-name))
|
|
|
|
|
(message "No image, or image with correct properties, at point.")
|
|
|
|
|
(with-current-buffer dired-buf
|
|
|
|
|
(when (dired-goto-file file-name)
|
|
|
|
|
,@body
|
|
|
|
|
(image-dired-thumb-update-marks))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(defmacro image-dired--do-mark-command (maybe-next &rest body)
|
|
|
|
|
"Helper macro for the mark, unmark and flag commands.
|
|
|
|
|
Run BODY in Dired buffer.
|
|
|
|
|
If optional argument MAYBE-NEXT is non-nil, show next image
|
|
|
|
|
according to `image-dired-marking-shows-next'."
|
|
|
|
|
(declare (indent defun) (debug t))
|
|
|
|
|
`(image-dired--with-thumbnail-buffer
|
|
|
|
|
(image-dired--on-file-in-dired-buffer
|
|
|
|
|
,@body)
|
|
|
|
|
,(when maybe-next
|
|
|
|
|
'(if image-dired-marking-shows-next
|
|
|
|
|
(image-dired-display-next-thumbnail-original)
|
|
|
|
|
(image-dired-next-line)))))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-mark-thumb-original-file ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Mark original image file in associated Dired buffer."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(image-dired--do-mark-command t
|
|
|
|
|
(dired-mark 1)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-unmark-thumb-original-file ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Unmark original image file in associated Dired buffer."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(image-dired--do-mark-command t
|
|
|
|
|
(dired-unmark 1)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-flag-thumb-original-file ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Flag original image file for deletion in associated Dired buffer."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(image-dired--do-mark-command t
|
|
|
|
|
(dired-flag-file-deletion 1)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-toggle-mark-thumb-original-file ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Toggle mark on original image file in associated Dired buffer."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(image-dired--do-mark-command nil
|
|
|
|
|
(if (image-dired-dired-file-marked-p)
|
|
|
|
|
(dired-unmark 1)
|
|
|
|
|
(dired-mark 1))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-10-01 12:49:28 +00:00
|
|
|
|
(defun image-dired-unmark-all-marks ()
|
2021-11-03 06:14:21 +00:00
|
|
|
|
"Remove all marks from all files in associated Dired buffer.
|
|
|
|
|
Also update the marks in the thumbnail buffer."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-08 23:57:34 +00:00
|
|
|
|
(image-dired--do-mark-command nil
|
|
|
|
|
(dired-unmark-all-marks))
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(image-dired--with-thumbnail-buffer
|
|
|
|
|
(image-dired-thumb-update-marks)))
|
2021-10-01 12:49:28 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-jump-original-dired-buffer ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Jump to the Dired buffer associated with the current image file.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
You probably want to use this together with
|
|
|
|
|
`image-dired-track-original-file'."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((buf (image-dired-associated-dired-buffer))
|
|
|
|
|
window frame)
|
|
|
|
|
(setq window (image-dired-get-buffer-window buf))
|
|
|
|
|
(if window
|
|
|
|
|
(progn
|
|
|
|
|
(if (not (equal (selected-frame) (setq frame (window-frame window))))
|
|
|
|
|
(select-frame-set-input-focus frame))
|
|
|
|
|
(select-window window))
|
|
|
|
|
(message "Associated dired buffer not visible"))))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-jump-thumbnail-buffer ()
|
|
|
|
|
"Jump to thumbnail buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((window (image-dired-thumbnail-window))
|
|
|
|
|
frame)
|
|
|
|
|
(if window
|
|
|
|
|
(progn
|
|
|
|
|
(if (not (equal (selected-frame) (setq frame (window-frame window))))
|
|
|
|
|
(select-frame-set-input-focus frame))
|
|
|
|
|
(select-window window))
|
|
|
|
|
(message "Thumbnail buffer not visible"))))
|
|
|
|
|
|
2016-12-03 21:18:48 +00:00
|
|
|
|
(defvar image-dired-thumbnail-mode-line-up-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
;; map it to "g" so that the user can press it more quickly
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "g" #'image-dired-line-up-dynamic)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
;; "f" for "fixed" number of thumbs per row
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "f" #'image-dired-line-up)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
;; "i" for "interactive"
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "i" #'image-dired-line-up-interactive)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
map)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Keymap for line-up commands in `image-dired-thumbnail-mode'.")
|
|
|
|
|
|
2016-12-03 21:18:48 +00:00
|
|
|
|
(defvar image-dired-thumbnail-mode-tag-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
;; map it to "t" so that the user can press it more quickly
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "t" #'image-dired-tag-thumbnail)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
;; "r" for "remove"
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "r" #'image-dired-tag-thumbnail-remove)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
map)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Keymap for tag commands in `image-dired-thumbnail-mode'.")
|
|
|
|
|
|
2016-12-03 21:18:48 +00:00
|
|
|
|
(defvar image-dired-thumbnail-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map [right] #'image-dired-forward-image)
|
|
|
|
|
(define-key map [left] #'image-dired-backward-image)
|
|
|
|
|
(define-key map [up] #'image-dired-previous-line)
|
|
|
|
|
(define-key map [down] #'image-dired-next-line)
|
|
|
|
|
(define-key map "\C-f" #'image-dired-forward-image)
|
|
|
|
|
(define-key map "\C-b" #'image-dired-backward-image)
|
|
|
|
|
(define-key map "\C-p" #'image-dired-previous-line)
|
|
|
|
|
(define-key map "\C-n" #'image-dired-next-line)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
|
2021-10-27 01:43:21 +00:00
|
|
|
|
(define-key map "<" #'image-dired-beginning-of-buffer)
|
|
|
|
|
(define-key map ">" #'image-dired-end-of-buffer)
|
|
|
|
|
(define-key map (kbd "M-<") #'image-dired-beginning-of-buffer)
|
|
|
|
|
(define-key map (kbd "M->") #'image-dired-end-of-buffer)
|
2021-10-27 01:23:49 +00:00
|
|
|
|
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "d" #'image-dired-flag-thumb-original-file)
|
|
|
|
|
(define-key map [delete] #'image-dired-flag-thumb-original-file)
|
|
|
|
|
(define-key map "m" #'image-dired-mark-thumb-original-file)
|
|
|
|
|
(define-key map "u" #'image-dired-unmark-thumb-original-file)
|
|
|
|
|
(define-key map "U" #'image-dired-unmark-all-marks)
|
|
|
|
|
(define-key map "." #'image-dired-track-original-file)
|
|
|
|
|
(define-key map [tab] #'image-dired-jump-original-dired-buffer)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
|
|
|
|
|
;; add line-up map
|
|
|
|
|
(define-key map "g" image-dired-thumbnail-mode-line-up-map)
|
|
|
|
|
;; add tag map
|
|
|
|
|
(define-key map "t" image-dired-thumbnail-mode-tag-map)
|
|
|
|
|
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "\C-m" #'image-dired-display-thumbnail-original-image)
|
|
|
|
|
(define-key map [C-return] #'image-dired-thumbnail-display-external)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "L" #'image-dired-rotate-original-left)
|
|
|
|
|
(define-key map "R" #'image-dired-rotate-original-right)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "D" #'image-dired-thumbnail-set-image-description)
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(define-key map "S" #'image-dired-slideshow-start)
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "\C-d" #'image-dired-delete-char)
|
|
|
|
|
(define-key map " " #'image-dired-display-next-thumbnail-original)
|
|
|
|
|
(define-key map (kbd "DEL") #'image-dired-display-previous-thumbnail-original)
|
|
|
|
|
(define-key map "c" #'image-dired-comment-thumbnail)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
|
|
|
|
|
;; Mouse
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map [mouse-2] #'image-dired-mouse-display-image)
|
|
|
|
|
(define-key map [mouse-1] #'image-dired-mouse-select-thumbnail)
|
2021-10-27 02:34:25 +00:00
|
|
|
|
(define-key map [mouse-3] #'image-dired-mouse-select-thumbnail)
|
|
|
|
|
(define-key map [down-mouse-1] #'image-dired-mouse-select-thumbnail)
|
|
|
|
|
(define-key map [down-mouse-2] #'image-dired-mouse-select-thumbnail)
|
|
|
|
|
(define-key map [down-mouse-3] #'image-dired-mouse-select-thumbnail)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
;; Seems I must first set C-down-mouse-1 to undefined, or else it
|
|
|
|
|
;; will trigger the buffer menu. If I try to instead bind
|
|
|
|
|
;; C-down-mouse-1 to `image-dired-mouse-toggle-mark', I get a message
|
|
|
|
|
;; about C-mouse-1 not being defined afterwards. Annoying, but I
|
|
|
|
|
;; probably do not completely understand mouse events.
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map [C-down-mouse-1] #'undefined)
|
|
|
|
|
(define-key map [C-mouse-1] #'image-dired-mouse-toggle-mark)
|
2016-12-03 21:18:48 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for `image-dired-thumbnail-mode'.")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-03 01:39:00 +00:00
|
|
|
|
(easy-menu-define image-dired-thumbnail-mode-menu image-dired-thumbnail-mode-map
|
|
|
|
|
"Menu for `image-dired-thumbnail-mode'."
|
|
|
|
|
'("Image-Dired"
|
|
|
|
|
["Display image" image-dired-display-thumbnail-original-image]
|
|
|
|
|
["Display in external viewer" image-dired-thumbnail-display-external]
|
2021-11-12 02:51:21 +00:00
|
|
|
|
["Jump to Dired buffer" image-dired-jump-original-dired-buffer]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-12 02:51:21 +00:00
|
|
|
|
["Mark image" image-dired-mark-thumb-original-file]
|
|
|
|
|
["Unmark image" image-dired-unmark-thumb-original-file]
|
|
|
|
|
["Unmark all images" image-dired-unmark-all-marks]
|
|
|
|
|
["Flag for deletion" image-dired-flag-thumb-original-file]
|
|
|
|
|
["Delete marked images" image-dired-delete-marked]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Rotate original right" image-dired-rotate-original-right]
|
|
|
|
|
["Rotate original left" image-dired-rotate-original-left]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Comment thumbnail" image-dired-comment-thumbnail]
|
|
|
|
|
["Tag current or marked thumbnails" image-dired-tag-thumbnail]
|
|
|
|
|
["Remove tag from current or marked thumbnails"
|
|
|
|
|
image-dired-tag-thumbnail-remove]
|
2021-11-12 03:10:40 +00:00
|
|
|
|
["Start slideshow" image-dired-slideshow-start]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-12 02:51:21 +00:00
|
|
|
|
("View Options"
|
|
|
|
|
["Toggle movement tracking" image-dired-toggle-movement-tracking
|
|
|
|
|
:style toggle
|
|
|
|
|
:selected image-dired-track-movement]
|
|
|
|
|
"---"
|
|
|
|
|
["Line up thumbnails" image-dired-line-up]
|
|
|
|
|
["Dynamic line up" image-dired-line-up-dynamic]
|
|
|
|
|
["Refresh thumb" image-dired-refresh-thumb])
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Quit" quit-window]))
|
|
|
|
|
|
2016-12-03 21:18:48 +00:00
|
|
|
|
(defvar image-dired-display-image-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(define-key map "S" #'image-dired-slideshow-start)
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(define-key map (kbd "SPC") #'image-dired-display-next-thumbnail-original)
|
|
|
|
|
(define-key map (kbd "DEL") #'image-dired-display-previous-thumbnail-original)
|
|
|
|
|
(define-key map "n" #'image-dired-display-next-thumbnail-original)
|
|
|
|
|
(define-key map "p" #'image-dired-display-previous-thumbnail-original)
|
|
|
|
|
(define-key map "m" #'image-dired-mark-thumb-original-file)
|
|
|
|
|
(define-key map "d" #'image-dired-flag-thumb-original-file)
|
|
|
|
|
(define-key map "u" #'image-dired-unmark-thumb-original-file)
|
|
|
|
|
(define-key map "U" #'image-dired-unmark-all-marks)
|
2021-11-04 01:05:29 +00:00
|
|
|
|
;; Disable keybindings from `image-mode-map' that doesn't make sense here.
|
|
|
|
|
(define-key map "o" nil) ; image-save
|
2016-12-03 21:18:48 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for `image-dired-display-image-mode'.")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(define-derived-mode image-dired-thumbnail-mode
|
2016-12-15 18:49:38 +00:00
|
|
|
|
special-mode "image-dired-thumbnail"
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Browse and manipulate thumbnail images using Dired.
|
2016-12-13 16:32:04 +00:00
|
|
|
|
Use `image-dired-minor-mode' to get a nice setup."
|
2021-11-12 03:27:11 +00:00
|
|
|
|
:interactive nil
|
2016-12-14 03:56:42 +00:00
|
|
|
|
(buffer-disable-undo)
|
2021-10-27 04:05:39 +00:00
|
|
|
|
(add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)
|
2021-11-08 05:20:21 +00:00
|
|
|
|
(setq-local window-resize-pixelwise t)
|
2021-10-27 05:51:35 +00:00
|
|
|
|
(setq-local bookmark-make-record-function #'image-dired-bookmark-make-record)
|
|
|
|
|
;; Use approximately as much vertical spacing as horizontal.
|
|
|
|
|
(setq-local line-spacing (frame-char-width)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Display image mode
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(define-derived-mode image-dired-display-image-mode
|
2021-11-04 01:05:29 +00:00
|
|
|
|
image-mode "image-dired-image-display"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Mode for displaying and manipulating original image.
|
|
|
|
|
Resized or in full-size."
|
2021-11-04 01:05:29 +00:00
|
|
|
|
:interactive nil
|
|
|
|
|
(add-hook 'file-name-at-point-functions #'image-dired-file-name-at-point nil t))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2016-12-13 16:32:04 +00:00
|
|
|
|
(defvar image-dired-minor-mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
;; (set-keymap-parent map dired-mode-map)
|
|
|
|
|
;; Hijack previous and next line movement. Let C-p and C-b be
|
|
|
|
|
;; though...
|
2021-11-12 04:02:27 +00:00
|
|
|
|
(define-key map "p" #'image-dired-dired-previous-line)
|
|
|
|
|
(define-key map "n" #'image-dired-dired-next-line)
|
|
|
|
|
(define-key map [up] #'image-dired-dired-previous-line)
|
|
|
|
|
(define-key map [down] #'image-dired-dired-next-line)
|
|
|
|
|
|
|
|
|
|
(define-key map (kbd "C-S-n") #'image-dired-next-line-and-display)
|
|
|
|
|
(define-key map (kbd "C-S-p") #'image-dired-previous-line-and-display)
|
|
|
|
|
(define-key map (kbd "C-S-m") #'image-dired-mark-and-display-next)
|
|
|
|
|
|
|
|
|
|
(define-key map "\C-td" #'image-dired-display-thumbs)
|
|
|
|
|
(define-key map [tab] #'image-dired-jump-thumbnail-buffer)
|
|
|
|
|
(define-key map "\C-ti" #'image-dired-dired-display-image)
|
|
|
|
|
(define-key map "\C-tx" #'image-dired-dired-display-external)
|
|
|
|
|
(define-key map "\C-ta" #'image-dired-display-thumbs-append)
|
|
|
|
|
(define-key map "\C-t." #'image-dired-display-thumb)
|
|
|
|
|
(define-key map "\C-tc" #'image-dired-dired-comment-files)
|
|
|
|
|
(define-key map "\C-tf" #'image-dired-mark-tagged-files)
|
2016-12-13 16:32:04 +00:00
|
|
|
|
map)
|
|
|
|
|
"Keymap for `image-dired-minor-mode'.")
|
|
|
|
|
|
2021-11-03 01:39:00 +00:00
|
|
|
|
(easy-menu-define image-dired-minor-mode-menu image-dired-minor-mode-map
|
|
|
|
|
"Menu for `image-dired-minor-mode'."
|
|
|
|
|
'("Image-dired"
|
|
|
|
|
["Display thumb for next file" image-dired-next-line-and-display]
|
|
|
|
|
["Display thumb for previous file" image-dired-previous-line-and-display]
|
|
|
|
|
["Mark and display next" image-dired-mark-and-display-next]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Create thumbnails for marked files" image-dired-create-thumbs]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Display thumbnails append" image-dired-display-thumbs-append]
|
|
|
|
|
["Display this thumbnail" image-dired-display-thumb]
|
|
|
|
|
["Display image" image-dired-dired-display-image]
|
|
|
|
|
["Display in external viewer" image-dired-dired-display-external]
|
2021-11-03 02:00:23 +00:00
|
|
|
|
"---"
|
|
|
|
|
["Toggle display properties" image-dired-toggle-dired-display-properties
|
|
|
|
|
:style toggle
|
|
|
|
|
:selected image-dired-dired-disp-props]
|
|
|
|
|
["Toggle append browsing" image-dired-toggle-append-browsing
|
|
|
|
|
:style toggle
|
|
|
|
|
:selected image-dired-append-when-browsing]
|
|
|
|
|
["Toggle movement tracking" image-dired-toggle-movement-tracking
|
|
|
|
|
:style toggle
|
|
|
|
|
:selected image-dired-track-movement]
|
|
|
|
|
"---"
|
2021-11-03 01:39:00 +00:00
|
|
|
|
["Jump to thumbnail buffer" image-dired-jump-thumbnail-buffer]
|
|
|
|
|
["Mark tagged files" image-dired-mark-tagged-files]
|
|
|
|
|
["Comment files" image-dired-dired-comment-files]
|
|
|
|
|
["Copy with EXIF file name" image-dired-copy-with-exif-file-name]))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;;###autoload
|
2016-12-13 16:32:04 +00:00
|
|
|
|
(define-minor-mode image-dired-minor-mode
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Setup easy-to-use keybindings for the commands to be used in Dired mode.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
Note that n, p and <down> and <up> will be hijacked and bound to
|
2021-11-04 01:05:29 +00:00
|
|
|
|
`image-dired-dired-next-line' and `image-dired-dired-previous-line'."
|
2016-12-13 16:32:04 +00:00
|
|
|
|
:keymap image-dired-minor-mode-map)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-17 23:58:26 +00:00
|
|
|
|
(declare-function clear-image-cache "image.c" (&optional filter))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-create-thumbs (&optional arg)
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Create thumbnail images for all marked files in Dired.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
With prefix argument ARG, create thumbnails even if they already exist
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
\(i.e. use this to refresh your thumbnails)."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "P")
|
2016-12-04 18:43:03 +00:00
|
|
|
|
(let (thumb-name)
|
|
|
|
|
(dolist (curr-file (dired-get-marked-files))
|
|
|
|
|
(setq thumb-name (image-dired-thumb-name curr-file))
|
|
|
|
|
;; If the user overrides the exist check, we must clear the
|
|
|
|
|
;; image cache so that if the user wants to display the
|
|
|
|
|
;; thumbnail, it is not fetched from cache.
|
2016-12-16 15:14:01 +00:00
|
|
|
|
(when arg
|
|
|
|
|
(clear-image-cache (expand-file-name thumb-name)))
|
2016-12-04 18:43:03 +00:00
|
|
|
|
(when (or (not (file-exists-p thumb-name))
|
|
|
|
|
arg)
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(image-dired-create-thumb curr-file thumb-name)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
;;; Slideshow
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(defcustom image-dired-slideshow-delay 5.0
|
|
|
|
|
"Seconds to wait before showing the next image in a slideshow.
|
|
|
|
|
This is used by `image-dired-slideshow-start'."
|
|
|
|
|
:type 'float
|
|
|
|
|
:version "29.1")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(define-obsolete-variable-alias 'image-dired-slideshow-timer
|
|
|
|
|
'image-dired--slideshow-timer "29.1")
|
|
|
|
|
(defvar image-dired--slideshow-timer nil
|
|
|
|
|
"Slideshow timer.")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(defvar image-dired--slideshow-initial nil)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-slideshow-step ()
|
2021-11-12 03:10:40 +00:00
|
|
|
|
"Step to next image in a slideshow."
|
|
|
|
|
(if-let ((buf (get-buffer image-dired-thumbnail-buffer)))
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(image-dired-display-next-thumbnail-original))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-slideshow-stop)))
|
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(defun image-dired-slideshow-start (&optional arg)
|
2021-12-07 11:59:18 +00:00
|
|
|
|
"Start a slideshow, waiting `image-dired-slideshow-delay' between images.
|
2021-11-12 03:10:40 +00:00
|
|
|
|
|
|
|
|
|
With prefix argument ARG, wait that many seconds before going to
|
|
|
|
|
the next image.
|
|
|
|
|
|
|
|
|
|
With a negative prefix argument, prompt user for the delay."
|
|
|
|
|
(interactive "P" image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-12-07 11:59:18 +00:00
|
|
|
|
(let ((delay (if (not arg)
|
|
|
|
|
image-dired-slideshow-delay
|
|
|
|
|
(if (> arg 0)
|
|
|
|
|
arg
|
|
|
|
|
(string-to-number
|
|
|
|
|
(let ((delay (number-to-string image-dired-slideshow-delay)))
|
|
|
|
|
(read-string
|
|
|
|
|
(format-prompt "Delay, in seconds. Decimals are accepted" delay))
|
|
|
|
|
delay))))))
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(setq image-dired--slideshow-timer
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(run-with-timer
|
2021-11-12 03:10:40 +00:00
|
|
|
|
0 delay
|
|
|
|
|
'image-dired-slideshow-step))
|
|
|
|
|
(add-hook 'post-command-hook 'image-dired-slideshow-stop)
|
|
|
|
|
(setq image-dired--slideshow-initial t)
|
|
|
|
|
(message "Running slideshow; use any command to stop")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-slideshow-stop ()
|
|
|
|
|
"Cancel slideshow."
|
2021-11-12 03:10:40 +00:00
|
|
|
|
;; Make sure we don't immediately stop after
|
|
|
|
|
;; `image-dired-slideshow-start'.
|
|
|
|
|
(unless image-dired--slideshow-initial
|
|
|
|
|
(remove-hook 'post-command-hook 'image-dired-slideshow-stop)
|
|
|
|
|
(cancel-timer image-dired--slideshow-timer))
|
|
|
|
|
(setq image-dired--slideshow-initial nil))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Thumbnail mode (cont. 3)
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-delete-char ()
|
|
|
|
|
"Remove current thumbnail from thumbnail buffer and line up."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(delete-char 1)
|
2017-02-12 14:46:03 +00:00
|
|
|
|
(when (= (following-char) ?\s)
|
|
|
|
|
(delete-char 1))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-display-thumbs-append ()
|
|
|
|
|
"Append thumbnails to `image-dired-thumbnail-buffer'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(image-dired-display-thumbs nil t t))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-display-thumb ()
|
|
|
|
|
"Shorthand for `image-dired-display-thumbs' with prefix argument."
|
|
|
|
|
(interactive)
|
|
|
|
|
(image-dired-display-thumbs t nil t))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-line-up ()
|
|
|
|
|
"Line up thumbnails according to `image-dired-thumbs-per-row'.
|
|
|
|
|
See also `image-dired-line-up-dynamic'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (and (not (image-dired-image-at-point-p))
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(delete-char 1))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(while (and (not (image-dired-image-at-point-p))
|
|
|
|
|
(not (eobp)))
|
|
|
|
|
(delete-char 1)))
|
|
|
|
|
(goto-char (point-min))
|
2021-10-27 00:36:57 +00:00
|
|
|
|
(let ((seen 0)
|
|
|
|
|
(thumb-prev-pos 0)
|
|
|
|
|
(thumb-width-chars
|
|
|
|
|
(ceiling (/ (+ (* 2 image-dired-thumb-relief)
|
|
|
|
|
(* 2 image-dired-thumb-margin)
|
|
|
|
|
(image-dired-thumb-size 'width))
|
|
|
|
|
(float (frame-char-width))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(if (= image-dired-thumbs-per-row 1)
|
|
|
|
|
(insert "\n")
|
2021-10-27 00:36:57 +00:00
|
|
|
|
(cl-incf thumb-prev-pos thumb-width-chars)
|
|
|
|
|
(insert (propertize " " 'display `(space :align-to ,thumb-prev-pos)))
|
|
|
|
|
(cl-incf seen)
|
|
|
|
|
(when (and (= seen (- image-dired-thumbs-per-row 1))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(not (eobp)))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(insert "\n")
|
2021-10-27 00:36:57 +00:00
|
|
|
|
(setq seen 0)
|
|
|
|
|
(setq thumb-prev-pos 0)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(goto-char (point-min))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-line-up-dynamic ()
|
|
|
|
|
"Line up thumbnails images dynamically.
|
|
|
|
|
Calculate how many thumbnails fit."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((char-width (frame-char-width))
|
|
|
|
|
(width (image-dired-window-width-pixels (image-dired-thumbnail-window)))
|
|
|
|
|
(image-dired-thumbs-per-row
|
|
|
|
|
(/ width
|
|
|
|
|
(+ (* 2 image-dired-thumb-relief)
|
|
|
|
|
(* 2 image-dired-thumb-margin)
|
2016-12-16 00:55:47 +00:00
|
|
|
|
(image-dired-thumb-size 'width)
|
2016-12-15 18:25:08 +00:00
|
|
|
|
char-width))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-line-up)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-line-up-interactive ()
|
|
|
|
|
"Line up thumbnails interactively.
|
|
|
|
|
Ask user how many thumbnails should be displayed per row."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((image-dired-thumbs-per-row
|
|
|
|
|
(string-to-number (read-string "How many thumbs per row: "))))
|
|
|
|
|
(if (not (> image-dired-thumbs-per-row 0))
|
|
|
|
|
(message "Number must be greater than 0")
|
|
|
|
|
(image-dired-line-up))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-thumbnail-display-external ()
|
|
|
|
|
"Display original image for thumbnail at point using external viewer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((file (image-dired-original-file-name)))
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(message "No thumbnail at point")
|
|
|
|
|
(if (not file)
|
|
|
|
|
(message "No original file name found")
|
2016-12-14 03:56:42 +00:00
|
|
|
|
(start-process "image-dired-thumb-external" nil
|
|
|
|
|
image-dired-external-viewer file)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-dired-display-external ()
|
|
|
|
|
"Display file at point using an external viewer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((file (dired-get-filename)))
|
2016-12-14 03:56:42 +00:00
|
|
|
|
(start-process "image-dired-external" nil
|
|
|
|
|
image-dired-external-viewer file)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-window-width-pixels (window)
|
|
|
|
|
"Calculate WINDOW width in pixels."
|
|
|
|
|
(* (window-width window) (frame-char-width)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-display-window ()
|
|
|
|
|
"Return window where `image-dired-display-image-buffer' is visible."
|
|
|
|
|
(get-window-with-predicate
|
|
|
|
|
(lambda (window)
|
|
|
|
|
(equal (buffer-name (window-buffer window)) image-dired-display-image-buffer))
|
|
|
|
|
nil t))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-thumbnail-window ()
|
|
|
|
|
"Return window where `image-dired-thumbnail-buffer' is visible."
|
|
|
|
|
(get-window-with-predicate
|
|
|
|
|
(lambda (window)
|
|
|
|
|
(equal (buffer-name (window-buffer window)) image-dired-thumbnail-buffer))
|
|
|
|
|
nil t))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-associated-dired-buffer-window ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Return window where associated Dired buffer is visible."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let (buf)
|
|
|
|
|
(if (image-dired-image-at-point-p)
|
|
|
|
|
(progn
|
|
|
|
|
(setq buf (image-dired-associated-dired-buffer))
|
|
|
|
|
(get-window-with-predicate
|
|
|
|
|
(lambda (window)
|
|
|
|
|
(equal (window-buffer window) buf))))
|
|
|
|
|
(error "No thumbnail image at point"))))
|
|
|
|
|
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(defun image-dired-display-image (file &optional _ignored)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Display image FILE in image buffer.
|
2021-11-04 01:05:29 +00:00
|
|
|
|
Use this when you want to display the image, in a new window.
|
|
|
|
|
The window will use `image-dired-display-image-mode' which is
|
|
|
|
|
based on `image-mode'."
|
|
|
|
|
(declare (advertised-calling-convention (file) "29.1"))
|
|
|
|
|
(setq file (expand-file-name file))
|
|
|
|
|
(when (not (file-exists-p file))
|
|
|
|
|
(error "No such file: %s" file))
|
|
|
|
|
(let ((buf (get-buffer image-dired-display-image-buffer))
|
|
|
|
|
(cur-win (selected-window)))
|
|
|
|
|
(when buf
|
|
|
|
|
(kill-buffer buf))
|
|
|
|
|
(when-let ((buf (find-file-other-window file)))
|
|
|
|
|
(display-buffer buf)
|
|
|
|
|
(rename-buffer image-dired-display-image-buffer)
|
|
|
|
|
(image-dired-display-image-mode)
|
|
|
|
|
(select-window cur-win))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-display-thumbnail-original-image (&optional arg)
|
|
|
|
|
"Display current thumbnail's original image in display buffer.
|
|
|
|
|
See documentation for `image-dired-display-image' for more information.
|
|
|
|
|
With prefix argument ARG, display image in its original size."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((file (image-dired-original-file-name)))
|
|
|
|
|
(if (not (string-equal major-mode "image-dired-thumbnail-mode"))
|
|
|
|
|
(message "Not in image-dired-thumbnail-mode")
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(message "No thumbnail at point")
|
|
|
|
|
(if (not file)
|
|
|
|
|
(message "No original file name found")
|
|
|
|
|
(image-dired-display-image file arg))))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-dired-display-image (&optional arg)
|
|
|
|
|
"Display current image file.
|
|
|
|
|
See documentation for `image-dired-display-image' for more information.
|
|
|
|
|
With prefix argument ARG, display image in its original size."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(image-dired-display-image (dired-get-filename) arg))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-image-at-point-p ()
|
2021-09-22 18:26:40 +00:00
|
|
|
|
"Return non-nil if there is an `image-dired' thumbnail at point."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(get-text-property (point) 'image-dired-thumbnail))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-refresh-thumb ()
|
|
|
|
|
"Force creation of new image for current thumbnail."
|
2021-10-28 00:10:09 +00:00
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
2016-12-16 15:14:01 +00:00
|
|
|
|
(let* ((file (image-dired-original-file-name))
|
|
|
|
|
(thumb (expand-file-name (image-dired-thumb-name file))))
|
|
|
|
|
(clear-image-cache (expand-file-name thumb))
|
|
|
|
|
(image-dired-create-thumb file thumb)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-original (degrees)
|
|
|
|
|
"Rotate original image DEGREES degrees."
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(image-dired--check-executable-exists
|
|
|
|
|
'image-dired-cmd-rotate-original-program)
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(message "No image at point")
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(let* ((file (image-dired-original-file-name))
|
|
|
|
|
(spec
|
|
|
|
|
(list
|
|
|
|
|
(cons ?d degrees)
|
|
|
|
|
(cons ?o (expand-file-name file))
|
|
|
|
|
(cons ?t image-dired-temp-rotate-image-file))))
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(unless (eq 'jpeg (image-type file))
|
2021-11-20 10:09:23 +00:00
|
|
|
|
(user-error "Only JPEG images can be rotated"))
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(if (not (= 0 (apply #'call-process image-dired-cmd-rotate-original-program
|
|
|
|
|
nil nil nil
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-rotate-original-options))))
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(error "Could not rotate image")
|
|
|
|
|
(image-dired-display-image image-dired-temp-rotate-image-file)
|
|
|
|
|
(if (or (and image-dired-rotate-original-ask-before-overwrite
|
|
|
|
|
(y-or-n-p
|
|
|
|
|
"Rotate to temp file OK. Overwrite original image? "))
|
|
|
|
|
(not image-dired-rotate-original-ask-before-overwrite))
|
|
|
|
|
(progn
|
|
|
|
|
(copy-file image-dired-temp-rotate-image-file file t)
|
|
|
|
|
(image-dired-refresh-thumb))
|
|
|
|
|
(image-dired-display-image file))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-original-left ()
|
2020-01-22 16:05:03 +00:00
|
|
|
|
"Rotate original image left (counter clockwise) 90 degrees.
|
|
|
|
|
The result of the rotation is displayed in the image display area
|
|
|
|
|
and a confirmation is needed before the original image files is
|
|
|
|
|
overwritten. This confirmation can be turned off using
|
|
|
|
|
`image-dired-rotate-original-ask-before-overwrite'."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(image-dired-rotate-original "270"))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-original-right ()
|
2020-01-22 16:05:03 +00:00
|
|
|
|
"Rotate original image right (clockwise) 90 degrees.
|
|
|
|
|
The result of the rotation is displayed in the image display area
|
|
|
|
|
and a confirmation is needed before the original image files is
|
|
|
|
|
overwritten. This confirmation can be turned off using
|
|
|
|
|
`image-dired-rotate-original-ask-before-overwrite'."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(image-dired-rotate-original "90"))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; EXIF support
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-get-exif-file-name (file)
|
|
|
|
|
"Use the image's EXIF information to return a unique file name.
|
|
|
|
|
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
|
|
|
|
|
`image-dired-copy-with-exif-file-name'."
|
|
|
|
|
(let (data no-exif-data-found)
|
2016-09-04 02:09:31 +00:00
|
|
|
|
(if (not (eq 'jpeg (image-type (expand-file-name file))))
|
|
|
|
|
(setq no-exif-data-found t
|
|
|
|
|
data (format-time-string
|
|
|
|
|
"%Y:%m:%d %H:%M:%S"
|
|
|
|
|
(file-attribute-modification-time
|
|
|
|
|
(file-attributes (expand-file-name file)))))
|
2021-10-23 04:49:09 +00:00
|
|
|
|
(setq data (exif-field 'date-time (exif-parse-file
|
|
|
|
|
(expand-file-name file)))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(while (string-match "[ :]" data)
|
|
|
|
|
(setq data (replace-match "_" nil nil data)))
|
|
|
|
|
(format "%s%s%s" data
|
|
|
|
|
(if no-exif-data-found
|
|
|
|
|
"_noexif_"
|
|
|
|
|
"_")
|
|
|
|
|
(file-name-nondirectory file))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-thumbnail-set-image-description ()
|
|
|
|
|
"Set the ImageDescription EXIF tag for the original image.
|
|
|
|
|
If the image already has a value for this tag, it is used as the
|
|
|
|
|
default value at the prompt."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(message "No thumbnail at point")
|
|
|
|
|
(let* ((file (image-dired-original-file-name))
|
2021-10-23 04:49:09 +00:00
|
|
|
|
(old-value (or (exif-field 'description (exif-parse-file file)) "")))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if (eq 0
|
|
|
|
|
(image-dired-set-exif-data file "ImageDescription"
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(read-string "Value of ImageDescription: "
|
|
|
|
|
old-value)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(message "Successfully wrote ImageDescription tag.")
|
|
|
|
|
(error "Could not write ImageDescription tag")))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-set-exif-data (file tag-name tag-value)
|
|
|
|
|
"In FILE, set EXIF tag TAG-NAME to value TAG-VALUE."
|
2016-09-12 19:28:42 +00:00
|
|
|
|
(image-dired--check-executable-exists
|
|
|
|
|
'image-dired-cmd-write-exif-data-program)
|
2016-12-20 00:47:06 +00:00
|
|
|
|
(let ((spec
|
|
|
|
|
(list
|
|
|
|
|
(cons ?f (expand-file-name file))
|
|
|
|
|
(cons ?t tag-name)
|
|
|
|
|
(cons ?v tag-value))))
|
|
|
|
|
(apply #'call-process image-dired-cmd-write-exif-data-program nil nil nil
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-write-exif-data-options))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-copy-with-exif-file-name ()
|
|
|
|
|
"Copy file with unique name to main image directory.
|
2021-10-27 20:10:04 +00:00
|
|
|
|
Copy current or all marked files in Dired to a new file in your
|
2007-04-22 13:44:05 +00:00
|
|
|
|
main image directory, using a file name 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
|
|
|
|
|
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
|
|
|
|
|
2005_05_08_12_52_00_dscn0319.jpg,
|
|
|
|
|
2005_05_08_14_27_45_dscn0320.jpg etc."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let (new-name
|
|
|
|
|
(files (dired-get-marked-files)))
|
2016-12-16 01:36:24 +00:00
|
|
|
|
(mapc
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(lambda (curr-file)
|
|
|
|
|
(setq new-name
|
|
|
|
|
(format "%s/%s"
|
|
|
|
|
(file-name-as-directory
|
|
|
|
|
(expand-file-name image-dired-main-image-directory))
|
|
|
|
|
(image-dired-get-exif-file-name curr-file)))
|
|
|
|
|
(message "Copying %s to %s" curr-file new-name)
|
|
|
|
|
(copy-file curr-file new-name))
|
|
|
|
|
files)))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
;;; Thumbnail mode (cont.)
|
|
|
|
|
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(defun image-dired-display-next-thumbnail-original (&optional arg)
|
2021-12-07 22:28:44 +00:00
|
|
|
|
"Move to the next image in the thumbnail buffer and display it.
|
2021-11-03 02:34:28 +00:00
|
|
|
|
With prefix ARG, move that many thumbnails."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive "p" image-dired-thumbnail-mode image-dired-display-image-mode)
|
|
|
|
|
(image-dired--with-thumbnail-buffer
|
|
|
|
|
(image-dired-forward-image arg t)
|
|
|
|
|
(image-dired-display-thumbnail-original-image)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(defun image-dired-display-previous-thumbnail-original (arg)
|
2021-12-07 22:28:44 +00:00
|
|
|
|
"Move to the previous image in the thumbnail buffer and display it.
|
2021-11-03 02:34:28 +00:00
|
|
|
|
With prefix ARG, move that many thumbnails."
|
2021-12-07 22:28:44 +00:00
|
|
|
|
(interactive "p" image-dired-thumbnail-mode image-dired-display-image-mode)
|
2021-11-03 02:34:28 +00:00
|
|
|
|
(image-dired-display-next-thumbnail-original (- arg)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Image Comments
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-write-comments (file-comments)
|
|
|
|
|
"Write file comments to database.
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
Write file comments to one or more files.
|
|
|
|
|
FILE-COMMENTS is an alist on the following form:
|
2007-04-22 13:44:05 +00:00
|
|
|
|
((FILE . COMMENT) ... )"
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let (end comment-beg-pos comment-end-pos file comment)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(setq buffer-file-name image-dired-db-file)
|
|
|
|
|
(dolist (elt file-comments)
|
|
|
|
|
(setq file (car elt)
|
|
|
|
|
comment (cdr elt))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (search-forward-regexp (format "^%s.*$" file) nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
;; Delete old comment, if any
|
|
|
|
|
(when (search-forward ";comment:" end t)
|
|
|
|
|
(setq comment-beg-pos (match-beginning 0))
|
|
|
|
|
;; Any tags after the comment?
|
|
|
|
|
(if (search-forward ";" end t)
|
|
|
|
|
(setq comment-end-pos (- (point) 1))
|
|
|
|
|
(setq comment-end-pos end))
|
|
|
|
|
;; Delete comment tag and comment
|
|
|
|
|
(delete-region comment-beg-pos comment-end-pos))
|
|
|
|
|
;; Insert new comment
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(unless (search-forward ";" end t)
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(insert ";"))
|
|
|
|
|
(insert (format "comment:%s;" comment)))
|
|
|
|
|
;; File does not exist in database - add it.
|
|
|
|
|
(goto-char (point-max))
|
2021-08-17 23:37:43 +00:00
|
|
|
|
(insert (format "%s;comment:%s\n" file comment))))
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(save-buffer))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-update-property (prop value)
|
|
|
|
|
"Update text property PROP with value VALUE at point."
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(put-text-property
|
|
|
|
|
(point) (1+ (point))
|
|
|
|
|
prop
|
|
|
|
|
value)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-dired-comment-files ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Add comment to current or marked files in Dired."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((comment (image-dired-read-comment)))
|
|
|
|
|
(image-dired-write-comments
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (curr-file)
|
|
|
|
|
(cons curr-file comment))
|
|
|
|
|
(dired-get-marked-files)))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-comment-thumbnail ()
|
|
|
|
|
"Add comment to current thumbnail in thumbnail buffer."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((file (image-dired-original-file-name))
|
|
|
|
|
(comment (image-dired-read-comment file)))
|
|
|
|
|
(image-dired-write-comments (list (cons file comment)))
|
|
|
|
|
(image-dired-update-property 'comment comment))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-read-comment (&optional file)
|
|
|
|
|
"Read comment for an image.
|
Fix typos in docstrings.
* image-dired.el (image-dired-display-thumbs): Fix typo in docstring.
(image-dired-read-comment): Doc fix.
* json.el (json-object-type, json-array-type, json-key-type, json-false)
(json-null, json-read-number):
* minibuffer.el (completion-in-region-functions):
* calendar/cal-tex.el (cal-tex-daily-end, cal-tex-number-weeks)
(cal-tex-cursor-week):
* emacs-lisp/trace.el (trace-function):
* eshell/em-basic.el (eshell/printnl):
* eshell/em-dirs.el (eshell-last-dir-ring, eshell-parse-drive-letter)
(eshell-read-last-dir-ring, eshell-write-last-dir-ring):
* obsolete/levents.el (allocate-event, event-key, event-object)
(event-point, event-process, event-timestamp, event-to-character)
(event-window, event-x, event-x-pixel, event-y, event-y-pixel):
* textmodes/reftex-vars.el (reftex-index-macros-builtin)
(reftex-section-levels, reftex-auto-recenter-toc, reftex-toc-mode-hook)
(reftex-cite-punctuation, reftex-search-unrecursed-path-first)
(reftex-highlight-selection): Fix typos in docstrings.
2010-03-22 16:50:29 +00:00
|
|
|
|
Optionally use old comment from FILE as initial value."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((comment
|
|
|
|
|
(read-string
|
|
|
|
|
"Comment: "
|
|
|
|
|
(if file (image-dired-get-comment file)))))
|
|
|
|
|
comment))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-get-comment (file)
|
|
|
|
|
"Get comment for file FILE."
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(let (end comment-beg-pos comment-end-pos comment)
|
|
|
|
|
(when (search-forward-regexp (format "^%s" file) nil t)
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(when (search-forward ";comment:" end t)
|
|
|
|
|
(setq comment-beg-pos (point))
|
|
|
|
|
(if (search-forward ";" end t)
|
|
|
|
|
(setq comment-end-pos (- (point) 1))
|
|
|
|
|
(setq comment-end-pos end))
|
|
|
|
|
(setq comment (buffer-substring
|
|
|
|
|
comment-beg-pos comment-end-pos))))
|
|
|
|
|
comment)))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
2022-05-12 00:51:53 +00:00
|
|
|
|
(defun image-dired-mark-tagged-files (regexp)
|
|
|
|
|
"Use REGEXP to mark files with matching tag.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
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
|
2021-10-27 02:53:41 +00:00
|
|
|
|
matching tag will be marked in the Dired buffer."
|
2022-05-12 00:51:53 +00:00
|
|
|
|
(interactive "sMark tagged files (regexp): ")
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2022-05-12 00:51:53 +00:00
|
|
|
|
(let ((hits 0)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
files)
|
|
|
|
|
(image-dired--with-db-file
|
2022-05-12 00:51:53 +00:00
|
|
|
|
;; Collect matches
|
|
|
|
|
(while (search-forward-regexp "\\(^[^;\n]+\\);\\(.*\\)" nil t)
|
|
|
|
|
(let ((file (match-string 1))
|
|
|
|
|
(tags (split-string (match-string 2) ";")))
|
|
|
|
|
(when (seq-find (lambda (tag)
|
|
|
|
|
(string-match-p regexp tag))
|
|
|
|
|
tags)
|
|
|
|
|
(push file files)))))
|
2011-08-08 18:21:32 +00:00
|
|
|
|
;; Mark files
|
|
|
|
|
(dolist (curr-file files)
|
|
|
|
|
;; I tried using `dired-mark-files-regexp' but it was waaaay to
|
|
|
|
|
;; slow. Don't bother about hits found in other directories
|
|
|
|
|
;; than the current one.
|
|
|
|
|
(when (string= (file-name-as-directory
|
|
|
|
|
(expand-file-name default-directory))
|
|
|
|
|
(file-name-as-directory
|
|
|
|
|
(file-name-directory curr-file)))
|
|
|
|
|
(setq curr-file (file-name-nondirectory curr-file))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
|
|
|
|
|
(setq hits (+ hits 1))
|
|
|
|
|
(dired-mark 1))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(message "%d files with matching tag marked." hits)))
|
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Mouse support
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-mouse-display-image (event)
|
|
|
|
|
"Use mouse EVENT, call `image-dired-display-image' to display image.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
Track this in associated Dired buffer if `image-dired-track-movement' is
|
2007-04-22 13:44:05 +00:00
|
|
|
|
non-nil."
|
|
|
|
|
(interactive "e")
|
2011-01-28 18:09:59 +00:00
|
|
|
|
(mouse-set-point event)
|
|
|
|
|
(goto-char (posn-point (event-end event)))
|
2021-10-27 02:34:25 +00:00
|
|
|
|
(unless (image-at-point-p)
|
|
|
|
|
(image-dired-backward-image))
|
2011-01-28 18:09:59 +00:00
|
|
|
|
(let ((file (image-dired-original-file-name)))
|
|
|
|
|
(when file
|
|
|
|
|
(if image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
|
|
|
|
(image-dired-display-image file))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-mouse-select-thumbnail (event)
|
|
|
|
|
"Use mouse EVENT to select thumbnail image.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
Track this in associated Dired buffer if `image-dired-track-movement' is
|
2007-04-22 13:44:05 +00:00
|
|
|
|
non-nil."
|
|
|
|
|
(interactive "e")
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(mouse-set-point event)
|
|
|
|
|
(goto-char (posn-point (event-end event)))
|
2021-10-27 02:34:25 +00:00
|
|
|
|
(unless (image-at-point-p)
|
|
|
|
|
(image-dired-backward-image))
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(if image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(image-dired-update-header-line))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Dired marks and tags
|
|
|
|
|
|
2021-11-03 21:34:51 +00:00
|
|
|
|
(defun image-dired-thumb-file-marked-p (&optional flagged)
|
|
|
|
|
"Check if file is marked in associated Dired buffer.
|
|
|
|
|
If optional argument FLAGGED is non-nil, check if file is flagged
|
|
|
|
|
for deletion instead."
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(let ((file-name (image-dired-original-file-name))
|
|
|
|
|
(dired-buf (image-dired-associated-dired-buffer)))
|
|
|
|
|
(when (and dired-buf file-name)
|
|
|
|
|
(with-current-buffer dired-buf
|
2021-10-12 12:31:58 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(when (dired-goto-file file-name)
|
2021-11-03 21:34:51 +00:00
|
|
|
|
(if flagged
|
|
|
|
|
(image-dired-dired-file-flagged-p)
|
|
|
|
|
(image-dired-dired-file-marked-p))))))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-thumb-file-flagged-p ()
|
|
|
|
|
"Check if file is flagged for deletion in associated Dired buffer."
|
|
|
|
|
(image-dired-thumb-file-marked-p t))
|
2021-08-11 12:03:23 +00:00
|
|
|
|
|
2021-08-11 16:02:25 +00:00
|
|
|
|
(defun image-dired-delete-marked ()
|
2021-08-16 22:19:08 +00:00
|
|
|
|
"Delete current or marked thumbnails and associated images."
|
2021-08-11 16:02:25 +00:00
|
|
|
|
(interactive)
|
2021-08-18 12:53:25 +00:00
|
|
|
|
(image-dired--with-marked
|
|
|
|
|
(image-dired-delete-char)
|
2022-01-20 14:16:46 +00:00
|
|
|
|
(unless (bobp)
|
|
|
|
|
(backward-char)))
|
2021-10-12 12:31:58 +00:00
|
|
|
|
(image-dired--line-up-with-method)
|
|
|
|
|
(with-current-buffer (image-dired-associated-dired-buffer)
|
|
|
|
|
(dired-do-delete)))
|
2021-08-11 16:02:25 +00:00
|
|
|
|
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(defun image-dired-thumb-update-marks ()
|
|
|
|
|
"Update the marks in the thumbnail buffer."
|
|
|
|
|
(when image-dired-thumb-visible-marks
|
|
|
|
|
(with-current-buffer image-dired-thumbnail-buffer
|
2021-08-13 10:25:27 +00:00
|
|
|
|
(save-mark-and-excursion
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(while (not (eobp))
|
2021-08-13 10:25:27 +00:00
|
|
|
|
(with-silent-modifications
|
2021-11-03 21:34:51 +00:00
|
|
|
|
(cond ((image-dired-thumb-file-marked-p)
|
|
|
|
|
(add-face-text-property (point) (1+ (point))
|
|
|
|
|
'image-dired-thumb-mark))
|
|
|
|
|
((image-dired-thumb-file-flagged-p)
|
|
|
|
|
(add-face-text-property (point) (1+ (point))
|
|
|
|
|
'image-dired-thumb-flagged))
|
|
|
|
|
(t (remove-text-properties (point) (1+ (point))
|
|
|
|
|
'(face image-dired-thumb-mark)))))
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(forward-char)))))))
|
|
|
|
|
|
2021-08-11 11:39:53 +00:00
|
|
|
|
(defun image-dired-mouse-toggle-mark-1 ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Toggle Dired mark for current thumbnail.
|
|
|
|
|
Track this in associated Dired buffer if
|
|
|
|
|
`image-dired-track-movement' is non-nil."
|
2021-08-11 11:39:53 +00:00
|
|
|
|
(when image-dired-track-movement
|
|
|
|
|
(image-dired-track-original-file))
|
|
|
|
|
(image-dired-toggle-mark-thumb-original-file))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defun image-dired-mouse-toggle-mark (event)
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Use mouse EVENT to toggle Dired mark for thumbnail.
|
2021-08-11 11:39:53 +00:00
|
|
|
|
Toggle marks of all thumbnails in region, if it's active.
|
2021-10-27 02:53:41 +00:00
|
|
|
|
Track this in associated Dired buffer if
|
|
|
|
|
`image-dired-track-movement' is non-nil."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive "e")
|
2021-08-11 11:39:53 +00:00
|
|
|
|
(if (use-region-p)
|
|
|
|
|
(let ((end (region-end)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (region-beginning))
|
|
|
|
|
(while (<= (point) end)
|
|
|
|
|
(when (image-dired-image-at-point-p)
|
|
|
|
|
(image-dired-mouse-toggle-mark-1))
|
|
|
|
|
(forward-char))))
|
|
|
|
|
(mouse-set-point event)
|
|
|
|
|
(goto-char (posn-point (event-end event)))
|
2021-08-11 12:03:23 +00:00
|
|
|
|
(image-dired-mouse-toggle-mark-1))
|
|
|
|
|
(image-dired-thumb-update-marks))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-dired-display-properties ()
|
2021-10-27 02:53:41 +00:00
|
|
|
|
"Display properties for Dired file in the echo area."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((file (dired-get-filename))
|
|
|
|
|
(file-name (file-name-nondirectory file))
|
|
|
|
|
(dired-buf (buffer-name (current-buffer)))
|
2016-12-15 19:40:32 +00:00
|
|
|
|
(props (mapconcat #'identity (image-dired-list-tags file) ", "))
|
|
|
|
|
(comment (image-dired-get-comment file))
|
|
|
|
|
(message-log-max nil))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(if file-name
|
2007-12-06 00:17:56 +00:00
|
|
|
|
(message "%s"
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-format-properties-string
|
|
|
|
|
dired-buf
|
|
|
|
|
file-name
|
|
|
|
|
props
|
|
|
|
|
comment)))))
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
|
|
|
|
|
;;; Gallery support
|
2021-11-04 23:47:00 +00:00
|
|
|
|
|
|
|
|
|
;; 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.
|
2021-11-05 13:47:00 +00:00
|
|
|
|
The name of this directory needs to be \"shared\" to the public
|
|
|
|
|
so that it can access the index.html page that image-dired creates."
|
2021-11-04 23:47:00 +00:00
|
|
|
|
: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.
|
2021-11-05 13:47:00 +00:00
|
|
|
|
Note that this URL has to be configured on your web server.
|
2021-11-04 23:47:00 +00:00
|
|
|
|
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.
|
2021-11-05 13:47:00 +00:00
|
|
|
|
Note that URL path has to be configured on your web server.
|
2021-11-04 23:47:00 +00:00
|
|
|
|
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))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defvar image-dired-tag-file-list nil
|
|
|
|
|
"List to store tag-file structure.")
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-file-tag-list nil
|
|
|
|
|
"List to store file-tag structure.")
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-file-comment-list nil
|
|
|
|
|
"List to store file comments.")
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(defun image-dired--add-to-tag-file-lists (tag file)
|
|
|
|
|
"Helper function used from `image-dired--create-gallery-lists'.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
Add TAG to FILE in one list and FILE to TAG in the other.
|
|
|
|
|
|
|
|
|
|
Lisp structures look like the following:
|
|
|
|
|
|
|
|
|
|
image-dired-file-tag-list:
|
|
|
|
|
|
|
|
|
|
((\"filename1\" \"tag1\" \"tag2\" \"tag3\" ...)
|
|
|
|
|
(\"filename2\" \"tag1\" \"tag2\" \"tag3\" ...)
|
|
|
|
|
...)
|
|
|
|
|
|
|
|
|
|
image-dired-tag-file-list:
|
|
|
|
|
|
|
|
|
|
((\"tag1\" \"filename1\" \"filename2\" \"filename3\" ...)
|
|
|
|
|
(\"tag2\" \"filename1\" \"filename2\" \"filename3\" ...)
|
|
|
|
|
...)"
|
|
|
|
|
;; Add tag to file list
|
|
|
|
|
(let (curr)
|
|
|
|
|
(if image-dired-file-tag-list
|
|
|
|
|
(if (setq curr (assoc file image-dired-file-tag-list))
|
|
|
|
|
(setcdr curr (cons tag (cdr curr)))
|
|
|
|
|
(setcdr image-dired-file-tag-list
|
|
|
|
|
(cons (list file tag) (cdr image-dired-file-tag-list))))
|
|
|
|
|
(setq image-dired-file-tag-list (list (list file tag))))
|
|
|
|
|
;; Add file to tag list
|
|
|
|
|
(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))))))
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(defun image-dired--add-to-file-comment-list (file comment)
|
|
|
|
|
"Helper function used from `image-dired--create-gallery-lists'.
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
For FILE, add COMMENT to list.
|
|
|
|
|
|
|
|
|
|
Lisp structure looks like the following:
|
|
|
|
|
|
|
|
|
|
image-dired-file-comment-list:
|
|
|
|
|
|
|
|
|
|
((\"filename1\" . \"comment1\")
|
|
|
|
|
(\"filename2\" . \"comment2\")
|
|
|
|
|
...)"
|
|
|
|
|
(if image-dired-file-comment-list
|
|
|
|
|
(if (not (assoc file image-dired-file-comment-list))
|
|
|
|
|
(setcdr image-dired-file-comment-list
|
|
|
|
|
(cons (cons file comment)
|
|
|
|
|
(cdr image-dired-file-comment-list))))
|
|
|
|
|
(setq image-dired-file-comment-list (list (cons file comment)))))
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(defun image-dired--create-gallery-lists ()
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Create temporary lists used by `image-dired-gallery-generate'."
|
2007-07-21 23:43:59 +00:00
|
|
|
|
(image-dired-sane-db-file)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(image-dired--with-db-file
|
|
|
|
|
(let (end beg file row-tags)
|
|
|
|
|
(setq image-dired-tag-file-list nil)
|
|
|
|
|
(setq image-dired-file-tag-list nil)
|
|
|
|
|
(setq image-dired-file-comment-list nil)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward-regexp "^." nil t)
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(unless (search-forward ";" end nil)
|
|
|
|
|
(error "Something is really wrong, check format of database"))
|
|
|
|
|
(setq row-tags (split-string
|
|
|
|
|
(buffer-substring beg end) ";"))
|
|
|
|
|
(setq file (car row-tags))
|
|
|
|
|
(dolist (x (cdr row-tags))
|
|
|
|
|
(if (not (string-match "^comment:\\(.*\\)" x))
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(image-dired--add-to-tag-file-lists x file)
|
|
|
|
|
(image-dired--add-to-file-comment-list file (match-string 1 x)))))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; Sort tag-file list
|
|
|
|
|
(setq image-dired-tag-file-list
|
|
|
|
|
(sort image-dired-tag-file-list
|
|
|
|
|
(lambda (x y)
|
|
|
|
|
(string< (car x) (car y))))))
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(defun image-dired--hidden-p (file)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
"Return t if image FILE has a \"hidden\" tag."
|
2016-12-13 16:47:21 +00:00
|
|
|
|
(cl-loop for tag in (cdr (assoc file image-dired-file-tag-list))
|
|
|
|
|
if (member tag image-dired-gallery-hidden-tags) return t))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
|
|
|
|
(defun image-dired-gallery-generate ()
|
|
|
|
|
"Generate gallery pages.
|
|
|
|
|
First we create a couple of Lisp structures from the database to make
|
|
|
|
|
it easier to generate, then HTML-files are created in
|
* completion.el (add-completion-to-head, add-completion): Doc fixes.
(completion-search-next, add-completions-from-file):
Fix typos in docstrings.
* filesets.el (filesets-menu-ensure-use-cached)
(filesets-ingroup-patterns, filesets-filetype-property):
* tutorial.el (get-lang-string):
* play/gamegrid.el (gamegrid-score-file-length, gamegrid-add-score):
Fix typos in docstrings.
* image-dired.el (image-dired-dired-after-readin-hook): Doc fix.
(image-dired-line-up-method, image-dired-thumb-size)
(image-dired-cmd-write-exif-data-options, image-dired-write-tags)
(image-dired-track-original-file, image-dired-track-thumbnail)
(image-dired-dired-next-line, image-dired-dired-previous-line)
(image-dired-write-comments): Reflow docstrings.
(image-dired-show-all-from-dir-max-files)
(image-dired-format-properties-string, image-dired-create-thumbs)
(image-dired-mark-tagged-files, image-dired-gallery-generate):
Fix typos in docstrings.
* savehist.el (savehist-save-minibuffer-history, savehist-file)
(savehist-additional-variables, savehist-ignored-variables)
(savehist-file-modes, savehist-autosave-interval):
* startup.el (inhibit-startup-echo-area-message, inhibit-default-init)
(inhibit-startup-buffer-menu, mail-host-address, user-mail-address)
(fancy-splash-image):
* thumbs.el (thumbs-thumbsdir, thumbs-geometry, thumbs-relief)
(thumbs-conversion-program, thumbs-margin):
Remove spurious * in docstrings.
2008-10-25 00:46:25 +00:00
|
|
|
|
`image-dired-gallery-dir'."
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (eq 'per-directory image-dired-thumbnail-storage)
|
|
|
|
|
(error "Currently, gallery generation is not supported \
|
|
|
|
|
when using per-directory thumbnail file storage"))
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(image-dired--create-gallery-lists)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(let ((tags image-dired-tag-file-list)
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(index-file (format "%s/index.html" image-dired-gallery-dir))
|
|
|
|
|
count tag tag-file
|
2007-04-22 13:44:05 +00:00
|
|
|
|
comment file-tags tag-link tag-link-list)
|
|
|
|
|
;; Make sure gallery root exist
|
|
|
|
|
(if (file-exists-p image-dired-gallery-dir)
|
|
|
|
|
(if (not (file-directory-p image-dired-gallery-dir))
|
|
|
|
|
(error "Variable image-dired-gallery-dir is not a directory"))
|
2021-10-24 19:20:16 +00:00
|
|
|
|
;; FIXME: Should we set umask to 077 here, as we do for thumbnails?
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(make-directory image-dired-gallery-dir))
|
|
|
|
|
;; Open index file
|
2011-08-08 18:21:32 +00:00
|
|
|
|
(with-temp-file index-file
|
|
|
|
|
(if (file-exists-p index-file)
|
|
|
|
|
(insert-file-contents index-file))
|
|
|
|
|
(insert "<html>\n")
|
|
|
|
|
(insert " <body>\n")
|
|
|
|
|
(insert " <h2>Image-Dired Gallery</h2>\n")
|
|
|
|
|
(insert (format "<p>\n Gallery generated %s\n <p>\n"
|
|
|
|
|
(current-time-string)))
|
|
|
|
|
(insert " <h3>Tag index</h3>\n")
|
|
|
|
|
(setq count 1)
|
|
|
|
|
;; Pre-generate list of all tag links
|
|
|
|
|
(dolist (curr tags)
|
|
|
|
|
(setq tag (car curr))
|
|
|
|
|
(when (not (member tag image-dired-gallery-hidden-tags))
|
|
|
|
|
(setq tag-link (format "<a href=\"%d.html\">%s</a>" count tag))
|
|
|
|
|
(if tag-link-list
|
|
|
|
|
(setq tag-link-list
|
|
|
|
|
(append tag-link-list (list (cons tag tag-link))))
|
|
|
|
|
(setq tag-link-list (list (cons tag tag-link))))
|
|
|
|
|
(setq count (1+ count))))
|
|
|
|
|
(setq count 1)
|
|
|
|
|
;; Main loop where we generated thumbnail pages per tag
|
|
|
|
|
(dolist (curr tags)
|
|
|
|
|
(setq tag (car curr))
|
|
|
|
|
;; Don't display hidden tags
|
|
|
|
|
(when (not (member tag image-dired-gallery-hidden-tags))
|
|
|
|
|
;; Insert link to tag page in index
|
|
|
|
|
(insert (format " %s<br>\n" (cdr (assoc tag tag-link-list))))
|
|
|
|
|
;; Open per-tag file
|
|
|
|
|
(setq tag-file (format "%s/%s.html" image-dired-gallery-dir count))
|
|
|
|
|
(with-temp-file tag-file
|
|
|
|
|
(if (file-exists-p tag-file)
|
|
|
|
|
(insert-file-contents tag-file))
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert "<html>\n")
|
|
|
|
|
(insert " <body>\n")
|
|
|
|
|
(insert " <p><a href=\"index.html\">Index</a></p>\n")
|
|
|
|
|
(insert (format " <h2>Images with tag "%s"</h2>" tag))
|
|
|
|
|
;; Main loop for files per tag page
|
|
|
|
|
(dolist (file (cdr curr))
|
|
|
|
|
(unless (image-dired-hidden-p file)
|
|
|
|
|
;; Insert thumbnail with link to full image
|
|
|
|
|
(insert
|
|
|
|
|
(format "<a href=\"%s/%s\"><img src=\"%s/%s\"%s></a>\n"
|
|
|
|
|
image-dired-gallery-image-root-url
|
|
|
|
|
(file-name-nondirectory file)
|
|
|
|
|
image-dired-gallery-thumb-image-root-url
|
|
|
|
|
(file-name-nondirectory (image-dired-thumb-name file)) file))
|
|
|
|
|
;; Insert comment, if any
|
|
|
|
|
(if (setq comment (cdr (assoc file image-dired-file-comment-list)))
|
|
|
|
|
(insert (format "<br>\n%s<br>\n" comment))
|
|
|
|
|
(insert "<br>\n"))
|
|
|
|
|
;; Insert links to other tags, if any
|
|
|
|
|
(when (> (length
|
|
|
|
|
(setq file-tags (assoc file image-dired-file-tag-list))) 2)
|
|
|
|
|
(insert "[ ")
|
|
|
|
|
(dolist (extra-tag file-tags)
|
|
|
|
|
;; Only insert if not file name or the main tag
|
|
|
|
|
(if (and (not (equal extra-tag tag))
|
|
|
|
|
(not (equal extra-tag file)))
|
|
|
|
|
(insert
|
|
|
|
|
(format "%s " (cdr (assoc extra-tag tag-link-list))))))
|
|
|
|
|
(insert "]<br>\n"))))
|
|
|
|
|
(insert " <p><a href=\"index.html\">Index</a></p>\n")
|
|
|
|
|
(insert " </body>\n")
|
|
|
|
|
(insert "</html>\n"))
|
|
|
|
|
(setq count (1+ count))))
|
|
|
|
|
(insert " </body>\n")
|
|
|
|
|
(insert "</html>"))))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
;;; Tag support
|
2021-11-04 23:47:00 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(defvar image-dired-widget-list nil
|
|
|
|
|
"List to keep track of meta data in edit buffer.")
|
|
|
|
|
|
lisp/*.el: Add missing declarations.
* descr-text.el (quail-find-key):
* dired.el (desktop-file-name):
* dirtrack.el (shell-prefixed-directory-name, shell-process-cd):
* generic-x.el (comint-mode, comint-exec):
* image-dired.el (widget-forward):
* info.el (speedbar-add-expansion-list, speedbar-center-buffer-smartly)
(speedbar-change-expand-button-char)
(speedbar-change-initial-expansion-list, speedbar-delete-subblock)
(speedbar-make-specialized-keymap, speedbar-make-tag-line):
* printing.el (easy-menu-add-item, easy-menu-remove-item)
(widget-field-action, widget-value-set):
* speedbar.el (imenu--make-index-alist):
* term.el (ring-empty-p, ring-ref, ring-insert-at-beginning)
(ring-length, ring-insert):
* vcursor.el (compare-windows-skip-whitespace):
* woman.el (dired-get-filename):
Declare functions.
* term/w32-win.el (cygwin-convert-path-from-windows): Fix declaration.
2012-11-17 21:52:12 +00:00
|
|
|
|
(declare-function widget-forward "wid-edit" (arg))
|
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-dired-edit-comment-and-tags ()
|
|
|
|
|
"Edit comment and tags of current or marked image files.
|
|
|
|
|
Edit comment and tags for all marked image files in an
|
|
|
|
|
easy-to-use form."
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq image-dired-widget-list nil)
|
|
|
|
|
;; Setup buffer.
|
|
|
|
|
(let ((files (dired-get-marked-files)))
|
2016-12-02 21:50:25 +00:00
|
|
|
|
(pop-to-buffer-same-window "*Image-Dired Edit Meta Data*")
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(erase-buffer))
|
|
|
|
|
(remove-overlays)
|
|
|
|
|
;; Some help for the user.
|
|
|
|
|
(widget-insert
|
|
|
|
|
"\nEdit comments and tags for each image. Separate multiple tags
|
|
|
|
|
with a comma. Move forward between fields using TAB or RET.
|
|
|
|
|
Move to the previous field using backtab (S-TAB). Save by
|
|
|
|
|
activating the Save button at the bottom of the form or cancel
|
|
|
|
|
the operation by activating the Cancel button.\n\n")
|
|
|
|
|
;; Here comes all images and a comment and tag field for each
|
|
|
|
|
;; image.
|
|
|
|
|
(let (thumb-file img comment-widget tag-widget)
|
|
|
|
|
|
|
|
|
|
(dolist (file files)
|
|
|
|
|
|
|
|
|
|
(setq thumb-file (image-dired-thumb-name file)
|
|
|
|
|
img (create-image thumb-file))
|
|
|
|
|
|
|
|
|
|
(insert-image img)
|
|
|
|
|
(widget-insert "\n\nComment: ")
|
|
|
|
|
(setq comment-widget
|
|
|
|
|
(widget-create 'editable-field
|
|
|
|
|
:size 60
|
|
|
|
|
:format "%v "
|
|
|
|
|
:value (or (image-dired-get-comment file) "")))
|
|
|
|
|
(widget-insert "\nTags: ")
|
|
|
|
|
(setq tag-widget
|
|
|
|
|
(widget-create 'editable-field
|
|
|
|
|
:size 60
|
|
|
|
|
:format "%v "
|
|
|
|
|
:value (or (mapconcat
|
2016-12-16 01:36:24 +00:00
|
|
|
|
#'identity
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-list-tags file)
|
|
|
|
|
",") "")))
|
|
|
|
|
;; Save information in all widgets so that we can use it when
|
|
|
|
|
;; the user saves the form.
|
|
|
|
|
(setq image-dired-widget-list
|
|
|
|
|
(append image-dired-widget-list
|
|
|
|
|
(list (list file comment-widget tag-widget))))
|
|
|
|
|
(widget-insert "\n\n")))
|
|
|
|
|
|
|
|
|
|
;; Footer with Save and Cancel button.
|
|
|
|
|
(widget-insert "\n")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(lambda (&rest _ignore)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(image-dired-save-information-from-widgets)
|
|
|
|
|
(bury-buffer)
|
|
|
|
|
(message "Done."))
|
|
|
|
|
"Save")
|
|
|
|
|
(widget-insert " ")
|
|
|
|
|
(widget-create 'push-button
|
|
|
|
|
:notify
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(lambda (&rest _ignore)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
(bury-buffer)
|
|
|
|
|
(message "Operation canceled."))
|
|
|
|
|
"Cancel")
|
|
|
|
|
(widget-insert "\n")
|
|
|
|
|
(use-local-map widget-keymap)
|
|
|
|
|
(widget-setup)
|
|
|
|
|
;; Jump to the first widget.
|
|
|
|
|
(widget-forward 1)))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-save-information-from-widgets ()
|
|
|
|
|
"Save information found in `image-dired-widget-list'.
|
|
|
|
|
Use the information in `image-dired-widget-list' to save comments and
|
|
|
|
|
tags to their respective image file. Internal function used by
|
|
|
|
|
`image-dired-dired-edit-comment-and-tags'."
|
|
|
|
|
(let (file comment tag-string tag-list lst)
|
|
|
|
|
(image-dired-write-comments
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (widget)
|
|
|
|
|
(setq file (car widget)
|
|
|
|
|
comment (widget-value (cadr widget)))
|
|
|
|
|
(cons file comment))
|
|
|
|
|
image-dired-widget-list))
|
|
|
|
|
(image-dired-write-tags
|
|
|
|
|
(dolist (widget image-dired-widget-list lst)
|
|
|
|
|
(setq file (car widget)
|
|
|
|
|
tag-string (widget-value (car (cddr widget)))
|
|
|
|
|
tag-list (split-string tag-string ","))
|
|
|
|
|
(dolist (tag tag-list)
|
|
|
|
|
(push (cons file tag) lst))))))
|
|
|
|
|
|
2021-10-27 04:05:39 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
;;; bookmark.el support
|
2021-10-27 04:05:39 +00:00
|
|
|
|
|
|
|
|
|
(declare-function bookmark-make-record-default
|
|
|
|
|
"bookmark" (&optional no-file no-context posn))
|
|
|
|
|
(declare-function bookmark-prop-get "bookmark" (bookmark prop))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-bookmark-name ()
|
|
|
|
|
"Create a default bookmark name for the current EWW buffer."
|
|
|
|
|
(file-name-nondirectory
|
|
|
|
|
(directory-file-name
|
|
|
|
|
(file-name-directory (image-dired-original-file-name)))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-bookmark-make-record ()
|
|
|
|
|
"Create a bookmark for the current EWW buffer."
|
|
|
|
|
`(,(image-dired-bookmark-name)
|
|
|
|
|
,@(bookmark-make-record-default t)
|
|
|
|
|
(location . ,(file-name-directory (image-dired-original-file-name)))
|
|
|
|
|
(image-dired-file . ,(file-name-nondirectory (image-dired-original-file-name)))
|
|
|
|
|
(handler . image-dired-bookmark-jump)))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun image-dired-bookmark-jump (bookmark)
|
|
|
|
|
"Default bookmark handler for Image-Dired buffers."
|
|
|
|
|
;; User already cached thumbnails, so disable any checking.
|
2021-10-27 18:39:10 +00:00
|
|
|
|
(let ((image-dired-show-all-from-dir-max-files nil))
|
2021-10-27 04:05:39 +00:00
|
|
|
|
(image-dired (bookmark-prop-get bookmark 'location))
|
|
|
|
|
;; TODO: Go to the bookmarked file, if it exists.
|
|
|
|
|
;; (bookmark-prop-get bookmark 'image-dired-file)
|
|
|
|
|
(goto-char (point-min))))
|
|
|
|
|
|
2022-06-17 19:14:39 +00:00
|
|
|
|
(put 'image-dired-bookmark-jump 'bookmark-handler-type "Image-Dired")
|
2021-10-27 04:05:39 +00:00
|
|
|
|
|
2021-11-08 05:42:44 +00:00
|
|
|
|
;;; Obsolete
|
2021-10-23 04:49:09 +00:00
|
|
|
|
|
2021-10-27 03:16:05 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(define-obsolete-function-alias 'tumme #'image-dired "24.4")
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(define-obsolete-function-alias 'image-dired-setup-dired-keybindings
|
|
|
|
|
#'image-dired-minor-mode "26.1")
|
|
|
|
|
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(defcustom image-dired-temp-image-file
|
|
|
|
|
(expand-file-name ".image-dired_temp" image-dired-dir)
|
|
|
|
|
"Name of temporary image file used by various commands."
|
|
|
|
|
:type 'file)
|
|
|
|
|
(make-obsolete-variable 'image-dired-temp-image-file
|
|
|
|
|
"no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-create-temp-image-program
|
|
|
|
|
(if (executable-find "gm") "gm" "convert")
|
|
|
|
|
"Executable used to create temporary image.
|
|
|
|
|
Used together with `image-dired-cmd-create-temp-image-options'."
|
|
|
|
|
:type 'file
|
|
|
|
|
:version "29.1")
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-create-temp-image-program
|
|
|
|
|
"no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-create-temp-image-options
|
|
|
|
|
(let ((opts '("-size" "%wx%h" "%f[0]"
|
|
|
|
|
"-resize" "%wx%h>"
|
|
|
|
|
"-strip" "jpeg:%t")))
|
|
|
|
|
(if (executable-find "gm") (cons "convert" opts) opts))
|
|
|
|
|
"Options of command used to create temporary image for display window.
|
|
|
|
|
Used together with `image-dired-cmd-create-temp-image-program',
|
|
|
|
|
Available format specifiers are: %w and %h which are replaced by
|
|
|
|
|
the calculated max size for width and height in the image display window,
|
|
|
|
|
%f which is replaced by the file name of the original image and %t which
|
|
|
|
|
is replaced by the file name of the temporary file."
|
|
|
|
|
:version "29.1"
|
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-create-temp-image-options
|
|
|
|
|
"no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-display-window-width-correction 1
|
|
|
|
|
"Number to be used to correct image display window width.
|
|
|
|
|
Change if the default (1) does not work (i.e. if the image does not
|
|
|
|
|
completely fit)."
|
|
|
|
|
:type 'integer)
|
|
|
|
|
(make-obsolete-variable 'image-dired-display-window-width-correction
|
|
|
|
|
"no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-display-window-height-correction 0
|
|
|
|
|
"Number to be used to correct image display window height.
|
|
|
|
|
Change if the default (0) does not work (i.e. if the image does not
|
|
|
|
|
completely fit)."
|
|
|
|
|
:type 'integer)
|
|
|
|
|
(make-obsolete-variable 'image-dired-display-window-height-correction
|
|
|
|
|
"no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defun image-dired-display-window-width (window)
|
|
|
|
|
"Return width, in pixels, of WINDOW."
|
|
|
|
|
(declare (obsolete nil "29.1"))
|
|
|
|
|
(- (image-dired-window-width-pixels window)
|
|
|
|
|
image-dired-display-window-width-correction))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-display-window-height (window)
|
|
|
|
|
"Return height, in pixels, of WINDOW."
|
|
|
|
|
(declare (obsolete nil "29.1"))
|
|
|
|
|
(- (image-dired-window-height-pixels window)
|
|
|
|
|
image-dired-display-window-height-correction))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-window-height-pixels (window)
|
|
|
|
|
"Calculate WINDOW height in pixels."
|
|
|
|
|
(declare (obsolete nil "29.1"))
|
|
|
|
|
;; Note: The mode-line consumes one line
|
|
|
|
|
(* (- (window-height window) 1) (frame-char-height)))
|
|
|
|
|
|
2021-10-23 04:49:09 +00:00
|
|
|
|
(defcustom image-dired-cmd-read-exif-data-program "exiftool"
|
|
|
|
|
"Program used to read EXIF data to image.
|
|
|
|
|
Used together with `image-dired-cmd-read-exif-data-options'."
|
|
|
|
|
:type 'file)
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-read-exif-data-program
|
|
|
|
|
"use `exif-parse-file' and `exif-field' instead." "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-read-exif-data-options '("-s" "-s" "-s" "-%t" "%f")
|
|
|
|
|
"Arguments of command used to read EXIF data.
|
|
|
|
|
Used with `image-dired-cmd-read-exif-data-program'.
|
|
|
|
|
Available format specifiers are: %f which is replaced
|
|
|
|
|
by the image file name and %t which is replaced by the tag name."
|
|
|
|
|
:version "26.1"
|
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-read-exif-data-options
|
|
|
|
|
"use `exif-parse-file' and `exif-field' instead." "29.1")
|
|
|
|
|
|
|
|
|
|
(defun image-dired-get-exif-data (file tag-name)
|
|
|
|
|
"From FILE, return EXIF tag TAG-NAME."
|
|
|
|
|
(declare (obsolete "use `exif-parse-file' and `exif-field' instead." "29.1"))
|
|
|
|
|
(image-dired--check-executable-exists
|
|
|
|
|
'image-dired-cmd-read-exif-data-program)
|
|
|
|
|
(let ((buf (get-buffer-create "*image-dired-get-exif-data*"))
|
|
|
|
|
(spec (list (cons ?f file) (cons ?t tag-name)))
|
|
|
|
|
tag-value)
|
|
|
|
|
(with-current-buffer buf
|
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
|
(if (not (eq (apply #'call-process image-dired-cmd-read-exif-data-program
|
|
|
|
|
nil t nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-read-exif-data-options))
|
|
|
|
|
0))
|
|
|
|
|
(error "Could not get EXIF tag")
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
;; Clean buffer from newlines and carriage returns before
|
|
|
|
|
;; getting final info
|
|
|
|
|
(while (search-forward-regexp "[\n\r]" nil t)
|
|
|
|
|
(replace-match "" nil t))
|
|
|
|
|
(setq tag-value (buffer-substring (point-min) (point-max)))))
|
|
|
|
|
tag-value))
|
|
|
|
|
|
2021-10-27 23:59:01 +00:00
|
|
|
|
(defcustom image-dired-cmd-rotate-thumbnail-program
|
|
|
|
|
(if (executable-find "gm") "gm" "mogrify")
|
|
|
|
|
"Executable used to rotate thumbnail.
|
|
|
|
|
Used together with `image-dired-cmd-rotate-thumbnail-options'."
|
|
|
|
|
:type 'file
|
|
|
|
|
:version "29.1")
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-rotate-thumbnail-program nil "29.1")
|
|
|
|
|
|
|
|
|
|
(defcustom image-dired-cmd-rotate-thumbnail-options
|
|
|
|
|
(let ((opts '("-rotate" "%d" "%t")))
|
|
|
|
|
(if (executable-find "gm") (cons "mogrify" opts) opts))
|
|
|
|
|
"Arguments of command used to rotate thumbnail image.
|
|
|
|
|
Used with `image-dired-cmd-rotate-thumbnail-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), %t which is replaced by the file name
|
|
|
|
|
of the thumbnail file."
|
|
|
|
|
:version "29.1"
|
|
|
|
|
:type '(repeat (string :tag "Argument")))
|
|
|
|
|
(make-obsolete-variable 'image-dired-cmd-rotate-thumbnail-options nil "29.1")
|
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-thumbnail (degrees)
|
|
|
|
|
"Rotate thumbnail DEGREES degrees."
|
|
|
|
|
(declare (obsolete image-dired-refresh-thumb "29.1"))
|
|
|
|
|
(image-dired--check-executable-exists
|
|
|
|
|
'image-dired-cmd-rotate-thumbnail-program)
|
|
|
|
|
(if (not (image-dired-image-at-point-p))
|
|
|
|
|
(message "No thumbnail at point")
|
|
|
|
|
(let* ((file (image-dired-thumb-name (image-dired-original-file-name)))
|
|
|
|
|
(thumb (expand-file-name file))
|
|
|
|
|
(spec (list (cons ?d degrees) (cons ?t thumb))))
|
|
|
|
|
(apply #'call-process image-dired-cmd-rotate-thumbnail-program nil nil nil
|
|
|
|
|
(mapcar (lambda (arg) (format-spec arg spec))
|
|
|
|
|
image-dired-cmd-rotate-thumbnail-options))
|
|
|
|
|
(clear-image-cache thumb))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-thumbnail-left ()
|
|
|
|
|
"Rotate thumbnail left (counter clockwise) 90 degrees."
|
|
|
|
|
(declare (obsolete image-dired-refresh-thumb "29.1"))
|
|
|
|
|
(interactive)
|
|
|
|
|
(with-suppressed-warnings ((obsolete image-dired-rotate-thumbnail))
|
|
|
|
|
(image-dired-rotate-thumbnail "270")))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-rotate-thumbnail-right ()
|
|
|
|
|
"Rotate thumbnail counter right (clockwise) 90 degrees."
|
|
|
|
|
(declare (obsolete image-dired-refresh-thumb "29.1"))
|
|
|
|
|
(interactive)
|
|
|
|
|
(with-suppressed-warnings ((obsolete image-dired-rotate-thumbnail))
|
|
|
|
|
(image-dired-rotate-thumbnail "90")))
|
|
|
|
|
|
2021-11-03 06:02:13 +00:00
|
|
|
|
(defun image-dired-modify-mark-on-thumb-original-file (command)
|
|
|
|
|
"Modify mark in Dired buffer.
|
|
|
|
|
COMMAND is one of `mark' for marking file in Dired, `unmark' for
|
|
|
|
|
unmarking file in Dired or `flag' for flagging file for delete in
|
|
|
|
|
Dired."
|
|
|
|
|
(declare (obsolete image-dired--on-file-in-dired-buffer "29.1"))
|
|
|
|
|
(let ((file-name (image-dired-original-file-name))
|
|
|
|
|
(dired-buf (image-dired-associated-dired-buffer)))
|
|
|
|
|
(if (not (and dired-buf file-name))
|
|
|
|
|
(message "No image, or image with correct properties, at point.")
|
|
|
|
|
(with-current-buffer dired-buf
|
|
|
|
|
(message "%s" file-name)
|
|
|
|
|
(when (dired-goto-file file-name)
|
|
|
|
|
(cond ((eq command 'mark) (dired-mark 1))
|
|
|
|
|
((eq command 'unmark) (dired-unmark 1))
|
|
|
|
|
((eq command 'toggle)
|
|
|
|
|
(if (image-dired-dired-file-marked-p)
|
|
|
|
|
(dired-unmark 1)
|
|
|
|
|
(dired-mark 1)))
|
|
|
|
|
((eq command 'flag) (dired-flag-file-deletion 1)))
|
|
|
|
|
(image-dired-thumb-update-marks))))))
|
|
|
|
|
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(defun image-dired-display-current-image-full ()
|
|
|
|
|
"Display current image in full size."
|
|
|
|
|
(declare (obsolete image-transform-original "29.1"))
|
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
|
|
|
|
(let ((file (image-dired-original-file-name)))
|
|
|
|
|
(if file
|
|
|
|
|
(progn
|
|
|
|
|
(image-dired-display-image file)
|
|
|
|
|
(with-current-buffer image-dired-display-image-buffer
|
2021-11-04 18:05:44 +00:00
|
|
|
|
(image-transform-original)))
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(error "No original file name at point"))))
|
|
|
|
|
|
|
|
|
|
(defun image-dired-display-current-image-sized ()
|
|
|
|
|
"Display current image in sized to fit window dimensions."
|
|
|
|
|
(declare (obsolete image-mode-fit-frame "29.1"))
|
|
|
|
|
(interactive nil image-dired-thumbnail-mode)
|
|
|
|
|
(let ((file (image-dired-original-file-name)))
|
|
|
|
|
(if file
|
|
|
|
|
(progn
|
|
|
|
|
(image-dired-display-image file))
|
|
|
|
|
(error "No original file name at point"))))
|
|
|
|
|
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(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))))))
|
|
|
|
|
|
2021-12-09 02:28:19 +00:00
|
|
|
|
(defun image-dired-display-thumb-properties ()
|
|
|
|
|
"Display thumbnail properties in the echo area."
|
|
|
|
|
(declare (obsolete image-dired-update-header-line "29.1"))
|
|
|
|
|
(image-dired-update-header-line))
|
|
|
|
|
|
2021-11-12 03:10:40 +00:00
|
|
|
|
(defvar image-dired-slideshow-count 0
|
|
|
|
|
"Keeping track on number of images in slideshow.")
|
|
|
|
|
(make-obsolete-variable 'image-dired-slideshow-count "no longer used." "29.1")
|
|
|
|
|
|
|
|
|
|
(defvar image-dired-slideshow-times 0
|
|
|
|
|
"Number of pictures to display in slideshow.")
|
|
|
|
|
(make-obsolete-variable 'image-dired-slideshow-times "no longer used." "29.1")
|
|
|
|
|
|
2021-11-04 01:05:29 +00:00
|
|
|
|
(define-obsolete-function-alias 'image-dired-create-display-image-buffer
|
|
|
|
|
#'ignore "29.1")
|
2021-11-04 23:47:00 +00:00
|
|
|
|
(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")
|
2021-11-04 01:05:29 +00:00
|
|
|
|
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;;;;;;;; TEST-SECTION ;;;;;;;;;;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;; (defvar image-dired-dir-max-size 12300000)
|
|
|
|
|
|
|
|
|
|
;; (defun image-dired-test-clean-old-files ()
|
|
|
|
|
;; "Clean `image-dired-dir' from old thumbnail files.
|
|
|
|
|
;; \"Oldness\" measured using last access time. If the total size of all
|
|
|
|
|
;; thumbnail files in `image-dired-dir' is larger than 'image-dired-dir-max-size',
|
|
|
|
|
;; old files are deleted until the max size is reached."
|
|
|
|
|
;; (let* ((files
|
|
|
|
|
;; (sort
|
|
|
|
|
;; (mapcar
|
|
|
|
|
;; (lambda (f)
|
|
|
|
|
;; (let ((fattribs (file-attributes f)))
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
|
;; `(,(file-attribute-access-time fattribs)
|
|
|
|
|
;; ,(file-attribute-size fattribs) ,f)))
|
2015-09-17 19:28:45 +00:00
|
|
|
|
;; (directory-files (image-dired-dir) t ".+\\.thumb\\..+$"))
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; ;; Sort function. Compare time between two files.
|
2011-05-23 17:57:17 +00:00
|
|
|
|
;; (lambda (l1 l2)
|
2007-04-22 13:44:05 +00:00
|
|
|
|
;; (time-less-p (car l1) (car l2)))))
|
|
|
|
|
;; (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files))))
|
|
|
|
|
;; (while (> dirsize image-dired-dir-max-size)
|
|
|
|
|
;; (y-or-n-p
|
|
|
|
|
;; (format "Size of thumbnail directory: %d, delete old file %s? "
|
|
|
|
|
;; dirsize (cadr (cdar files))))
|
|
|
|
|
;; (delete-file (cadr (cdar files)))
|
|
|
|
|
;; (setq dirsize (- dirsize (car (cdar files))))
|
|
|
|
|
;; (setq files (cdr files)))))
|
|
|
|
|
|
|
|
|
|
(provide 'image-dired)
|
|
|
|
|
|
|
|
|
|
;;; image-dired.el ends here
|