diff options
author | JSDurand <mmemmew@gmail.com> | 2021-01-23 00:23:05 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-01-24 00:49:45 +0800 |
commit | 2066e827155ae2893097360024ffd975166a44ef (patch) | |
tree | e15bb118a4a0e622575847c05ef1dcfae30e58ef /view-conf.el | |
parent | 588b6031e152b031be1dee04c7b38938ea7eb706 (diff) |
More custom functions and adjust for custom completion framework
* LICENSE: Add GPLv3.
* basic.el (durand-enlarge-window):
(durand-shrink-window):
(durand-enlarge-window-horizontally):
(durand-shrink-window-horizontally): Now I can easily maximize or
minimize windows.
* comb/orderless-conf.el ("orderless"): Now I try to use my own
completion framework.
* common.el (durand-embark-scroll-down-or-go-to-completions):
(durand-embark-scroll-up-or-go-to-completions):
(durand-completion-scroll-down-or-go-to-minibuffer):
(durand-completion-scroll-up-or-go-to-minibuffer): Move these
functions here since they do not belong to the completion framework in
my opinion.
(register):
(register-val-jump-to): Rewrite this method so that it does not have
to ask me if I want to open a file while jumping.
* completion-conf.el: My intended completion framework, which is still
work in progress.
* init.el ("comb/orderless-conf.el"):
("completion-conf.el"): Adjust things accordingly.
("durand-simple"): My custom functions for viewing and for opening
things.
* modeline.el (modeline-propertize):
(modeline-format-minor-modes):
(modeline-format-major-mode): Now the macro `modeline-propertize'
won't override properties that it does not intend to define. This has
the effect that the properties of the original constructs will go
through and have effect.
(modeline-format-main): Make sure the space has a positive length.
(modeline-format-buffer-name): Make sure the length does not exceed
half the width of the window.
Diffstat (limited to 'view-conf.el')
-rw-r--r-- | view-conf.el | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/view-conf.el b/view-conf.el index 4d4ff00..ca08409 100644 --- a/view-conf.el +++ b/view-conf.el @@ -87,6 +87,19 @@ If ARG is '(16), view the battery information." (proced) (message "%s" (process-list)))) +;;; My map for viewing + +;;;###autoload +(defvar durand-view-map + ;; Against every good principle I guess... + (let ((map (list 'keymap "View"))) + (define-key map (vector ?v) 'view-mode) + (define-key map (vector ?p) #'durand-view-process) + (define-key map (vector ?t) #'durand-view-timers-or-temps) + (define-key map (vector ?e) #'eshell) + map) + "The keymap that is related to my custom functions about viewing.") + ;;; About view-mode (require 'view) @@ -95,6 +108,55 @@ If ARG is '(16), view the battery information." (define-key view-mode-map (vector ?j) #'View-scroll-line-forward) (define-key view-mode-map (vector ?k) #'View-scroll-line-backward) +(define-key global-map (vector 3 118) durand-view-map) + +;;; Open things + +;;;###autoload +(defvar durand-open-targets + (list (list "safari" "open" "-a" "Safari" -1) + (list "terminal" "open" "-a" "Terminal" -1)) + "Targets to open by `durand-open-object'. + +This is an association list whose elements have `car' equal to +the choice presented to the user, and have `cdr' a list that will +be passed to `make-process'.") + +;;;###autoload +(defun durand-open-object (&optional arg) + "Open something. + +What can be opened is controlled by the variable +`durand-open-targets'. + +If ARG is non-nil, and if the chosen target contains `-1' in the +command line options, then read a string to replace that -1." + (interactive "P") + (let* ((targets durand-open-targets) + (choice (completing-read "Open: " targets nil t)) + (commands (cdr (assoc choice targets #'string=))) + (contain-minus-one-p (memq -1 commands)) + (extra (cond + ((and arg contain-minus-one-p) + (read-string "Extra argument: ")))) + temp) + (cond + (contain-minus-one-p + (setq commands (progn + (while (consp commands) + (cond + ((eq (car commands) -1) + (setq temp (cons extra temp))) + ((setq temp (cons (car commands) temp)))) + (setq commands (cdr commands))) + (reverse temp))))) + (setq conmmands (delq nil commands)) + (make-process :name "durand-open" + :buffer nil + :command commands))) + +;;; C-c o => 3 111 +(define-key global-map (vector 3 111) #'durand-open-object) ;;; Convert downloaded videos from youtube to the URL again and copy ;;; the result. |