diff options
| author | Yuchen Pei <id@ypei.org> | 2026-09-12 21:24:44 +1000 |
|---|---|---|
| committer | Yuchen Pei <id@ypei.org> | 2026-09-12 21:24:44 +1000 |
| commit | de8560903a5268056125976344f5da003553b9dd (patch) | |
| tree | d5d45b3aa476233ae1c31a60d4420fbcdf5575bf | |
| parent | d1d7f6e7a04c9a26ca4761d5142147e8d4d3c59b (diff) | |
| -rw-r--r-- | emacs/.emacs.d/init/ycp-markup.el | 8 | ||||
| -rw-r--r-- | emacs/.emacs.d/init/ycp-org.el | 2 | ||||
| -rw-r--r-- | emacs/.emacs.d/init/ycp-reading.el | 2 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-libgen.el | 25 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-media-segment.el | 3 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-web.el | 2 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-wget.el | 17 |
7 files changed, 37 insertions, 22 deletions
diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el index a53d542..6dd2c6e 100644 --- a/emacs/.emacs.d/init/ycp-markup.el +++ b/emacs/.emacs.d/init/ycp-markup.el @@ -146,10 +146,10 @@ ;;; 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))) +(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 140b54d..3e73088 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -191,7 +191,7 @@ (setq org-agenda-custom-commands `(("A" "Agenda and next" ((agenda "" - ((org-agenda-span 32) + ((org-agenda-span 63) ;; only works when `org-agenda-start-on-weekday' ;; is nil (org-agenda-start-day "-2d"))) diff --git a/emacs/.emacs.d/init/ycp-reading.el b/emacs/.emacs.d/init/ycp-reading.el index 5c0284e..e8575b9 100644 --- a/emacs/.emacs.d/init/ycp-reading.el +++ b/emacs/.emacs.d/init/ycp-reading.el @@ -26,6 +26,8 @@ ;;; Code: +(setq text-scale-mode-step 1.1) + (my-package belf (my-setq-from-local belf-dir belf-locate-dirs) (add-hook 'find-file-hook 'belf-recent-add-current) diff --git a/emacs/.emacs.d/lisp/my/my-libgen.el b/emacs/.emacs.d/lisp/my/my-libgen.el index a8e7dca..f1c4f7c 100644 --- a/emacs/.emacs.d/lisp/my/my-libgen.el +++ b/emacs/.emacs.d/lisp/my/my-libgen.el @@ -135,14 +135,22 @@ my-libgen-host (alist-get 'coverurl info))))) +(defvar my-libgen-max-filename-length 200) + (defun my-libgen-format-filename (info) - (my-make-doc-file-name (format - "%s - %s (%s) [%s].%s" - (alist-get 'author info) - (alist-get 'title info) - (alist-get 'year info) - (alist-get 'identifier info) - (alist-get 'extension info)))) + (let ((name (format + "%s - %s (%s) [%s]" + (alist-get 'author info) + (alist-get 'title info) + (alist-get 'year info) + (alist-get 'identifier info)))) + (my-make-doc-file-name + (format + "%s.%s" + (if (length> name my-libgen-max-filename-length) + (substring name 0 my-libgen-max-filename-length) + name) + (alist-get 'extension info))))) (defvar my-libgen-download-dir "~/Downloads") @@ -187,7 +195,8 @@ my-libgen-plus-host (dom-attr (dom-search - (my-wget-dom (alist-get 'ads (my-libgen-plus-urls info))) + (my-wget-dom (alist-get 'ads (my-libgen-plus-urls info)) nil + "--referer" my-libgen-plus-host) (lambda (n) (string-match (format "get\\.php\\?md5=%s" .md5) (or (dom-attr n 'href) "")))) diff --git a/emacs/.emacs.d/lisp/my/my-media-segment.el b/emacs/.emacs.d/lisp/my/my-media-segment.el index e8ee5cc..4fca988 100644 --- a/emacs/.emacs.d/lisp/my/my-media-segment.el +++ b/emacs/.emacs.d/lisp/my/my-media-segment.el @@ -110,7 +110,8 @@ Much faster than my-segment-media-file or my-segment-media-file-1." (when end `("-to" ,end)) `("-c" "copy" ,(format - (format "%%s/%%0%dd-%%s.%%s" pad) dir idx title + (format "%%s/%%0%dd-%%s.%%s" pad) dir idx + (substring title 0 (min (length title) 100)) (file-name-extension media-file-name))))) (message "Will cut %s-%s to %s (%d/%d)..." start (or end "") title idx total))) diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el index 87c319f..7564a71 100644 --- a/emacs/.emacs.d/lisp/my/my-web.el +++ b/emacs/.emacs.d/lisp/my/my-web.el @@ -183,7 +183,7 @@ e.g. https://news.ycombinator.com/item?id=42505454" (browse-url-firefox (url-recreate-url urlobj)))) (defun my-newscorp-au-url-p (url) - (string-match-p "^\\(www\\.\\)?\\(heraldsun\\|theaustralian\\)\\.com\\.au$" + (string-match-p "^\\(www\\.\\)?\\(heraldsun\\|theaustralian\\|weeklytimesnow\\|thechronicle\\|couriermail\\)\\.com\\.au$" (url-host (url-generic-parse-url url)))) (defun my-stack-overflow-url-p (url) diff --git a/emacs/.emacs.d/lisp/my/my-wget.el b/emacs/.emacs.d/lisp/my/my-wget.el index f3f6771..0c3d447 100644 --- a/emacs/.emacs.d/lisp/my/my-wget.el +++ b/emacs/.emacs.d/lisp/my/my-wget.el @@ -86,19 +86,22 @@ no-tor move-if-video-or-large) (setq i (1+ i))))) -(defun my-wget-out-internal (url buffer-processor &optional no-tor) +(defun my-wget-out-internal (url buffer-processor &optional no-tor &rest args) "Run wget on url, dump the results in a temp buffer, then apply BUFFER-PROCESSOR" (with-temp-buffer - (my-call-process-with-torsocks no-tor "wget" nil '(t nil) nil "-O" "-" url) + (apply 'my-call-process-with-torsocks + `(,no-tor "wget" nil (t nil) nil "-O" "-" ,url ,@args)) (call-interactively 'delete-trailing-whitespace) (funcall buffer-processor) )) -(defun my-wget-dom (url &optional no-tor) - (my-wget-out-internal - url - (lambda () (libxml-parse-html-region (point-min) (point-max))) - no-tor)) +(defun my-wget-dom (url &optional no-tor &rest args) + (apply + 'my-wget-out-internal + `(,url + ,(lambda () (libxml-parse-html-region (point-min) (point-max))) + ,no-tor + ,@args))) (defun my-wget-raw (url &optional no-tor) (my-wget-out-internal url 'buffer-string no-tor)) |
