aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-buffer.el2
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el7
-rw-r--r--emacs/.emacs.d/init/ycp-org.el1
-rw-r--r--emacs/.emacs.d/lisp/my/my-emms.el24
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el12
-rw-r--r--emacs/.emacs.d/lisp/my/my-utils.el12
6 files changed, 44 insertions, 14 deletions
diff --git a/emacs/.emacs.d/init/ycp-buffer.el b/emacs/.emacs.d/init/ycp-buffer.el
index 6a560ea..78f5a66 100644
--- a/emacs/.emacs.d/init/ycp-buffer.el
+++ b/emacs/.emacs.d/init/ycp-buffer.el
@@ -235,6 +235,4 @@
"C-M-<mouse-5>" #'my-decrease-default-face-height)
)
-(setq large-file-warning-threshold 15000000)
-
(provide 'ycp-buffer)
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el
index 68b5459..a53d542 100644
--- a/emacs/.emacs.d/init/ycp-markup.el
+++ b/emacs/.emacs.d/init/ycp-markup.el
@@ -144,5 +144,12 @@
(add-to-list 'auto-mode-alist '("\\.html\\'" . htmlv-mode))
)
+;;; lilypond
+(add-to-list 'load-path "/usr/share/emacs/site-lisp")
+(autoload 'LilyPond-mode "lilypond-mode" "LilyPond Editing Mode" t)
+(add-to-list 'auto-mode-alist '("\\.ly\\'" . LilyPond-mode))
+(add-to-list 'auto-mode-alist '("\\.ily\\'" . LilyPond-mode))
+(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock)))
+
(provide 'ycp-markup)
;;; ycp-markup.el ends here
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el
index 77f720d..140b54d 100644
--- a/emacs/.emacs.d/init/ycp-org.el
+++ b/emacs/.emacs.d/init/ycp-org.el
@@ -346,6 +346,7 @@
("d" . org-deadline)
("s" . org-schedule)
("S" . org-toggle-narrow-to-subtree)
+ ("V" . my-org-defer-entry)
(";" . org-timer-set-timer)
("," . org-timer-pause-or-continue)
("h" . my-org-entry-toggle-drawer-visibility)
diff --git a/emacs/.emacs.d/lisp/my/my-emms.el b/emacs/.emacs.d/lisp/my/my-emms.el
index 91065a2..0e7243a 100644
--- a/emacs/.emacs.d/lisp/my/my-emms.el
+++ b/emacs/.emacs.d/lisp/my/my-emms.el
@@ -376,6 +376,7 @@ artist/album/track."
(my-emms-playlist-make-buffer-name
my-emms-favourites-playlist)))
+(require 'my-utils)
;;; random album in emms
(defun my-emms-current-album-name ()
(file-name-directory (my-emms-get-current-track-name)))
@@ -414,17 +415,18 @@ artist/album/track."
We put a low weight on discovery album, currently any directory
under /zzz-seren/."
(let ((album
- (elt my-emms-albums-cache (random (length my-emms-albums-cache)))))
+ (elt my-emms-albums-cache (my-random
+ (length my-emms-albums-cache)))))
(while (and (string-match "/zzz-seren/" album)
- (>= (random 100) 4))
+ (>= (my-random 100) 4))
(setq album
- (elt my-emms-albums-cache (random (length my-emms-albums-cache)))))
+ (elt my-emms-albums-cache (my-random (length my-emms-albums-cache)))))
album))
(defun my-emms-playlist-random-album ()
(interactive)
(with-current-emms-playlist
- (goto-line (1+ (random (count-lines (point-min) (point-max)))))
+ (goto-line (1+ (my-random (count-lines (point-min) (point-max)))))
(let ((album-name (my-emms-playlist-album-name-at-point)))
(goto-char (point-min))
(search-forward album-name)
@@ -526,13 +528,13 @@ Override `emms-mode-line-playlist-current' to incorporate wide chars."
(defun my-emms-playlist-random-group ()
(interactive)
(with-current-emms-playlist
- (let ((random-line (1+ (random (count-lines (point-min) (point-max))))))
- (goto-line random-line)
- (pcase-let ((`(,group-start . ,group-end) (my-emms-playlist-group-bounds)))
- (message "my-emms-playlist-random-group: (%d, %d)" random-line group-start)
- (goto-line group-start)
- (my-emms-playlist-mark-bounds group-end)
- (emms-playlist-mode-play-current-track)))))
+ (let ((random-line (1+ (my-random (count-lines (point-min) (point-max))))))
+ (goto-line random-line)
+ (pcase-let ((`(,group-start . ,group-end) (my-emms-playlist-group-bounds)))
+ (message "my-emms-playlist-random-group: (%d, %d)" random-line group-start)
+ (goto-line group-start)
+ (my-emms-playlist-mark-bounds group-end)
+ (emms-playlist-mode-play-current-track)))))
;;; TODO: mark bounds if and only if the currently played is out of
;;; the existing overlay.
diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el
index 5a50673..b3b3f28 100644
--- a/emacs/.emacs.d/lisp/my/my-org.el
+++ b/emacs/.emacs.d/lisp/my/my-org.el
@@ -696,7 +696,7 @@ Interactively remove empty logbooks when called with prefix-arg \\[universal-arg
(null (org-element-contents el)))
(org-element-remove el)
)))))))
- (setq clocks (sort clocks #'org-element-clock-start<=))
+ (setq clocks (sort clocks #'org-element-clock-start<=))
(setq headline (org-element-map data 'headline 'identity nil t)) ;; get the first headline within data
(or (org-element-map
(org-element-contents headline)
@@ -718,6 +718,16 @@ Interactively remove empty logbooks when called with prefix-arg \\[universal-arg
(kill-region (point-min) (point-max))
(insert (org-element-interpret-data data))))))
+(defun my-org-defer-entry ()
+ "Move current entry to the last of its parent."
+ (interactive)
+ (org-cut-subtree)
+ (save-excursion
+ (outline-up-heading 1)
+ (org-forward-heading-same-level 1)
+ (org-yank))
+ (message "Entry deferred."))
+
(defun my-org-refile-cache-rebuild ()
(org-refile-cache-clear)
(org-refile-get-targets))
diff --git a/emacs/.emacs.d/lisp/my/my-utils.el b/emacs/.emacs.d/lisp/my/my-utils.el
index 05ca2e6..8e0d184 100644
--- a/emacs/.emacs.d/lisp/my/my-utils.el
+++ b/emacs/.emacs.d/lisp/my/my-utils.el
@@ -503,4 +503,16 @@ With optional N, search in the Nth line from point."
(cond ((equal name "MIT") "expat")
(t name)))
+(defun my-random (limit)
+ (string-to-number
+ (calc-eval "$1 % $2" nil
+ (calc-eval
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (call-process "head" "/dev/urandom" t nil "-c"
+ (format "%d" (/ 256 8)))
+ (let ((f (apply-partially #'format "%02x")))
+ (concat "16#" (mapconcat f (buffer-string) "")))))
+ limit)))
+
(provide 'my-utils)