diff --git a/.org-id-locations b/.org-id-locations deleted file mode 100644 index cc259c42..00000000 --- a/.org-id-locations +++ /dev/null @@ -1,2 +0,0 @@ - -nil diff --git a/.profile b/.profile deleted file mode 100644 index a33f15a8..00000000 --- a/.profile +++ /dev/null @@ -1,41 +0,0 @@ -# Sample .profile for SuSE Linux -# rewritten by Christian Steinruecken -# -# This file is read each time a login shell is started. -# All other interactive shells will only read .bashrc; this is particularly -# important for language settings, see below. - -test -z "$PROFILEREAD" && . /etc/profile || true - -# Most applications support several languages for their output. -# To make use of this feature, simply uncomment one of the lines below or -# add your own one (see /usr/share/locale/locale.alias for more codes) -# This overwrites the system default set in /etc/sysconfig/language -# in the variable RC_LANG. -# -#export LANG=de_DE.UTF-8 # uncomment this line for German output -#export LANG=fr_FR.UTF-8 # uncomment this line for French output -#export LANG=es_ES.UTF-8 # uncomment this line for Spanish output -export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -# Some people don't like fortune. If you uncomment the following lines, -# you will have a fortune each time you log in ;-) - -#if [ -x /usr/bin/fortune ] ; then -# echo -# /usr/bin/fortune -# echo -#fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - PATH="$HOME/bin:$PATH" -fi - -# set PATH so it includes user's private bin if it exists -if [ -d "$HOME/.local/bin" ] ; then - PATH="$HOME/.local/bin:$PATH" -fi - -export PATH="$HOME/.cargo/bin:$PATH" -export PATH="$HOME/.npm-packages/bin:$PATH" diff --git a/bundle/bundles.el b/bundle/bundles.el deleted file mode 100644 index 88369cf4..00000000 --- a/bundle/bundles.el +++ /dev/null @@ -1,20 +0,0 @@ -;; Load my custom bundles - -(require 'os) -(require 'display) -(require 'fill-column-indicator) -(require 'calendar-settings) -(require 'org-mode-settings) -(require 'sbcl-settings) -(require 'hooks) -(require 'elpy-settings) -(require 'org-attach-git) - -(provide 'bundles) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; lisp-indent-offset: 2 -;; End: diff --git a/bundle/calendar-settings.el b/bundle/calendar-settings.el deleted file mode 100644 index 3ea70650..00000000 --- a/bundle/calendar-settings.el +++ /dev/null @@ -1,25 +0,0 @@ -(setq cal-html-directory "~/Documents/Diary" - view-diary-entries-initially t - mark-diary-entries-in-calendar t - number-of-diary-entries 7 - calendar-date-style (quote iso) - calendar-week-start-day 1) - -(setq calendar-intermonth-text - (quote - (propertize - (format "%2d" - (car - (calendar-iso-from-absolute - (calendar-absolute-from-gregorian - (list month day year))))) - (quote font-lock-face) - (quote font-lock-function-name-face)))) - -(when (string= (system-name) "EVG02667NB") - (unless (file-directory-p (expand-file-name "~/Documents")) - (let ((docs-path (getenv "DOCS_PATH"))) - (setq cal-html-directory (concat docs-path "\\Diary") - diary-file (concat docs-path "\\Diary\\diary") - timeclock-file (concat docs-path "\\Diary\\timelog"))))) -(provide 'calendar-settings) diff --git a/bundle/custom.el b/bundle/custom.el index c05d2dd5..37aeb5d0 100644 --- a/bundle/custom.el +++ b/bundle/custom.el @@ -3,103 +3,15 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(auto-save-default t) - '(backup-directory-alist (quote (("" . "~/.emacs.d/_backup_files")))) - '(blink-cursor-mode nil) - '(browse-url-browser-function (quote eww-browse-url)) - '(custom-safe-themes - (quote - ("3f5f69bfa958dcf04066ab2661eb2698252c0e40b8e61104e3162e341cee1eb9" "7f6d4aebcc44c264a64e714c3d9d1e903284305fd7e319e7cb73345a9994f5ef" "4c0739c6ad6fd91ebd737f8f40527d279cc5f85bc286a7c0d7467b4a6ba53166" "6096a2f93610f29bf0f6fe34307587edd21edec95073cbfcfb9d7a3b9206b399" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" "64d8237b42b3b01f1487a908836574a5e531ea5efab54b9afa19fb8fda471ab3" "4bdc0dfc53ae06323e031baf691f414babf13c9c9c35014dd07bb42c4db27c24" "d6c5b8dc6049f2e9dabdfcafa9ef2079352640e80dffe3e6cc07c0f89cbf9748" "fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "fa2af0c40576f3bde32290d7f4e7aa865eb6bf7ebe31eb9e37c32aa6f4ae8d10" "e396098fd5bef4f0dd6cedd01ea48df1ecb0554d8be0d8a924fb1d926f02f90f" "acfac6b14461a344f97fad30e2362c26a3fe56a9f095653832d8fc029cb9d05c" "85d1dbf2fc0e5d30f236712b831fb24faf6052f3114964fdeadede8e1b329832" "4639288d273cbd3dc880992e6032f9c817f17c4a91f00f3872009a099f5b3f84" "14c848e2c4a0a11fcd118e2519078aa50bb6020f89035423b40fff421fb24fbd" "cdb4ffdecc682978da78700a461cdc77456c3a6df1c1803ae2dd55c59fa703e3" "9e31aff9afe3c20a33dd966b4c54c6a5151f07659362e4b06bde38ded5370dae" "24fc62afe2e5f0609e436aa2427b396adf9a958a8fa660edbaab5fb13c08aae6" "82358261c32ebedfee2ca0f87299f74008a2e5ba5c502bde7aaa15db20ee3731" "4515feff287a98863b7b7f762197a78a7c2bfb6ec93879e7284dff184419268c" default))) - '(delete-selection-mode t) - '(desktop-save-mode nil) - '(diary-file "~/Documents/Diary/diary") - '(display-time-world-list - (quote - (("America/Los_Angeles" "Seattle") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Europe/Paris" "Paris") - ("Asia/Calcutta" "Bangalore") - ("Asia/Tokyo" "Tokyo")))) - '(global-auto-revert-mode t) - '(history-delete-duplicates t) - '(icomplete-mode t) - '(indent-tabs-mode nil) - '(inferior-lisp-program (executable-find "sbcl") t) - '(inhibit-startup-screen t) - '(kill-read-only-ok t) - '(linum-relative-backend (quote display-line-numbers-mode)) - '(load-prefer-newer t) - '(major-mode (quote text-mode)) - '(make-backup-files nil) - '(max-lisp-eval-depth 24000) - '(max-mini-window-height 0.35) - '(max-specpdl-size 19500) - '(network-security-level (quote medium)) - '(newsticker-download-logos nil) - '(newsticker-frontend (quote newsticker-plainview)) - '(newsticker-keep-obsolete-items nil) - '(newsticker-show-descriptions-of-new-items nil) - '(newsticker-url-list - (quote - (("Datacamp" "https://www.datacamp.com/community/rss.xml" nil 3600 nil) - ("PBP" "https://pbpython.com/feeds/all.atom.xml" nil 3600 nil) - ("Planet Python" "https://planetpython.org/rss20.xml" nil 3600 nil) - ("lucumr" "http://lucumr.pocoo.org/feed.atom" nil 3600 nil) - ("doughellmann" "https://doughellmann.com/blog/feed/" nil 3600 nil) - ("Sachachua" "https://sachachua.com/blog/feed/" nil 3600 nil) - ("Stack Exchange" "https://emacs.stackexchange.com/feeds" nil 3600 nil) - ("Phoronix" "https://www.phoronix.com/rss.php" nil 3600 nil) - ("Ubuntu" "https://blog.ubuntu.com/feed" nil 3600 nil) - ("Metaebene" "https://metaebene.me/feed/" nil 3600 nil) - ("Planet Lisp" "http://planet.lisp.org/rss20.xml" nil 3600 nil) - ("Python PEP" "https://www.python.org/dev/peps/peps.rss/" nil 3600 nil) - ("Omegacube" "https://www.omegacube.com/feed/" nil 3600 nil) - ("logisticsbureau" "https://www.logisticsbureau.com/feed/" nil 3600 nil) - ("nixcraft" "https://www.cyberciti.biz/atom/atom.xml" nil nil nil) - ("realpython" "https://realpython.com/atom.xml" nil nil nil) - ("Gitlab weblog" "https://about.gitlab.com/atom.xml" nil nil nil)))) - '(nord-comment-brightness 15) - '(nord-region-highlight "snowstorm") - '(nord-uniform-mode-lines t) - '(olivetti-body-width 90) - '(org-modules - (quote - (ol-bbdb ol-bibtex ol-docview ol-eww ol-gnus ol-info ol-irc ol-mhe ol-rmail org-tempo ol-w3m))) - '(package-enable-at-startup t) - '(package-selected-packages - (quote - (gnuplot org org-ref gnu-elpa-keyring-update ob-dart dart-mode dart-server projectile python-django ivy elpy olivetti ace-window graphviz-dot-mode dot-mode plantuml-mode elisp-format elisp-lint flymake-racket google-translate org-pomodoro elm-mode dashboard pickle poet-theme flymake-eslint json-mode darkroom dockerfile-mode ein spacemacs-theme flucui-themes leuven-theme htmlize scss-mode berrys-theme web-mode python-docstring sphinx-doc sphinx-frontend sphinx-mode ox-nikola racket-mode slime gherkin-mode powershell typescript-mode ob-http ob-ipython ob-restclient nord-theme restclient request restclient-test yaml-mode magit))) - '(python-shell-interpreter "python3") - '(register-preview-delay 2) - '(register-separator 43) - '(request-log-level (quote debug)) - '(request-message-level (quote debug)) - '(require-final-newline t) - '(resize-mini-windows t) - '(restclient-log-request t) - '(restclient-same-buffer-response t) - '(ring-bell-function (quote ignore)) - '(size-indication-mode nil) - '(tab-width 2) - '(timeclock-file "~/Documents/Diary/timelog") - '(timeclock-mode-line-display t) - '(tool-bar-mode nil) - '(truncate-lines nil) - '(visible-bell nil)) + '(ansi-color-faces-vector + [default default default italic underline success warning error]) + '(custom-enabled-themes (quote (misterioso))) + '(inhibit-startup-buffer-menu t) + '(initial-buffer-choice "d:/syncplicity/Marcus.Kammer/documents/Journal/README.org") + '(package-selected-packages (quote (ox-reveal ace-window htmlize ivy magit)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(highlight-indentation-current-column-face ((t (:inherit hl-line)))) - '(highlight-indentation-face ((t (:inherit hl-line)))) - '(show-paren-match ((t (:inherit hl-line)))) - '(variable-pitch ((t (:family "Noto Sans"))))) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; lisp-indent-offset: 2 -;; End: + ) diff --git a/bundle/display.el b/bundle/display.el deleted file mode 100644 index aec99a49..00000000 --- a/bundle/display.el +++ /dev/null @@ -1,47 +0,0 @@ -;; General userinterface and appearance -(tool-bar-mode -1) ; No toolbar -(menu-bar-mode -1) ; No Menubar -(set-scroll-bar-mode 'right) ; Scrollbar on the right -(scroll-bar-mode -1) ; No scrollbar -(global-font-lock-mode t) ; Color enabled -(global-prettify-symbols-mode t) ; Prettify symbols -(global-hl-line-mode 1) ; Highlight cursor line -(global-whitespace-mode 1) ; Show whitespace globally -(show-paren-mode 1) ; Visual matching parens -(global-display-line-numbers-mode -1) ; Display line numbers -;; Mode line specific -(column-number-mode 1) ; Display column number in the mode line -(size-indication-mode -1) ; Display buffer size in the mode line -(line-number-mode 1) ; Display line number in the mode line -(display-battery-mode -1) ; Display battery status in the mode line -(display-time-mode -1) ; Display time in the mode line - -(add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Maximize Window -(add-to-list 'default-frame-alist '(font . "Iosevka Term-12")) - -(when (eq system-type 'gnu/linux) - (add-to-list 'default-frame-alist '(undecorated . t))) - -(setq-default - echo-keystrokes 0.02 - column-number-indicator-zero-based nil - prettify-symbols-unprettify-at-point 'right-edge - show-paren-delay 0 - show-paren-style 'expression - whitespace-style '(tab-mark) - font-lock-maximum-decoration t - fill-column 72 - indicate-buffer-boundaries 'left - display-line-numbers-grow-only t - display-line-numbers-type (quote relative) - display-line-numbers-widen nil - ) - -(provide 'display) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; lisp-indent-offset: 2 -;; End: diff --git a/bundle/elpy-settings.el b/bundle/elpy-settings.el deleted file mode 100644 index 12ed919d..00000000 --- a/bundle/elpy-settings.el +++ /dev/null @@ -1,5 +0,0 @@ -(setenv "IPY_TEST_SIMPLE_PROMPT" "1") -(setq python-shell-interpreter "ipython" - python-shell-interpreter-args "-i") - -(provide 'elpy-settings) diff --git a/bundle/fill-column-indicator.el b/bundle/fill-column-indicator.el deleted file mode 100755 index a9966d3c..00000000 --- a/bundle/fill-column-indicator.el +++ /dev/null @@ -1,903 +0,0 @@ -;;; fill-column-indicator.el --- Graphically indicate the fill column - -;; Copyright (c) 2011-2014 Alp Aker - -;; Author: Alp Aker -;; Version: 1.86 -;; Keywords: convenience - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2 of the -;; License, or (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; A copy of the GNU General Public License can be obtained from the -;; Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -;; MA 02111-1307 USA - -;;; Commentary: - -;; Many modern editors and IDEs can graphically indicate the location of the -;; fill column by drawing a thin line (in design parlance, a `rule') down the -;; length of the editing window. Fill-column-indicator implements this -;; facility in Emacs. - -;; PLEASE NOTE: There is a small incompatibility between this package and the -;; current stable Emacs relase (v24.3). A bug in Emacs's internal display -;; routine that was introduced shortly before that release can cause vertical -;; motion commands to skip blank lines when fci-mode is active. This has -;; been fixed in Emacs trunk. See github.com/alpaker/Fill-Column-Indicator/issues/31 -;; for further discussion. - -;; Installation and Usage -;; ====================== - -;; Put this file in your load path and put: -;; -;; (require 'fill-column-indicator) -;; -;; in your init file. - -;; To toggle graphical indication of the fill column in a buffer, use the -;; command `fci-mode'. - -;; Configuration -;; ============= - -;; By default, fci-mode draws its vertical indicator at the fill column. If -;; you'd like it to be drawn at another column, set `fci-rule-column' to the -;; column number. (A case in which this might be useful is when you want to -;; fill comments at, for example, column 70, but want a vertical rule at -;; column 80 or 100 to indicate the maximum line length for code.) The -;; default behavior (showing the indicator at the fill column) is specified -;; by setting fci-rule-column to nil. - -;; On graphical displays the fill-column rule is drawn using a bitmap -;; image. Its color is controlled by the variable `fci-rule-color', whose -;; value can be any valid color name. The rule's width in pixels is -;; determined by the variable `fci-rule-width'; the default value is 1. - -;; The rule can be drawn as a solid or dashed line, controlled by the -;; variable `fci-rule-use-dashes'; the default is nil. The dash appearance is -;; controlled by `fci-dash-pattern', which is the ratio of dash length to -;; line height; the default is 0.75. (The value should be a number between 0 -;; and 1; values outside that interval are coerced to the nearest endpoint.) - -;; The image formats fci-mode can use are XPM and PBM. If Emacs has been -;; compiled with the appropriate library it uses XPM images by default; if -;; not it uses PBM images, which are natively supported. You can specify a -;; particular choice of format by setting `fci-rule-image-format' explicitly -;; to xpm or pbm. - -;; On character terminals the rule is drawn using the character specified by -;; `fci-rule-character'; the default is `|' (ascii 124). If -;; `fci-rule-character-color' is nil, then it is drawn using fci-rule-color -;; (or the closest approximation thereto that the terminal is capable of); if -;; it is a color name, then that color is used instead. - -;; If you'd like the rule to be drawn using fci-rule-character even on -;; graphical displays, set `fci-always-use-textual-rule' to a non-nil value. - -;; These variables (as well as those described in the next section) can be -;; given buffer-local bindings. - -;; Other Options -;; ============= - -;; When `truncate-lines' is nil, the effect of drawing a fill-column rule is -;; very odd looking. Indeed, it makes little sense to use a rule to indicate -;; the position of the fill column in that case (the positions at which the -;; fill column falls in the visual display space won't, in general, be -;; collinear). For this reason, fci-mode sets truncate-lines to t in buffers -;; in which it is enabled and restores it to its previous value when -;; disabled. You can turn this feature off by setting -;; `fci-handle-truncate-lines' to nil. - -;; If `line-move-visual' is t, then vertical navigation can behave oddly in -;; several edge cases while fci-mode is enabled (this is due to a bug in -;; Emacs's C code). Accordingly, fci-mode sets line-move-visual to nil in -;; buffers in which it is enabled and restores it to its previous value when -;; disabled. This can be suppressed by setting `fci-handle-line-move-visual' -;; to nil. (But you shouldn't want to do this. There's no reason to use -;; line-move-visual if truncate-lines is t, and it doesn't make sense to use -;; something like fci-mode when truncate-lines is nil.) - -;; Fci-mode needs free use of two characters (specifically, it needs the use -;; of two characters whose display table entries it can change -;; arbitrarily). Its defualt is to use the first two characters of the -;; Private Use Area of the Unicode BMP, viz. U+E000 and U+E001. If you need -;; to use those characters for some other purpose, set `fci-eol-char' and -;; `fci-blank-char' to different values. - -;; Troubleshooting -;; =============== - -;; o Fci-mode is intended to be used with monospaced fonts. If you're using -;; a monospaced font and the fill-column rule is missing or misaligned on a -;; few lines but otherwise appears normal, then most likely (a) there are -;; non-ascii characters on those lines that are being displayed using a -;; non-monospaced font, or (b) your font-lock settings use bold or italics -;; and those font variants aren't monospaced. - -;; o Fci-mode in not currently compatible with Emacs's -;; `show-trailing-whitespace' feature (given the way the latter is -;; implemented, such compatibility is going to be hard to achieve). A -;; workaround is to configure `whitespace-mode' to replicate the -;; functionality of show-trailing-whitespace. This can be done with the -;; following setting: -;; -;; (setq whitespace-style '(face trailing)) -;; -;; With this, whitespace-mode produces the same basic effect as a non-nil -;; value of show-trailing-whitespace, and compatibility with fci-mode is not -;; a problem. - -;; Known Issues -;; ============ - -;; o The indicator extends only to end of the buffer contents (as opposed to -;; running the full length of the editing window). - -;; o When portions of a buffer are invisible, such as when outline-mode is -;; used to hide certain lines, the fill-column rule is hidden as well. - -;; o Fci-mode should work smoothly when simultaneously displaying the same -;; buffer on both a graphical display and on a character terminal. It does -;; not currently support simultaneous display of the same buffer on window -;; frames with different default font sizes. (It would be feasible to -;; support this use case, but thus far there seems to be no demand for -;; it.) - -;; o An issue specific to the Mac OS X (NextStep) port, versions 23.0-23.2: -;; Emacs won't, in these particular versions, draw a cursor on top of an -;; image. Thus on graphical displays the cursor will disappear when -;; positioned directly on top of the fill-column rule. The best way to -;; deal with this is to upgrade to v23.3 or v24 (or downgrade to v22). If -;; that isn't practical, a fix is available via the mini-package -;; fci-osx-23-fix.el, which can be downloaded from: -;; -;; github.com/alpaker/Fill-Column-Indicator -;; -;; Directions for its use are given in the file header. - -;; Todo -;; ==== - -;; o Accommodate non-nil values of `hl-line-sticky-flag' and similar cases. - -;; o Accommodate linum-mode more robustly. - -;; o Compatibility with non-nil `show-trailing-whitespace.' - -;; Acknowledgements -;; ================ - -;; Thanks to Ami Fischman, Christopher Genovese, Michael Hoffman, José -;; Alfredo Romero L., R. Lange, Joe Lisee, José Lombera, Frank Meffert, -;; Mitchell Peabody, sheijk, and an anonymous BT subscriber for bug reports -;; and suggestions. Special thanks to lomew, David Röthlisberger, and Pär -;; Wieslander for code contributions. - -;;; Code: - -(unless (version<= "22" emacs-version) - (error "Fill-column-indicator requires version 22 or later")) - -;;; --------------------------------------------------------------------- -;;; User Options -;;; --------------------------------------------------------------------- - -(defgroup fill-column-indicator nil - "Graphically indicate the fill-column." - :tag "Fill-Column Indicator" - :group 'convenience - :group 'fill) - -;; We should be using :validate instead of :match, but that seems not to -;; work with defcustom widgets. -(defcustom fci-rule-column nil - "Controls where fci-mode displays a vertical line (rule). - -If nil, the rule is drawn at the fill column. Otherwise, it is -drawn at the column given by this variable. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :group 'fill-column-indicator - :tag "Fill-Column rule column" - :type '(choice (const :tag "Use the fill column" nil) - (integer :tag "Use a custom column" - :match (lambda (w val) (fci-posint-p val))))) - -(defcustom fci-rule-color "#cccccc" - "Color used to draw the fill-column rule. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :group 'fill-column-indicator - :tag "Fill-column rule color" - :type 'color) - -(defcustom fci-rule-width 1 - "Width in pixels of the fill-column rule on graphical displays. -Note that a value greater than the default character width is -treated as equivalent to the default character width. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Fill-Column Rule Width" - :group 'fill-column-indicator - :type '(integer :match (lambda (w val) (fci-posint-p val)))) - -(defcustom fci-rule-image-format - (if (image-type-available-p 'xpm) 'xpm 'pbm) - "Image format used for the fill-column rule on graphical displays. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Fill-Column Rule Image Format" - :group 'fill-column-indicator - :type '(choice (symbol :tag "XPM" 'xpm) - (symbol :tag "PBM" 'pbm))) - -(defcustom fci-rule-use-dashes nil - "Whether to show the fill-column rule as dashes or as a solid line. -This has no effect on non-graphical displays. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Fill-Column Rule Use Dashes" - :group 'fill-column-indicator - :type 'boolean) - -(defcustom fci-dash-pattern 0.75 - "When using a dashed rule, ratio of dash length to line height. -Values less than 0 or greather than 1 are coerced to the nearest -endpoint of that interval. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Fill-Column Rule Use Dashes" - :group 'fill-column-indicator - :type 'float) - -(defcustom fci-rule-character ?| - "Character used to draw the fill-column rule on character terminals. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Fill-Column Rule Character" - :group 'fill-column-indicator - :type 'character) - -(defcustom fci-rule-character-color nil - "Color used to draw the fill-column rule on character terminals. -If nil, the same color is used as for the graphical rule. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :group 'fill-column-indicator - :tag "Fill-column rule color" - :type '(choice (const :tag "Use same color as graphical rule" nil) - (color :tag "Specify a color"))) - -(defcustom fci-always-use-textual-rule nil - "When non-nil, the rule is always drawn using textual characters. -Specifically, fci-mode will use `fci-rule-character' intead of -bitmap images to draw the rule on graphical displays. - -Changes to this variable do not take effect until the mode -function `fci-mode' is run." - :tag "Don't Use Image for Fill-Column Rule" - :group 'fill-column-indicator - :type 'boolean) - -(defcustom fci-handle-truncate-lines t - "Whether fci-mode should set truncate-lines to t while enabled. -If non-nil, fci-mode will set truncate-lines to t in buffers in -which it is enabled, and restore it to its previous value when -disabled. - -Leaving this option set to the default value is recommended." - :group 'fill-column-indicator - :tag "Locally set truncate-lines to t during fci-mode" - :type 'boolean) - -(defcustom fci-handle-line-move-visual (version<= "23" emacs-version) - "Whether fci-mode should set line-move-visual to nil while enabled. -If non-nil, fci-mode will set line-move-visual to nil in buffers -in which it is enabled, and restore t to its previous value when -disabled. - -Leaving this option set to the default value is recommended." - :group 'fill-column-indicator - :tag "Locally set line-move-visual to nil during fci-mode" - :type 'boolean) - -(defcustom fci-eol-char ?\uE000 - "Character used for internal purposes by fci-mode. -If you need to use this character, set this variable's value to a -character you do not care about (a good choice is a character -from the Private Use Area of the Unicode BMP, i.e., the range -U+E000-U+F8FF, inclusive)." - :group 'fill-column-indicator - :type 'character) - -(defcustom fci-blank-char ?\uE001 - "Character used for internal purposes by fci-mode. -If you need to use this character, set this variable's value to a -character you do not care about (a good choice is a character -from the Private Use Area of the Unicode BMP, i.e., the the range -U+E000-U+F8FF, inclusive)." - :group 'fill-column-indicator - :type 'character) - -;;; --------------------------------------------------------------------- -;;; Internal Variables and Constants -;;; --------------------------------------------------------------------- - -;; Record prior state of buffer. -(defvar fci-saved-line-move-visual) -(defvar fci-line-move-visual-was-buffer-local) -(defvar fci-saved-truncate-lines) -(defvar fci-saved-eol) -(defvar fci-made-display-table) - -;; Record state of fci initialization in this buffer. -(defvar fci-display-table-processed) -(defvar fci-local-vars-set) - -;; Record current state of some quantities, so we can detect changes to them. -(defvar fci-column) -(defvar fci-newline) -(defvar fci-tab-width) -(defvar fci-char-width) -(defvar fci-char-height) - -;; Data used in setting the fill-column rule that only need to be -;; occasionally updated in a given buffer. -(defvar fci-limit) -(defvar fci-pre-limit-string) -(defvar fci-at-limit-string) -(defvar fci-post-limit-string) - -;; The preceding internal variables need to be buffer local and reset when -;; the mode is disabled. -(defconst fci-internal-vars '(fci-saved-line-move-visual - fci-line-move-visual-was-buffer-local - fci-saved-truncate-lines - fci-saved-eol - fci-made-display-table - fci-display-table-processed - fci-local-vars-set - fci-column - fci-newline - fci-tab-width - fci-char-width - fci-char-height - fci-limit - fci-pre-limit-string - fci-at-limit-string - fci-post-limit-string)) - -(dolist (var fci-internal-vars) - (make-variable-buffer-local var)) - -;; Hooks we use. -(defconst fci-hook-assignments - '((after-change-functions fci-redraw-region t) - (before-change-functions fci-extend-rule-for-deletion t) - (window-scroll-functions fci-update-window-for-scroll t) - (window-configuration-change-hook fci-redraw-frame) - (post-command-hook fci-post-command-check t) - (change-major-mode-hook turn-off-fci-mode t) - (longlines-mode-hook fci-update-all-windows t))) - -;;; --------------------------------------------------------------------- -;;; Miscellany -;;; --------------------------------------------------------------------- - -(defun fci-get-buffer-windows (&optional all-frames) - "Return a list of windows displaying the current buffer." - (get-buffer-window-list (current-buffer) 'no-minibuf all-frames)) - -(defun fci-posint-p (x) - "Return true if X is an integer greater than zero." - (and (wholenump x) - (/= 0 x))) - -(if (fboundp 'characterp) - (defalias 'fci-character-p 'characterp) - ;; For v22. - (defun fci-character-p (c) - "Return true if C is a character." - (and (fci-posint-p c) - ;; MAX_CHAR in v22 is (0x1f << 14). We don't worry about - ;; generic chars. - (< c 507904)))) - -;;; --------------------------------------------------------------------- -;;; Mode Definition -;;; --------------------------------------------------------------------- - -;;;###autoload -(define-minor-mode fci-mode - "Toggle fci-mode on and off. -Fci-mode indicates the location of the fill column by drawing a -thin line (a `rule') at the fill column. - -With prefix ARG, turn fci-mode on if and only if ARG is positive. - -The following options control the appearance of the fill-column -rule: `fci-rule-column', `fci-rule-width', `fci-rule-color', -`fci-rule-use-dashes', `fci-dash-pattern', `fci-rule-character', -and `fci-rule-character-color'. For further options, see the -Customization menu or the package file. (See the latter for tips -on troubleshooting.)" - - nil nil nil - - (if fci-mode - ;; Enabling. - (condition-case error - (progn - (fci-check-user-options) - (fci-process-display-table) - (fci-set-local-vars) - (fci-get-frame-dimens) - (dolist (hook fci-hook-assignments) - (add-hook (car hook) (nth 1 hook) nil (nth 2 hook))) - (setq fci-column (or fci-rule-column fill-column) - fci-tab-width tab-width - fci-limit (if fci-newline - (1+ (- fci-column (length fci-saved-eol))) - fci-column)) - (fci-make-overlay-strings) - (fci-update-all-windows t)) - (error - (fci-mode 0) - (signal (car error) (cdr error)))) - - ;; Disabling. - (fci-restore-display-table) - (fci-restore-local-vars) - (dolist (hook fci-hook-assignments) - (remove-hook (car hook) (nth 1 hook) (nth 2 hook))) - (fci-delete-overlays-buffer) - (dolist (var fci-internal-vars) - (set var nil)))) - -;;;###autoload -(defun turn-on-fci-mode () - "Turn on fci-mode unconditionally." - (interactive) - (fci-mode 1)) - -(defun turn-off-fci-mode () - "Turn off fci-mode unconditionally." - (interactive) - (fci-mode 0)) - -;;; --------------------------------------------------------------------- -;;; Display Property Specs -;;; --------------------------------------------------------------------- - -(defun fci-overlay-fills-background-p (olay) - "Return true if OLAY specifies a background color." - (and (overlay-get olay 'face) - (not (eq (face-attribute (overlay-get olay 'face) :background nil t) - 'unspecified)))) - -(defun fci-competing-overlay-p (posn) - "Return true if there is an overlay at POSN that fills the background." - (memq t (mapcar #'fci-overlay-fills-background-p (overlays-at posn)))) - -;; The display spec used in overlay before strings to pad out the rule to the -;; fill-column. -(defconst fci-padding-display - '((when (not (fci-competing-overlay-p buffer-position)) - . (space :align-to fci-column)) - (space :width 0))) - -;; Generate the display spec for the rule. Basic idea is to use a "cascading -;; display property" to display the textual rule if the display doesn't -;; support images and the graphical rule if it does, but in either case only -;; display a rule if no other overlay wants to fill the background at the -;; relevant buffer position. -(defun fci-rule-display (blank rule-img rule-str for-pre-string) - "Generate a display specification for a fill-column rule overlay string." - (let* ((cursor-prop (if (and (not for-pre-string) (not fci-newline)) t)) - (propertized-rule-str (propertize rule-str 'cursor cursor-prop)) - (display-prop (if rule-img - `((when (not (or (display-images-p) - (fci-competing-overlay-p buffer-position))) - . ,propertized-rule-str) - (when (not (fci-competing-overlay-p buffer-position)) - . ,rule-img) - (space :width 0)) - `((when (not (fci-competing-overlay-p buffer-position)) - . ,propertized-rule-str) - (space :width 0))))) - (propertize blank 'cursor cursor-prop 'display display-prop))) - -;;; --------------------------------------------------------------------- -;;; Enabling -;;; --------------------------------------------------------------------- - -(defun fci-check-user-options () - "Check that all user options for fci-mode have valid values." - (unless (memq fci-rule-image-format '(xpm pbm)) - (error "Unrecognized value of `fci-rule-image-format'")) - ;; If the third element of a binding form is t, then nil is an acceptable - ;; value for the variable; otherwise, the variable value must satisfy the - ;; given predicate. - (let ((checks '((fci-rule-color color-defined-p) - (fci-rule-column fci-posint-p t) - (fci-rule-width fci-posint-p t) - (fci-rule-character-color color-defined-p t) - (fci-rule-character fci-character-p) - (fci-blank-char fci-character-p) - (fci-dash-pattern floatp) - (fci-eol-char fci-character-p)))) - (dolist (check checks) - (let ((value (symbol-value (nth 0 check))) - (pred (nth 1 check)) - (nil-is-ok (nth 2 check))) - (unless (or (and nil-is-ok (null value)) - (funcall pred value)) - (signal 'wrong-type-argument (list pred value))))))) - -(defun fci-process-display-table () - "Set up a buffer-local display table for fci-mode." - (unless fci-display-table-processed - (unless buffer-display-table - (setq buffer-display-table (make-display-table) - fci-made-display-table t)) - (aset buffer-display-table fci-blank-char [32]) - (setq fci-saved-eol (aref buffer-display-table 10)) - ;; Assumption: the display-table entry for character 10 is either nil or - ;; a vector whose last element is the newline glyph. - (let ((glyphs (butlast (append fci-saved-eol nil))) - eol) - (if glyphs - (setq fci-newline [10] - eol (vconcat glyphs)) - (setq fci-newline nil - eol [32])) - (aset buffer-display-table 10 fci-newline) - (aset buffer-display-table fci-eol-char eol)) - (setq fci-display-table-processed t))) - -(defun fci-set-local-vars () - "Set miscellaneous local variables when fci-mode is enabled." - (unless fci-local-vars-set - (when (and fci-handle-line-move-visual - (boundp 'line-move-visual)) - (if (local-variable-p 'line-move-visual) - (setq fci-line-move-visual-was-buffer-local t - fci-saved-line-move-visual line-move-visual - line-move-visual nil) - (set (make-local-variable 'line-move-visual) nil))) - (when fci-handle-truncate-lines - (setq fci-saved-truncate-lines truncate-lines - truncate-lines t)) - (setq fci-local-vars-set t))) - -(defun fci-make-rule-string () - "Return a string for drawing the fill-column rule." - (let ((color (or fci-rule-character-color - fci-rule-color))) - ;; Make sure we don't inherit weight or slant from font-lock. - (propertize (char-to-string fci-rule-character) - 'face `(:foreground ,color :weight normal :slant normal)))) - -(defun fci-make-img-descriptor () - "Make an image descriptor for the fill-column rule." - (unless (or (= 0 fci-char-width) - fci-always-use-textual-rule) - ;; No point passing width, height, color etc. directly to the image - ;; functions: those variables have either global or buffer-local - ;; scope, so the image-generating functions can access them directly. - (if (eq fci-rule-image-format 'xpm) - (fci-make-xpm-img) - (fci-make-pbm-img)))) - -(defun fci-get-frame-dimens () - "Determine the frame character height and width. - -If the selected frame cannot display images, use the character -height and width of the first graphic frame in the frame list -displaying the current buffer. (This fallback behavior is just a -rough heuristic.)" - (let ((frame (catch 'found-graphic - (if (display-images-p) - (selected-frame) - (dolist (win (fci-get-buffer-windows t)) - (when (display-images-p (window-frame win)) - (throw 'found-graphic (window-frame win)))))))) - (setq fci-char-width (frame-char-width frame) - fci-char-height (frame-char-height frame)))) - -(defmacro fci-with-rule-parameters (&rest body) - "Define various quantites used in generating rule image descriptors." - (declare (indent defun)) - `(let* ((height-str (number-to-string fci-char-height)) - (width-str (number-to-string fci-char-width)) - (rule-width (min fci-rule-width fci-char-width)) - (hmargin (/ (- fci-char-width rule-width) 2.0)) - (left-margin (floor hmargin)) - (right-margin (ceiling hmargin)) - (segment-ratio (if fci-rule-use-dashes fci-dash-pattern 1)) - (segment-ratio-coerced (min 1 (max 0 segment-ratio))) - (segment-length (round (* segment-ratio-coerced fci-char-height))) - (vmargin (/ (- fci-char-height segment-length) 2.0)) - (top-margin (floor vmargin)) - (bottom-margin (ceiling vmargin))) - ,@body)) - -(defun fci-mapconcat (sep &rest lists) - "Concatenate the strings in LISTS, using SEP as separator." - (mapconcat #'identity (apply 'nconc lists) sep)) - -(defun fci-make-pbm-img () - "Return an image descriptor for the fill-column rule in PBM format." - (fci-with-rule-parameters - (let* ((magic-number "P1\n") - (dimens (concat width-str " " height-str "\n")) - (on-pixels (fci-mapconcat " " - (make-list left-margin "0") - (make-list rule-width "1") - (make-list right-margin "0"))) - (off-pixels (fci-mapconcat " " (make-list fci-char-width "0"))) - (raster (fci-mapconcat "\n" - (make-list top-margin off-pixels) - (make-list segment-length on-pixels) - (make-list bottom-margin off-pixels))) - (data (concat magic-number dimens raster))) - `(image :type pbm - :data ,data - :mask heuristic - :foreground ,fci-rule-color - :ascent center)))) - -(defun fci-make-xpm-img () - "Return an image descriptor for the fill-column rule in XPM format." - (fci-with-rule-parameters - (let* ((identifier "/* XPM */\nstatic char *rule[] = {") - (dimens (concat "\"" width-str " " height-str " 2 1\",")) - (color-spec (concat "\"1 c " fci-rule-color "\",\"0 c None\",")) - (on-pixels (concat "\"" - (make-string left-margin ?0) - (make-string rule-width ?1) - (make-string right-margin ?0) - "\",")) - (off-pixels (concat "\"" (make-string fci-char-width ?0) "\",")) - (raster (fci-mapconcat "" - (make-list top-margin off-pixels) - (make-list segment-length on-pixels) - (make-list bottom-margin off-pixels))) - (end "};") - (data (concat identifier dimens color-spec raster end))) - `(image :type xpm - :data ,data - :mask heuristic - :ascent center)))) - -(defun fci-make-overlay-strings () - "Generate the overlay strings used to display the fill-column rule." - (let* ((str (fci-make-rule-string)) - (img (fci-make-img-descriptor)) - (blank-str (char-to-string fci-blank-char)) - (eol-str (char-to-string fci-eol-char)) - (end-cap (propertize blank-str 'display '(space :width 0))) - (pre-or-post-eol (propertize eol-str - 'cursor t - 'display (propertize eol-str 'cursor t))) - (pre-padding (propertize blank-str 'display fci-padding-display)) - (pre-rule (fci-rule-display blank-str img str t)) - (at-rule (fci-rule-display blank-str img str fci-newline)) - (at-eol (if fci-newline pre-or-post-eol ""))) - (setq fci-pre-limit-string (concat pre-or-post-eol pre-padding pre-rule) - fci-at-limit-string (concat at-eol at-rule) - fci-post-limit-string (concat pre-or-post-eol end-cap)))) - -;;; --------------------------------------------------------------------- -;;; Disabling -;;; --------------------------------------------------------------------- - -(defun fci-restore-local-vars () - "Restore miscellaneous local variables when fci-mode is disabled." - (when fci-local-vars-set - (when (and fci-handle-line-move-visual - (boundp 'line-move-visual)) - (if fci-line-move-visual-was-buffer-local - (setq line-move-visual fci-saved-line-move-visual) - (kill-local-variable 'line-move-visual))) - (when fci-handle-truncate-lines - (setq truncate-lines fci-saved-truncate-lines)))) - -(defun fci-restore-display-table () - "Restore the buffer display table when fci-mode is disabled." - (when (and buffer-display-table - fci-display-table-processed) - (aset buffer-display-table 10 fci-saved-eol) - ;; Don't set buffer-display-table to nil even if we created the display - ;; table; only do so if nothing else has changed it. - (when (and fci-made-display-table - (equal buffer-display-table (make-display-table))) - (setq buffer-display-table nil)))) - -;;; --------------------------------------------------------------------- -;;; Drawing and Erasing -;;; --------------------------------------------------------------------- - -(defun fci-get-overlays-region (start end) - "Return all overlays between START and END displaying the fill-column rule." - (delq nil (mapcar #'(lambda (o) (if (overlay-get o 'fci) o)) - (overlays-in start end)))) - -(defun fci-delete-overlays-region (start end) - "Delete overlays displaying the fill-column rule between START and END." - (mapc #'(lambda (o) (if (overlay-get o 'fci) (delete-overlay o))) - (overlays-in start end))) - -(defun fci-delete-overlays-buffer () - "Delete all overlays displaying the fill-column rule in the current buffer." - (save-restriction - (widen) - (fci-delete-overlays-region (point-min) (point-max)))) - -(defsubst fci-posn-visible-p (posn ranges) - "Return true if POSN falls within an interval in RANGES." - (memq t (mapcar #'(lambda (range) (and (<= (car range) posn) - (< posn (cdr range)))) - ranges))) - -(defsubst fci-get-visible-ranges () - "Return the window start and end for each window on the current buffer." - (mapcar #'(lambda (w) (cons (window-start w) (window-end w 'updated))) - (fci-get-buffer-windows t))) - -(defun fci-delete-unneeded () - "Erase the fill-column rule at buffer positions not visible in any window." - (let ((olays (fci-get-overlays-region (point-min) (point-max))) - (ranges (fci-get-visible-ranges))) - (dolist (o olays) - (unless (fci-posn-visible-p (overlay-start o) ranges) - (delete-overlay o))))) - -;; It would be slightly faster to run this backwards from END to START, but -;; only if we maintained the overlay center at an early position in the -;; buffer. Since other packages that use overlays typically place them while -;; traversing the buffer in a forward direction, that would be a bad idea. -(defun fci-put-overlays-region (start end) - "Place overlays displaying the fill-column rule between START and END." - (goto-char start) - (let (o cc) - (while (search-forward "\n" end t) - (goto-char (match-beginning 0)) - (setq cc (current-column) - o (make-overlay (match-beginning 0) (match-beginning 0))) - (overlay-put o 'fci t) - (cond - ((< cc fci-limit) - (overlay-put o 'after-string fci-pre-limit-string)) - ((> cc fci-limit) - (overlay-put o 'after-string fci-post-limit-string)) - (t - (overlay-put o 'after-string fci-at-limit-string))) - (goto-char (match-end 0))))) - -(defun fci-redraw-region (start end _ignored) - "Erase and redraw the fill-column rule between START and END." - (save-match-data - (save-excursion - (let ((inhibit-point-motion-hooks t)) - (goto-char end) - (setq end (line-beginning-position 2)) - (fci-delete-overlays-region start end) - (when (> (+ (window-width) (window-hscroll)) - fci-limit) - (fci-put-overlays-region start end)))))) - -(defun fci-redraw-window (win &optional start) - "Redraw the fill-column rule in WIN starting from START." - (fci-redraw-region (or start (window-start win)) (window-end win t) 'ignored)) - -;; This doesn't determine the strictly minimum amount by which the rule needs -;; to be extended, but the amount used is always sufficient, and determininga -;; the genuine minimum is more expensive than doing the extra drawing. -(defun fci-extend-rule-for-deletion (start end) - "Extend the fill-column rule after a deletion that spans newlines." - (unless (= start end) - (let ((delenda (fci-get-overlays-region start end))) - (when delenda - (let ((lossage (1+ (length delenda))) - (max-end 0) - win-end) - (mapc #'delete-overlay delenda) - (dolist (win (fci-get-buffer-windows t)) - ;; Do not ask for an updated value of window-end. - (setq win-end (window-end win)) - (when (and (< 0 (- (min win-end end) - (max (window-start win) start))) - (< max-end win-end)) - (setq max-end win-end))) - (unless (= max-end (point-max)) - (fci-redraw-region max-end - (save-excursion - (goto-char max-end) - (line-beginning-position lossage)) - nil))))))) - -(defun fci-update-window-for-scroll (win start) - "Redraw the fill-column rule in WIN after it has been been scrolled." - (fci-delete-unneeded) - (fci-redraw-window win start)) - -(defun fci-update-all-windows (&optional all-frames) - "Redraw the fill-column rule in all windows showing the current buffer." - (dolist (win (fci-get-buffer-windows all-frames)) - (fci-redraw-window win))) - -(defun fci-redraw-frame () - "Redraw the fill-column rule in all windows on the selected frame." - (let* ((wins (window-list (selected-frame) 'no-minibuf)) - (bufs (delete-dups (mapcar #'window-buffer wins)))) - (dolist (buf bufs) - (with-current-buffer buf - (when fci-mode - (fci-delete-unneeded) - (fci-update-all-windows)))))) - -;;; --------------------------------------------------------------------- -;;; Workarounds -;;; --------------------------------------------------------------------- - -;; This in placed in post-command-hook and does four things: -;; 1. If the display table has been deleted or something has changed the -;; display table for newline chars, we regenerate overlay strings after -;; reprocessing the display table. -;; 2. If the default char width or height has changed, we regenerate the rule -;; image. (This handles both font changes and also cases where we -;; activate the mode while displaying on a char terminal then subsequently -;; display the buffer on a window frame.) -;; 3. If the value of `tab-width' or `fill-column' has changed, we reset the -;; rule. (We could set things up so that the rule adjusted automatically -;; to such changes, but it wouldn't work on v22 or v23.) -;; 4. Cursor properties are ignored when they're out of sight because of -;; horizontal scrolling. We detect such situations and force a return -;; from hscrolling to bring our requested cursor position back into view. -;; These are all fast tests, so despite the large remit this function -;; shouldn't noticeably affect editing speed. -(defun fci-post-command-check () - "This function is a gross hack." - (cond - ((not (and buffer-display-table - (equal (aref buffer-display-table 10) fci-newline))) - (setq fci-display-table-processed nil) - (fci-mode 1)) - ((and (< 1 (frame-char-width)) - (not fci-always-use-textual-rule) - (not (and (= (frame-char-width) fci-char-width) - (= (frame-char-height) fci-char-height)))) - (fci-mode 1)) - ((not (and (= (or fci-rule-column fill-column) fci-column) - (= tab-width fci-tab-width))) - (fci-mode 1)) - ((and (< 0 (window-hscroll)) - auto-hscroll-mode - (<= (current-column) (window-hscroll))) - ;; Fix me: Rather than setting hscroll to 0, this should reproduce the - ;; relevant part of the auto-hscrolling algorithm. Most people won't - ;; notice the difference in behavior, though. - (set-window-hscroll (selected-window) 0)))) - -(provide 'fill-column-indicator) - -;;; fill-column-indicator.el ends here diff --git a/bundle/hooks.el b/bundle/hooks.el deleted file mode 100644 index 8cabe251..00000000 --- a/bundle/hooks.el +++ /dev/null @@ -1,35 +0,0 @@ -(add-hook 'diary-display-hook 'fancy-diary-display) -(add-hook 'today-visible-calendar-hook 'calendar-mark-today) -(add-hook 'write-file-hooks 'delete-trailing-whitespace) -(add-hook 'org-mode-hook 'turn-on-auto-fill) -(add-hook 'elpy-mode-hook - (lambda () - (highlight-indentation-mode 1))) -(elpy-enable) - -(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) -(add-hook 'js2-mode-hook #'js2-imenu-extras-mode) - -;; (add-hook 'newsticker-plainview-hooks (lambda () (display-line-numbers-mode -1))) -;; (add-hook 'python-mode-hook (lambda () (display-line-numbers-mode 1))) - -(setq my-hooks '(python-mode-hook emacs-lisp-mode-hook json-mode-hook)) -(while my-hooks (add-hook (car my-hooks) - (lambda () - (display-line-numbers-mode 1))) - (setq my-hooks (cdr my-hooks))) - -(add-hook 'newsticker-mode-hook 'imenu-add-menubar-index) - - -(add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode)) - - -(provide 'hooks) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; lisp-indent-offset: 2 -;; End: diff --git a/bundle/linum-relative b/bundle/linum-relative deleted file mode 160000 index c74a6981..00000000 --- a/bundle/linum-relative +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c74a6981b688a5e1e6b8e0809363963ff558ce4d diff --git a/bundle/lolsmacs.el b/bundle/lolsmacs.el deleted file mode 100644 index be9f693d..00000000 --- a/bundle/lolsmacs.el +++ /dev/null @@ -1,403 +0,0 @@ -;;; lolsmacs.el --- Law Of Least Surprise Lattice -*- lexical-binding: t; -*- - -;; Copyright (C) 2019 Grant Rettke - -;; Author: Grant Rettke -;; Keywords: convenience, files, frames -;; Version: 1.0.0 -;; Package-Requires: ((emacs "26.3")) -;; Homepage: https://github.com/grettke/lolsmacs - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Intuitive impersonal settings complying with the Law Of Least Surprise -;; meant for inclusion with any initialization file especially useful to -;; first-time Emacs users or experienced Emacs users looking for focused -;; high-value content to copy. - -;;; Code: - -(defun lolsmacs-this-must-before-everything-else-in-your-init-file () - "When both the source file and its compiled bytecode are present load the source file first. - -It would be safer to add this line of code to the first file and loads in your -initialization sequence. However it is probably good enough if you call this -function before anything else." - (interactive) - (setq load-prefer-newer t)) - -(defun lolsmacs-customize () - "Store customizations in a separate file." - (interactive) - (setq custom-file "custom.el") - (load custom-file :noerror)) - -(defun lolsmacs-require-packages () - "Load packages used by this package." - (interactive) - (require 'whitespace) - (require 'eldoc)) - -(defun lolsmacs-persistence () - "Remember what you were doing and how things looked and restore it upon restarting." - (interactive) - (save-place-mode t) - - (setq savehist-save-minibuffer-history t) - (setq savehist-additional-variables - '(kill-ring - search-ring - regexp-search-ring - last-kbd-macro - kmacro-ring - shell-command-history)) - (savehist-mode) - - (setq desktop-restore-eager 5) - (desktop-save-mode) - - (setq make-backup-files nil) - (setq auto-save-default nil) - (auto-save-visited-mode) - - (global-auto-revert-mode)) - -(defvar lolsmacs-save-on-hooks - (append - '(focus-out-hook mouse-leave-buffer-hook kill-emacs-hook suspend-hook)) - "When they run save all file buffers.") -(defvar - lolsmacs-save-buffer-only-ons - (append - '(tex-compile vc-diff vc-next-action vc-revert)) - "Before they run save the buffer.") -(defvar - lolsmacs-save-buffers-ons - (append - '(dired eshell grep ibuffer shell tex-compile) - '(compile ns-do-hide-emacs goto-line) - '(eval-buffer) - '(org-export-dispatch org-babel-tangle org-babel-detangle) - '(kill-current-buffer list-buffers save-buffers-kill-emacs save-buffers-kill-terminal switch-to-buffer pop-to-buffer) - '(delete-frame delete-other-frames other-frame suspend-frame) - '(delete-window quit-window other-window select-window)) - "Before they run save all file buffers.") -(defvar lolsmacs-save-bufs-debug nil "When non-nil message debug information for `lolsmacs-save-bufs'.") -(defun lolsmacs-save-bufs () - "Save all file buffers. - -When `lolsmacs-save-bufs-debug' is non-nil display performance information in -*Messages* buffer." - (interactive) - (let ((time (current-time))) - (save-some-buffers t nil) - (when lolsmacs-save-bufs-debug - (message "lolsmacs-save-bufs completed in: %.06f seconds" (float-time (time-since time)))))) -(defun lolsmacs-save-buffers-ons-advice (&rest _args) - "Helper function for advising `lolsmacs-save-buffers-ons' (for advice ignore _ARGS)." - (lolsmacs-save-bufs)) -(defun lolsmacs-save-buffers-ons-advice-add (fn) - "Add save on advice to FN." - (advice-add fn :before #'lolsmacs-save-buffers-ons-advice)) -(defun lolsmacs-save-buffer-only-ons-advice (&rest _args) - "Helper function for advising `lolsmacs-save-buffer-only-ons' (for advice ignore _ARGS)." - (basic-save-buffer)) -(defun lolsmacs-save-buffer-only-ons-advice-add (fn) - "Add save on advice to FN." - (advice-add fn :before #'lolsmacs-save-buffer-only-ons-advice)) -(defun lolsmacs-persistence-files () - "Granular file-related persistence. - -A single value pervades this set up: all development is performed -using file-based artifacts that are as current as possible and -stored in version control. Its motivated by broken builds and -other bizarre conditions due to files being out of sync between -the file system and the editor. The entire persistence set up -deals with this. This function deals with the granular file -management not covered by existing modes. With that in mind here -is where it begins. - -We must consider the elephant in the living room here: given -`auto-save-visited-mode' is enabled why is this additional -granularity even a topic? It is a topic because sometimes -`auto-save-visited-mode' (ASVM) isn't fast enough. - -For example imagine editing a Makefile in Emacs, switching to a -console terminal (either hosted within Emacs or externally using a -terminal client), hitting the up arrow, then return to execute -Make. You've performed this operation thousands of times and you -do it in milliseconds. Its even faster if you rigged up a macro -to execute and external command to do it. Is ASVM failing you -here? Nope. ASVM is working perfectly well and as expected right -now. - -Here is why: ASVM save file buffers when you've been idle for -`auto-save-visited-interval' seconds. If you make it to large you -can lose your work because it waited too long. If you make it to -small it will waste energy and kill performance. ASVM's default settings are -perfect for 99% of its use cases. Once in a while though you need to perform -the same a lot sooner than before `auto-save-visited-interval' seconds. The -best way to consider these cases is splitting them up into three broad groups. - -There are three frames of mind to get into your cognitive workspace when you -want to configure granular file persistence - - 1. Handling Special Events: Events, Hooks, and Keys - 2. Handling Unrelated File Buffers - 3. Handling Related File Buffers - -When do you want to automatically save file buffers? For most of us it is most -of the time and ASVM handles that. There are exceptions though when the save -needs to be performed as quickly as possible. Here is the breakdown and -examples of and how it needs to happen. - -1. Handling Special Events: Events, Hooks, and Keys - -This section tries to handling quitting Emacs in unhappy -unplanned unpleasant ways. - -dying Emacs will go away on gracefully, begrudgingly, and by dying. Usually Emacs closes on request -`save-buffers-kill-terminal'. Other times it might be locked up and you send -it a signal `(elisp)Event Examples'. Other times you must kill -`(elisp)Killing Emacs' Emacs' it. This function sets up the 3 ways to handle them: - - A. Before advice for functions - B. Hooks - C. Key bindings - -It seems to cover most of the worst cases. - -2. Handling Unrelated File Buffers - -Here is the best example: - -The VC package `(emacs)Version Control' `vc-next-action' operates -on a single file `(emacs) Basic VC Editing'. If you make a change -before calling `vc-next-action' VC will ask you if you want to -save your changes before performing the action. Most of us /want/ -the changes saved before we perform the next action which is -usually and `add' or `commit' operating to the VC backend. In -fact the intent and expectation of the function is that it will -only ever operate on one file: it is safe to expect that. It is -frustrating being prompted `yes-or-no-p' for something you'll -answer yes to nearly every time. Before-advice saves you from -this pain. There is a good case where this is the wrong -functionality though. - -Perhaps you want to be able to perform `vc-next-action' against -the state of the file on the disk, not in the buffer because you -*know* that it is correct. For example if you have an automated -build system that watches for file changes. You made some -changes, save them, the build system saw them did the build and -ran all of the unit tests and passed. At the same time, you -notice something in your code and want to add a TODO item. -However you don't want it to be part of the commit. Right now you have a file -on disk that you know is correct and ready to commit, and changes in your -buffer that you don't want to commit. In this case you want to commit the file -without saving the changes. You need to all of this before -`auto-save-visited-interval' and it is realistic to do so. - -3. Handling Related File Buffers - -Here is an example: - -You've got multiple buffers open working on a single project's source code. For -the build to work correctly all of the files need to be persisted to the disk. -As you work on code and move between buffers you need *all* of the files to be -properly persisted (it is the same for auto-build or manual build setups). -There are three ways to address this: 1. Add `lolsmacs-save-buffers-ons' to -`other-window'. 2. Add the same advice to `shell'. 3. Add a hook that calls -`lolsmacs-save-bufs' to `focus-out-hook'. This configuration addresses the -most common development cycle for file based development. However not all -of the development process is file based. - -Some development environments and development cycles aren't -designed strictly around changes being persisted and working off -of a file. One good example is that of TeX. When you perform a -compilation, \"Run TeX on...\"), a TeX file if the compiler runs -into problems it will stop and prompt you what it should do next. -Suppose you got here by running TeX on a file, it ran into a -problem, and now you want to resolve it. When you use `tex-mode' -you have two ways of running TeX on a file: the functions -`tex-file' or `tex-buffer'. When `tex-offer-save' is non-nil the -former asks if you want to save all file based buffers then runs -TeX. The latter takes the contents of the current buffer, saves -them to a temporary file, and runs TeX over it. The formers seems to be -simpler and more predictable even if you are just playing around with what you -might do next but it is a good example of when you might not want all of your -files to be persisted as quickly as possible. " - (interactive) - (mapc (lambda (hook) - (add-hook hook #'lolsmacs-save-bufs)) - lolsmacs-save-on-hooks) - - (mapc (lambda (fn) - (lolsmacs-save-buffer-only-ons-advice-add fn)) - lolsmacs-save-buffer-only-ons) - - (mapc (lambda (fn) - (lolsmacs-save-buffers-ons-advice-add fn)) - lolsmacs-save-buffers-ons) - - (define-key special-event-map [sigusr1] #'lolsmacs-save-bufs)) - -(defun lolsmacs-display () - "Editor appearance." - (interactive) - (setq echo-keystrokes 0.02) - - (global-font-lock-mode) - - (setq-default indicate-buffer-boundaries 'left) - - (show-paren-mode) - (setq show-paren-delay 0) - (setq show-paren-style 'expression) - - (global-hl-line-mode) - - (setq whitespace-style '(tab-mark)) - (setf - (cdr (assoc 'tab-mark whitespace-display-mappings)) - '(?\t [?↹ ?\t] [?\t])) - (global-whitespace-mode) - - (size-indication-mode) - - (column-number-mode) - (setq column-number-indicator-zero-based nil) - - (setq prettify-symbols-unprettify-at-point 'right-edge) - (global-prettify-symbols-mode)) - -(defun lolsmacs-buffers () - "Buffer behavior." - (interactive) - (defconst lolsmacs-column-width 78) - - (minibuffer-electric-default-mode) - - (electric-pair-mode) - - (delete-selection-mode) - - (setq save-interprogram-paste-before-kill t) - - (require 'uniquify) - (setq uniquify-buffer-name-style 'post-forward-angle-brackets) - (setq uniquify-after-kill-buffer-p t) - (setq uniquify-ignore-buffers-re "^\\*") - - (setq scroll-preserve-screen-position t) - - (setq scroll-conservatively 101) - - (setq make-pointer-invisible t) - - (setq mouse-drag-copy-region t) - (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) - (setq mouse-wheel-progressive-speed nil) - (setq mouse-wheel-follow-mouse t) - - (setq track-eol t) - - (setq line-move-visual nil) - - (setq ring-bell-function 'ignore) - (setq visible-bell t)) - -(defun lolsmacs-operations () - "Editor operations." - (interactive) - (setq minibuffer-eldef-shorten-default t) - - (setq resize-mini-windows t) - - (setq max-mini-window-height 0.33) - - (setq history-delete-duplicates t) - - (setq register-preview-delay 2) - (setq register-separator "\n\n") - - (setq initial-major-mode 'emacs-lisp-mode) - (with-current-buffer "*scratch*" - (emacs-lock-mode 'kill)) - - (setq-default eval-expression-print-level nil) - - (put #'upcase-region 'disabled nil) - (put #'downcase-region 'disabled nil) - - (setq large-file-warning-threshold (* 1024 1024)) - - (setq help-window-select t) - - (setq search-default-mode #'char-fold-to-regexp) - - (setq kill-read-only-ok t) - - ;; Here is the scenario for this style of Comint configuration: - ;; - ;; You are doing a lot of interactive work via various Comint-supported - ;; buffers. You are working in one buffer (the one with focus) while the - ;; others are doing their own thing. They are probably doing work and output - ;; is scrolling by and that is fine because you are not reading it. In the - ;; buffer you are working in though, you want to go back and read something. - ;; So although it its process continues to output information, you want to - ;; keep the cursor in the same spot. Then when you are ready to type a - ;; command (suppose you know the output has stopped) to do something else, - ;; when you type the cursor will go to the end of the buffer. That is why - ;; you prevent the focused buffer from auto-scrolling and moving the mark, - ;; and leave the other ones alone. - (setq comint-scroll-to-bottom-on-input 'this) - (setq comint-scroll-to-bottom-on-output 'others) - (setq comint-move-point-for-output 'others) - (setq comint-scroll-show-maximum-output t) - (setq comint-prompt-read-only nil)) - -(defun lolsmacs-editing () - "Editing things." - (interactive) - (setq inhibit-eol-conversion t) - - (setq require-final-newline t) - - (setq-default tab-width 2) - - (delete-selection-mode t) - - (setq-default fill-column lolsmacs-column-width) - - (setq sentence-end-double-space nil) - (setq sentence-end-without-period nil) - (setq colon-double-space nil)) - -(defun lolsmacs-init () - "Load entire LOLSMacs configuration." - (interactive) - (lolsmacs-this-must-before-everything-else-in-your-init-file) - (lolsmacs-customize) - (lolsmacs-require-packages) - (lolsmacs-persistence) - (lolsmacs-persistence-files) - (lolsmacs-display) - (lolsmacs-buffers) - (lolsmacs-editing)) - -(provide 'lolsmacs) -;;; lolsmacs.el ends here - diff --git a/bundle/markdown-mode b/bundle/markdown-mode deleted file mode 160000 index 115f77df..00000000 --- a/bundle/markdown-mode +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 115f77df9755c6a453f3e5d9623ff885d207ea82 diff --git a/bundle/newsfeeds.el b/bundle/newsfeeds.el deleted file mode 100644 index 8b137891..00000000 --- a/bundle/newsfeeds.el +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bundle/nord-theme b/bundle/nord-theme deleted file mode 160000 index ba8f9b98..00000000 --- a/bundle/nord-theme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ba8f9b98a5028d3ec8c44e43889e7edda9a3b8dd diff --git a/bundle/org-mode-settings.el b/bundle/org-mode-settings.el deleted file mode 100644 index a40979b6..00000000 --- a/bundle/org-mode-settings.el +++ /dev/null @@ -1,54 +0,0 @@ -(setq org-agenda-dim-blocked-tasks nil - org-agenda-files (quote - ("~/Documents/Journal")) - org-agenda-inhibit-startup nil - org-babel-load-languages (quote - ((js . t) - (gnuplot . t) - (emacs-lisp . t) - (python . t) - (sqlite . t) - (lisp . t) - (shell . t) - (css . t) - (calc . t) - (plantuml . t) - (dot . t))) - org-babel-shell-names (quote ("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")) - org-clock-persist t - org-confirm-babel-evaluate nil - org-default-notes-file "~/Documents/Journal/notes.org" - org-html-doctype "html5" - org-html-html5-fancy t - org-log-done (quote time) - org-startup-folded nil - org-startup-truncated nil - org-babel-python-command "python3" - org-todo-keywords (quote ((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))) - -(setq org-use-property-inheritance nil) - -(org-clock-persistence-insinuate) -(org-display-inline-images) - -(when (eq system-type 'windows-nt) - (setq org-duration-format (quote h:mm)) - (setq org-babel-python-command "python") - (setq org-plantuml-jar-path (expand-file-name - "~/AppData/Local/Programs/plantuml/plantuml.jar")) - (when (string= (system-name) "EVG02667NB") - (when *docs-path* - (setq org-agenda-files `(,(concat *docs-path* "\\Journal"))) - (setq org-default-notes-file (concat *docs-path* "\\Journal\\notes.org"))))) - -(when (eq system-type 'gnu/linux) - (setq org-plantuml-jar-path - (expand-file-name "~/.local/bin/plantuml.jar"))) - -(provide 'org-mode-settings) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; End: diff --git a/bundle/os.el b/bundle/os.el deleted file mode 100644 index 6087e61f..00000000 --- a/bundle/os.el +++ /dev/null @@ -1,36 +0,0 @@ -(defun evo-load-paths () - (unless (file-directory-p (expand-file-name "~/Documents")) - (defvar *docs-path* (getenv "DOCS_PATH")))) - -(when (eq system-type 'darwin) - (when (display-graphic-p) - (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) - (add-to-list 'default-frame-alist '(ns-appearance . dark)))) - -(when (eq system-type 'windows-nt) - (setq python-shell-interpreter "python") - (add-to-list 'load-path (expand-file-name "~/AppData/Roaming/__secrets")) - (cd "~/opt") - (when (string= (system-name) "EVG02667NB") - (evo-load-paths)) - (when (string= (system-name) "XPS-8930"))) - -(when (eq system-type 'gnu/linux) - (setq x-select-enable-clipboard t - x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING) - x-select-enable-primary t - undo-tree-enable-undo-in-region nil - slime-lisp-implementations '((sbcl ("/usr/bin/sbcl"))) - gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3" - elpy-rpc-python-command "python3") - (when (string= (system-name) "XPS-13-9380"))) - - -(provide 'os) - -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; lisp-indent-offset: 2 -;; End: diff --git a/bundle/sbcl-settings.el b/bundle/sbcl-settings.el deleted file mode 100644 index ca5f6870..00000000 --- a/bundle/sbcl-settings.el +++ /dev/null @@ -1,12 +0,0 @@ -(defun win-set-sbcl () - ;; %USERPROFILE%\AppData\Local\Programs\emacs-26.2-x86_64\bin\emacsclientw.exe -c -n -a runemacs.exe - ;; (setq inferior-lisp-program (executable-find "sbcl")) - (setq sbcl-exe (expand-file-name "~/AppData/Local/Programs/Steel Bank Common Lisp/1.4.14/sbcl.exe") - sbcl-core (expand-file-name "~/AppData/Local/Programs/Steel Bank Common Lisp/1.4.14/sbcl.core") - inferior-lisp-program "sbcl" - slime-lisp-implementations `((sbcl (,sbcl-exe "--core" ,sbcl-core))))) - -(when (eq system-type 'windows-nt) - (win-set-sbcl)) - -(provide 'sbcl-settings) diff --git a/emacs.service b/emacs.service deleted file mode 100644 index f3d7df9f..00000000 --- a/emacs.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Emacs text editor -Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ - -[Service] -Type=simple -ExecStart=/usr/bin/emacs --fg-daemon -ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" -Environment=SSH_AUTH_SOCK=%t/keyring/ssh -Restart=on-failure - -[Install] -WantedBy=default.target diff --git a/init.el b/init.el index 93909a8f..2a6b3e4c 100755 --- a/init.el +++ b/init.el @@ -1,146 +1,181 @@ (require 'server) (unless (server-running-p) (server-start)) -;; ==================== GLOBAL KEYS ==================== ;; -(global-set-key (kbd "C-c l") 'org-store-link) -(global-set-key (kbd "C-c a") 'org-agenda) -(global-set-key (kbd "C-c c") 'org-capture) -(global-set-key (kbd "C-c b") 'org-switchb) -(global-set-key (kbd "C-c C-x m") 'org-pomodoro) -(global-set-key (kbd "C-x g") 'magit-status) -(global-set-key (kbd "C-x M-g") 'magit-dispatch) -(global-set-key (kbd "M-i") 'imenu) -(global-set-key (kbd "C-c n") 'newsticker-start) -(global-set-key (kbd "M-o") 'ace-window) +;; DISPLAY SETTINGS + ;; General userinterface and appearance + (tool-bar-mode -1) ; No toolbar + (menu-bar-mode -1) ; No Menubar + (set-scroll-bar-mode 'right) ; Scrollbar on the right + (scroll-bar-mode -1) ; No scrollbar + (global-font-lock-mode t) ; Color enabled + (global-prettify-symbols-mode t) ; Prettify symbols + (global-hl-line-mode 1) ; Highlight cursor line + (global-whitespace-mode -1) ; Show whitespace globally + (show-paren-mode 1) ; Visual matching parens + (global-display-line-numbers-mode -1) ; Display line numbers + ;; Mode line specific + (column-number-mode 1) ; Display column number in the mode line + (size-indication-mode -1) ; Display buffer size in the mode line + (line-number-mode 1) ; Display line number in the mode line + (display-battery-mode -1) ; Display battery status in the mode line + (display-time-mode 1) ; Display time in the mode line -;; (global-unset-key "\C-z") + (add-to-list 'default-frame-alist '(fullscreen . maximized)) ; Maximize Window + (add-to-list 'default-frame-alist '(font . "Iosevka Term-12")) + (add-to-list 'default-frame-alist '(undecorated . t)) + (when (eq system-type 'gnu/linux) + (add-to-list 'default-frame-alist '(undecorated . t))) -(require 'package) -;; Added by Package.el. This must come before configurations of -;; installed packages. Don't delete this line. If you don't want it, -;; just comment it out by adding a semicolon to the start of the line. -;; You may delete these explanatory comments. +;; GLOBAL KEYS + (global-set-key (kbd "C-c l") 'org-store-link) + (global-set-key (kbd "C-c a") 'org-agenda) + (global-set-key (kbd "C-c c") 'org-capture) + (global-set-key (kbd "C-c b") 'org-switchb) + ;; (global-set-key (kbd "C-c C-x m") 'org-pomodoro) + (global-set-key (kbd "C-x g") 'magit-status) + (global-set-key (kbd "C-x M-g") 'magit-dispatch) + (global-set-key (kbd "M-i") 'imenu) + (global-set-key (kbd "C-c n") 'newsticker-start) + (global-set-key (kbd "M-o") 'ace-window) -(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) - (not (gnutls-available-p)))) - (proto (if no-ssl "http" "https"))) - (when no-ssl - (warn "\ -Your version of Emacs does not support SSL connections, -which is unsafe because it allows man-in-the-middle attacks. -There are two things you can do about this warning: -1. Install an Emacs version that does support SSL and be safe. -2. Remove this warning from your init file so you won't see it again.")) - ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired - (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) - ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) - (when (< emacs-major-version 24) - ;; For important compatibility libraries like cl-lib - (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) -(package-initialize) +;; OS SETTINGS + (defun evo-load-paths () + (unless (file-directory-p (expand-file-name "~/Documents")) + (defvar *docs-path* (getenv "DOCS_PATH")))) -(setq custom-file "~/.emacs.d/bundle/custom.el") -(load custom-file :noerror) + (when (eq system-type 'windows-nt) + (setq python-shell-interpreter "python") + (add-to-list 'load-path (expand-file-name "~/AppData/Roaming/__secrets")) + (cd "~/opt") + (when (string= (system-name) "EVG02667NB") + (evo-load-paths)) + (when (string= (system-name) "XPS-8930"))) -(when (eq system-type 'gnu/linux) - (load-theme 'nord)) -(unless (eq system-type 'gnu/linux) - (load-theme 'nord)) -(add-to-list 'load-path (expand-file-name "~/.emacs.d/bundle")) -(require 'bundles) -(ivy-mode 1) -(projectile-mode +1) -(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) -(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map) ;; UTF-8 FTW -(prefer-coding-system 'utf-8) -(set-default-coding-systems 'utf-8) -(set-terminal-coding-system 'utf-8) -(set-keyboard-coding-system 'utf-8) -(setq default-buffer-file-coding-system 'utf-8) + (prefer-coding-system 'utf-8) + (set-default-coding-systems 'utf-8) + (set-terminal-coding-system 'utf-8) + (set-keyboard-coding-system 'utf-8) + (setq default-buffer-file-coding-system 'utf-8) + (defalias 'yes-or-no-p 'y-or-n-p) + (with-current-buffer "*scratch*" (emacs-lock-mode 'kill)) -(defalias 'yes-or-no-p 'y-or-n-p) -(with-current-buffer "*scratch*" (emacs-lock-mode 'kill)) +;; CUSTOM_FILE + (setq custom-file "~/.emacs.d/bundle/custom.el") + (load custom-file :noerror) -(defun copy-whole-buffer () - "Copy entire buffer to clipboard" - (interactive) - (clipboard-kill-ring-save (point-min) (point-max))) +;; PACKAGE + (require 'package) + ;; Added by Package.el. This must come before configurations of + ;; installed packages. Don't delete this line. If you don't want it, + ;; just comment it out by adding a semicolon to the start of the line. + ;; You may delete these explanatory comments. -(put 'narrow-to-region 'disabled nil) -(put 'narrow-to-page 'disabled nil) -(put 'upcase-region 'disabled nil) + (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) + (not (gnutls-available-p)))) + (proto (if no-ssl "http" "https"))) + (when no-ssl + (warn "\ + Your version of Emacs does not support SSL connections, + which is unsafe because it allows man-in-the-middle attacks. + There are two things you can do about this warning: + 1. Install an Emacs version that does support SSL and be safe. + 2. Remove this warning from your init file so you won't see it again.")) + ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired + (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) + ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) + (when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) + (package-initialize) + (ivy-mode 1) -(defun duplicate-line() - (interactive) - (move-beginning-of-line 1) - (kill-line) - (yank) - (open-line 1) - (next-line 1) - (yank) - ) +;; ORG_MODE SETTINGS + (setq org-agenda-dim-blocked-tasks nil + org-agenda-files (quote + ("~/Documents/Journal")) + org-agenda-inhibit-startup nil + org-babel-load-languages (quote + ((js . t) + (gnuplot . t) + (emacs-lisp . t) + (python . t) + (sqlite . t) + (lisp . t) + (shell . t) + (css . t) + (calc . t) + (plantuml . t) + (dot . t))) + org-babel-shell-names (quote ("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")) + org-clock-persist t + org-confirm-babel-evaluate nil + org-default-notes-file "~/Documents/Journal/notes.org" + org-html-doctype "html5" + org-html-html5-fancy t + org-log-done (quote time) + org-startup-folded nil + org-startup-truncated nil + org-babel-python-command "python3" + org-todo-keywords (quote ((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))) + (setq org-use-property-inheritance nil) + (org-clock-persistence-insinuate) + (org-display-inline-images) + (when (eq system-type 'windows-nt) + (setq org-duration-format (quote h:mm)) + (setq org-babel-python-command "python") + (setq org-plantuml-jar-path (expand-file-name + "~/AppData/Local/Programs/plantuml/plantuml.jar")) + (when (string= (system-name) "EVG02667NB") + (when *docs-path* + (setq org-agenda-files `(,(concat *docs-path* "\\Journal"))) + (setq org-default-notes-file (concat *docs-path* "\\Journal\\notes.org"))))) + (when (eq system-type 'gnu/linux) + (setq org-plantuml-jar-path + (expand-file-name "~/.local/bin/plantuml.jar"))) -(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)) -(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) +;; HOOKS + (add-hook 'diary-display-hook 'fancy-diary-display) + (add-hook 'today-visible-calendar-hook 'calendar-mark-today) + (add-hook 'write-file-hooks 'delete-trailing-whitespace) + (add-hook 'org-mode-hook 'turn-on-auto-fill) + (add-hook 'rst-mode-hook 'turn-on-orgstruct) + (setq my-hooks '(python-mode-hook emacs-lisp-mode-hook json-mode-hook)) + (while my-hooks (add-hook (car my-hooks) + (lambda () + (display-line-numbers-mode 1))) + (setq my-hooks (cdr my-hooks))) + (add-hook 'newsticker-mode-hook 'imenu-add-menubar-index) + (add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode)) -;; slime -(setq slime-contribs '(slime-fancy)) - - -(defun git-blame-line () - "Runs `git blame` on the current line and - adds the commit id to the kill ring" - (interactive) - (let* ((line-number (save-excursion - (goto-char (point-at-bol)) - (+ 1 (count-lines 1 (point))))) - (line-arg (format "%d,%d" line-number line-number)) - (commit-buf (generate-new-buffer "*git-blame-line-commit*"))) - (call-process "git" nil commit-buf nil - "blame" (buffer-file-name) "-L" line-arg) - (let* ((commit-id (with-current-buffer commit-buf - (buffer-substring 1 9))) - (log-buf (generate-new-buffer "*git-blame-line-log*"))) - (kill-new commit-id) - (call-process "git" nil log-buf nil - "log" "-1" "--pretty=%h %an %s" commit-id) - (with-current-buffer log-buf - (message "Line %d: %s" line-number (buffer-string))) - (kill-buffer log-buf)) - (kill-buffer commit-buf))) - -(defun org-dblock-write:rangereport (params) - "Display day-by-day time reports." - (let* ((ts (plist-get params :tstart)) - (te (plist-get params :tend)) - (start (time-to-seconds - (apply 'encode-time (org-parse-time-string ts)))) - (end (time-to-seconds - (apply 'encode-time (org-parse-time-string te)))) - day-numbers) - (setq params (plist-put params :tstart nil)) - (setq params (plist-put params :end nil)) - (while (<= start end) - (save-excursion - (insert "\n\n" - (format-time-string (car org-time-stamp-formats) - (seconds-to-time start)) - "----------------\n") - (org-dblock-write:clocktable - (plist-put - (plist-put - params - :tstart - (format-time-string (car org-time-stamp-formats) - (seconds-to-time start))) - :tend - (format-time-string (car org-time-stamp-formats) - (seconds-to-time end)))) - (setq start (+ 86400 start)))))) +;; DIARY + (setq cal-html-directory "~/Documents/Diary" + view-diary-entries-initially t + mark-diary-entries-in-calendar t + number-of-diary-entries 7 + calendar-date-style (quote iso) + calendar-week-start-day 1) + (setq calendar-intermonth-text + (quote + (propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian + (list month day year))))) + (quote font-lock-face) + (quote font-lock-function-name-face)))) + (when (string= (system-name) "EVG02667NB") + (unless (file-directory-p (expand-file-name "~/Documents")) + (let ((docs-path (getenv "DOCS_PATH"))) + (setq cal-html-directory (concat docs-path "\\Diary") + diary-file (concat docs-path "\\Diary\\diary") + timeclock-file (concat docs-path "\\Diary\\timelog"))))) + (provide 'calendar-settings) ;; Local Variables: ;; mode: emacs-lisp -;; coding: utf-8-unix +;; coding: utf-8 +;; fill-column: 79 ;; End: