Skip to content

Instantly share code, notes, and snippets.

@minorugh
minorugh / flycheck-for-leaf
Last active April 4, 2024 23:23
Fixing leaf-keywords "Unrecognized keyword" error in flycheck
;; Fixing leaf-keywords "Unrecognized keyword" error in flycheck
(eval-and-compile (require 'flycheck))
(setq flycheck-emacs-lisp-package-initialize-form
(flycheck-sexp-to-string
'(progn
(with-demoted-errors "Error during package initialization: %S"
(package-initialize))
(leaf-keywords-init))))
@minorugh
minorugh / picchange.js
Created September 6, 2023 01:47
picchange
<img id="pic" src="pic/0.jpg" style="width:100%; border-radius: 8px;">
<script>
'use strict';
const img = ["pic/0.jpg", "pic/1.jpg", "pic/2.jpg" , "pic/3.jpg" , "pic/4.jpg" , "pic/5.jpg" , "pic/6.jpg" , "pic/7.jpg" , "pic/8.jpg" , "pic/9.jpg"];
let count = -1;
picChange(); // 関数を実行
function picChange() {
count++;
// カウントが最大になれば配列を初期値に戻すため「0」を指定する
@minorugh
minorugh / 40_dired.el
Created August 2, 2023 21:26
append [Dir] of dired buffer name
(defun dired-my-append-buffer-name-hint ()
"Append a auxiliary string [Dir] to a name of dired buffer."
(when (eq major-mode 'dired-mode)
(let* ((dir (expand-file-name list-buffers-directory))
;; Add a drive letter for Windows
(drive (if (and (eq 'system-type 'windows-nt)
(string-match "^\\([a-zA-Z]:\\)/" dir))
(match-string 1 dir) "")))
(rename-buffer (concat (buffer-name) " [" drive "dir]") t))))
(add-hook 'dired-mode-hook 'dired-my-append-buffer-name-hint)
@minorugh
minorugh / deepl.el
Created July 23, 2023 23:56 — forked from masatoi/deepl.el
emacs deepl client
;;; Install
;; requestが必要なので M-x package-install request などでインストールしておく
;; init.elなどでロードする
;; (load-file "/path/to/deepl.el")
;; キーバインドを設定しておく
;; (global-set-key (kbd "C-c t") 'deepl-translate)
;;; Usage
;; 翻訳したい部分をリージョン選択して設定したキーバインド、または M-x deepl-translate
;; 翻訳結果がミニバッファに出る。また、同じ内容がクリップボードにコピーされている
@minorugh
minorugh / deepl.el
Created July 23, 2023 23:56 — forked from masatoi/deepl.el
emacs deepl client
;;; Install
;; requestが必要なので M-x package-install request などでインストールしておく
;; init.elなどでロードする
;; (load-file "/path/to/deepl.el")
;; キーバインドを設定しておく
;; (global-set-key (kbd "C-c t") 'deepl-translate)
;;; Usage
;; 翻訳したい部分をリージョン選択して設定したキーバインド、または M-x deepl-translate
;; 翻訳結果がミニバッファに出る。また、同じ内容がクリップボードにコピーされている
@minorugh
minorugh / 40_dired.el
Created July 12, 2023 11:21
dired-my-append-buffer-name-hint
(defun dired-my-append-buffer-name-hint ()
"Append a auxiliary string [Dir] to a name of dired buffer."
(when (eq major-mode 'dired-mode)
(let* ((dir (expand-file-name list-buffers-directory))
;; Add a drive letter for Windows
(drive (if (and (eq 'system-type 'windows-nt)
(string-match "^\\([a-zA-Z]:\\)/" dir))
(match-string 1 dir) "")))
(rename-buffer (concat (buffer-name) " [" drive "dir]") t))))
(add-hook 'dired-mode-hook 'dired-my-append-buffer-name-hint)
@minorugh
minorugh / nyan-mode.el
Created July 10, 2023 12:36
nyan-mode
(leaf nyan-mode
:ensure t
:if (display-graphic-p)
:after doom-modeline
:config
(nyan-mode 1)
(nyan-start-animation))
(leaf tempbuf
:doc "Auto kill unused buffers in the background"
:el-get (tempbuf :url "http://www.emacswiki.org/emacs/download/tempbuf.el")
:hook ((find-file-hook . my:find-file-tempbuf-hook)
((dired-mode-hook magit-mode-hook) . turn-on-tempbuf-mode))
:custom
`((tempbuf-kill-message . nil)
(my:tempbuf-ignore-files . '("~/Dropbox/org/task.org")))
:init
(defun my:find-file-tempbuf-hook ()
@minorugh
minorugh / pangu-spacing.el
Last active June 28, 2023 21:50
pangu-spacing
(leaf pangu-spacing
:doc "Put a space between Japanese and English"
:url "http://github.com/coldnew/pangu-spacing"
:ensure t
:hook ((markdown-mode-hook text-mode-hook) . pangu-spacing-mode)
:config
(setq pangu-spacing-real-insert-separtor t)
(setq pangu-spacing-include-regexp ;; alphabet only
(rx (or (and (or (group-n 3 (any "。,!?;:「」()、"))
(group-n 1 (or (category japanese))))))
(leaf *text-adjust-space
:doc "Put space between full-width and half-width characters"
:url "https://github.com/uwabami/text-adjust.el"
:el-get uwabami/text-adjust.el
:hook (before-save-hook . text-adjust-space-before-save-if-needed)
:config
(defun text-adjust-space-before-save-if-needed ()
(when (memq major-mode
'(prog-mode text-mode markdown-mode))
(text-adjust-space-buffer)))