Skip to content

Instantly share code, notes, and snippets.

@bmcbm
Last active January 16, 2018 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmcbm/c935beeec463540c9b1e5ff5d2e59e96 to your computer and use it in GitHub Desktop.
Save bmcbm/c935beeec463540c9b1e5ff5d2e59e96 to your computer and use it in GitHub Desktop.
.emacs file
;; Sæt (netværks)printer sti
;(setq lpr-switches nil) ; Stop printing headers
;(setq printer-name "HPLJ6MP")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; start gnuserv stuff. Put it up front so you don't get into a
;; timeout problem when starting emacs from gnuclient or gnudoit,
;; according to Cristian Ionescu-Idbohrn
;; <cristian.ionescu-idbohrn@axis.com>
;(if (memq window-system '(win32 w32)) ; Windows NT/95
;(progn
;(require 'gnuserv)
; (setq server-done-function 'bury-buffer
; gnuserv-frame (car (frame-list)))
; (gnuserv-start)
; ;;; open buffer in existing frame instead of creating new one...
;(setq gnuserv-frame (selected-frame))
; (message "gnuserv started.")))
;
;(if (or (string-equal (getenv "OSTYPE") "Linux" )
; (string-equal (getenv "OSTYPE") "linux-gnu" ))
; (server-start))
;; end gnuserv stuff
; Use unicode for files
(prefer-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)
; move scroll bar the the right
(set-scroll-bar-mode 'right)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Visuelle sager
;(setq cperl-indent-level 8)
;(setq java-indent-level 8)
; Gør det synligt, når en region markeres med Ctrl-Space
(transient-mark-mode t)
(setq mark-even-if-inactive t)
; Font-lock tilføjer syntax highlighting
(global-font-lock-mode t)
; Gør maximalt brug af font-lock mode.
(setq font-lock-maximum-decoration t)
; Sæt de brugte farver
;(setq font-lock-face-attributes
; ; face fg bg bf it ul
; '((font-lock-comment-face "FireBrick" nil nil nil nil)
; (font-lock-string-face "DarkGreen" nil nil nil nil)
; (font-lock-keyword-face "MediumBlue" nil t nil nil)
; (font-lock-type-face "ForestGreen" nil t nil nil)
; (font-lock-function-name-face "Brown" nil nil nil nil)
; (font-lock-variable-name-face "Goldenrod" nil t nil nil)
; (font-lock-reference-face "Gold" nil t nil nil)))
; Vis linie og kolonne nummer
(setq line-number-mode t)
(setq column-number-mode t)
; use line numbers i buffers
(global-linum-mode 1)
;; Set the frame's title. %b is the name of the buffer. %+ indicates
;; the state of the buffer: * if modified, % if read only, or -
;; otherwise. Two of them to emulate the mode line. %f for the file
;; name. Incredibly useful!
(setq frame-title-format "Emacs: %b %+%+ %f")
; (cond ((fboundp 'global-font-lock-mode)
; ;; Customize face attributes
; (setq font-lock-face-attributes
; ;; Symbol-for-Face Foreground Background Bold Italic Underline
; '((font-lock-comment-face "Grey")
; (font-lock-string-face "DarkGreen")
; (font-lock-keyword-face "RoyalBlue")
; (font-lock-function-name-face "Blue")
; (font-lock-variable-name-face "Purple")
; (font-lock-type-face "Red")
; (font-lock-reference-face "Pink")
; ))
; ;; Load the font-lock package.
; (require 'font-lock)
; ;; Maximum colors
; (setq font-lock-maximum-decoration t)
; ;; Turn on font-lock in all modes that support it
; (global-font-lock-mode t)))
;; Sæt tab vidde
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)
;, Set tab width for json-mode:
;(add-hook 'json-mode-hook
; (lambda ()
; (make-local-variable 'js-indent-level)
; (setq js-indent-level 4)))
;; Brug HTML mode for htt-templates
(setq auto-mode-alist (cons '("\\.htt\\'" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.jhtml\\'" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.asp\\'" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.js\\'" . java-mode) auto-mode-alist))
;; Brug CPerl mode til perl
(setq auto-mode-alist (cons '("\\.pl\\'" . cperl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pm\\'" . cperl-mode) auto-mode-alist))
;; Brug CSS-mode til CSS
(autoload 'css-mode "css-mode")
(setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist))
;; Brug json mode til Cloudformation templates
(setq auto-mode-alist (cons '("\\.template\\'" . json-mode) auto-mode-alist))
;; Omdefiner home og end taster
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
(global-set-key [C-home] 'beginning-of-buffer)
(global-set-key [C-end] 'end-of-buffer)
(global-set-key [C-tab] 'switch-to-buffer)
(global-set-key [C-f6] 'switch-to-buffer)
(global-set-key [M-f11] 'occur)
(global-set-key [M-p] 'join-line)
(global-set-key (quote [-67108832]) (quote hippie-expand)) ; C-M-SPC
(global-set-key [C-\-] 'fill-region-as-paragraph)
;(global-set-key (kbd "<C-M- >") 'hippie-expand)
;(global-set-key [C-M-SPC] 'hippie-expand)
;; Omdefiner andre taster:
;(global-unset-key [M-f])
;(global-set-key [M-f] 'fill-region-as-paragraph)
(global-set-key [C-<] 'indent-region)
;; reload .emacs
(global-set-key "\M-r" '(lambda ()
(interactive)
(load-file "~/.emacs")))
; ;; Set load-path
; ;;(setq load-path (cons "K:/" load-path))
;; Set geometri
;(set-frame-position (selected-frame) 0 52)
;; Fjern visning af i buffer
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m 'nil t)
;; Vis colonne nummer i statusbar
(setq column-number-mode t)
;; Undlad at lave autosave filer
(setq make-backup-files 'nil)
;; Goto line
;; Please note, that this will override the function
;; ``facemenu-keymap'' normally used to change fonts.
;; M-g runs `M-x goto-line'
;(global-set-key "\M-g" 'goto-line)
; ;; Stop "down"-arrow from adding CR to end of file
(setq next-line-add-newlines 'nil)
;; Use spaces instead of tabs
;(setq-default indent-tabs-mode 'nil)
;; When using X Windows, you can request a more powerful alternative kind
;; of automatic parenthesis matching by enabling Show Paren mode. This
;; mode turns off the usual kind of matching parenthesis display and
;; instead uses highlighting to show what matches. Whenever point is
;; after a close parenthesis, the close parenthesis and its matching open
;; parenthesis are both highlighted; otherwise, if point is before an
;; open parenthesis, the matching close parenthesis is
;; highlighted. (There is no need to highlight the open parenthesis after
;; point because the cursor appears on top of that character.) Use the
;; command M-x show-paren-mode to enable or disable this mode.
(show-paren-mode t)
; ;; Load Untranslate package to control the use of CR/LF vs LF save mode
; ;; according to filesystem
; ;(load "untranslate.el")
; ;(add-untranslated-filesystem "K:")
; ;; Start gnuserv
;(require 'gnuserv)
;(if (load "gnuserv" 'noerror 'nomessage) (gnuserv-start))
; (custom-set-variables
; '(delete-key-deletes-forward t))
; (custom-set-faces)
;; Configure ange-ftp
;(setq ange-ftp-ftp-program-name "c:/winnt/ange-ftp.exe")
;(setq ange-ftp-tmp-name-template
; (concat (expand-file-name (getenv "TEMP")) "/ange-ftp"))
;(setq ange-ftp-gateway-tmp-name-template
; (concat (expand-file-name (getenv "TEMP")) "/ange-ftp"))
;(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
; )
(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.
; '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
'(default ((t (:inherit nil :stipple nil :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
;; Set text encoding filters based on file name regexs
(setq file-coding-system-alist (quote (
("\\.elc\\'" emacs-mule . emacs-mule)
("\\(\\`\\|/\\)loaddefs.el\\'" raw-text . raw-text-unix)
("\\.tar\\'" no-conversion . no-conversion)
("\\.po\\'" utf-8 . utf-8)
("\\.pm\\'" raw-text . raw-text-unix)
("\\.pl\\'" raw-text . raw-text-unix)
("\\.html\\'" raw-text . raw-text-unix)
("\.htt\'" raw-text . raw-text-unix)
("\\.css\\'" raw-text . raw-text-unix)
("\\.xsl\\'" raw-text . raw-text-unix)
("\\.xml\\'" raw-text . raw-text-unix)
("\\'" raw-text . raw-text-unix)
)))
;; Enable all the hairy stuff in cperl mode
;(setq cperl-hairy t)
;; XSL mode
(autoload 'xsl-mode "xslide" "Major mode for XSL stylesheets." t)
;; VCL mode
;(require 'vcl-mode)
;; Turn on font lock when in XSL mode
;; Planner MOde
;(add-to-list 'load-path "c:/Programmer/emacs-21.2/lisp/emacs-wiki")
;(add-to-list 'load-path "c:/Programmer/emacs-21.2/lisp/planner/")
;; Load planner
;(require 'planner)
;; Euro symbol
;(standard-display-ascii ?\200 (compose-chars ?C ?\=)) ; euro
; Copy and Paste to Gnome Clipboard
; http://www.emacswiki.org/emacs/CopyAndPaste
;(global-set-key "\C-w" 'clipboard-kill-region)
;(global-set-key "\M-w" 'clipboard-kill-ring-save)
;(global-set-key "\C-y" 'clipboard-yank)
(setq x-select-enable-clipboard t) ; as above
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
(custom-set-variables
;; custom-set-variables 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.
'(inhibit-startup-screen t))
; Node.js Jade mode
;(add-to-list 'load-path "~/Dropbox/Ubuntu-init/emacs/jade-mode")
;(require 'sws-mode)
;(require 'jade-mode)
;(add-to-list 'auto-mode-alist '("\\.styl$" . sws-mode))
;(add-to-list 'auto-mode-alist '("\\.jade$" . sws-mode))
; Puppet mode
(add-to-list 'load-path "~/Dropbox/Ubuntu-init/emacs/puppet-syntax-emacs")
;(load "puppet-mode")
;; Setup puppet-mode for autoloading
(autoload 'puppet-mode "puppet-mode" "Major mode for editing puppet manifests")
(add-to-list 'auto-mode-alist '("\\.pp$" . puppet-mode))
; For puppet mode, make sure trailling whitespaces are removed on save (to avid puppet-lint error)
(add-hook 'puppet-mode-hook (lambda () (add-to-list 'write-file-functions 'delete-trailing-whitespace)))
; Open resent files
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
; fix <dead-tilde> is undefined
(require 'iso-transl)
; stop electric indent mode
; http://emacs.stackexchange.com/questions/5939/how-to-disable-auto-indentation-of-new-lines
(when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment