See the variable Man-notify-method, which can be customized. Specifically, the O.P. may be interested in the value 'aggressive. The following is a printout of the *Help* buffer for C-h v aka M-x describe-variable:
Man-notify-method is a variable defined in ‘man.el’.
Its value is ‘friendly’
You can customize this variable.
Probably introduced at or ...
Assuming that the O.P. meant to use an underscore in the function name of org_setup (which is possible, but not the standard naming convention), then the problem is with the call to add-hook itself. Instead of using (org_setup), it should be 'org_setup. Try changing the call to add-hook as follows:
(add-hook 'org-mode-hook 'org_setup)
The only hook I know of that might help is window-size-change-functions.
Code such as this, for example (replace the message call by whatever you want done:
(defun foo (frame)
(let ((fullscreen (frame-parameter frame 'fullscreen)))
(when (memq fullscreen '(fullscreen fullboth))
(message "Do what you want here."))))
reposition-window calls beginning-of-defun to compute the window boundaries.
So you get an infinite recursion when calling reposition-window from c-beginning-of-defun.
You can add the following guard for avoiding that recursion:
(defvar c-beginning-of-defun-after-hook nil
"Functions to be run after `c-beginning-of-defun'.")
Is there ... some inbuilt way to achieve this?
Yes -- if you enable savehist-mode in your init file, then any variable you add to savehist-additional-variables will automatically be saved and restored between sessions.
Bonus question: it would be awesome to also be able to save the history of the same
savehist-mode automatically saves most history ...
You could try using something like:
(add-function :after after-focus-change-function #'your-function-here)
So, in your case, something like this should do what you are after:
(add-function :after after-focus-change-function (lambda () (save-some-buffers t)))
If you look at the documentation of after-focus-change-function with C-h v after-focus-change-...
Welcome to SE (emacs)! Look up run-hooks which gives the whole story but the tl;dr is expose a hook variable my-fancy-hook to the user and at the right place in yr own code put:
I am a strong believer in not polluting hooks, especially something so fundamental like special-mode that is used by countless other major-modes. As such, I would recommend not using the special-mode-hook. The following example adds an entry to the display-buffer-alist that will trigger a custom display-buffer-... function when a matching regexp exists.
If I correctly understood your question, the solution is pretty simple:
(defun emacs-startup-screen ()
"Display the weekly org-agenda and all todos."
(org-agenda nil "n"))
(add-hook 'emacs-startup-hook #'emacs-startup-screen)
Instead of the named function emacs-startup-screen, you can also use a lambda function like (lambda () (org-...
You may use per-buffer-theme.el. For example you could start with a setup like this:
(setq per-buffer-theme/use-timer t)
(setq per-buffer-theme/timer-idle-delay 0.1)
(setq per-buffer-theme/default-theme 'notheme)
'(((:theme . dichromacy)
It depends on what kind of changes you make. There's nothing special about code invoked from a hook.
If you set a global variable it remains set until something sets it differently or makunbounds it.
Your question is general, so the answer is general. If you pose a specific question, e.g. with some code, specific answers can likely be given.
You say: "post-command-hook triggers after every command, not just user-invoked commands." And in comments you say that by "user-invoked" you really mean invoked interactively.
It's not true that post-command-hook triggers each time a function that is a command is invoked. It's triggered for such a function only when it is invoked ...
As discussed in the comments to my question, I was a bit confused when writing the question, but will keep the original text in case similarly inexperienced people approach it from the same way.
To answer the main question "How to dynamically replace certain text, by evaluating a function on change in current buffer", below is an example of how to ...
You don’t need to pass any arguments to anything. The new hook that you have created, after-save-interactively-hook, is called just after saving the current buffer. Any hook functions you add to that list can simply call buffer-file-name to get the name of the file visited by the current buffer. For more information, use C-h f buffer-file-name to view the ...
I think something has gone wrong if you can't modify the use-package form -- AFAIK that macro is intended for use by end-users only.
That said, the documentation you've quoted:
all of the following are equivalent:
:hook (prog-mode . ace-jump-mode))
It appears as though org-roam has a hook specifically for this: org-roam-file-setup-hook. It's not well documented, but from reading the code it looks like it's called whenever an org-roam file is opened.
From my testing, that means when it's done through the normal find-file means, from org-roam-find-file, and probably just about everything else that opens ...
There is a variable named interprogram-paste-function that is bound to the function that retrieves the value from the system.
You can define your own function that calls the original function and remove the hyphens, and bind it to this variable.
The package https://github.com/Lindydancer/highlight2clipboard does similar things, although it modifies things ...
TL;DR: set the variable org-agenda-files to be a list of all the directories that you want to scan recursively for *.org files:
(setq org-agenda-files '("~/Dropbox/org/journal/"))
There are two org-agenda-files objects: a function and a variable. Org mode calls the function when it needs the list. The function looks at the org-agenda-...
Following NickD's input on my first answer (thanks @NickD) I think a better approach is to limit org-update-radio-target-regexp to only fire when the target is first created. This is done by binding the ">" key and then testing whether point is just to the right of a <<<radio target>>> (after it is pressed). Here is the code:
You can find out what is going on yourself by putting the cursor after the use-package stanza and doing M-x pp-macroexpand-last-sexp. You will discover that the :hook line expands to
(add-hook 'TeX-after-compilation-finished-functions-hook #'TeX-revert-document-buffer)
which is not what you wanted.
Long story short: :hook only does what you want if the car ...
There is no such hook, but you can write a function that does what you want and execute that instead:
(defun ndk/org-export-to-html-and-rsync ()
You can even bind to a key so that you can execute it easily:
(define-key org-mode-map (kbd "C-c z") #'ndk/org-export-to-html-and-rsync)
There is no hook called org-deadline. Most hooks are called <mumble>-hook so when you are looking for one, try C-h v org--hook and press TAB: that should give you a completion buffer with all the available hooks whose names start with org-.
Unfortunately, there is no hook defined to allow you to call a function after you set a deadline. But you can ...
Sure, just add something like this to your init file:
(defun oleg/compile-lua ()
"use love2d to compile my lua code"
(compile "love2d /home/huseyin/Documents/Programming/Lua/"))
(global-set-key (kbd "<f5>") #'oleg/compile-lua)
You can name the function whatever you prefer, and bind it to whichever key ...