help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Better way to make sure external command exists in the system?


From: Emanuel Berg
Subject: Re: Better way to make sure external command exists in the system?
Date: Tue, 23 Mar 2021 10:56:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jean Louis wrote:

OK, let's see, straight X-Mas Eve this...

> (defvar *image-default-resize-size* 1536)
> (defvar *image-resize-sizes* '("1536" "1024" "800" "1200" "640"))

The *common-lisp-convention* for global variables is
disencourage in Elisp.

Also, why the strings?

> Argument FILE is image to be resized."
>   (if (rcd-which-list '("mogrify"))

Not known to be defined: rcd-which-list (indeed I don't have it)
Same with rcd-warning-message.

>       (let ((extension (file-name-extension file)))
>       (when (or (equal (downcase extension) "jpg")
>                 (equal (downcase extension) "png"))

Same thing twice, instead do let*.

> (defun image-resize-dired ()
>   "Resizes images."
>   (interactive)
>   (let ((files (dired-get-marked-files))
>       (size (read-number "Size: " *image-default-resize-size* 
> '(*image-resize-sizes*))))

HIST isn't used like that what I can see, read the
`read-from-minibuffer' docstring. Does it even work?

Also, why `read-number' and not in interactive?

And, no need for globals if they are only used here. Use let*
for that as well.

Keep it on...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]