SET UP, DEFAULTS, AND CUSTOMIZATION

  • Necessary Adjustments when you set-up on a new computer
  • Paths to Update on Change
  • Executable Paths
  • Libraries
  • Function declarations
  • Emacs Customization Seperate File
  • Emax Defaults
  • Some Defaults
  • Frames, Buffers, And Lines
  • Some Custom Default Functions
  • Some New Key Bindings
  • Popup, Pos-tip,Tooltip, Posframe
  • Which Key

Customization

You can rename the file Emacs uses to store customizations you enter from the menu ...

You can load it now or never.



(setq custom-file (expand-file-name "custom.el" "c:/emacs/emax/"))
 (load custom-file)

Defaults

Here's some code:


 ;; set some code just for windows
(when window-system
(blink-cursor-mode 0)                           ; Disable the cursor blinking
;(scroll-bar-mode 0)                             ; Disable the scroll bar
(tool-bar-mode 0)                               ; Disable the tool bar
(tooltip-mode 0))                               ; Disable the tooltips


;;declare many settings in one declaration 
(setq-default
ad-redefinition-action 'accept                   ; Silence warnings for redefinition
confirm-kill-emacs 'yes-or-no-p                  ; Confirm before exiting Emacs
cursor-in-non-selected-windows t                 ; Hide the cursor in inactive windows
delete-by-moving-to-trash t                      ; Delete files to trash
display-time-default-load-average nil            ; Don't display load average
display-time-format "%H:%M"                      ; Format the time string
fill-column 140                                   ; Set width for automatic line breaks
help-window-select t                             ; Focus new help windows when opened
indent-tabs-mode nil                             ; Stop using tabs to indent
inhibit-startup-screen t                         ; Disable start-up screen
initial-scratch-message ""                       ; Empty the initial *scratch* buffer
; left-margin-width 1 right-margin-width 1         ; Add left and right margins
mode-require-final-newline 'visit-save           ; Add a newline at EOF on visit
mouse-yank-at-point t                            ; Yank at point rather than pointer
ns-use-srgb-colorspace nil                       ; Don't use sRGB colors
recenter-positions '(5 top bottom)               ; Set re-centering positions
redisplay-dont-pause t                           ; don't pause display on input
debug-on-error t
jit-lock-defer-time 0
frame-resize-pixelwise t
fast-but-imprecise-scrolling t
scroll-conservatively 10000                      ; Always scroll by one line
scroll-margin 1                                  ; scroll N lines to screen edge
scroll-step 1                                    ; keyboard scroll one line at a time
scroll-preserve-screen-position 1
select-enable-clipboard t                        ; Merge system's and Emacs' clipboard
show-trailing-whitespace nil                     ; Display trailing whitespaces
; split-height-threshold nil                       ; Disable vertical window splitting
; split-width-threshold nil                        ; Disable horizontal window splitting
tab-width 4                                      ; Set width for tabs
uniquify-buffer-name-style 'forward              ; Uniquify buffer names
; window-combination-resize t                      ; Resize windows proportionally
x-stretch-cursor t)                              ; Stretch cursor to the glyph width





(setq sentence-end-double-space nil)             ; End a sentence after a dot and a space

(setq line-number-mode t)                         ; Enable line numbers in the mode-line

(setq column-number-mode t)                       ; Enable column numbers in the mode-line

(size-indication-mode 1)                          ; Enable size status in the mode-line

(display-time-mode)                               ; Enable time in the mode-line

(fringe-mode 0)                                   ; Hide fringes

(fset 'yes-or-no-p 'y-or-n-p)                     ; Replace yes/no prompts with y/n

;(show-paren-mode t)
(setq show-paren-style 'expression)

;(menu-bar-mode 0)                                 ; Disable the menu bar

;(mouse-avoidance-mode 'banish)                    ; Avoid collision of mouse with point

(put 'downcase-region 'disabled nil)              ; Enable downcase-region

(put 'upcase-region 'disabled nil)                ; Enable upcase-region

;Garbage-collect on focus-out, Emacs /should/ feel snappier.

(add-hook 'focus-out-hook #'garbage-collect)

;delete trailing whitespace
(add-hook 'before-save-hook 'delete-trailing-whitespace)

(pdf-tools-install :no-query)

;set-warning level
(setq warning-minimum-level :emergency)

More Defaults

Here's some more code!



; Silence warnings for redefinition
(setq ad-redefinition-action 'warn)

; Hide the cursor in inactive windows
(setq cursor-in-non-selected-windows t )

; Don't display load average
(setq display-time-default-load-average nil)

; Focus new help windows when opened
(setq help-window-select t )

; Prefers spaces over tabs
(setq indent-tabs-mode nil )

; Merge system's and Emacs' clipboard
(setq select-enable-clipboard t )

;interprogram-paste-before-kill
(setq save-interprogram-paste-before-kill t)

; Avoid the :ensure keyword for each package
(setq use-package-always-ensure t)

; Always follow the symlinks
(setq vc-follow-symlinks 'ask)

;view-read-only-defined in 'files.el, (require 'file.el) moved from later line to here
(require 'files)

;read-only files in read-only-mode
(setq view-read-only t)

;no byte compile warnings (not set here?)
;(setq byte-compile-warnings -1)

; Re-define package--save-selected-packages to stop customization sending dependeny info to melpa process.
(defun package--save-selected-packages (&rest opt) nil)

;ensure manual indentation
(setq electric-indent-mode -1)
(add-hook 'after-change-major-mode-hook (lambda() (electric-indent-mode -1)))

;set tab width
(setq-default tab-width 4)

;(bind-key "C-x TAB" 'indent-rigidly)
(global-set-key (kbd "C-x TAB") 'indent-rigidly)

;; Save a list of recent files visited. (open recent file with C-x f)
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-saved-items 100)

;save abbrevs silently
(setq save-abbrevs 'silently)