reddit / emacs

Don't like how it works? You can change Emacs.

karthink · 2022-07-29 15:15
_viz_ · 2022-07-29 16:02
At ~26:53, you don't need the underscore in the if-let BTW. (I get the no-var-bind condition thingy wrong all the time too.) EDIT: I don't really have anything to add here except: If you're not the brightest bulb in the room like me, then you can fist your way though the problem by edebug-ing the suspicious functions.
nv-elisp · 2022-07-29 17:18
It's a matter of wrapping the expression in an extra set of parens: (if-let ((var 1) ((cl-incf var))) var) To add to your comment, the use of `seq-some` is unnecessary for what they're checking. `member` is more appropriate. They can also make better use of generalized booleans assuming the hide argument does not need to be explicitly `t` (most likely it just needs to be non-nil). (defun my/notmuch-show-hide-patches (args) (append (butlast args) (list (member (notmuch-show-mime-type part) my/notmuch-fold-mime-types)))) /u/karthink: I admire the spirit of the video. IMO it would have been better if you had tried the hook route instead of jumping to advice right away.
karthink · 2022-07-29 23:15
> the use of seq-some is unnecessary for what they're checking I used the custom predicate `notmuch-match-content-type` instead of `member` since this matches mimetypes with globs. You can place `"text/*"` in `my/notmuch-fold-mime-types` to fold all text mimetypes by default. > I admire the spirit of the video. Thank you. > IMO it would have been better if you had tried the hook route instead of jumping to advice right away. I considered it briefly, then decided not to live-code this as it involves a completely different logic -- the hook function would have to parse the notmuch-show buffer (probably with a text-property search) looking for the right button to push. The advice built on what I'd already discovered.
7890yuiop · 2022-07-30 02:56
> Don't like how it works? You can change Emacs. I can't help but laugh. Is there *anyone* using Emacs who isn't aware of this?
groundcrate · 2022-07-30 03:25
I think every user knows it in theory, but there are a whole lot of users who need a reminder how accessible it can be.
karthink · 2022-07-30 09:48
As the median question on this sub illustrates, there's a big gap between knowing that emacs is extensible and knowing how to extend emacs. This is especially true when what you need isn't available through modifying a variable. This video is a recipe of sorts for a general method.
7890yuiop · 2022-07-30 10:09
Fair enough (I've not watched the video). It was just that the subject line is a bit surreal.
JeremyHilaryBoob · 2022-08-05 04:26
This is an excellent video. I was able to follow along until the defadvice section. Then you drew the rest of the effing owl. ;)