emacs-devel
[Top][All Lists]
Advanced

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

Re: empty-directory predicate, native implementation


From: Arthur Miller
Subject: Re: empty-directory predicate, native implementation
Date: Mon, 19 Oct 2020 00:21:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:

> What's wrong using FIXNATP and XFIXNAT everywhere?
If we return nil for 0 count, then it make sense to return nil for
negative count too?

XFIXNAT will turn it negative num into some big int.
I thought first it is fine, but after second thought I don't think it is
best thing to do.

if (FIXNUMP(return_count))
    {
      last = XFIXNUM(return_count);

      if (last < 1)
        return Qnil;
    }

This works better.

Negative bignums end up also as big unsigneds which results with all
file namess returned, but I don't know if it matters. Correct me if I am wrong.

>> --- a/lisp/net/tramp-adb.el
>> +++ b/lisp/net/tramp-adb.el
>> @@ -312,7 +312,7 @@ tramp-adb-handle-directory-files-and-attributes
>>        (copy-tree
>>         (with-tramp-file-property
>>         v localname (format "directory-files-and-attributes-%s-%s-%s-%s"
>> -                           full match id-format nosort)
>> +                           full match id-format nosort count)
I did that first, but then decided to skip count in format and forgot
to delete the count from the argument list. I didn't know how format was
used so I didn't want to mess with it; but if it is only for the name,
then it is maybe useful?

>> diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
>> index 6d44ad23ad..a99af70196 100644
>> --- a/lisp/net/tramp.el
>> +++ b/lisp/net/tramp.el
>> +(defun tramp-handle-directory-files (directory &optional full match
>> +                                               nosort count)
>
> This fits into one line (80 chars).
It is 81 chars so Emacs breaks the line. I can call it num, saves 2 chars.

I have fixed identation and docs; as well as other stuff you pointed
out. I can send patch when I get answers to questions above.

Best regards; sorry for giving you so much work!

/a



reply via email to

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