« first day (836 days earlier)      last day (1034 days later) » 

1:02 PM
Q: emacs history (invalid-read-syntax "#")

eugeneEmacs fails to load my init.el file after it fails to load .emacs.d/history file from (savehist-mode 1) Here's the minimum history file (setq minibuffer-history '("/home/eugenekim/.emacs.d/init.el" "Enabled" #("stash" 0 5 (face magit-hash magit-section [cl-struct-magit-section stash "stash@{9}" #<

1 hour later…
2:14 PM
Q: display eldoc help info behind point

stardivinerI have the following code to replace default eldoc display function: (defun my-eldoc-display-message-momentary (format-string &rest args) "Display eldoc message near point." (when format-string ;; (pos-tip-show (apply 'format format-string args)) (momentary-string-display ...

3 hours later…
5:22 PM
Hey, @YoungFrog
@ebpa sorry I misremembered your question, which is about supplying more (not less) args than what the function wants. I removed my comment.
Oh; no problem!
I think historically emacs has used dynamic scope for what I'm looking to accomplish. I just want to make things a bit more explicit / readable.
Thanks for the comment, @YoungFrog
@ebpa You mean that emacs sometimes uses variables instead of explicit function arguments ?
For this sort of purpose; yeah
I can see where emacs uses global variables, but I didn't really notice the link with your question tbh
5:32 PM
I'm struggling to think of examples
The url package for example (emacswiki.org/emacs/UrlPackage)
it just simply relies on dynamic scoping. I can't think of circumstances that involve hooks/callbacks
A better example: after-save-hook
attached functions don't accept any arguments, but typically examine the environment in order to determine which buffer was saved, etc.
after-save-hook could be defined in a way that functions added to the hook may accept the buffer reference/name as an argument if the function arity is non-zero.
ok I understand better what you mean, so basically Stefan's answer is not very useful to you, is it ?
It's a very clever solution which could possibly be applied via a recursive definition.
I haven't accepted it because I think a cleaner solution examines the signature rather than relying on (/abusing?) emacs error handling
I mean it's not robust enough (if the wrong number argument error comes from a deeper level)
5:49 PM
I imagine that it would behave robustly, but you could easily be generating several errors for every function on a hook each time it is called. They may be handled errors, but that sets off my personal code smell detector.
In the JavaScript world the accepted convention is if you are declaring a callback function of some sort that you simply drop/omit any arguments which you do not use.
I didn't realize that I hadn't upvoted stefan's answer
Who is supposed to drop the arguments? Is the callback itself supposed to ignore the unnecessary arguments ? That would be like adding an &rest _unused to the signature of the callback function
Whoever defines the function that is supplied as a callback would drop the function. Exactly! The practical significance is simply not requiring the authors to supply functions with an &rest _unused.
Truly not a Big Dealâ„¢ in the grand scheme of things, but a little bit of sugar like this goes a long way IMHO in the experience of using a library.
So if I wanted to log a message each time an event is called I can just attach a function that does (message "It was called!"). Depending on the hook it may expect a signature (LINE-NUMBER COLUMN), but since I would otherwise be ignoring those arguments the hypothetical convenience would be in my being able to attach a (lambda () (message "It was called!")).
Sorry for being verbose. If you have suggestions for revising the question I'd appreciate it!
6:05 PM
Alright, that makes sense. Perhaps you could mention "&rest _unused" and how your questions mostly boils down to avoid having to add that ; at least it helped me understand.
Thanks! :-)
did you read the source code of funcall ?
I think you could improve your own easy-going funcall by handling the SUBR case (using the function subr-arity), and by dereferencing symbol as many times as needed (sometimes a symbol has another symbol in its function cell).
also ISTR there's code out there which tries to guess the signature of every function, even including their names when that is possible.
6:26 PM
@ebpa There it is: help-function-arglist
I hadn't! I had seen subr-arity though. wasamasa mentioned it in my related question: emacs.stackexchange.com/questions/29239/…
I also hadn't considered that function resolution might require further recursion
@ebpa I posted these some of these thoughts as an answer. It doesn't qualify as a good answer yet, but I don't have time to improve it or write the code right now. Thanks for the chat, it was enlighting!
6:43 PM
@YoungFrog Thank you too! Those details convince me that a clean, viable solution exists
4 hours later…
10:59 PM
Q: How to prevent single lines from disappearing when cycle with TAB key?

user430Sometimes my latex commands (with #+LATEX:) get buried within my org document. Can I disable the visibility cycle behavior for single lines? A preferred behavior would be to leave non-indented lines always visible.


« first day (836 days earlier)      last day (1034 days later) »