Open jcguu95 opened 3 years ago
The test in question is here: https://github.com/alphapapa/org-super-agenda/blob/f5e80e4d0da6b2eeda9ba21e021838fa6a495376/org-super-agenda.el#L664
Actually, I think it's hitting this test first: https://github.com/alphapapa/org-super-agenda/blob/f5e80e4d0da6b2eeda9ba21e021838fa6a495376/org-super-agenda.el#L658
Yeah.. there's a comment in the source that reads
;; FIXME: What if the lambda's byte-compiled?
Do you by any chance remember what it means?
My elisp fu is pretty noobie, but if you'd point out that it's doable in the current setting, I will try my best to learn and make it work. In any case, thanks so much (and happy holiday if there's any :smiley: )
Well, it means what it says. :) IOW, at the time I wrote it, I considered that it might be a problem if the function is byte-compiled, and it turns out that it can be.
And it so happens that apply-partially
sometimes (or always?) returns a byte-compiled function (although I don't know why, from looking at its code). So that code in org-super-agenda needs to be modified to handle those cases. You can see in the backtrace the line of code that signaled an error, then find that code in this package, and make the necessary changes.
For example, one of the errors is because symbol-name
is called on a byte-compiled function, which isn't a symbol, so it signals an error.
Thanks, and Merry Christmas to you.
This is the source of apply-partially
that I got from counsel-find-function
(defun apply-partially (fun &rest args)
"Return a function that is a partial application of FUN to ARGS.
ARGS is a list of the first N arguments to pass to FUN.
The result is a new function which does the same as FUN, except that
the first N arguments are fixed at the values with which this function
was called."
(lambda (&rest args2)
(apply fun (append args args2))))
Now, with emacs freshly loaded,
(defun foo (x y) t)
(apply-partially 'foo nil)
returns a byte-compiled function as I evaluated by C-x C-e
. However, after evaluating the given definition of apply-partially
again, it did not. So I suppose emacs secretly did something over it..
About the symbol-name
error.. is it because that if I choose to use a single function (instead of a list of functions), symbol-name
is called in (https://github.com/alphapapa/org-super-agenda/blob/f5e80e4d0da6b2eeda9ba21e021838fa6a495376/org-super-agenda.el#L661), and so I need to relax it for it to work?
returns a byte-compiled function as I evaluated by
C-x C-e
. However, after evaluating the given definition ofapply-partially
again, it did not. So I suppose emacs secretly did something over it..
I guess when apply-partially
is byte-compiled, the lambdas it returns are also byte-compiled. Good to know.
About the symbol-name error..
Yes, because a byte-compiled function is not a symbol, and symbol-name
only works on symbols.
I think it's impractical to derive a textual description of a predicate function for use in the section name this way (especially given recent changes in Emacs's internal function representations). So probably we should use a user-supplied section name if given, or otherwise just say something like "[predicate]".
This would be a bit more than a simple bug fix but more like a change in functionality, so retargeting for v1.4.
Does the grouping method by predicate supports curried functions? I couldn't make it work.. perhaps it's because it does not support byte-compiled function well? Below is a minimal example.
Setup
Case one
Error:
Case two
Case three