AutoModerator · 2022-08-03 08:15
This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.
[See this search for previous "Weekly Tips, Tricks, &c." Threads.](https://www.reddit.com/r/emacs/search?q=Weekly+tips&restrict_sr=on&sort=new&t=all)
Don't feel constrained in regards to what you post, just keep your post vaguely, generally on the topic of emacs.
[deleted] · 2022-08-03 10:47
Org mode - insert a complete set of export options:
`org-export-insert-default-template`
This inserts all export keywords with default values at beginning of line.
This command is not documented in `info emacs` (v27.1).
WorldsEndless · 2022-08-03 15:00
This prepares to make notifications and appointments out of all my org agenda items today. It clears out all appointments first so it is idempotent.
(defun tsa/org-clear-appts ()
(interactive)
(let ((appt-count (if (boundp 'appt-time-msg-list)
(length appt-time-msg-list)
0)))
(setq appt-time-msg-list nil)
(message (format "Cleared %d events" appt-count))))
(defun tsa/org-appts (arg)
(interactive "P")
(cond ((equal arg '(4))
(progn
(tsa/org-clear-appts)
(message "Appointments cleared")))
(t (progn
(tsa/org-clear-appts)
(org-agenda-to-appt)))))
yigitemres · 2022-08-04 15:29
Question:
Is there a way to get the name of the function while inside of it?
(defun my/a-to-b ()
(message "Function name is %s" (some-magic))
)
"Function name is my/a-to-b"
ainstr · 2022-08-04 20:57
This works:
(defun my/a-to-b ()
(message "Function name is %s"
(cdr (backtrace-frame 3))))
(my/a-to-b) ;; "Function name is (my/a-to-b)"
But it's kinda hacky as `backtrace-frame` literally deals with scope:
(defun my/c-to-d ()
(cdr (backtrace-frame 2)))
(my/c-to-d) ;; (my/c-to-d)
yigitemres · 2022-08-04 21:44
~~Thanks for the answer but this is so much hacky that it's actually bad (sound like d* but the solution is bad not your helpfulness). What I want is something like `(which-function)` but not for the cursor, instead for the current function.~~
Actually it's good enough. But if somebody comes to another function or method I will be happy too.
WorldsEndless · 2022-08-05 20:13
Modus themes can take a heading size when you specify your customizable modus-themes-headings. Having the size change with the headings causes major performance issues if you are a heavy org-mode user, for instance with consult-org-headings on large org files. Plus, I don't like the way they look 😼
Here is the :custom section of my use-package that removed the sized integers at the end of the definitions:
(modus-themes-headings
;; '((1 . (rainbow overline background 1.4))
;; (2 . (rainbow background 1.3))
;; (3 . (rainbow bold 1.2))
;; (t . (rainbow-line))) ;; disabled because I don't love them changing sizes
'((1 . (rainbow overline background))
(2 . (rainbow background))
(3 . (rainbow bold))
(t . (rainbow-line)))
)
LemonBreezes · 2022-08-06 00:52
I wish the background extended past the newline and stayed that way when folded. 😿
meain · 2022-08-09 17:47
I think what you are looking for is the variable `this-command`. Something like `(message "Function name is %s" this-command)` at the beginning of the defun will give to the current func name.
​
EDIT: There is also \`last-command\`.
yigitemres · 2022-08-09 17:53
Holy... Thank you so much!