unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Function: rcd-find-latest-pictures-in-directory
Date: Thu, 05 Dec 2024 16:29:40 +0300	[thread overview]
Message-ID: <b3f255bd5b3d672e6654c9dd85c240df.support1@rcdrun.com> (raw)

I have just finished this function and find it very interesting:

(defun rcd-find-latest-pictures-in-directory (directory &optional count)
  "Return the latest .webp, .png, .jpg or .jpeg picture in DIRECTORY.

Optional COUNT will return only specified number of pictures."
  (let* ((files (directory-files directory t "\\.\\(webp\\|png\\|jpe?g\\)$" t))
	 (latest-files (sort files
                             (lambda (a b)
                               (time-less-p (nth 5 (file-attributes b))
                                            (nth 5 (file-attributes a)))))))
    (cond (count (seq-take latest-files count))
	  (t latest-files))))

It will be used to quickly fetch latest downloaded picture, sort it
somewhere, optimize it for the website, and upload it. It is for
workflow optimization.

Jean Louis



                 reply	other threads:[~2024-12-05 13:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b3f255bd5b3d672e6654c9dd85c240df.support1@rcdrun.com \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).