Hi Arash,

>>>>> Arash Esbati <ar...@gnu.org> writes:
>> (1) `string-trim' and `string-empty-p'

> Thanks for catching these.  I should have checked better :-(  I checked
> the sources and what do you think about something like this in latex.el:

>   (eval-when-compile
>     (when (< emacs-major-version 29)
>       (require 'subr-x)))

> The `eval-when-compile'-thing is recommended by subr-x.el itself.

Ah, (almost) all contents of subr-x.el are defsubst or defmacro. Then
`eval-when-compile' would be enough. 

>> (2) `always'
> Upps; I thought is was always there.  I'll add that to tex.el,  maybe
> something like this:

>   (if (> emacs-major-version 27)
>       (defalias 'TeX-always #'always)
>     (defun TeX-always (&rest _ignore)
>       "Ignore ARGUMENTS, do nothing and return t.
>   This is a compatibility function for Emacs versions prior to v.28"
>       t))

OK.

>> In addition,
>> 
>>> +      (cl-letf (((symbol-function 'y-or-n-p) #'always))
>> 
>> it seems to me that `cl-flet' suits better than `cl-letf' here.

> Can you elaborate why?  I don't see why `cl-flet' suits better in this
> case.

I have little experience with cl-lib, so please bear with me if I'm
saying something stupid. As far as I can read out of elisp reference
and their doc strings,

(cl-flet ((AAA BBB))
  (AAA CCC))

is basically the same as

(cl-letf (((symbol-function 'AAA) BBB))
  (AAA CCC)

and, in my opinion, more clear. Acutually,
(cl-letf (((symbol-function 'y-or-n-p) #'always))
  (y-or-n-p "dummy"))
and
(cl-flet ((y-or-n-p #'always))
  (y-or-n-p "dummy"))
behave in the same way apparently.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

Reply via email to