0

Some of my images contain a large comment (> 1000 chars). Yet the image-dired properties header shows only one line (count,size,tags,comment).

How can I see the complete comment (alongside all tags) in the header?

As a lisp layman I grepped for keywords like window, buffer, size etc. in image-dired.el.gz, yet (defun image-dired--update-header-line () seems the most promising part to start with.
To better explain, I tried to link to that function here source though can't find any header using Ctrl+F.

1 Answer 1

1

Some of my images contain a large comment (> 1000 chars).

If this is the case then header-line may not be the right place for it.

With the recipe below, as you move through the thumbnails, the eldoc buffers will get updated with image EXIF info.

To get this

Image Exif Info in an *eldoc* buffer, and in a eldoc-box

Exif info as `eldoc' string

do this

;; Recipe for `emacs -Q'

(use-package eldoc-box
  :demand t
  :load-path "/home/kjambunathan/src1/myemacs/my-pkg-user-dir/eldoc-box-20231115.519/"
  :hook (eldoc-mode . eldoc-box-hover-mode)
  :bind (("C-h D" . eldoc-box-help-at-point))
  :custom-face
  (eldoc-box-body ((t (:background "yellow")))))

;; If you don't want to use `eldoc-box' do `M-x eldoc-doc-buffer`
;; followed by `C-x 4 b *eldoc*`

(use-package image-dired
  :config
  (require 'map)
  (require 'eldoc)
  (defun my-image-exifinfo ()
    (shell-command-to-string
     (format "exiftool '%s'"
             (map-elt (text-properties-at (point)) 'original-file-name))))
  (defun my-image-dired-thumbnail-mode-hook ()
    (add-function :before-until (local 'eldoc-documentation-function)
                  #'my-image-exifinfo)
    (turn-on-eldoc-mode))
  :hook (image-dired-thumbnail-mode . my-image-dired-thumbnail-mode-hook))

If you are using image-dired's own comment and tagging system to add metadata to images, then the following definition will do the job well

(defun my-image-exifinfo () header-line-format)`

or

(defun my-image-exifinfo ()
 (map-elt (text-properties-at (point)) 'comment))
   

or

(defun my-image-exifinfo ()
 (map-elt (text-properties-at (point)) 'tags))
   

See lines around https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/image/image-dired.el?h=30b1b0d7cd8e4d46a601e9737350cda970f6bab0#n474

FWIW, in image-dired one can add adhoc comments ...

     `Variables`                       
`image-dired-file-comment-list`             v-      List to store file comments.                                                cs/30.0.50/lisp/image/image-dired.el
     `Functions`                       
`image-dired-comment-thumbnail`            c       Add comment to current thumbnail in thumbnail buffer.                       cs/30.0.50/lisp/image/image-dired.el
`image-dired--add-to-file-comment-list`     f-      Helper function used from `image-dired--create-gallery-lists'.              cs/30.0.50/lisp/image/image-dired.el
`image-dired-add-to-file-comment-list`      f&-     Helper function used from `image-dired--create-gallery-lists'.              cs/30.0.50/lisp/image/image-dired.el

3
  • Very cool recipe, thank you so much. Image-dired though uses it's own textfile (csv) to store tags and comments and for reading the properties (not exif).
    – jjk
    Commented Apr 5 at 14:52
  • Ok ... I don't use image-dired. Please update the question and tell others what command you use add comments to the images. See my updated answer ... The mechanics of using eldoc to display that custom metadata still stands ...
    – mxnt
    Commented Apr 5 at 15:35
  • I wish could accept more than once as answer. Very valuable answer, thank you so much.
    – jjk
    Commented Apr 6 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.