;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
;; do m-x benchmark-init to see some benchmark stats
;;(add-to-list 'load-path "~/.emacs.d/src/benchmark-init-el/")
;;(require 'benchmark-init-loaddefs)
;;(benchmark-init/activate)
-
;;; init.el --- the start of customization
;; (toggle-debug-on-error) ;uncomment to help debug
-;; Package.el added this a long time ago. emacs 26 gives a warning that
-;; this is obsolete, but it doesn't happen automatically in batch mode,
-;; and then emacs dies on error, so it doesn't seem obsolete to me.
-
-
;; stop from minimizing & freezing the gui
;; used to freeze emacs and was really annoying,
;; seems its changed now. no harm in keeping this though.
(global-unset-key (kbd "C-z"))
;; speed up init https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
-(setq gc-cons-threshold 100000000)
+;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
+(defvar file-name-handler-alist-old file-name-handler-alist)
+(setq package-enable-at-startup nil
+ file-name-handler-alist nil
+ message-log-max 16384
+ gc-cons-threshold 402653184
+ gc-cons-percentage 0.6
+ auto-window-vscroll nil)
+
+(add-hook 'after-init-hook
+ `(lambda ()
+ (setq file-name-handler-alist file-name-handler-alist-old
+ gc-cons-threshold 800000
+ gc-cons-percentage 0.1)
+ (garbage-collect)) t)
+
+;; 2019-6-26, 1.26s
+ ;;; to profile init:
+ ;;; uncomment the following block
+;; (require 'benchmark-init)
+;; (add-hook 'after-init-hook 'benchmark-init/deactivate)
+ ;;; Then run:
+ ;;; emacs -f benchmark-init/show-durations-tabulated
+ ;;; emacs -f benchmark-init/show-durations-tree
+ ;;; to catch things post-init
+ ;;; emacs -f benchmark-init/deactivate
;; these need to be done before the hook in order to satisfy the byte compiler or batch mode
;; disabled since not used.
;;(add-to-list 'load-path "~/.emacs.d/src/bbdb-csv-import")
+;;(add-to-list 'load-path "~/.emacs.d/src/ghci-completion")
+;;(add-to-list 'load-path "~/.emacs.d/src/mediawiki-el")
+;;(add-to-list 'load-path "~/.emacs.d/src/spray")
-(add-to-list 'load-path "~/.emacs.d/src/ghci-completion")
-(add-to-list 'load-path "~/.emacs.d/src/mediawiki-el")
-(add-to-list 'load-path "~/.emacs.d/src/spray")
(add-to-list 'load-path "~/.emacs.d/src/visible-mark")
-;; git version of gnus
-;; (add-to-list 'load-path "~/.emacs.d/src/gnus/lisp")
-(require 'info)
-(add-to-list 'Info-default-directory-list "~/.emacs.d/src/gnus/texi")
-
-;; needed for git version
-;;(add-to-list 'load-path "~/.emacs.d/src/haskell-mode")
-;;(require 'haskell-mode-autoloads)
-;;(add-to-list 'Info-default-directory-list "~/.emacs.d/src/haskell-mode")
-
-;; for using custom/upstream bbdb
-;;(require 'bbdb-loaddefs "~/.emacs.d/src/bbdb/lisp/bbdb-loaddefs.el")
-;;(setq bbdb-print-tex-path "~/.emacs.d/src/bbdb/tex")
-
-
-;; iank: dunno what this was about
-;;(add-hook 'server-visit-hook 'raise-frame)
(setq init-dir (file-name-directory load-file-name))
;; previously, i was doing byte-recompile-directory, but
;; now i just have one init file
(unless (equal (user-uid) 0) ; don't make root owned files
- (byte-recompile-file (expand-file-name "init.el" init-dir)))
-
-;; load init in `after-init-hook' so all packages are loaded. However, disabled because
-;; there seems to be no need.
-;; todo, learn about the weird evaluation order of this hook that requires the quoting.
-;; adapted from starter-kit
-;; (add-hook 'after-init-hook
-;; `(lambda ()
-;; (load-file (expand-file-name "myinit.el" init-dir))
-;; ))
-
-
-;;; Weird package bug workaround
-
-
-;; without this, when installing a package, this message happens
-;;
-;; custom-handle-keyword: Unknown keyword :group
-;;
-;; but when i lookup the function, i get the following, and if
-;; I evaluate it, the error goes away. so I think the real
-;; definition is happening somewhere else
-
-(defun custom-handle-keyword (symbol keyword value type)
- "For customization option SYMBOL, handle KEYWORD with VALUE.
-Fourth argument TYPE is the custom option type."
- (if purify-flag
- (setq value (purecopy value)))
- (cond ((eq keyword :group)
- (custom-add-to-group value symbol type))
- ((eq keyword :version)
- (custom-add-version symbol value))
- ((eq keyword :package-version)
- (custom-add-package-version symbol value))
- ((eq keyword :link)
- (custom-add-link symbol value))
- ((eq keyword :load)
- (custom-add-load symbol value))
- ((eq keyword :tag)
- (put symbol 'custom-tag value))
- ((eq keyword :set-after)
- (custom-add-dependencies symbol value))
- (t
- (error "Unknown keyword %s" keyword))))
-
+ (byte-recompile-file (expand-file-name "init.el" init-dir) nil 0)
+ (when (file-exists-p "/p/c/mymu4e.el")
+ (byte-recompile-file "/p/c/mymu4e.el" nil 0))
+ )
;;; misc emacs documentation
;; nnfolder-generate-active-file
;; to reset things, when changing mail group. I duno all the proper way, but it works to delete
-;; ~/Mail ~/.newsrc.eld ~/.dribble (or something)
+;; ~/Mail ~/.newsrc.eld ~/.newsrc-dribble
;;;;; mail sources vs select methods background
;;; things that should be at the beginning
-;; todo, evaluating this manually disables debug on error instead of toggling it
-(toggle-debug-on-error) ;uncomment to help debug and catch errors
-
-;; packages installed from package manager: i pretty much prioritize repos this way: gnu, then melpa, then marmalade.
-
-;; package-activated-list:
-;; ac-dabbrev ac-haskell-process ack-and-a-half alect-themes auctex bash-completion bbdb csv-mode cyberpunk-theme dot-mode expand-region f find-file-in-project flycheck foreign-regexp ggtags ghc gnuplot-mode goto-chg haskell-mode heroku-theme highlight-indentation highlight-symbol htmlize inf-ruby info+ inkpot-theme jedi auto-complete jedi-core epc ctable concurrent key-chord leuven-theme logstash-conf magit git-commit magit-popup misc-fns mouse+ naquadah-theme nginx-mode occidental-theme org paredit pcsv php-mode pkg-info epl popup py-autopep8 python-environment deferred python-info python-mode rainbow-mode rust-mode rw-hunspell s smartparens smex smooth-scroll sr-speedbar strings swiper ivy tabulated-list tangotango-theme thingatpt+ undo-tree vimrc-mode volatile-highlights web-mode with-editor dash async ws-butler yasnippet
-
-;;;; alternate keyboards
-;; todo, figure out an easy way to disable this when using external keyboard
-(if (display-graphic-p)
- (setq
- enter-key (kbd "<return>")
- s-enter-key (kbd "<S-return>")
- c-m-enter-key (kbd "<C-M-return>")
- m-enter (kbd "<M-return>")
- c-enter (kbd "<C-return>"))
- (setq
- enter-key (kbd "C-m")
- s-enter-key (kbd "C-8")
- c-m-enter-key (kbd "C-M-8")
- m-enter (kbd "M-m")
- c-enter (kbd "C-8")))
-
-(setq tp (string= (system-name) "tp"))
-(setq x200 (string= (system-name) "x2"))
-(setq laptop-keyboard (or tp x200))
-
-;; Ubiquitous Packages which should be loaded on startup rather than
-;; autoloaded on demand since they are likely to be used in every
-;; session.
-(require 'saveplace)
-(require 'ffap)
-(require 'uniquify)
-(require 'ansi-color)
-(require 'recentf)
-;; Better to have a list of packages in here vs installed manually.
-;; However, I install manually because sometimes there are two
-;; versions and it is not necessarily easy to reconcile that.
-;; based on marmalage website front page.
-(require 'package)
+;; from its README.md
+(eval-when-compile
+ (require 'use-package))
-;; little kit to help remove a down server
-;; (setq package-archives nil)
+
+;; Ubiquitous Packages. these could go anywhere actually
+(use-package saveplace
+ :unless noninteractive
+ :config
+ (save-place-mode 1))
+(use-package ffap)
+
+;; from jwiegley
+(use-package recentf
+ :defer 10
+ :commands (recentf-mode
+ recentf-add-file
+ recentf-apply-filename-handlers)
+ :config
+ (recentf-mode 1))
+
+(setq package-archives
+ (quote
+ (("gnu" . "https://elpa.gnu.org/packages/")
+ ("MELPA" . "https://melpa.org/packages/"))))
;;(add-to-list 'package-archives
;; '("marmalade" .
;; "http://marmalade-repo.org/packages/"))
-(add-to-list 'package-archives
- '("melpa" . "http://melpa.milkbox.net/packages/") t)
-(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
+;; down atm 2020-08-30
+;;(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
;; keep our init.el clean, by moving customization elisp to it's own file
(load custom-file 'noerror)
-
-;;; abreviations
-;; turn on abbrev mode globally
-(setq-default abbrev-mode t)
-
-;; default abbreviation mode file is .emacs.d/abbrev_defs.
-;; add-global-abbrev, add-mode-abbrev for expansion at point
-;; if all else fails, edit the abbrev file
-
-
-
-
;;; auto-complete
;; auto-completion in minibuffer
(define-key ac-completing-map (kbd "<down>") nil)
(define-key ac-completing-map (kbd "<S-return>") 'ac-expand)
(define-key ac-completing-map "\t" 'ac-complete)
-(define-key ac-completing-map (kbd "<tab>") 'ac-complete)
+;;(define-key ac-completing-map (kbd "<tab>") 'ac-complete)
+(define-key ac-completing-map (kbd "TAB") 'ac-complete)
(add-hook 'shell-mode-hook
(lambda ()
- (define-key shell-mode-map (kbd "<tab>") 'auto-complete)))
+ ;;(define-key shell-mode-map (kbd "<tab>") 'auto-complete)
+ (define-key shell-mode-map (kbd "TAB") 'auto-complete)
+ ))
;;; readline complete fix
-;; I need this function here, where INSIDE_EMACS is replaced with RLC_INSIDE_EMACS.
+;; I need this function here, where INSIDE_EMACS is replaced with LC_INSIDE_EMACS.
;; ian: last update 2017-1-7. update this periodically from upstream
;; like when we do a major emacs update
(defun comint-exec-1 (name buffer command switches)
(format "COLUMNS=%d" (window-width)))
(list "TERM=emacs"
(format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
- (list (format "RLC_INSIDE_EMACS=%s,comint" emacs-version))
+ (list (format "LC_INSIDE_EMACS=%s,comint" emacs-version))
process-environment))
(default-directory
(if (file-accessible-directory-p default-directory)
;; mu4e has a bug right now, undo breaks when saving drafts
(not (string= (buffer-file-name) "*draft*"))
(buffer-modified-p)
- (not (org-src-edit-buffer-p)))
+ (not (and (boundp 'org-src-edit-buffer-p) (org-src-edit-buffer-p))))
;; serial is incremented on each save, so let's do a bit less of them
(not (derived-mode-p 'dns-mode))
(setq my-auto-save-last last)
(load-theme arg t))
(setq color-theme-is-global t)
+;; temporary, make night be default
+
(defun toggle-night ()
(interactive)
(cond ((equal (car custom-enabled-themes) 'naquadah)
;; Save a list of recent files visited.
(recentf-mode 1)
-(setq recentf-max-saved-items 200
+(setq recentf-max-saved-items 400
recentf-max-menu-items 15)
;;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
-(require 'mu4e)
+;; (require 'mu4e)
;; (setq mu4e-headers-results-limit 2000)
+
+(defun my-mu4e-init ()
+ (setq mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields))
+ ;; it's implemented in mu4e, but not in the actions list for
+ ;; some reason.
+ (add-to-list 'mu4e-view-actions
+ '("browser view" . mu4e-action-view-in-browser) t)
+
+ (add-to-list 'mu4e-headers-actions
+ '("from this sender" . mu4e-action-msgs-by-this-sender) t)
+ (add-to-list 'mu4e-view-actions
+ '("from this sender" . mu4e-action-msgs-by-this-sender) t)
+ ;; normally, you would add to this, but we want to
+ ;; modify unread messages. the first 4 are defined by default.
+ (setq mu4e-bookmarks
+ `( ,(make-mu4e-bookmark
+ :name "Unread messages"
+ ;; old less restrictive unread, for adapting in the future:
+ ;; flag:unread AND NOT flag:trashed AND NOT maildir:/Junk AND NOT maildir:/fwfw AND NOT maildir:/log
+ :query "flag:unread maildir:/INBOX"
+ :key ?u)
+ ,(make-mu4e-bookmark
+ :name "Today's messages"
+ :query "date:today..now"
+ :key ?t)
+ ,(make-mu4e-bookmark
+ :name "Last 7 days"
+ :query "date:7d..now"
+ :key ?w)
+ ,(make-mu4e-bookmark
+ :name "Messages with images"
+ :query "mime:image/*"
+ :key ?p))
+ )
+ )
+
+(eval-after-load "mu4e" '(my-mu4e-init))
+
(setq
+ ;; https://github.com/djcb/mu/issues/1025
+ mail-user-agent 'mu4e-user-agent
;; common to gnus. default sendmail-query-once asks us, then sets this via customize.
send-mail-function (quote sendmail-send-it)
;; use the standard imap folders
mu4e-use-fancy-chars t
mu4e-confirm-quit nil
mu4e-headers-leave-behavior 'apply ;; dont ask, do whatever was marked
- mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields)
;; default 500.
mu4e-headers-results-limit 1000
;; tell exim to use from: as envelope from.
mu4e-cache-maildir-list t
;; default is 8, way too small for my big monitors
mu4e-headers-visible-lines 50
+ message-sendmail-envelope-from 'header
+ ;; trying this out
+ ;;mu4e-view-use-gnus t
+ ;; had problems where mu4e and gnus would hang verifying signatures, gnus man
+ ;; said this should help, but it didnt work. they still got verified.
+ ;; mm-verify-option 'never
)
;; fucks up reading unread bookmark. when that is fixed, enable it
;; mu4e-user-mail-address-list
;; and a function
;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
-(load "/p/c/mu4e.el")
+(when (file-exists-p "/p/c/mymu4e.el")
+ (load "/p/c/mymu4e.el"))
(defun my-decrypt ()
;; use for decrypting in mu4e
)))
(add-hook 'mu4e-view-mode-hook 'my-decrypt)
-(defun mu-set-from-name (regexes)
+(defun iank-set-from-name (regexes)
"If we find an address matching regex, then set that address as the to,
and whatever was used"
(when mu4e-compose-parent-message
regexes (cdr regexes)
found (mu4e-message-contact-field-matches
mu4e-compose-parent-message :to re)))
- (when found (setq user-mail-address (cdr found)
- user-full-name (car found)))
+ (when found
+ (setq user-full-name (car found))
+ ;; we get an error unless we do this. that is a bug. I could
+ ;; send a patch... also a bug: setting message-from-style nil
+ ;; doesnt work in mu4e unless user-full-name is also nil.
+ (unless user-full-name
+ (setq message-from-style nil))
+ (setq user-mail-address (cdr found)
+ mail-signature nil))
found)))
-(defun mu-set-from (regexes)
+(defun iank-set-from (regexes)
"If we find an address matching regex, then set that address as the to,
and Ian Kelling as the name"
(when mu4e-compose-parent-message
(let ((found nil))
(while (and regexes (not found))
(setq re (car regexes)
- regexes (cdr regexes)
+ sig (cadr regexes)
+ regexes (cddr regexes)
found (cdr (mu4e-message-contact-field-matches
mu4e-compose-parent-message :to re))))
(when found (setq user-mail-address found
found)))
-(defun my-mu4e-to-fsf ()
- "inspired by mu4e info manual, search for mu4e-compose-pre-hook."
- (cond
- ((mu-set-from '("iank@fsf.org"
- "iank@gnu.org")))
- ((setq user-mail-address "iank@fsf.org"
- user-full-name "Ian Kelling"))))
-
-
-;; on first run mkdir -p /nocow/user/.mufsf; mu index --maildir=/nocow/user/fsfmd
(defun mu-exit-wait ()
(interactive)
;; taken from the mu source
(defun fsf-mu4e ()
(interactive)
- (unless (equal mu4e-maildir "/nocow/user/fsfmd") (mu-exit-wait))
+ (my-mu4e-commmon)
(setq
- ;; fsf monitor is smaller
- mu4e-headers-visible-lines 15
- mu4e-maildir "/nocow/user/fsfmd"
- mu4e-refile-folder "/Spam"
- mu4e-index-lazy-check nil
- mu4e-get-mail-command "true"
user-mail-address "iank@fsf.org"
+ iank-user-mail-address user-mail-address
;; WARNING: be careful editing this, there needs to be a space after --, and my editor
;; and git will automatically remove it unless i manually disable it.
- mail-signature "
-
---
-Ian Kelling | Senior Systems Administrator, Free Software Foundation
-GPG Key: B125 F60B 7B28 7FF6 A2B7 DF8F 170A F0E2 9542 95DF
-https://fsf.org | https://gnu.org
-"
-
- mu4e-user-mail-address-list '("iank@fsf.org"
- "iank@gnu.org")
- mu4e-maildir-shortcuts
- '( ("/INBOX" . ?i)
- ("/sysadmin" . ?a)
- ("/sec" . ?x)
- ("/rtcc" . ?c)
- ("/Drafts" . ?d)
- ("/Sent" . ?s)
- )
+ mail-signature fsf-sig
) ;; end setq
- (call-process "/a/exe/lnf" nil nil nil "-T" "/nocow/user/.mufsf" (concat (getenv "HOME") "/.mu"))
- (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to-fsf)
- (remove-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
- (mu4e)) ;; end defun fsf-mu4e
-
-
-;; it's implemented in mu4e, but not in the actions list for
-;; some reason.
-(add-to-list 'mu4e-view-actions
- '("browser view" . mu4e-action-view-in-browser) t)
-
-;; normally, you would add to this, but we want to
-;; modify unread messages. the first 4 are defined by default.
-(setq mu4e-bookmarks
- `( ,(make-mu4e-bookmark
- :name "Unread messages"
- ;; old less restrictive unread, for adapting in the future:
- ;; flag:unread AND NOT flag:trashed AND NOT maildir:/Junk AND NOT maildir:/fwfw AND NOT maildir:/log
- :query "flag:unread maildir:/INBOX"
- :key ?u)
- ,(make-mu4e-bookmark
- :name "Today's messages"
- :query "date:today..now"
- :key ?t)
- ,(make-mu4e-bookmark
- :name "Last 7 days"
- :query "date:7d..now"
- :key ?w)
- ,(make-mu4e-bookmark
- :name "Messages with images"
- :query "mime:image/*"
- :key ?p))
- )
+ (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
+ (mu4e))
+
+
(defun mu4e-action-msgs-by-this-sender (msg)
;; from is structured like: (("Anacron" . "root@x2.lan"))
(mu4e-headers-search (concat "f:" (cdar from)))))
-(add-to-list 'mu4e-headers-actions
- '("from this sender" . mu4e-action-msgs-by-this-sender) t)
-(add-to-list 'mu4e-view-actions
- '("from this sender" . mu4e-action-msgs-by-this-sender) t)
;;; elisp settings
;; from the package readme for ghci-completion
-(require 'ghci-completion)
(add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)
(add-hook 'haskell-interactive-mode-hook
(lambda ()
(define-key haskell-interactive-mode-map "\r" nil)
- (define-key haskell-interactive-mode-map (kbd "<return>") 'haskell-interactive-mode-return)))
+ (define-key haskell-interactive-mode-map (kbd "RET")
+ 'haskell-interactive-mode-return)))
(add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil)))
;;(require 'csv-mode)
;;(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode))
-(require 'outshine)
-(add-hook 'outline-minor-mode-hook 'outshine-mode)
-(add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
-(add-hook 'sh-mode-hook 'outline-minor-mode)
-
-
+;; disabled temporarily
+;;(add-hook 'outline-minor-mode-hook 'outshine-mode)
(setq org-caldav-url "https://cal.iankelling.org"
org-caldav-calendar-id "ian"
(setq css-indent-offset 2)
-(load-file "/a/h/iank-mod.el")
+(when (file-exists-p "/a/h/iank-mod.el")
+ (load-file "/a/h/iank-mod.el"))
;; from when i was running my own patches
;;(add-to-list 'load-path "/a/opt/ws-butler")
;; gnu global
-(require 'ggtags)
(add-hook 'c-mode-common-hook
(lambda () (ggtags-mode 1)
(setq c-label-minimum-indentation 0)))
-;; specific to my unusual keybind setup, you may want to
-;; pick different keys
-(define-key ggtags-mode-map (kbd "C-M-o") 'ggtags-find-tag-dwim)
-(define-key ggtags-mode-map (kbd "C-M-m") 'ggtags-grep)
+(defun my-ggtags-init()
+ ;; specific to my unusual keybind setup, you may want to
+ ;; pick different keys
+ (define-key ggtags-mode-map (kbd "C-M-o") 'ggtags-find-tag-dwim)
+ (define-key ggtags-mode-map (kbd "C-M-m") 'ggtags-grep))
+(eval-after-load "ggtags" '(my-ggtags-init))
+
(defun gtags-update-single(filename)
"Update Gtags database for changes in a single file"
(defun gtags-update-hook()
"Update GTAGS file incrementally upon saving a file"
- (when (and ggtags-mode ggtags-project-root)
+ (when (and (boundp 'ggtags-mode) ggtags-mode ggtags-project-root)
(gtags-update-current-file)))
(add-hook 'after-save-hook 'gtags-update-hook)
;; but that didn't register as functional.
;; so I'd need to modify the list in place.
-(require 'magit)
-
-
;; colorize hex colors: use rainbow mode
;; here we use the standard sendmail interface, which I use postfix for
(setq send-mail-function (quote sendmail-send-it))
-(require 'spray)
(global-set-key (kbd "C-M-w") 'spray-mode)
;; remember, h/l = move. f/s = faster/slower, space = pause, all others quit
;; use shift + arrow keys to switch between visible buffers
;; todo, set these keys to something else
-(require 'windmove)
-(windmove-default-keybindings)
+;; (require 'windmove)
+;; (windmove-default-keybindings)
;; show the name of the current function definition in the modeline
-(require 'which-func)
+;;(require 'which-func)
(setq which-func-modes t)
(which-function-mode 1)
(temp-buffer-resize-mode 1)
-(require 'info+)
-;; based on suggestions in info+.el, I also installed misc-fns, strings, and thingatpt+
-;; remove some bad keybinds from info+
-(define-key Info-mode-map [mouse-4] nil)
-(define-key Info-mode-map [mouse-5] nil)
+(defun my-info-init()
+ (require 'info+)
+ ;; based on suggestions in info+.el, I also installed misc-fns, strings, and thingatpt+
+ ;; remove some bad keybinds from info+
+ (define-key Info-mode-map [mouse-4] nil)
+ (define-key Info-mode-map [mouse-5] nil))
-
-(require 'smooth-scroll)
-;; long gnus summary buffers lags too much with this,
-;; but I like it enough to leave it enabled by default
-;; and crank up the step size to be faster
-;; and it doesn't have a way to enable it only for certain modes etc.
-;; todo sometime, make it work for certain modes only
-(smooth-scroll-mode t)
-;; its too slow with the default of 2
-(setq smooth-scroll/vscroll-step-size 7)
-;; sublimity doesn't work as good going fast by default
-;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location
+(add-hook 'info-mode-hook 'my-info-init)
(setq sh-here-document-word "'EOF'")
(setq tramp-default-method "ssh")
;;; misc general settings
+;; from tramp manual, use the same ssh controlmaster. I was having problems with
+;; tramp prompting me for a username and pass.
+(customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
+
+(setq
+ auto-revert-interval 2
+ ;; fix eof end of file newline
+ mode-require-final-newline t
+ require-final-newline t
+ auto-revert-verbose nil
+ auto-revert-remote-files t)
+
(ivy-mode 1)
(add-hook 'text-mode-hook (lambda () (auto-fill-mode t)))
(setq counsel-find-file-at-point t)
-;; easier to read with just spaces as separator
-(setf (nth 2 ido-decorations) " ")
+(eval-after-load "ido"
+ ;; easier to read with just spaces as separator
+ (quote (setf (nth 2 ido-decorations) " ")))
;; https://www.emacswiki.org/emacs/FillParagraph
;; give us a shell to start instead of scratch
;;(setq initial-buffer-choice (lambda () (new-shell)))
-;; disable this nasty function, as I always use a gui
-(defun suspend-frame() (interactive))
;; Seed the random-number generator
(random t)
;; easier to remember than keybinds
(defalias 'scrypt 'mml-secure-message-encrypt-pgpmime)
(defalias 'sign 'mml-secure-message-sign-pgpmime)
+;; otherwise we get error on sending:
+;; mml-secure-epg-sign: Couldn’t find any signer names; try setting `mml-secure-smime-sign-with-sender'.
+;; i dunno why sign+encrypt doesnt cause this, seems kinda dumb,
+;;
+(setq mml-secure-openpgp-sign-with-sender t)
+;; i dun use smime, the smime signing fails complaining it doesnt have
+;; my key. todo: learn about smime
+(setq mml-secure-smime-sign-with-sender t)
(defun encrypt ()
(interactive)
(mml-secure-message-encrypt-pgpmime 'dontsign))
imenu-auto-rescan t
indicate-empty-lines t) ; mark end of buffer
+(require 'smooth-scroll)
+;; long gnus summary buffers lags too much with this,
+;; but I like it enough to leave it enabled by default
+;; and crank up the step size to be faster
+;; and it doesn't have a way to enable it only for certain modes etc.
+;; todo sometime, make it work for certain modes only
+(smooth-scroll-mode t)
+;; its too slow with the default of 2
+(setq smooth-scroll/vscroll-step-size 7)
+;; sublimity doesn't work as good going fast by default
+;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location
+
(blink-cursor-mode '(-4))
(menu-bar-mode -1)
inhibit-startup-message t
inhibit-startup-echo-area-message t
inhibit-startup-screen t
- compilation-read-command nil ;; just don't compile with unsafe file local vars
kill-buffer-query-functions (remq 'process-kill-buffer-query-function
kill-buffer-query-functions))
(dot-mode . "")
(yas-global-mode . "")
(yas-minor-mode . "")
+ (undo-tree-mode . "")
(volatile-highlights-mode . "")
(highlight-symbol-mode . "")
;; Major modes
org-extend-today-until 0
org-startup-truncated nil
org-clock-persist t
+ org-use-sub-superscripts "{}"
+ org-export-with-sub-superscripts nil
org-clock-mode-line-total 'today
;; global STYLE property values for completion
org-global-properties (quote (("STYLE_ALL" . "habit")))
;; non universally recommended settings
(setq
- org-default-notes-file (concat org-directory "/a/t.org")
+ org-default-notes-file "/a/t.org"
org-agenda-files (quote ("/a/t.org"))
org-mobile-directory "/p/org-mobile"
org-mobile-inbox-for-pull "/p/from-mobile.org"
;; which is populated by a function which starts from (org-clock-get-sum-start)
;;
-(org-clock-persistence-insinuate)
+(eval-after-load "org"
+ '(org-clock-persistence-insinuate))
(defun time-to-org-day (time)
(variable-pitch-mode 0))
(add-hook 'yaml-mode-hook 'variable-pitch-off)
+(eval-after-load "org" '(my-org-face-init))
-(set-face-attribute 'org-table nil :family (face-attribute 'fixed-pitch :family))
-(set-face-attribute 'org-code nil :family (face-attribute 'fixed-pitch :family))
-(set-face-attribute 'org-formula nil :family (face-attribute 'fixed-pitch :family))
-(set-face-attribute 'org-link nil :family (face-attribute 'fixed-pitch :family))
-(set-face-attribute 'org-block nil :family (face-attribute 'fixed-pitch :family))
-(set-face-attribute 'org-date nil :family (face-attribute 'fixed-pitch :family))
-
+(defun my-org-face-init()
+ (set-face-attribute 'org-table nil :family (face-attribute 'fixed-pitch :family))
+ (set-face-attribute 'org-code nil :family (face-attribute 'fixed-pitch :family))
+ (set-face-attribute 'org-formula nil :family (face-attribute 'fixed-pitch :family))
+ (set-face-attribute 'org-link nil :family (face-attribute 'fixed-pitch :family))
+ (set-face-attribute 'org-block nil :family (face-attribute 'fixed-pitch :family))
+ (set-face-attribute 'org-date nil :family (face-attribute 'fixed-pitch :family))
+ )
(defun remove-org-binds ()
(define-key org-mode-map (kbd "<M-return>") nil)
(defun prog-mode-defaults ()
"Default coding hook, useful with any programming language."
;; so that I can do completion before the dialog pops up
- (local-set-key (kbd "<tab>") 'auto-complete)
+ ;;(local-set-key (kbd "<tab>") 'auto-complete)
+ (local-set-key (kbd "TAB") 'auto-complete)
;; todo, this is causing error message on loading file, prolly not working
;;(flycheck-mode +1)
(setq ac-sources (delq 'ac-source-dictionary ac-sources))
;;; shell mode
+
+
+;; # eval: (outline-minor-mode)
+;; # outline-regexp: "\\( *\\)# [*]\\{1,8\\} "
+
+
;; avoid stupid git crap like "warning, terminal not fully functional"
(setenv "PAGER" "cat")
;; don't store successive duplicates in comint command history
;; when opening a pair, and then inserting a newline, push the closing pair to another newline
(sp-pair "{" nil :post-handlers
'(:add ((lambda (id action context)
- (gp/sp/pair-on-newline-and-indent id action context)) (kbd "<return>"))))
+ (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
(sp-pair "[" nil :post-handlers
'(:add ((lambda (id action context)
- (gp/sp/pair-on-newline-and-indent id action context)) (kbd "<return>"))))
+ (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
;; in my version, this is not a pairing.
;; todo, testout these mode specific settings from graphene.
;; Ruby-specific pairs and handlers
-(require 'smartparens-ruby)
+
+(eval-after-load "ruby"
+ '(require 'smartparens-ruby))
;; Markdown
(sp-local-pair '(markdown-mode gfm-mode) "*" "*"
(sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p))
-;;; smex
-;; todo; check out smex-show-unbound-commands shows frequently used commands that have no key bindings.
- ; these must be before smex-initialize
-(setq
- smex-save-file "~/.emacs.d/.smex-items")
-(smex-initialize)
+
;;; spell correction
(setq
ispell-program-name "hunspell"
;; if I could define overlay faces to use inverse foreground color
-;;; zrc
-(require 'znc)
+;;; znc
+
+
(setq erc-fill-prefix "")
(defun chirp()
(interactive)
(setq vol 50)
- (when (string= (system-name) "tp") (setq vol 40))
- (start-process-shell-command "ignoreme" nil (format "mpv --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol)))
+ (when (string= (system-name) "kd") (setq vol 80))
+ ;; speed is there so i can adjust and make it go slow so it plays long enough to adjust in pavucontrol
+ (start-process-shell-command "ignoreme" nil (format "mpv --speed=1 --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol)))
;; from https://www.emacswiki.org/emacs/ErcSound
+(defun chirp-slow()
+ (interactive)
+ (setq vol 50)
+ (when (string= (system-name) "tp") (setq vol 80))
+ ;; speed is there so i can adjust and make it go slow so it plays long enough to adjust in pavucontrol
+ (start-process-shell-command "ignoreme" nil (format "mpv --speed=.2 --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol)))
(defun erc-my-privmsg-sound (proc parsed)
(let* ((tgt (car (erc-response.command-args parsed)))
(chirp)))
(add-hook 'erc-text-matched-hook 'erc-sound-if-not-server)
-(erc-track-mode 1)
+(eval-after-load "erc"
+ '(erc-track-mode 1))
(setq
;; consider invisible frames to be unseen. seems like an obvious default
erc-track-visibility 'visible
;; switch to buffer where i've been mentioned, etc instead of oldest
- erc-track-switch-direction 'importance)
+ erc-track-switch-direction 'importance
+ ;; defaults minus fill. todo: modify the list instead of specifying it explicitly in case the defaults change
+ erc-modules
+ '(autojoin button completion irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track)
+ )
;;; named commands
;; worth the benefit of only having one concept in my mind.
(dolist
(r `(
- (?i (file . ,"~/.emacs.d/my-init.org"))
+ (?i (file . ,"~/.emacs.d/init.el"))
+ (?o (file . ,"/a/work.org"))
(?t (file . ,"/a/t.org"))
+ (?s (file . ,"/usr/share/doc/exim4-base/spec.txt.gz"))
+ (?w (file . ,"/p/w.org"))
+ (?k (file . ,"/a/bin/ds/Arduino/Model01-Firmware/Model01-Firmware.ino"))
(?x (file . ,"/a/x.txt"))
))
(set-register (car r) (cadr r)))
undo-limit 500000000 ; undo history limit
undo-strong-limit 600000000) ; undo history limit plus some extra
+
+;;; undo tree mode
+
+;; note, this has weird errors when it was before recentf-mode
+
+;; more resilient undo-tree-history if we have its location set up front.
+(setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history")))
+
+
+;; todo, send patch undo-tree-visualize should scroll with the scroll key, instead of just pgup pgdn (aka next/prior)
+(global-undo-tree-mode)
+;; disabled due to bug, something like unknown entry in undo tree canary
+;; (setq undo-tree-auto-save-history t)
+(setq undo-outer-limit 100000000 ; per undo command
+ undo-limit 500000000 ; undo history limit
+ undo-strong-limit 600000000) ; undo history limit plus some extra
+;; Undo in region just happens accidentally, and throws me off
+(setq undo-tree-enable-undo-in-region nil)
+
;;; keybinds
;;;; misc
+
+(define-prefix-command 'terminal-key-map)
+(global-set-key (kbd "\e[") 'terminal-key-map)
+
+
+
(global-set-key (kbd "C-x C-b") 'ibuffer)
;;;; single/special keys
;;;;; tab - isearch
-(define-key isearch-mode-map (kbd "<tab>") 'isearch-query-replace)
+;; todo: this doesnt work. needs <tab>, which doesnt work in terminal. fix that.
+;; (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace)
+(define-key isearch-mode-map (kbd "M-f") 'isearch-query-replace)
;;;;; f12 - isearch-forward
;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs
(global-set-key (kbd "<home>") 'back-to-indentation-or-beginning)
;;;;; s-tab - indent-buffer
+;; graphical
(global-set-key (kbd "<S-iso-lefttab>") 'indent-buffer)
+;; terminal
+(global-set-key (kbd "<backtab>") 'indent-buffer)
;;;;; s-delete - send-shell
(global-set-key (kbd "<S-delete>") 'send-shell)
;; stop splitting windows verticallly when I open a buffer or shell
(setq split-height-threshold nil)
-;;;;; s-left arrow - shell
-(global-set-key (kbd "<S-left>") 'shell-wrap)
-(add-hook 'org-mode-hook
- (lambda ()
- (define-key org-mode-map (kbd "<S-left>") nil)))
+;;;;; s-left arrow - ---
+;; cant be used in terminal
+;; When I had a binding, i did this so org-mode wouldnt clobber it
+;; (add-hook 'org-mode-hook
+;; (lambda ()
+;; (define-key org-mode-map (kbd "<S-left>") nil)))
;;;;; s-right arrow - keyboard-yank-primary
(defun keyboard-yank-primary ()
(add-hook 'comint-mode-hook
(lambda ()
(define-key comint-mode-map "\r" nil)
- (define-key comint-mode-map (kbd "<return>") 'comint-send-input)))
+ (define-key comint-mode-map (kbd "RET") 'comint-send-input)))
(add-hook 'comint-mode-hook
(lambda ()
;; kp-enter is shift return in terminal
(global-set-key (kbd "<kp-enter>") 'flyspell-auto-correct-previous-word)
-;;;;; s-down arrow - my-contract-region
+;;;;; s-up arrow - my-contract-region
(global-set-key (kbd "<S-up>") 'my-contract-region)
;;;;; c-up/down move 8 lines
;;;; left primary
-;;;;; C-2 copy-symbol
-
-(global-unset-key (kbd "C-2"))
-(defun copy-symbol (&optional arg)
- "Copy symbol at point into kill-ring"
- (interactive "P")
- (kill-new (thing-at-point 'symbol)))
-
-(global-set-key (kbd "C-2") 'copy-symbol)
-
;;;;; M-2 shell-cd-to-file
(message "%s" "shell-cd-to-file: buffer has no file name"))))
(global-set-key (kbd "M-2") 'shell-cd-to-file)
-;;;;; C-M-2 ---
- ; todo. whats going on here?
+;;;;; C-M-2 copy-symbol
(global-unset-key (kbd "C-M-2"))
+(defun copy-symbol (&optional arg)
+ "Copy symbol at point into kill-ring"
+ (interactive "P")
+ (kill-new (thing-at-point 'symbol)))
+
+(global-set-key (kbd "C-M-2") 'copy-symbol)
-;;;;; C-3 dot-mode-execute
+;;;;; M-3 dot-mode-execute
-(global-set-key (kbd "C-3") 'dot-mode-execute)
+(global-set-key (kbd "M-3") 'dot-mode-execute)
;;;;; C-M-3 recenter-top-bottom
(global-set-key (kbd "C-M-q") 'quoted-insert)
-;;;;; C-w ---
-;; in terminal, it's ctrl-backspace, duplicate keybind.
-;;;;; M-w org-clock-in
+;;;;; C-w counsel-find-file
+
+(global-set-key (kbd "C-w") 'counsel-find-file)
+
+;;;;; M-w shell
-(global-set-key (kbd "M-w") 'org-clock-in)
+(global-set-key (kbd "M-w") 'shell-wrap)
;;;;; C-e copy-line
(global-set-key (kbd "C-a") 'copy-all)
;;;;; C-s - c-x prefix
- ; prefix key binds.
- ; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
- ; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
- ; so you have to dig into their key maps and redo things.
- ; There are 2 simpler alternatives which have their own downsides.
- ; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
- ; The other is keyboard-translate, which translates the key presses before anything else.
- ; The downside is that it translates them when you aren't using them as a prefix.
- ; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
-
- ; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
- ; (define-key key-translation-map [f12] "\C-c")
- ; (define-key key-translation-map "\C-c" [left])
-
-
- ;idea to remove the hook later since it is only needed at startup.
- ; did not work however, and there is not a real need to fix it, so I did not investigate
- ;(defun removeSwapHook ()
- ; (remove-hook 'buffer-list-update-hook 'myKeySwap)
- ; (remove-hook 'change-major-mode-hook 'removeSwapHook))
- ;(add-hook 'change-major-mode-hook 'removeSwapHook)
-
-
- ; went through almost all the relevant standard hooks,
- ; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
- (add-hook 'buffer-list-update-hook (lambda () (interactive)
- (keyboard-translate ?\C-x ?\C-s)
- (keyboard-translate ?\C-s ?\C-x)
- (keyboard-translate ?\C-c ?\C-d)
- (keyboard-translate ?\C-d ?\C-c)))
-
-
-
- ; these all don't work
- ; don't know why this doesn't error but reversing the keys does
- ;(keyboard-translate ?\t ?\M-\t)
- ;(keyboard-translate [M-tab] [tab])
- ; from what i can tell, it wants to use a keyboard-translate-table,
- ; which is a char table, which is a vector indexed by chars,
- ; and mod+tab is not a char (it has too many bits), it is an integer
- ; it actually says it can hold vectors or strings, but that it is obsolete to do so
- ;(characterp ?\M-a)
- ;(characterp ?\C-a)
+ ; prefix key binds.
+ ; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
+ ; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
+ ; so you have to dig into their key maps and redo things.
+ ; There are 2 simpler alternatives which have their own downsides.
+ ; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
+ ; The other is keyboard-translate, which translates the key presses before anything else.
+ ; The downside is that it translates them when you aren't using them as a prefix.
+ ; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
+
+ ; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
+ ; (define-key key-translation-map [f12] "\C-c")
+ ; (define-key key-translation-map "\C-c" [left])
+
+
+ ;idea to remove the hook later since it is only needed at startup.
+ ; did not work however, and there is not a real need to fix it, so I did not investigate
+ ;(defun removeSwapHook ()
+ ; (remove-hook 'buffer-list-update-hook 'myKeySwap)
+ ; (remove-hook 'change-major-mode-hook 'removeSwapHook))
+ ;(add-hook 'change-major-mode-hook 'removeSwapHook)
+
+
+ ; went through almost all the relevant standard hooks,
+ ; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
+(add-hook 'buffer-list-update-hook (lambda () (interactive)
+ (keyboard-translate ?\C-x ?\C-s)
+ (keyboard-translate ?\C-s ?\C-x)
+ (keyboard-translate ?\C-c ?\C-d)
+ (keyboard-translate ?\C-d ?\C-c)))
+
+
+
+ ; these all don't work
+ ; don't know why this doesn't error but reversing the keys does
+ ;(keyboard-translate ?\t ?\M-\t)
+ ;(keyboard-translate [M-tab] [tab])
+ ; from what i can tell, it wants to use a keyboard-translate-table,
+ ; which is a char table, which is a vector indexed by chars,
+ ; and mod+tab is not a char (it has too many bits), it is an integer
+ ; it actually says it can hold vectors or strings, but that it is obsolete to do so
+ ;(characterp ?\M-a)
+ ;(characterp ?\C-a)
;;;;; C-M-s - split-window-vertically
(global-set-key (kbd "C-M-s") 'split-window-vertically)
;;;;; C-d - C-c prefix
+
+;;;;; M-d - run
+
+(global-set-key (kbd "M-d") 'run)
+
;;;;; C-M-d - swap buffer across windows
;; from http://www.emacswiki.org/emacs/TransposeWindows
(global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)
-;;;;; C-f] - kill-whole-line
+;;;;; C-f - kill-whole-line
(global-set-key (kbd "C-f") 'kill-whole-line-wrapper)
(defun kill-whole-line-wrapper (&optional arg)
(define-key org-mode-map (kbd "C-M-f") 'org-kill-line)))
(global-set-key (kbd "C-M-f") 'kill-line)
-;;;;; C-g - cancel / other window
-
-(global-set-key (kbd "C-g") 'other-window)
-
+;;;;; C-g - keyboard-quit
;;;;; M-g - abort-recursive-edit
(global-set-key (kbd "M-g") 'abort-recursive-edit)
(global-set-key (kbd "C-M-g") 'mu4e)
;;;;; C-z - undo-only
-
-(global-set-key (kbd "C-z") 'undo-only)
+(global-set-key (kbd "C-z") 'undo-tree-undo)
+;;;;; C-M-z - suspend-frame
+(global-set-key (kbd "C-M-z") 'suspend-frame)
+;; this is never good in a gui
+(when (window-system)
+ (defun suspend-frame() (interactive)))
;;;;; C-x - kill-region
(global-set-key (kbd "C-s") 'kill-region)
-;;;;; M-x - smex
+;;;;; M-x - counsel-m-x
+
+
+;; todo; check out smex-show-unbound-commands shows frequently used commands that have no key bindings.
+;; this must be before smex-initialize
+(setq
+ smex-save-file "~/.emacs.d/.smex-items")
-(global-set-key (kbd "M-x") 'smex)
+;; this uses smex
+(global-set-key (kbd "M-x") 'counsel-M-x)
;;;;; C-M-x - cut-to-register
(define-key c-mode-base-map (kbd "<deletechar>") 'c-electric-delete-forward)))
-;;;;; M-c - org-capture
+;;;;; M-c - delete-other-windows
-(define-key global-map "\M-c" 'org-capture)
+;; todo, consider binding/using org-capture
+(define-key global-map "\M-c" 'delete-other-windows)
;;;;; C-M-c - copy-to-register
(global-set-key (kbd "C-M-v") 'yank-pop)
-;;;;; C-b - delete-other-windows
+;;;;; C-b - other-window
-(global-set-key (kbd "C-b") 'delete-other-windows)
+(global-set-key (kbd "C-b") 'other-window)
;;;;; M-b - isearch-backward-current-symbol
;;;;; C-right-arrow - forward-symbol
;;;;; C-M-right-arrow - org-shiftdown
(add-hook 'org-mode-hook
-(lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
+ (lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
;;;;; C-backspace - backward-kill-symbol
+(define-key terminal-key-map (kbd "4b") 'backward-kill-symbol) ;c-backspace in my konsole
+
+;; c-w is duplicate in terminal
(global-set-key (kbd "<C-backspace>") 'backward-kill-symbol)
(add-hook 'comint-mode-hook
(lambda ()
(global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
;;;; right primary
-;;;;; C-* - split-window-horizontally
-
-(global-set-key (kbd "C-*") 'split-window-horizontally)
+;;;;; M-8 - delete-window-or-exit
-;;;;; C-M-* - calc-dispatch
-
-(global-set-key (kbd "C-M-*") 'calc-dispatch)
-
-;;;;; C-9 - delete-window-or-exit
-
-(global-set-key (kbd "C-9") 'delete-window-or-exit)
+(global-set-key (kbd "M-8") 'delete-window-or-exit)
(defun delete-window-or-exit ()
"Delete window or exit emacs."
(progn (basic-save-buffer) (delete-frame))
(save-buffers-kill-terminal t))))
+;;;;; C-* - split-window-horizontally
+(global-set-key (kbd "C-*") 'split-window-horizontally)
+;;;;; C-M-* - calc-dispatch
+
+(global-set-key (kbd "C-M-*") 'calc-dispatch)
+
;;;;; M-9 - kill-buffer
(defun kill-buffer-no-ido ()
;; save & kill buffer if it was opened externally via emacsclient
- (defun server-edit-save ()
- (interactive)
- (save-buffer)
- (server-edit))
- (global-set-key (kbd "C-M-9") 'server-edit-save)
+(defun server-edit-save ()
+ (interactive)
+ (save-buffer)
+ (server-edit))
+(global-set-key (kbd "C-M-9") 'server-edit-save)
;;;;; C-u - universal-argument
;;;;; C-M-u - search-keybind
- (global-set-key (kbd "C-M-u") 'search-keybind)
+(global-set-key (kbd "C-M-u") 'search-keybind)
- (defun search-keybind (regexp &optional nlines)
- (interactive (occur-read-primary-args))
- (save-excursion
- (describe-bindings)
- (set-buffer "*Help*")
- (occur regexp)
- (delete-windows-on "*Help*")
- ))
+(defun search-keybind (regexp &optional nlines)
+ (interactive (occur-read-primary-args))
+ (save-excursion
+ (describe-bindings)
+ (set-buffer "*Help*")
+ (occur regexp)
+ (delete-windows-on "*Help*")
+ ))
+
+;;;;; C-i -
+;; todo: try making use
+;; this is the key in terminal
+;;M-[ 4 d is undefined
+
+;; previously had this for enhancing graphical keybinds,
+;; but afaik its no help since i want terminal to work
+;; the same.
+;; (define-key input-decode-map [?\C-i] [C-i])
-;;;;; C-i - -----
;;;;; C-M-i - query-replace-regexp
- (global-set-key (kbd "C-M-i") 'query-replace-regexp)
- (add-hook 'flyspell-mode-hook
- (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
- (add-hook 'text-mode-hook
- (lambda () (define-key text-mode-map (kbd "C-M-i") nil)))
+(global-set-key (kbd "C-M-i") 'query-replace-regexp)
+(add-hook 'flyspell-mode-hook
+ (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
+(add-hook 'text-mode-hook
+ (lambda () (define-key text-mode-map (kbd "C-M-i") nil)))
;;;;; C-o - occur
- (global-set-key (kbd "C-o") 'occur)
+(global-set-key (kbd "C-o") 'occur)
;;;;; C-M-o - counsel-imenu
- (global-set-key (kbd "C-M-o") 'counsel-imenu)
+(global-set-key (kbd "C-M-o") 'counsel-imenu)
;;;;; C-p - move-mouse-to-point
- (global-set-key (kbd "C-p") 'move-mouse-to-point)
+(global-set-key (kbd "C-p") 'move-mouse-to-point)
;;;;; C-M-p - delete-horizontal-space
- (global-set-key (kbd "C-M-p") 'delete-horizontal-space)
+(global-set-key (kbd "C-M-p") 'delete-horizontal-space)
;;;;; C-j - pop-to-mark
- (defun my-pop-to-mark-command ()
- "Jump to mark, and pop a new position for mark off the ring.
+(defun my-pop-to-mark-command ()
+ "Jump to mark, and pop a new position for mark off the ring.
\(Does not affect global mark ring\)."
- (interactive)
- (pop-to-mark-command)
- (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
- (org-show-context 'mark-goto)))
-
- (global-set-key (kbd "C-j") 'my-pop-to-mark-command)
- (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)
- (add-hook 'ido-setup-hook
- (lambda () (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)))
- (add-hook 'lisp-interaction-mode-hook
- (lambda ()
- (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
+ (interactive)
+ (pop-to-mark-command)
+ (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
+ (org-show-context 'mark-goto)))
+
+(global-set-key (kbd "C-j") 'my-pop-to-mark-command)
+(add-hook 'ido-setup-hook
+ (lambda ()
+ (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)
+ ))
+(add-hook 'lisp-interaction-mode-hook
+ (lambda ()
+ (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
;;;;; M-j - previous-error
- (global-set-key (kbd "M-j") 'previous-error)
+(global-set-key (kbd "M-j") 'previous-error)
;;;;; C-M-j - register prefix
- (define-key global-map (kbd "C-M-j") ctl-x-r-map)
- (define-key ctl-x-r-map "m" 'kmacro-to-register)
+(define-key global-map (kbd "C-M-j") ctl-x-r-map)
+(define-key ctl-x-r-map "m" 'kmacro-to-register)
;;;;; C-k - jump-to-register
- (global-set-key (kbd "C-k") 'jump-to-register)
+(global-set-key (kbd "C-k") 'jump-to-register)
;;;;; M-k - next-error
- (global-set-key (kbd "M-k") 'next-error)
+(global-set-key (kbd "M-k") 'next-error)
;;;;; C-M-k - man
- (global-set-key (kbd "C-M-k") 'man)
+(global-set-key (kbd "C-M-k") 'man)
;;;;; C-l - ivy-switch-buffer
- (global-set-key (kbd "C-l") 'ivy-switch-buffer)
+(global-set-key (kbd "C-l") 'ivy-switch-buffer)
;;;;; C-M-l - move cursor top bottom mid, comint clear screen
- (global-set-key (kbd "C-M-l") 'move-to-window-line-top-bottom)
+(global-set-key (kbd "C-M-l") 'move-to-window-line-top-bottom)
;;;;; C-; - used in flyspell, not sure what for, otherwise unbound
;;;;; M-; - comment-dwim
;;;;; C-M-; - comment-current-line-dwim
- (defun comment-current-line-dwim ()
- "Comment or uncomment the current line."
- (interactive)
- (save-excursion
- (push-mark (beginning-of-line) t t)
- (end-of-line)
- (comment-dwim nil))
- (move-beginning-of-line 2))
- (global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
-
+(defun comment-current-line-dwim ()
+ "Comment or uncomment the current line."
+ (interactive)
+ (save-excursion
+ (push-mark (beginning-of-line) t t)
+ (end-of-line)
+ (comment-dwim nil))
+ (move-beginning-of-line 2))
+(global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
+
+;;;;; C-m - ---
+;; terminal/console needs this. otherwise, we could do this
+;; to make C-m be a valid key in graphical mode.
+;; (define-key input-decode-map [?\C-m] [C-m])
;;;;; C-M-m - recursive grep
- (define-key global-map (kbd "C-M-m") 'rgrep)
+(define-key global-map (kbd "C-M-m") 'rgrep)
-;;;;; C-, - ounsel-find-file
+;;;;; C-, - ---
+;; not recognized by terminal, can't get konsole keydef file to recognize comma,
+;; todo: dig into konsole sources, or try newer version than t8
- (global-set-key (kbd "C-,") 'counsel-find-file)
- (add-hook 'flyspell-mode-hook
- (lambda () (define-key flyspell-mode-map (kbd "C-,") nil)))
+(add-hook 'flyspell-mode-hook
+ (lambda () (define-key flyspell-mode-map (kbd "C-,") nil)))
;;;;; C-M-, - ind-file-in-project
- (global-set-key (kbd "C-M-,") 'find-file-in-project)
+(global-set-key (kbd "C-M-,") 'find-file-in-project)
;;;;; C-. - find recent file
-;; Taken from starter kit.
-
- (defun recentf-ido-find-file ()
- "Find a recent file using Ido."
- (interactive)
- (let* ((file-assoc-list
- (mapcar (lambda (x)
- (cons (file-name-nondirectory x)
- x))
- recentf-list))
- (filename-list
- (remove-duplicates (mapcar #'car file-assoc-list)
- :test #'string=))
- (filename (ido-completing-read "Choose recent file: "
- filename-list
- nil
- t)))
- (when filename
- (find-file (cdr (assoc filename
- file-assoc-list))))))
-
- (add-hook 'flyspell-mode-hook
- (lambda () (define-key flyspell-mode-map (kbd "C-.") nil)))
- (define-key dot-mode-map (kbd "C-.") nil)
- (global-set-key (kbd "C-.") 'recentf-ido-find-file)
- (add-hook 'php-mode-hook
- (lambda () (define-key php-mode-map (kbd "C-.") nil)))
+
+(add-hook 'flyspell-mode-hook
+ (lambda () (define-key flyspell-mode-map (kbd "C-.") nil)))
+(define-key dot-mode-map (kbd "C-.") nil)
+(define-key terminal-key-map (kbd "4c") 'counsel-recentf)
+(global-set-key (kbd "C-.") 'counsel-recentf)
+(add-hook 'php-mode-hook
+ (lambda () (define-key php-mode-map (kbd "C-.") nil)))
;;;;; C-M-. - -
- (define-key dot-mode-map (kbd "C-M-.") nil)
- ;; (global-set-key (kbd "C-M-.") 'execute-extended-command)
+(define-key dot-mode-map (kbd "C-M-.") nil)
+;; (global-set-key (kbd "C-M-.") 'execute-extended-command)
;;;;; C-/ - join lines
- (defun vim-style-join-line ()
- (interactive)
- (join-line '(4)))
- (global-set-key (kbd "C-/") 'vim-style-join-line)
+(defun vim-style-join-line ()
+ (interactive)
+ (join-line '(4)))
+(global-set-key (kbd "C-/") 'vim-style-join-line)
+(define-key undo-tree-map (kbd "C-/") nil)
;;;;; C-M-/ - copy-buffer-file-name
- ;; haven't bound this atm, todo, maybe someday?
- (defun copy-variable (variable)
- (interactive
- (let ((v (variable-at-point))
- (enable-recursive-minibuffers t)
- val)
- (setq val (completing-read (if (symbolp v)
- (format
- "Describe variable (default %s): " v)
- "Describe variable: ")
- obarray
- (lambda (vv)
- (or (get vv 'variable-documentation)
- (and (boundp vv) (not (keywordp vv)))))
- t nil nil
- (if (symbolp v) (symbol-name v))))
- (list (if (equal val "")
- v (intern val)))))
- (kill-new (symbol-value variable)))
-
- (defun copy-buffer-file-name ()
- (interactive)
- (let ((name (cond
- ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
- (t buffer-file-name))
- ))
- (kill-new name)
- (message name)))
-
-
- (global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
+;; haven't bound this atm, todo, maybe someday?
+(defun copy-variable (variable)
+ (interactive
+ (let ((v (variable-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (completing-read (if (symbolp v)
+ (format
+ "Describe variable (default %s): " v)
+ "Describe variable: ")
+ obarray
+ (lambda (vv)
+ (or (get vv 'variable-documentation)
+ (and (boundp vv) (not (keywordp vv)))))
+ t nil nil
+ (if (symbolp v) (symbol-name v))))
+ (list (if (equal val "")
+ v (intern val)))))
+ (kill-new (symbol-value variable)))
+
+(defun copy-buffer-file-name ()
+ (interactive)
+ (let ((name (cond
+ ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
+ (t buffer-file-name))
+ ))
+ (kill-new name)
+ (message name)))
+(global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
-;;;;; C-8 - calc-embedded-word
- (global-set-key (kbd "C-8") 'calc-embedded-word)
;;;;; C-up-arrow - org prev headline
- ;; disabled just because i don't want to accidentally hit it
- (define-key global-map "\C-_" nil)
- (global-set-key (kbd "<C-_>") 'beginning-of-defun)
+;; disabled just because i don't want to accidentally hit it
+(define-key global-map "\C-_" nil)
+(global-set-key (kbd "<C-_>") 'beginning-of-defun)
- (add-hook 'org-mode-hook
- (lambda ()
- (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
+(add-hook 'org-mode-hook
+ (lambda ()
+ (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
;;;;; C-S-up-arrow - winner undo
- (global-set-key (kbd "<C-S-_>") 'winner-undo)
+(global-set-key (kbd "<C-S-_>") 'winner-undo)
;;;;; C-down-arrow - org next headline
- (global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
+(global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
- (add-hook 'org-mode-hook
- (lambda ()
- (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
+(add-hook 'org-mode-hook
+ (lambda ()
+ (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
;;;;; C-M-down-arrow - toggle-mark-activation
- (defun toggle-mark-activation ()
- (interactive)
- (if mark-active
- (deactivate-mark t)
- (activate-mark)))
+(defun toggle-mark-activation ()
+ (interactive)
+ (if mark-active
+ (deactivate-mark t)
+ (activate-mark)))
- (global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
+(global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
;;;;; C-S-down-arrow winner redo
- (global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
+(global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
;;;;; C-S-down-arrow - m-x for major mode
- (global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
+;; todo, update this for ivy
+(global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
;;;;; C-lbracket - ----
;;;;; C-M-lbracket - scroll-right
- (global-set-key (kbd "C-M-[") 'scroll-right)
+(global-set-key (kbd "C-M-[") 'scroll-right)
;;;;; C-rbracket - fill-paragraph
- (global-set-key (kbd "C-]") 'fill-paragraph)
+(global-set-key (kbd "C-]") 'fill-paragraph)
;;;;; C-M-rbracket - scroll-left
- (global-set-key (kbd "C-M-]") 'scroll-left)
+(global-set-key (kbd "C-M-]") 'scroll-left)
;;;;; C-return - newline-anywhere
- (defun newline-anywhere ()
- "Add a newline from anywhere in the line."
- (interactive)
- (end-of-line)
- (newline-and-indent))
- (global-set-key (kbd "<C-return>") 'newline-anywhere)
+(defun newline-anywhere ()
+ "Add a newline from anywhere in the line."
+ (interactive)
+ (end-of-line)
+ (newline-and-indent))
+;; todo use alternate keybind make this work for terminal
+(global-set-key (kbd "<C-return>") 'newline-anywhere)
;;;;; M-return - plain newline
- (defun plain-newline ()
- (interactive)
- (insert "\n"))
- (global-set-key (kbd "<M-return>") 'plain-newline)
-
-
-;;;;; C-M-return - newline-anywhere-previous
-(defun newline-anywhere-previous ()
- "Add a newline from anywhere in the line."
+(defun plain-newline ()
(interactive)
- (forward-line -1)
- (end-of-line)
- (newline-and-indent))
-(global-set-key (kbd "<C-M-return>") 'newline-anywhere-previous)
+ (insert "\n"))
+(global-set-key (kbd "M-RET") 'plain-newline)
+
;;;;; C-space - org-edit-special
;;;;; C-home - start of buffer
;;;;; C-end - end of buffer
;;;; right secondary
-;;;;; C-6 - save-buffers-kill-emacs
+;;;;; C-^ - save-buffers-kill-emacs
-(global-set-key (kbd "C-6") 'save-buffers-kill-emacs)
+(global-set-key (kbd "C-^") 'save-buffers-kill-emacs)
;;;;; C-M-6 - insert-small-copyright
(interactive)
(beginning-of-line)
(let ((beg (point)))
- (insert "Copyright (C) 2017 Ian Kelling\nThis program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>")
+ (insert "Copyright (C) 2019 Ian Kelling\nThis program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>")
(comment-region beg (point))))
(global-set-key (kbd "C-M-6") 'insert-small-copyright)
+;;;;; M-7 - calc-embedded-word
+
+(global-set-key (kbd "M-7") 'calc-embedded-word)
+
;;;;; C-M-7 - insert-full-copyright
(defun insert-full-copyright ()
(interactive)
(beginning-of-line)
(let ((beg (point)))
- (insert "Copyright (C) 2017 Ian Kelling\n")
+ (insert "Copyright (C) 2019 Ian Kelling\n")
(insert "\n")
(insert "This program is free software: you can redistribute it and/or modify\n")
(insert "it under the terms of the GNU General Public License as published by\n")
;;;;; C-M-- - org-edit-src-exit
;;;;; C-y - undo
-(global-set-key (kbd "C-y") 'undo)
+(global-set-key (kbd "C-y") 'undo-tree-redo)
(add-hook 'org-mode-hook
(lambda () (define-key org-mode-map (kbd "C-y") nil)))
;;;;; C-escape - find-tag
(global-set-key (kbd "<C-escape>") 'find-tag)
+
+
+;; Local Variables:
+;; eval: (outline-minor-mode)
+;; End: