summaryrefslogtreecommitdiff
path: root/view-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'view-conf.el')
-rw-r--r--view-conf.el62
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.