Migrate mouse config to general.el, Org config to use-package

This commit is contained in:
contrapunctus 2019-11-04 20:36:09 +05:30
parent af39864690
commit 05fe16785f
3 changed files with 77 additions and 85 deletions

View File

@ -2,29 +2,6 @@
;; mouse-4 and 5 - wheel up and wheel down
;; mouse-9 and 8 - 'forward' and 'backward' thumb buttons
(cp-set-keys
:bindings
'( ;; ([down-mouse-1] mouse-set-point)
;; ([up-mouse-1] er/expand-region)
([s-mouse-3] bury-buffer)
([mouse-8] delete-window)
;; (,(kbd "<mouse-9>") keyboard-quit)
;; ([mouse-9] buffer-menu)
([mouse-9] ibuffer)
([C-mouse-9] recentf-open-files)
([M-mouse-4] next-buffer)
([M-mouse-5] previous-buffer)
([M-mouse-8] split-window-right)
([M-mouse-9] split-window-below)
;; quitting from helm-mini - whether with keyboard-quit or
;; keyboard-escape-quit - "banishes" the mouse pointer to the
;; top-right corner!? wtf, helm.
;; (,(kbd "s-<mouse-9>") helm-mini)
))
(with-eval-after-load 'org
(define-key org-mode-map [mouse-1] 'org-cycle))
;; (require 'ediff)
;; (cp-set-keys

View File

@ -1,26 +1,24 @@
(require 'cp-daylog)
(global-set-key (kbd "<f5> o") 'org-mode)
(with-eval-after-load 'org
(use-package org-mode
:bind
(("<f5> o" . 'org-mode)
:map org-mode-map
("C-," . nil)
("M-n" . org-metadown)
("M-p" . org-metaup)
("C-c C--" . org-ctrl-c-minus)
("C-c C-," . org-metaleft)
("C-c C-." . org-metaright)
;; ("C-j" . org-return)
;; ("C-m" . org-return-indent)
("C-c C-9" . org-mark-ring-goto)
("C-c C-/" . org-sparse-tree)
("M-w" . cp-copy-line-or-link)
("C-c C-]" . org-set-tags)
("C-M-x" . cp/eval-sexp)
("C-c C-o" . cp/org-open))
:config
;; (setq org-M-RET-may-split-line 'nil)
;; (add-hook 'org-mode-hook 'org-display-inline-images)
(cp-set-keys
:keymap org-mode-map
:bindings
`((,(kbd "C-,") nil)
(,(kbd "M-n") org-metadown)
(,(kbd "M-p") org-metaup)
(,(kbd "C-c C--") org-ctrl-c-minus)
(,(kbd "C-c C-,") org-metaleft)
(,(kbd "C-c C-.") org-metaright)
;; (,(kbd "C-j") org-return)
;; (,(kbd "C-m") org-return-indent)
(,(kbd "C-c C-9") org-mark-ring-goto)
(,(kbd "C-c C-/") org-sparse-tree)
(,(kbd "M-w") cp-copy-line-or-link)
(,(kbd "C-c C-]") org-set-tags)
(,(kbd "C-M-x") cp/eval-sexp)
(,(kbd "C-c C-o") cp/org-open)))
;; (defun cp-org-expand-all ()
;; (interactive)
@ -29,20 +27,20 @@
;; ;; todo - check if we are on a heading
;; (org-forward-heading-same-level)
;; ())
(setq org-file-apps
'(("txt" . emacs)
("org" . emacs)
;; ("pdf" . zathura)
("\\(?:gif\\|jpe?g\\|png\\)" . "sxiv -f %s")
;; (t . "xdg-open %s")
(setq org-file-apps '(("txt" . emacs)
("org" . emacs)
;; ("pdf" . zathura)
("\\(?:gif\\|jpe?g\\|png\\)" . "sxiv -f %s")
;; (t . "xdg-open %s")
("pdf" . system)
;; ("pdf" . "zathura %s")
;; (auto-mode . emacs)
;; (system . "xdg-open %s")
(system . "zathura %s")
;; (t . system)
)
("pdf" . system)
;; ("pdf" . "zathura %s")
;; (auto-mode . emacs)
;; (system . "xdg-open %s")
(system . "zathura %s")
;; (t . system)
)
org-todo-keywords '((sequence "TODO" "RESEARCH" "STARTED" "DONE"))
org-image-actual-width 400
org-cycle-include-plain-lists 'integrate
@ -110,42 +108,42 @@
,(format "\\.%s\\'"
(regexp-opt
'("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm"
"xpm" "pbm" "pgm" "ppm" "webp") t)))))
"xpm" "pbm" "pgm" "ppm" "webp") t))))) )
(defvar cp/org-heading-or-list-rx
'(and
;; headings
(zero-or-more "*")
(zero-or-more blank)
;; list items
(zero-or-one
(or "- " "+ " "* "
(and (one-or-more (char "0-9"))
(or ". " ") "))))
(zero-or-one (and "[" nonl "] "))))
(defvar cp/org-heading-or-list-rx
'(and
;; headings
(zero-or-more "*")
(zero-or-more blank)
;; list items
(zero-or-one
(or "- " "+ " "* "
(and (one-or-more (char "0-9"))
(or ". " ") "))))
(zero-or-one (and "[" nonl "] "))))
(defun org-link-ahead-p (&optional link-type)
"Returns t if point is before an org-mode link, ignoring
(defun org-link-ahead-p (&optional link-type)
"Returns t if point is before an org-mode link, ignoring
whitespace and org-mode header and list syntax, else nil.
If LINK-TYPE is 'implicit, checks for an implicit link (one not
inside single or double brackets); otherwise, checks for links in
the form [[address][description]] and [[address]]."
(looking-at
(looking-at
(rx-to-string
(append cp/org-heading-or-list-rx
(if (eq link-type 'implicit)
'("http")
'("["))))))
(defun cp/org-open (&optional arg reference-buffer)
(interactive "P")
(save-excursion
(re-search-line
(rx-to-string
(append cp/org-heading-or-list-rx
(if (eq link-type 'implicit)
'("http")
'("["))))))
(defun cp/org-open (&optional arg reference-buffer)
(interactive "P")
(save-excursion
(re-search-line
(rx-to-string
(append cp/org-heading-or-list-rx
'((or "[" "[[" "http")))))
(org-open-at-point arg reference-buffer))))
'((or "[" "[[" "http")))))
(org-open-at-point arg reference-buffer)))
(defun cp-copy-line-or-link (prefix-arg)
"Copy address of org-mode link after point, ignoring whitespace,

19
init.el
View File

@ -651,7 +651,24 @@ and eval it."
"T" 'cp-insert-timestamp
"c" 'calendar)
(load "cp-mouse")
(general-define-key
;; [down-mouse-1] 'mouse-set-point
;; [up-mouse-1] 'er/expand-region
[s-mouse-3] 'bury-buffer
[mouse-8] 'delete-window
;; (kbd "<mouse-9>") 'keyboard-quit
;; [mouse-9] 'buffer-menu
[mouse-9] 'ibuffer
[C-mouse-9] 'recentf-open-files
[M-mouse-4] 'next-buffer
[M-mouse-5] 'previous-buffer
[M-mouse-8] 'split-window-right
[M-mouse-9] 'split-window-below
;; quitting from helm-mini - whether with keyboard-quit or
;; keyboard-escape-quit - "banishes" the mouse pointer to the
;; top-right corner!? wtf, helm.
;; (kbd "s-<mouse-9>") 'helm-mini
))
(with-eval-after-load 'help-mode
(cp-set-keys