2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Main options
|
2012-10-12 22:02:52 +02:00
|
|
|
|
|
2017-06-16 21:33:53 +02:00
|
|
|
|
(require 'functions)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Minimal UI. Run early to hide it as soon as possible.
|
2014-03-08 11:48:35 +01:00
|
|
|
|
(setq inhibit-startup-screen t)
|
|
|
|
|
(menu-bar-mode -1)
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; `tool-bar-mode' and `scroll-bar-mode' might not be compiled in.
|
|
|
|
|
(when (fboundp 'tool-bar-mode) (tool-bar-mode -1))
|
|
|
|
|
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
|
2017-07-28 18:20:50 +02:00
|
|
|
|
;;; In some cases, Emacs can still decide by itself to use graphical boxes.
|
|
|
|
|
;;; Force on using the minibuffer instead.
|
|
|
|
|
(setq use-dialog-box nil)
|
2014-03-08 11:48:35 +01:00
|
|
|
|
|
2017-07-28 18:21:06 +02:00
|
|
|
|
;;; Timeout before echoing the prefix of an unfinished keystroke.
|
|
|
|
|
(setq echo-keystrokes 0.5)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Remember last cursor position.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(setq save-place-file (concat emacs-cache-folder "saveplace"))
|
2017-08-03 18:49:33 +02:00
|
|
|
|
(save-place-mode)
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; When the daemon is killed abruptly, places are not saved. Adding this hook
|
|
|
|
|
;;; allows to save places at a strategic moment.
|
2014-03-03 21:05:09 +01:00
|
|
|
|
(add-hook 'before-save-hook 'save-place-kill-emacs-hook)
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2017-07-26 12:12:17 +02:00
|
|
|
|
;;; Network files
|
2014-03-10 11:26:12 +01:00
|
|
|
|
(setq url-cookie-file (concat emacs-cache-folder "url.cookies"))
|
2017-07-26 12:12:17 +02:00
|
|
|
|
(with-eval-after-load 'nsm
|
|
|
|
|
(setq nsm-settings-file (concat emacs-cache-folder "network-security.data")))
|
2014-03-10 11:26:12 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Bookmark file to cache folder.
|
2014-02-21 20:14:50 +01:00
|
|
|
|
(setq bookmark-default-file (concat emacs-cache-folder "emacs.bmk"))
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Recent files.
|
2017-07-28 18:23:48 +02:00
|
|
|
|
(setq recentf-save-file (concat emacs-cache-folder "recentf")
|
|
|
|
|
recentf-max-saved-items 40)
|
2016-06-09 18:20:38 +02:00
|
|
|
|
|
2017-07-28 18:24:15 +02:00
|
|
|
|
;;; Save M-: history.
|
|
|
|
|
(setq savehist-file (concat emacs-cache-folder "savehist"))
|
|
|
|
|
(savehist-mode)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Disable autosave features.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(setq auto-save-default nil)
|
2013-06-04 20:51:04 +02:00
|
|
|
|
(setq auto-save-list-file-prefix nil)
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Place backup files in specific directory.
|
2013-05-31 19:01:32 +02:00
|
|
|
|
(setq backup-directory-alist
|
2017-06-03 14:47:14 +02:00
|
|
|
|
`(("." . ,(concat emacs-cache-folder "backups/"))))
|
2013-05-31 19:01:32 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Default mode
|
2017-05-24 00:27:02 +02:00
|
|
|
|
(setq-default major-mode 'text-mode)
|
2013-02-28 22:09:31 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Disable suspend key since it is useless on Emacs server.
|
2013-06-12 17:05:10 +02:00
|
|
|
|
(global-unset-key (kbd "C-z"))
|
|
|
|
|
(global-unset-key (kbd "C-x C-z"))
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Make questions less annoying.
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2017-06-22 19:03:10 +02:00
|
|
|
|
;;; Enable all disabled commands.
|
|
|
|
|
(setq disabled-command-function nil)
|
2013-10-20 18:19:19 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Print buffer size in mode line.
|
2013-06-27 17:06:07 +02:00
|
|
|
|
(size-indication-mode 1)
|
|
|
|
|
|
2017-06-19 21:32:54 +02:00
|
|
|
|
;;; Display defun in mode line.
|
2017-06-27 22:14:36 +02:00
|
|
|
|
;; (which-function-mode)
|
2017-06-19 21:32:54 +02:00
|
|
|
|
|
2017-07-31 18:39:21 +02:00
|
|
|
|
;;; No need when we have a status bar.
|
|
|
|
|
;; (display-time)
|
|
|
|
|
;; (setq display-time-day-and-date t
|
|
|
|
|
;; display-time-24hr-format t
|
|
|
|
|
;; display-time-default-load-average nil)
|
|
|
|
|
|
|
|
|
|
;;; Just like time, no need when we have a status bar.
|
|
|
|
|
;; (display-battery-mode)
|
2017-06-19 21:32:54 +02:00
|
|
|
|
;;; TODO: Battery status (%b) does not work properly.
|
2017-07-31 18:39:21 +02:00
|
|
|
|
;; (setq battery-mode-line-format "[%p%%%b %t]")
|
2017-06-19 21:32:54 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Line numbers
|
|
|
|
|
;;; Adding to `find-file-hook' ensures it will work for every file, regardless of
|
|
|
|
|
;;; the mode, but it won't work for buffers without files nor on mode change.
|
2017-06-18 17:55:38 +02:00
|
|
|
|
(dolist (hook '(prog-mode-hook text-mode-hook))
|
2017-06-24 11:04:27 +02:00
|
|
|
|
(add-hook hook 'turn-on-column-number-mode)
|
2017-06-20 16:24:23 +02:00
|
|
|
|
(add-hook hook 'turn-off-line-number-mode)
|
2017-06-18 17:55:38 +02:00
|
|
|
|
(add-hook hook 'linum-mode))
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Emacs-nox does not display a fringe after the linum: Setting linum-format in
|
|
|
|
|
;;; linum-before-numbering-hook is not the right approach as it will change the
|
|
|
|
|
;;; type of linum-format in the middle. See linum-update-window.
|
|
|
|
|
;;; See http://stackoverflow.com/questions/3626632/right-align-line-numbers-with-linum-mode
|
|
|
|
|
;;; and http://stackoverflow.com/questions/3626632/right-align-line-numbers-with-linum-mode.
|
|
|
|
|
;;; The complexity is not worth the benefit.
|
|
|
|
|
|
2017-06-20 16:24:23 +02:00
|
|
|
|
;;; Alternative scrolling
|
|
|
|
|
(setq scroll-error-top-bottom t)
|
|
|
|
|
|
|
|
|
|
;;; Kill whole line including \n.
|
|
|
|
|
(setq kill-whole-line t)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Indentation
|
2014-10-24 14:58:38 +02:00
|
|
|
|
(setq-default tab-width 2)
|
|
|
|
|
(defvaralias 'standard-indent 'tab-width)
|
|
|
|
|
(setq-default indent-tabs-mode t)
|
2014-10-30 18:18:08 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Line by line scrolling
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(setq scroll-step 1)
|
|
|
|
|
|
2014-11-12 15:09:14 +01:00
|
|
|
|
(setq
|
|
|
|
|
whitespace-style
|
2016-06-10 18:05:05 +02:00
|
|
|
|
'(face empty indentation space-after-tab space-before-tab tab-mark trailing))
|
2017-06-18 20:52:00 +02:00
|
|
|
|
;;; REVIEW: `whitespace-report' will mistakenly always report empty lines at
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; beginning and end of buffer as long as there is at least one empty line.
|
|
|
|
|
;;; `whitespace-cleanup' works properly however.
|
2017-06-18 20:52:00 +02:00
|
|
|
|
;;; Reported at http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23740.
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;; (setq whitespace-action '(report-on-bogus))
|
|
|
|
|
|
2017-06-22 19:09:31 +02:00
|
|
|
|
;;; Add formatting functions to the buffer-local `before-save-hook'.
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; WARNING: this can break some configuration files needing whitespaces at the
|
2017-06-03 12:47:23 +02:00
|
|
|
|
;;; end. This can also slow down saving on big files. Some modes (e.g. lisp) run
|
|
|
|
|
;;; `fmt' in their local hook, which is redundant with this.
|
2017-06-22 19:09:31 +02:00
|
|
|
|
;; (add-hook 'find-file-hook 'turn-on-fmt-before-save)
|
|
|
|
|
(add-hook 'find-file-hook 'turn-on-delete-trailing-whitespace)
|
2013-03-08 15:46:03 +01:00
|
|
|
|
|
2017-08-30 17:45:48 +02:00
|
|
|
|
;;; Cycle spacing instead of just-one-space. This frees M-\.
|
|
|
|
|
(global-set-key [remap just-one-space] 'cycle-spacing)
|
|
|
|
|
|
2017-06-03 12:47:23 +02:00
|
|
|
|
;;; Hippie expand
|
2017-06-20 20:38:59 +02:00
|
|
|
|
;; (global-set-key (kbd "M-/") 'hippie-expand)
|
2014-02-21 20:41:11 +01:00
|
|
|
|
|
2017-06-30 18:23:37 +02:00
|
|
|
|
;;; Abbreviation is like snippets: annoying at times, especially in
|
|
|
|
|
;;; prog-mode. They are useful in text mode to avoid the sprawling of
|
|
|
|
|
;;; abbreviations.
|
|
|
|
|
(add-hook 'text-mode-hook 'abbrev-mode)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2017-06-03 12:46:09 +02:00
|
|
|
|
;;; Auto-fill
|
|
|
|
|
(when (getenv "MANWIDTH")
|
|
|
|
|
(setq-default fill-column (string-to-number (getenv "MANWIDTH"))))
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
2017-06-03 12:47:23 +02:00
|
|
|
|
;; (setq sentence-end-double-space nil)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Enforce horizontal splitting. 140 means that the window is large enough to
|
|
|
|
|
;;; hold 2 other windows of 70 columns.
|
2017-07-28 18:24:43 +02:00
|
|
|
|
(setq split-height-threshold nil
|
|
|
|
|
split-width-threshold 140)
|
2016-07-21 13:37:46 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Windmove mode
|
2017-10-08 20:36:28 +02:00
|
|
|
|
;;; By default, it allows easy window switching with Shift+arrows. I like to
|
|
|
|
|
;;; stick to the home-row, but to avoid shadowing other binding I exceptionaly use
|
|
|
|
|
;;; 'super' (normally reserved to the WM).
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(when (fboundp 'windmove-default-keybindings)
|
2017-06-20 20:38:59 +02:00
|
|
|
|
(global-set-keys
|
2017-07-09 22:47:50 +02:00
|
|
|
|
"s-h" 'windmove-left
|
|
|
|
|
"s-j" 'windmove-down
|
|
|
|
|
"s-k" 'windmove-up
|
|
|
|
|
"s-l" 'windmove-right))
|
|
|
|
|
(global-set-keys
|
|
|
|
|
"s-o" 'delete-other-windows
|
|
|
|
|
;; "s-w" 'other-window
|
|
|
|
|
"s-c" 'delete-window)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2017-07-28 18:23:23 +02:00
|
|
|
|
|
|
|
|
|
;;; Since `browse-url-default-browser' fails at seeing we can run xdg, force it.
|
|
|
|
|
(setq browse-url-browser-function
|
|
|
|
|
(if (executable-find "xdg-open") 'browse-url-xdg-open 'browse-url-generic))
|
|
|
|
|
;;; If xdg-open is not found, set Emacs URL browser to the environment browser,
|
|
|
|
|
;;; or w3m if BROWSER is not set.
|
2017-09-11 19:29:35 +02:00
|
|
|
|
;;; TODO: Upstream should be smart at this, e.g. allow using xdg without a DE. Report.
|
|
|
|
|
(setq browse-url-generic-program (or
|
|
|
|
|
(executable-find (or (getenv "BROWSER") ""))
|
|
|
|
|
(when (executable-find "xdg-mime")
|
|
|
|
|
(let ((desktop-browser (call-process-to-string "xdg-mime" "query" "default" "text/html")))
|
|
|
|
|
(substring desktop-browser 0 (string-match "\\.desktop" desktop-browser))))
|
|
|
|
|
(executable-find browse-url-mozilla-program)
|
|
|
|
|
(executable-find browse-url-firefox-program)
|
|
|
|
|
(executable-find browse-url-chromium-program)
|
|
|
|
|
(executable-find browse-url-kde-program)
|
|
|
|
|
(executable-find browse-url-conkeror-program)
|
|
|
|
|
(executable-find browse-url-chrome-program)))
|
|
|
|
|
|
2018-01-31 12:05:27 +01:00
|
|
|
|
;;; Extend MIME-types support for videos.
|
2018-01-12 11:23:37 +01:00
|
|
|
|
(with-eval-after-load 'mailcap
|
|
|
|
|
(add-to-list 'mailcap-mime-extensions '(".webm" . "video/webm"))
|
2018-01-31 12:05:27 +01:00
|
|
|
|
(add-to-list 'mailcap-mime-extensions '(".mp4" . "video/mp4"))
|
|
|
|
|
(add-to-list 'mailcap-mime-extensions '(".flv" . "video/mp4"))
|
|
|
|
|
(add-to-list 'mailcap-mime-extensions '(".ogv" . "video/ogg"))
|
2018-01-12 11:23:37 +01:00
|
|
|
|
(add-to-list 'mailcap-mime-extensions '(".mkv" . "video/x-matroska")))
|
2012-11-13 18:46:20 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Default ispell dictionary. If not set, Emacs uses the current locale.
|
2015-04-17 15:47:48 +02:00
|
|
|
|
(setq ispell-dictionary "english")
|
2017-06-30 18:24:09 +02:00
|
|
|
|
(define-keys text-mode-map
|
|
|
|
|
"C-<f6>" 'ispell-change-dictionary
|
|
|
|
|
"<f6>" 'ispell-buffer)
|
2012-12-21 21:30:54 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Show matching parenthesis
|
2013-01-10 15:57:07 +01:00
|
|
|
|
(show-paren-mode 1)
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; By default, there’s a small delay before showing a matching parenthesis. Set
|
|
|
|
|
;;; it to 0 to deactivate.
|
2013-01-10 15:57:07 +01:00
|
|
|
|
(setq show-paren-delay 0)
|
2016-10-05 06:56:16 +02:00
|
|
|
|
(setq show-paren-when-point-inside-paren t)
|
2013-01-10 15:57:07 +01:00
|
|
|
|
|
2017-06-29 19:06:53 +02:00
|
|
|
|
;;; Electric Pairs to auto-complete () [] {} "" etc. It works on regions.
|
2017-06-03 19:41:19 +02:00
|
|
|
|
;; (electric-pair-mode)
|
2013-02-27 22:35:16 +01:00
|
|
|
|
|
2017-10-17 00:52:50 +02:00
|
|
|
|
;;; Spawn terminal shortcut: WM's binding is s+<return>.
|
|
|
|
|
(global-set-key (kbd "C-x M-<return>") 'spawn-terminal)
|
2016-11-27 12:40:13 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Calendar ISO display.
|
2013-02-27 22:35:16 +01:00
|
|
|
|
(setq calendar-week-start-day 1)
|
|
|
|
|
(setq calendar-date-style 'iso)
|
2013-02-28 22:09:31 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Compilation bindings and conveniences.
|
2014-03-13 13:50:56 +01:00
|
|
|
|
(setq compilation-ask-about-save nil)
|
2017-05-28 12:03:28 +02:00
|
|
|
|
(setq compilation-scroll-output 'first-error)
|
2017-05-22 16:12:30 +02:00
|
|
|
|
(with-eval-after-load 'compile
|
|
|
|
|
;; Making `compilation-directory' local only works with `recompile'
|
|
|
|
|
;; and if `compile' is never used. In such a scenario,
|
|
|
|
|
;; `compile-command' is not saved by `recompile' itself which adds a
|
|
|
|
|
;; lot of bookkeeping.
|
|
|
|
|
;; (make-variable-buffer-local 'compilation-directory)
|
|
|
|
|
;; (make-variable-buffer-local 'compile-history)
|
|
|
|
|
(make-variable-buffer-local 'compile-command))
|
2017-06-12 22:29:30 +02:00
|
|
|
|
;;; Some commands ignore that compilation-mode is a "dumb" terminal and still display colors.
|
|
|
|
|
;;; Thus we render those colors.
|
|
|
|
|
(require 'ansi-color)
|
|
|
|
|
(defun compilation-colorize-buffer ()
|
|
|
|
|
(when (eq major-mode 'compilation-mode)
|
|
|
|
|
(ansi-color-apply-on-region compilation-filter-start (point-max))))
|
|
|
|
|
(add-hook 'compilation-filter-hook 'compilation-colorize-buffer)
|
2017-06-18 17:18:56 +02:00
|
|
|
|
(global-set-key (kbd "<f7>") 'previous-error)
|
|
|
|
|
(global-set-key (kbd "<f8>") 'next-error)
|
2017-09-14 17:50:34 +02:00
|
|
|
|
(defun compile-last-command ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(compile compile-command))
|
2017-06-18 17:18:56 +02:00
|
|
|
|
(define-keys prog-mode-map
|
|
|
|
|
"C-<f6>" 'compile
|
2017-09-14 17:50:34 +02:00
|
|
|
|
;; Do not use `recompile' since we want to change the compilation folder for the current buffer.
|
|
|
|
|
"<f6>" 'compile-last-command)
|
|
|
|
|
|
|
|
|
|
;;; REVIEW: Bug 26658 reports that cc-modes mistakenly does not make use of prog-mode-map.
|
|
|
|
|
;;; The following line is a suggested work-around.
|
|
|
|
|
;;; This should be fixed in Emacs 26.
|
|
|
|
|
(eval-after-load 'cc-mode '(set-keymap-parent c-mode-base-map prog-mode-map))
|
2014-03-13 13:50:56 +01:00
|
|
|
|
|
2017-07-28 18:22:59 +02:00
|
|
|
|
;;; Comint mode
|
|
|
|
|
(setq comint-prompt-read-only t)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Desktop-mode
|
2017-10-22 18:42:44 +02:00
|
|
|
|
;;; REVIEW: Desktop does not get saved when Emacs quits.
|
|
|
|
|
;;; See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28945.
|
2017-11-22 15:35:34 +01:00
|
|
|
|
(load "patch-desktop")
|
2017-10-23 21:07:25 +02:00
|
|
|
|
;;; REVIEW: `desktop-kill' should not query the user in `kill-emacs-hook'.
|
|
|
|
|
;;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28943
|
2017-07-28 09:12:25 +02:00
|
|
|
|
;;; TODO: Desktop mode does not save window registers properly.
|
|
|
|
|
;;; See https://groups.google.com/forum/#!topic/gnu.emacs.help/64aO_O43530
|
|
|
|
|
;;; and https://www.reddit.com/r/emacs/comments/4q38s1/save_register_between_sessions/?st=j419vc7r&sh=2617ffb4
|
|
|
|
|
;;; and http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27422
|
2017-11-06 22:07:48 +01:00
|
|
|
|
;;; and https://stackoverflow.com/questions/5830494/windows-configuration-to-registers#5830928
|
|
|
|
|
;;; and https://www.reddit.com/r/emacs/comments/7au3hj/how_do_you_manage_your_emacs_windows_and_stay_sane/dpfbg3a/?context=3.
|
2017-04-28 07:24:51 +02:00
|
|
|
|
(when (daemonp)
|
2017-10-22 18:42:44 +02:00
|
|
|
|
;; Let Emacs auto-load/save sessions only when running the daemon.
|
|
|
|
|
;; `server-running-p' is only useful once the daemon is started and cannot be
|
|
|
|
|
;; used for initialization. We use `daemonp' instead.
|
2017-08-14 16:33:27 +02:00
|
|
|
|
(setq history-length 250
|
2017-10-23 21:07:25 +02:00
|
|
|
|
;; REVIEW: Default timer (30) is way to high: for somebody too frenzy, the
|
|
|
|
|
;; timer might never be saved. See
|
|
|
|
|
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28943.
|
2017-10-22 18:42:44 +02:00
|
|
|
|
desktop-auto-save-timeout 5
|
2017-08-14 16:33:27 +02:00
|
|
|
|
desktop-dirname (concat emacs-cache-folder "desktop")
|
|
|
|
|
desktop-path (list desktop-dirname)
|
2017-10-22 18:42:44 +02:00
|
|
|
|
;; desktop-restore-eager 4 ; Can be annoying as you don't have your last-loaded buffers immediately.
|
|
|
|
|
desktop-save t)
|
2017-12-07 11:07:53 +01:00
|
|
|
|
(desktop-save-mode)
|
2017-12-01 10:58:11 +01:00
|
|
|
|
(add-to-list 'desktop-modes-not-to-save 'pdf-view-mode)
|
2017-12-03 10:49:40 +01:00
|
|
|
|
(add-to-list 'desktop-modes-not-to-save 'image-mode)
|
2015-04-17 16:16:10 +02:00
|
|
|
|
(unless (file-directory-p desktop-dirname)
|
|
|
|
|
(make-directory desktop-dirname t))
|
2017-05-12 08:34:17 +02:00
|
|
|
|
;; TODO: `compile-history' should be buffer local but that does not work.
|
|
|
|
|
;; http://user42.tuxfamily.org/compile-history-local/index.html
|
|
|
|
|
;; http://stackoverflow.com/questions/22995203/one-compile-command-per-buffer-not-directory
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;; (add-to-list 'desktop-locals-to-save 'compile-history)
|
2017-05-22 16:26:52 +02:00
|
|
|
|
(add-to-list 'desktop-locals-to-save 'compile-command)
|
2017-12-07 11:07:53 +01:00
|
|
|
|
(add-to-list 'desktop-locals-to-save 'ispell-local-dictionary))
|
2013-06-16 16:57:23 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Buffer names.
|
2014-02-21 20:14:50 +01:00
|
|
|
|
(setq uniquify-buffer-name-style 'forward)
|
2013-07-04 10:37:18 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Skeleton settings
|
|
|
|
|
;;; Do not expand abbrevs in skeletons.
|
2014-03-13 16:13:21 +01:00
|
|
|
|
(setq-default skeleton-further-elements '((abbrev-mode nil)))
|
2017-05-28 12:03:28 +02:00
|
|
|
|
(turn-on-skeleton-markers)
|
2017-06-20 20:38:59 +02:00
|
|
|
|
(global-set-keys
|
|
|
|
|
"C->" 'skeleton-next-position
|
2017-10-06 21:03:09 +02:00
|
|
|
|
"C-<" 'skeleton-previous-position)
|
2014-03-13 16:13:21 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Disable prompt (but leave warning) on git symlink.
|
2014-02-12 18:31:00 +01:00
|
|
|
|
(setq vc-follow-symlinks t)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Clipboard and primary selection.
|
|
|
|
|
;; (setq select-enable-clipboard t)
|
2017-08-29 18:32:04 +02:00
|
|
|
|
(setq select-enable-primary t
|
|
|
|
|
save-interprogram-paste-before-kill t)
|
2014-03-20 09:03:53 +01:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Move mouse away.
|
2017-06-18 16:28:15 +02:00
|
|
|
|
(mouse-avoidance-mode 'banish)
|
2017-05-28 18:37:54 +02:00
|
|
|
|
;;; That binding is not very useful and gets in the way of C-<mouse-1>.
|
|
|
|
|
(global-unset-key (kbd "C-<down-mouse-1>"))
|
2015-05-09 13:16:10 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Scroll zooming.
|
2017-06-20 20:38:59 +02:00
|
|
|
|
(global-set-keys
|
|
|
|
|
"C-<wheel-down>" 'text-scale-decrease
|
|
|
|
|
"C-<mouse-5>" 'text-scale-decrease
|
|
|
|
|
"C-<wheel-up>" 'text-scale-increase
|
|
|
|
|
"C-<mouse-4>" 'text-scale-increase)
|
2015-06-02 10:05:14 +02:00
|
|
|
|
(setq text-scale-mode-step 1.1)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Sort
|
2015-11-02 13:34:04 +01:00
|
|
|
|
(setq sort-fold-case t)
|
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Replace not-so-useful comment-dwim binding.
|
2017-10-17 00:52:50 +02:00
|
|
|
|
(global-set-key (kbd "M-;") 'comment-line)
|
2016-10-05 06:56:16 +02:00
|
|
|
|
|
2017-06-30 18:24:09 +02:00
|
|
|
|
;;; Eldoc: Disable if too distracting.
|
2016-10-06 14:37:53 +02:00
|
|
|
|
;; (global-eldoc-mode 0)
|
2017-07-28 18:24:43 +02:00
|
|
|
|
;; (setq eldoc-idle-delay 0.1) ; Could be even more distracting.
|
2016-09-23 15:26:24 +02:00
|
|
|
|
|
2017-05-28 12:32:48 +02:00
|
|
|
|
;;; Replace `kill-buffer' binding by `kill-this-buffer'.
|
2017-06-20 20:38:59 +02:00
|
|
|
|
(global-set-key (kbd "C-x k") 'kill-this-buffer)
|
2016-11-06 06:48:41 +01:00
|
|
|
|
|
2017-06-15 21:08:38 +02:00
|
|
|
|
;;; Ediff
|
2017-08-01 20:55:50 +02:00
|
|
|
|
;;; TODO: Ediff does not seem to auto-refine. Bug? Compare daemon and no-daemon.
|
2016-12-10 17:53:59 +01:00
|
|
|
|
(setq ediff-window-setup-function 'ediff-setup-windows-plain
|
|
|
|
|
ediff-split-window-function 'split-window-horizontally)
|
|
|
|
|
|
2017-06-15 21:08:38 +02:00
|
|
|
|
;;; Trash
|
|
|
|
|
(setq delete-by-moving-to-trash t)
|
|
|
|
|
|
2017-06-20 16:24:23 +02:00
|
|
|
|
;;; Display Time World
|
2017-06-18 14:26:26 +02:00
|
|
|
|
(setq
|
|
|
|
|
zoneinfo-style-world-list
|
|
|
|
|
'(("UTC" "-")
|
|
|
|
|
("Europe/Paris" "France Germany Sweden")
|
|
|
|
|
("Asia/Calcutta" "India")
|
|
|
|
|
("Indian/Mauritius" "Mauritius")
|
|
|
|
|
("Africa/Tunis" "Tunisia")
|
|
|
|
|
("Asia/Ho_Chi_Minh" "Vietnam")
|
|
|
|
|
("Australia/Melbourne" "Melbourne")
|
|
|
|
|
("Africa/Nairobi" "Uganda")))
|
|
|
|
|
|
2017-06-18 14:50:40 +02:00
|
|
|
|
;;; Tramp
|
2017-07-28 18:22:48 +02:00
|
|
|
|
(setq tramp-persistency-file-name (concat emacs-cache-folder "tramp")
|
|
|
|
|
tramp-backup-directory-alist backup-directory-alist)
|
2017-06-18 14:50:40 +02:00
|
|
|
|
|
2017-06-19 23:10:32 +02:00
|
|
|
|
;;; Frame title
|
|
|
|
|
(setq frame-title-format (concat "%b" (unless (daemonp) " [serverless]")))
|
|
|
|
|
|
2017-10-08 20:36:28 +02:00
|
|
|
|
;;; Initial scratch buffer message.
|
2017-09-18 16:06:13 +02:00
|
|
|
|
(require 'functions) ; For `fortune-scratch-message'.
|
|
|
|
|
(let ((fortune (fortune-scratch-message)))
|
|
|
|
|
(when fortune
|
|
|
|
|
(setq initial-scratch-message fortune)))
|
|
|
|
|
|
2017-10-25 20:12:52 +02:00
|
|
|
|
;;; Support for Emacs pinentry.
|
|
|
|
|
;;; Required for eshell/sudo and everything relying on GPG queries.
|
|
|
|
|
(setq epa-pinentry-mode 'loopback) ; This will fail if gpg>=2.1 is not available.
|
|
|
|
|
(pinentry-start)
|
|
|
|
|
|
2017-12-25 19:17:07 +01:00
|
|
|
|
;;; EWW
|
|
|
|
|
(setq eww-bookmarks-directory "~/personal/bookmarks")
|
|
|
|
|
|
2014-03-08 11:48:35 +01:00
|
|
|
|
(provide 'main)
|