(defun cur-fun () (with-temp-buffer (let ((standard-output (current-buffer))) (backtrace)) (message (buffer-string)) (goto-char (point-min)) (dotimes (_ 3) (re-search-forward “^ [^(]” nil t))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun yf/forward-sexp-or-inside-next-sexp (&optional n) "" | |
(interactive "p") | |
(dotimes (_ n) | |
(condition-case nil | |
(forward-sexp) | |
(scan-error (save-match-data | |
(re-search-forward "\\s)*") | |
(when (looking-at "\\s(") (forward-char))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun yf/narrow-to-window-view (printmsg) | |
(interactive "p") | |
(narrow-to-region (window-start) | |
(save-excursion | |
(goto-char (window-end nil t)) | |
(when (not (pos-visible-in-window-p)) | |
;; Line is not fully visible. | |
(forward-visible-line -1)) | |
(point))) | |
(when printmsg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(lambda () | |
(let ((hd (format-time-string "%Y"))) | |
(goto-char (point-min)) | |
(unless (derived-mode-p 'org-mode) | |
(error | |
"Target buffer \"%s\" for file+headline should be in Org mode" | |
(current-buffer))) | |
(if (re-search-forward | |
(format org-complex-heading-regexp-format (regexp-quote hd)) | |
nil t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- lexical-binding: t; -*- | |
(setq test-bar 'initial-value) | |
(defun test-test-bar () | |
(message "testbar: %S" test-bar)) | |
(let ((test-bar 'dynscope)) | |
(test-test-bar)) ; => initial-value | |
(defvar test-bar 'newvalue "ignored") | |
(let ((test-bar 'dynscope)) | |
(test-test-bar)) ; => dynscope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((list | |
(mapcar | |
(lambda (proc) | |
(cons (format "%s" proc) proc)) | |
(process-list)))) | |
(cdr | |
(assoc (ido-completing-read "Process: " | |
(mapcar #'car list)) | |
list))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; rcirc-color.el -- color nicks | |
;; Copyright 2005-2013 Alex Schroeder | |
;; This program is free software; you can redistribute it and/or | |
;; modify it under the terms of the GNU General Public License as | |
;; published by the Free Software Foundation; either version 2 of | |
;; the License, or (at your option) any later version. | |
;; This program is distributed in the hope that it will be | |
;; useful, but WITHOUT ANY WARRANTY; without even the implied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'shell-mode-hook #'delete-window-after-exit) | |
(defun delete-window-after-exit () | |
(let ((proc (get-buffer-process (current-buffer)))) | |
(add-function :after | |
(process-sentinel proc) | |
(lambda | |
(proc _change) | |
(let ((win (get-buffer-window (process-buffer proc)))) | |
(when win |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar bulk-saved-attachments-dir (expand-file-name "~/Documents/mu4e")) | |
(defun cleanse-subject (sub) | |
(replace-regexp-in-string | |
"[^A-Z0-9]+" | |
"-" | |
(downcase sub))) | |
(defun view-attachments-dired (&optional msg) | |
"Saves all of the attachments in `msg' to a directory under |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun yf/perform-replace (matcher replacement &optional skip-predicate) | |
"Interactively replace MATCHER with REPLACEMENT | |
MATCHER is a regular expression or a function (see below). | |
REPLACEMENT is a text valid for `replace-match' or a function. | |
SKIP-PREDICATE, if given, is a function which will be called at every | |
match. If it returns nil, that occurrence is skipped silently." | |
(let (matched-string start end literal-replacement overlay) | |
(unwind-protect | |
(map-y-or-n-p | |
(lambda (_) |
NewerOlder