diff options
author | JSDurand <mmemmew@gmail.com> | 2023-02-21 16:28:54 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-02-21 16:28:54 +0800 |
commit | ee77fcd68760dd826c174e3e22e93d6f1a6247c0 (patch) | |
tree | 9b05fee7e528d6c16aacc75930df21b29deb7aaa | |
parent | 7880f616502f64c8b1b3b092ade8876a433aeb12 (diff) |
view: repeat, lower-case open target, and conversion.
* view-conf.el (durand-view-timers-or-temps): Make it repeating.
(durand-open-targets): Use lower-case names so that the completion
works better.
(durand-convert-youtube-video-to-url): Return the converted YouTube
address.
-rw-r--r-- | view-conf.el | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/view-conf.el b/view-conf.el index 215644b..9837079 100644 --- a/view-conf.el +++ b/view-conf.el @@ -78,6 +78,11 @@ If ARG is '(16), view the battery information." (t (user-error "Unsupported ARG: %S" arg)))) +(put 'durand-view-timers-or-temps 'repeat-map + (let ((map (make-sparse-keymap))) + (define-key map (vector ?t) 'repeat) + map)) + (define-obsolete-function-alias 'durand-view-timers 'durand-view-timers-or-temps "2020-09-02" "View the list of timers.") @@ -146,7 +151,7 @@ See the documentation for `durand-open-object' for the formats of targets.") (setq durand-open-targets - (list (list "Safari" "open" "-a" "Safari" + (list (list "safari" "open" "-a" "Safari" (list "https://www.youtube.com" "https://www.gmail.com" "https://www.facebook.com" @@ -155,11 +160,11 @@ targets.") "https://dictionary.christian-steinert.de/#home" ;; "https://wmail1.cc.ntu.edu.tw/index.php?url=https%3A%2F%2Fwmail1.cc.ntu.edu.tw%2F" )) - (list "Terminal" "open" "-a" "Terminal" (list + (list "terminal" "open" "-a" "Terminal" (list "/Users/durand/Desktop/Centre/Vidéos/" "/Users/durand/Desktop/Centre/Musique/" "/Users/durand/Downloads/")) - (list "Messenger" "open" "-a" "Messenger") + (list "messenger" "open" "-a" "Messenger") (list "temp d'écran" "open" "-b" "com.apple.systempreferences" "/System/Library/PreferencePanes/ScreenTime.prefPane"))) @@ -242,28 +247,33 @@ options to choose from." (defun durand-convert-youtube-video-to-url (video-name) "Convert VIDEO-NAME to its original url." (interactive (list (read-string "Video name: "))) - (save-match-data - (cond - ((string-match (rx "[" (group (1+ (not "]"))) "].") - video-name) - (kill-new - (concat - "https://www.youtube.com/watch?v=" - (match-string 1 video-name)))) - ((string-match "\\.[^.]+$" video-name) - ;; with extension - (kill-new - (concat - "https://www.youtube.com/watch?v=" - (substring-no-properties - video-name - (- (match-beginning 0) 11) - (match-beginning 0))))) - (t - ;; no extension - (kill-new - (concat "https://www.youtube.com/watch?v=" - (substring-no-properties video-name -11))))))) + (let (result) + (save-match-data + (cond + ((string-match (rx "[" (group (1+ (not "]"))) "].") + video-name) + (setq result (concat + "https://www.youtube.com/watch?v=" + (match-string 1 video-name))) + (kill-new result)) + ((string-match "\\.[^.]+$" video-name) + ;; with extension + (setq + result + (concat + "https://www.youtube.com/watch?v=" + (substring-no-properties + video-name + (- (match-beginning 0) 11) + (match-beginning 0)))) + (kill-new result)) + (t + ;; no extension + (setq result + (concat "https://www.youtube.com/watch?v=" + (substring-no-properties video-name -11))) + (kill-new result))) + result))) ;;; moving by paragraphs |