summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-01-17 21:38:38 +0800
committerJSDurand <mmemmew@gmail.com>2021-01-17 21:38:38 +0800
commit82d3a1fcc5c36a48b2a404536f89e1d80c48d999 (patch)
treeb8df471f662006b921a0d544bd8bc171f0c9c0d5
parent5f61771063f35f5cd6492708d89eb220e4067f6e (diff)
Tweak more things.
* basic.el (recenter-positions): In effect nothing changed. (prot-pulse-line): Puling the line. (pulse): Useful built-in library. (durand-pulse-pulse-line): My own tweak. (durand-pulse-recenter-top): Recenter and pulse. * init.el (prepare-in-hook-once): Make it interactive. (global-map): Add Org-mode bindings. ("durand-chercher-pdf"): Search PDFs quickly. * modeline.el (modeline-format-left): Remove the vertical bar. * org-conf.el (org-adapt-indentation) (org-modules) (org-hide-emphasis-markers) (org-hide-macro-markers) (org-hide-leading-stars): Steal some configurations from Protesilaos. (global-map) (org-mode-map): Add Org-mode bindings. (durand-pulse-pulse-line): (org-follow-link-hook): Pulse and recenter when following the link.
-rw-r--r--basic.el50
-rw-r--r--common.el2
-rw-r--r--dired-conf.el14
-rw-r--r--init.el31
-rw-r--r--modeline.el2
-rw-r--r--org-conf.el25
-rw-r--r--view-conf.el7
7 files changed, 122 insertions, 9 deletions
diff --git a/basic.el b/basic.el
index fcc6ed1..97b5345 100644
--- a/basic.el
+++ b/basic.el
@@ -148,6 +148,56 @@ window, then also delete the selected window."
;;;###autoload
(setq set-mark-command-repeat-pop t)
+;;; I prefer going to the top first.
+
+;; But I don't really like always going to the top. I am still
+;; thinking about solutions.
+
+(setq recenter-positions (list 'middle 'top 'bottom))
+
+;;; Pulse the current line
+
+;;;###autoload
+(defface prot-pulse-line
+ '((default :extend t)
+ (((class color) (min-colors 88) (background light))
+ :background "#8eecf4")
+ (((class color) (min-colors 88) (background dark))
+ :background "#004065")
+ (t :inverse-video t))
+ "Default face for `durand-pulse-pulse-line'.
+I stole from Protesilaos' dotemacs.")
+
+(require 'pulse)
+
+;;;###autoload
+(defun durand-pulse-pulse-line (&optional face)
+ "Temporarily highlight the current line with optional FACE."
+ (interactive)
+ (let ((start (cond
+ ((= (point) (point-max))
+ (save-excursion
+ (forward-line -1)
+ (point)))
+ ((save-excursion
+ (forward-line 0)
+ (point)))))
+ (end (save-excursion
+ (forward-line 1)
+ (point)))
+ (pulse-delay .04)
+ (face (or face 'prot-pulse-line)))
+ (pulse-momentary-highlight-region start end face)))
+
+(define-key global-map (vector 's-escape) #'durand-pulse-pulse-line)
+
+;;;###autoload
+(defun durand-pulse-recenter-top ()
+ "Recenter to the top and pulse the line."
+ (interactive)
+ (recenter 0)
+ (durand-pulse-pulse-line))
+
;;; auto-fill for texts
(set 'adaptive-fill-mode t)
diff --git a/common.el b/common.el
index 8b9ef16..21ba10d 100644
--- a/common.el
+++ b/common.el
@@ -64,8 +64,6 @@
(user-error "You pressed an intentionally disabled key-binding: %s"
(key-description (this-command-keys-vector))))
-
-
(provide 'common)
;;; common.el ends here.
diff --git a/dired-conf.el b/dired-conf.el
index 31d64fd..126c67c 100644
--- a/dired-conf.el
+++ b/dired-conf.el
@@ -1,4 +1,18 @@
;;; -*- lexical-binding: t; -*-
+(require 'dired)
+(require 'files)
(set 'insert-directory-program "gls")
(set 'dired-listing-switches "-alh --group-directories-first")
+(setq dired-dwim-target t)
+
+(require 'dired-aux)
+
+(setq dired-isearch-filenames 'dwim)
+(setq dired-create-destination-dirs 'ask)
+(setq dired-vc-rename-file t)
+
+(require 'wdired)
+
+(setq wdired-allow-to-change-permissions t)
+(setq wdired-create-parent-directories t)
diff --git a/init.el b/init.el
index f0cbc5b..1b4c8e5 100644
--- a/init.el
+++ b/init.el
@@ -36,6 +36,7 @@
"Define a function called ENTRY-NAME that loads FILE in HOOK once."
`(progn
(defun ,entry-name ()
+ (interactive)
(remove-hook ',hook ',entry-name)
(load-config ,file))
(add-hook ',hook ',entry-name)))
@@ -45,7 +46,9 @@
"Load FILE-PATH after FUNCTION-NAME.
After loading, execute DEF.
Finally if REDEFINE-P is non-nil,
-then FUNCTION-NAME will be defined as DEF after loading."
+then FUNCTION-NAME will be defined as DEF after loading.
+
+If FUNCTION-NAME is already a valid function, this won't do anything."
(cond
((fboundp function-name))
(t
@@ -82,6 +85,12 @@ then FUNCTION-NAME will be defined as DEF after loading."
(prepare-in-hook-once prepare-org org-mode-hook "org-conf.el")
+(add-hook 'org-mode-hook #'prepare-org)
+
+(define-key global-map (vector 3 97) #'prepare-org)
+(define-key global-map (vector 3 99) #'prepare-org)
+(define-key global-map (vector 3 ?l) #'prepare-org)
+
;;;###autoload
(load-after-function durand-mu4e "mail.el" "Open mu4e." t (mu4e))
@@ -97,6 +106,20 @@ then FUNCTION-NAME will be defined as DEF after loading."
(load-after-function bongo "bongo.el" "Listen to music in Emacs." nil
(bongo))
+;;; My PDF facilities
+
+(use-package "durand-chercher-pdf" 'durand-chercher-pdf
+ (define-key durand-pdf-mode-map (vector ?q) 'quit-window)
+ (define-key durand-pdf-mode-map (vector ?N) 'forward-line)
+ (define-key durand-pdf-mode-map (vector ?n) 'durand-pdf-next-pdf-line)
+ (define-key durand-pdf-mode-map (vector ?P) (lambda () (interactive) (forward-line -1)))
+ (define-key durand-pdf-mode-map (vector ?p) 'durand-pdf-previous-pdf-line)
+ (define-key durand-pdf-mode-map (vector 'return) 'durand-pdf-open-pdf)
+ (define-key durand-pdf-mode-map (vector 32) 'durand-pdf-open-or-scroll-up)
+ (define-key durand-pdf-mode-map (vector 'backspace) 'durand-pdf-open-or-scroll-down)
+ (define-key durand-pdf-mode-map (vector ?o) 'kill-other-buffer-window)
+ (define-key durand-pdf-mode-map (vector ?k) 'kill-current-buffer))
+
;;; gnus
(load-config "gnus-conf.el")
@@ -160,4 +183,10 @@ then FUNCTION-NAME will be defined as DEF after loading."
(define-key global-map (vector ?\s-q) #'window-toggle-side-windows)
+;;; server
+
+;; (cond
+;; ((bound-and-true-p server-process))
+;; ((server-start)))
+
(setq gc-cons-threshold (* 2 1024 1024))
diff --git a/modeline.el b/modeline.el
index cb0df77..62e4781 100644
--- a/modeline.el
+++ b/modeline.el
@@ -28,7 +28,7 @@
(defun modeline-format-left ()
"The left mode line format."
(concat
- (modeline-format-bar)
+ ;; (modeline-format-bar)
(modeline-spc)
(modeline-format-buffer-status)
(modeline-spc)
diff --git a/org-conf.el b/org-conf.el
index d252657..1104a2b 100644
--- a/org-conf.el
+++ b/org-conf.el
@@ -4,6 +4,12 @@
;; org-format-latex-options (plist-put org-format-latex-options :scale 1.5)
)
+(setq org-adapt-indentation nil)
+(setq org-modules '(ol-gnus ol-info ol-eww))
+
+(setq org-hide-emphasis-markers nil)
+(setq org-hide-macro-markers nil)
+(setq org-hide-leading-stars nil)
;; tempo
@@ -11,9 +17,24 @@
(add-to-list 'org-structure-template-alist (cons "g" "src durand-greek"))
(add-to-list 'org-structure-template-alist (cons "el" "src emacs-lisp"))
-(add-to-list 'org-modules 'ol-gnus)
+;; (add-to-list 'org-modules 'ol-gnus)
+
+;;; Keys
+
+(define-key global-map (vector 3 97) #'org-agenda)
+(define-key global-map (vector 3 99) #'org-capture)
+(define-key global-map (vector 3 ?l) #'org-store-link)
+
+(define-key org-mode-map (vector ?\C-') nil)
+(define-key org-mode-map (vector ?\C-,) nil)
+(define-key org-mode-map (vector 'C-return) nil)
+(define-key org-mode-map (vector 'C-S-return) nil)
+(define-key org-mode-map (vector 3 ?\S-l) #'org-toggle-link-display)
+(define-key org-mode-map (vector 3 ?\C-\S-l) #'org-insert-last-stored-link)
+
+(declare-function 'durand-pulse-pulse-line "~/Desktop/emacs.d/basic.el")
-;;; TODO: To finish this configuration file...
+(add-hook 'org-follow-link-hook #'durand-pulse-recenter-top)
;;; Some variables
diff --git a/view-conf.el b/view-conf.el
index ee6b8dd..945276f 100644
--- a/view-conf.el
+++ b/view-conf.el
@@ -37,7 +37,6 @@ If ARG is '(16), view the battery information."
cpu-die-temperature
(progn (re-search-forward "temperature: \\([[:digit:]]+\\.[[:digit:]]+\\)" nil t)
(string-to-number (match-string 1))))
-
;;; NOTE: Now battery charge information
(erase-buffer)
(call-process "system_profiler" nil t nil
@@ -57,7 +56,6 @@ If ARG is '(16), view the battery information."
(setf condition (match-string-no-properties 1))
(re-search-forward "Connected: \\(.+\\)$" nil t)
(setf connected (match-string-no-properties 1))
-
;;; NOTE: Now battery temperature
(erase-buffer)
(call-process "ioreg" nil t nil "-n" "AppleSmartBattery" "-r")
@@ -93,4 +91,7 @@ If ARG is '(16), view the battery information."
(require 'view)
-(define-key view-mode-map (vector 108) 'recenter-top-bottom)
+(define-key view-mode-map (vector 108) #'recenter-top-bottom)
+
+(define-key view-mode-map (vector ?j) #'View-scroll-line-forward)
+(define-key view-mode-map (vector ?k) #'View-scroll-line-backward)