While editing files, time to time I regret deleting some redundant parts which afterwards become necessary.
Let's say you are writing a letter and first you explained your thoughts with redundantly very long sentences. Later on, you come up with an on-spot phrase for them and rephrase with them. But later again, on 2nd thought, you think the words weren't right phrasing.
To go back to original sentences, in my knowledge, is to use undo, or undo-tree, to go back in history. But you have to keep pressing the key til it hits that version.
Is there any easy way to search in undo-history to get back to the version? I'm looking for something along the line of helm-occur functionality, which searches your word in current buffer and lists all the matching lines with line number, but works for the undo-history.
browse-kill-ringbuffer. – Tobias Oct 06 '16 at 09:04foobarworks withgit log --patch -Sfoobar. The--patchoption causes git to output also the differences and the-Soption is used for the search in the differences. If you only want to see the log messages of the changes wherefoobaroccurs you can also just usegit log -Sfoobar. – Tobias Oct 06 '16 at 10:07browse-kill-ringto current buffer:(require 'browse-kill-ring) (defun browse-kill-ring-current-buffer (itemsArg) (list (cl-delete-if (lambda (item) (let ((buf (get-text-property 0 'src-buffer item))) (null (and buf (equal buf browse-kill-ring-original-buffer))))) (car itemsArg)))) (advice-add #'browse-kill-ring-insert-as-separated :filter-args #'browse-kill-ring-current-buffer) (defun browse-kill-ring-add-src-buffer-to-kill (str) (propertize str 'src-buffer (current-buffer))) (advice-add #'filter-buffer-substring :filter-return #'browse-kill-ring-add-src-buffer-to-kill)– Tobias Oct 08 '16 at 13:14(require 'cl-lib)at the front. Also note, that this is a dirty hack. – Tobias Oct 08 '16 at 13:17