emacs-devel
[Top][All Lists]
Advanced

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

Re: [NonGNU ELPA] 11 new packages!


From: Akib Azmain Turja
Subject: Re: [NonGNU ELPA] 11 new packages!
Date: Tue, 22 Nov 2022 23:42:10 +0600

Philip Kaludercic <philipk@posteo.net> writes:

>>> I've managed to skim through workroom.el.  The code looks great, so I
>>> just have a non-comprehensive list of comments and ideas:
>>
>> Really?  It was one of my worst packages until I almost rewrote it over
>> the last few weeks.
>
> The coding style was clean and the documentation went into details.
> That is good stuff in my book :)

I can't remember writing any comments, and the docstring are just the
result of checkdoc, which always teases me as I program.

>
>>>  (defun workroom-rebind-command-map-prefix ()
>>>    "Rebind command prefix key sequence `workroom-command-map-prefix'."
>>>    (substitute-key-definition
>>> @@ -234,6 +235,7 @@ The value is a mode line terminal like 
>>> `mode-line-format'."
>>>  ;;;; Workroom and View Manipulation.
>>>  
>>>  (cl-defstruct (workroom--room
>>> +          (:predicate workroomp)
>>>                 (:constructor workroom--make-room)
>>>                 (:copier workroom--copy-room))
>>>    "Structure for workroom."
>>> @@ -253,6 +255,7 @@ The value is a mode line terminal like 
>>> `mode-line-format'."
>>>     :documentation "`completing-read' history of view names."))
>>>  
>>>  (cl-defstruct (workroom--view
>>> +          (:predicate workroom-view-p)
>>>                 (:constructor workroom--make-view)
>>>                 (:copier workroom--copy-view))
>>>    "Structure for view of workroom."
>>> @@ -268,7 +271,7 @@ The value is a mode line terminal like 
>>> `mode-line-format'."
>>>  (defvar workroom--dont-clear-new-view nil
>>>    "Non-nil mean don't clear empty new views.")
>>
>> They don't get a docstring on my machine.  :(
>
> That might be the case.  In that case you can keep the previous code,
> and perhaps define the prettier variants using `defalias`, or by
> manually annotating a function symbol.

I think I'll keep the code.

>
>>>  
>>> -(defvar workroom--rooms nil
>>> +(defvar workroom--rooms nil ;maybe some comments on the structure
>>>    "List of currently live workrooms.")
>>
>> As the docstring describes, it's a list, and all elements satisfies
>> `workroomp'.
>
> Hmm, I guess that is self-descriptive enough.  I was wondering if this
> was a alist or something else.
>
>>> @@ -558,7 +552,7 @@ Return DEF when input is empty, where DEF is either a 
>>> string or nil.
>>>  
>>>  REQUIRE-MATCH and PREDICATE is same as in `completing-read'."
>>>    (completing-read
>>> -   (concat prompt (when def (format " (default %s)" def)) ": ")
>>> +   (concat prompt (and def (format " (default %s)" def)) ": ") ;Compat has 
>>> `format-prompt'
>>>     (mapcar #'workroom-name workroom--rooms) predicate require-match
>>>     nil 'workroom-room-history def))
>>
>> I don't have much idea about Compat, how does it work?
>
> Compat is provided on ELPA.  If you add it as a dependency and load it,
> it will define missing functionality on older systems.
>
> The documentation goes into greater detail:
> https://elpa.gnu.org/packages/doc/compat.html#Usage.
>
> But as everything else, this is just a "fun fact", nothing critical.

OK, I've change the code to use format-prompt, just only because it's
customizable with the user option minibuffer-default-prompt-format.

>
>>> @@ -1254,7 +1248,7 @@ ACTION and ARGS are also described there."
>>>    (setf (workroom-buffer-manager-data room)
>>>          (cl-delete-if-not #'buffer-live-p
>>>                            (workroom-buffer-manager-data room)))
>>> -  (pcase action
>>> +  (pcase action                            ;perhaps match on (cons action 
>>> args)?
>>>      (:initialize
>>>       (cl-destructuring-bind () args
>>>         (setf (workroom-buffer-manager-data room)
>>
>> I wonder why I used cl-destructuring-bind when there isn't any keyword
>> arguments.
>>
>> Fixing...
>> Fixing...done
>
> I assumed this was just for the sake of consistency?  After all, my
> suggestion does do one unnecessary `cons' for the sake of convenience.

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

Attachment: signature.asc
Description: PGP signature


reply via email to

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