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
(defmacro custom-set-variable (variable) | |
"Update saved value of custom `VARIABLE'" | |
`(custom-set-variables | |
'(,variable `,,variable 'now nil ,(format "Customized in %s" load-file-name)))) |
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
(define-advice counsel-yank-pop (:around (fun &rest args)) | |
(if (equal major-mode 'vterm-mode) | |
(let ((counsel-yank-pop-action-fun (symbol-function | |
'counsel-yank-pop-action)) | |
(last-command-yank-p (eq last-command 'yank))) | |
(cl-letf (((symbol-function 'counsel-yank-pop-action) | |
(lambda (s) | |
(let ((inhibit-read-only t) | |
(last-command (if (memq last-command | |
'(counsel-yank-pop |
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
# Copyright 2020 The Chromium OS Authors. All rights reserved. | |
# Use of this source code is governed by a BSD-style license that can be | |
# found in the LICENSE file. | |
# | |
# Use this file to customize per-user sommelier options. | |
# | |
# For documentation, see: | |
# https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/ | |
# Import environment from ~/.bash_profile and ~/.profile |
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
(define-advice ivy-posframe--display (:around (fun &rest args)) | |
(let ((ivy-posframe-font (face-attribute 'default :font (selected-frame)))) | |
(apply fun args))) |
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
(ivy-posframe-size-function | |
(lambda () | |
(list | |
:height (or ivy-posframe-height ivy-height) | |
:width ivy-posframe-width | |
:min-height (or ivy-posframe-min-height ivy-height) | |
:min-width (or ivy-posframe-min-width | |
(let* ((buf-rows (split-string | |
(with-current-buffer ivy-posframe-buffer | |
(buffer-string)) |
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
(eval-and-compile | |
(unless (fboundp 'expand-file-name-current-directory) | |
(defun expand-file-name-current-directory (name) | |
"Convert filename NAME to absolute and canonicalize. | |
Starting with directory of `load-file-name' or `buffer-file-name' or | |
`default-directory' if NAME is relative (does not startwith slash or tilde)." | |
(let ((dir (file-name-directory (or load-file-name buffer-file-name "")))) | |
(expand-file-name name dir))))) |
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 expand-file-name-current-directory (name) | |
"Convert filename NAME to absolute and canonicalize, starting with directory | |
of `load-file-name' or `buffer-file-name' or `default-directory' if NAME | |
is relative (does not start with slash or tilde)." | |
(let ((dir (file-name-directory (or load-file-name buffer-file-name "")))) | |
(expand-file-name name dir))))) |
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
(ert-deftest all-completions () | |
(should | |
(equal '("a" "b") (all-completions "" '(a b) nil)))) |
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
(define-key ivy-mode-map (kbd "C-s") | |
(defalias (make-symbol "swiper-or-swiper-all") | |
;; Wrapped in `defalias' with uninterned SYMBOL so `describe-key' | |
;; displays command as a proper symbol instead of byte-codes | |
(lambda () | |
"Runs the command swiper. | |
With a prefix argument, run the command swiper-all." | |
(interactive) | |
(if current-prefix-arg | |
(swiper-all) |
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
(defmacro with-file-temp-buffer (filename &rest body) | |
"Create a temporary buffer visiting FILENAME, and evaluate BODY there like | |
`progn'." | |
(declare (indent 1) (debug t)) | |
(let* ((temp-buffer (make-symbol "temp-buffer"))) | |
`(let* ((truename (abbreviate-file-name (file-truename ,filename))) | |
(number (nthcdr 10 (file-attributes truename))) | |
(,temp-buffer (find-file-noselect-1 | |
(create-file-buffer ,filename) | |
,filename 'nowarn nil truename number))) |
NewerOlder