Skip to content

Instantly share code, notes, and snippets.

@tttuuu888
tttuuu888 / sk-mode-line.el
Last active May 10, 2021 00:50
simple Emacs mode line
(defun git-tracked-file-p (&optional file-name)
(let ((file (or file-name buffer-file-name)))
(and file
(file-exists-p file)
(zerop (process-file "git" nil nil nil
"ls-files" "--error-unmatch"
(file-name-nondirectory file))))))
(defun git-branch-of-file (file)
(when (git-tracked-file-p file)
@tttuuu888
tttuuu888 / package-loading-notice.el
Last active June 6, 2021 02:57
Eye-candy for Emacs package loading time
(defvar sk-package-loading-notice-list '(org yasnippet))
(defun sk-package-loading-notice (old &rest r)
(let* ((elt (car r))
(mode
(when (stringp elt)
(let ((ret (assoc-default elt auto-mode-alist 'string-match)))
(and (symbolp ret) (symbol-name ret)))))
(pkg
(cond ((symbolp elt) elt)
@tttuuu888
tttuuu888 / toggle-highlight-word.el
Created November 30, 2020 15:00
Toggle highlighting current word
(require 'hi-lock)
(defun toggle-highlight-word ()
(interactive)
(let ((regex (concat "\\_<" (current-word) "\\_>")))
(if (member regex (mapcar #'car hi-lock-interactive-patterns))
(unhighlight-regexp regex)
(highlight-symbol-at-point))))
(defun unhighlight-all-highlighted-words ()
@tttuuu888
tttuuu888 / pinstall.el
Last active January 1, 2022 09:38
A script that installs all Emacs external packages maintained by `use-package ' in parallel.
;;; pinstall.el --- Parallel package install script
;; Copyright (C) 2019 SeungKi Kim
;; Author: SeungKi Kim <tttuuu888@gmail.com>
;; URL: https://github.com/tttuuu888/.emacs.d
;; Version: 0.7.0
;;; Commentary