Jun 22

Configuraciones

Tag: overdrive @ 12:24 am

En caso de configuraciones con distintas secciones, estas estan separadas por lineas marcadas en rojo, los comentarios con un ; seran lineas elisp validas comentadas por alguna razon, mientras que las que posean dos ;; implicara algun comentario clarificatorio. Intento mantener una estructura y formato bastante estricto pero creo que se me puede haber pasado alguna linea.

Tambien debo indicar que muchas funcionalidades dependen de programas o aplicaciones externas al propio entorno emacs (por lo que requiere de su instalacion) y que las rutas no tienen porque coincidir (dependiendo de version, lugar donde se instalaron, etc.) otras lineas dependen de ficheros externos como .authinfo, asi que tened todo esto en cuenta a la hora de copiar las lineas en las que esteis interesados. Sin mas dilacion, os dejo aqui mi .emacs:

.emacs

;; ---------------------------------------------------------------------------
;; File: .emacs
;; Author: Overdrive <overdrive@blackhats.es>
;; Description: emacs configuration file
;; ---------------------------------------------------------------------------

;;
;;                   /--> Major (Global change)
;;                 /
;;                /        /--> Emacs version
;;               /       /
;; Version 1.0(28)-l --> Platform version
;;                  \
;;                    \-> Minor (Local change)
;;
;; Major could be:
;;  ==> 0 (old)
;;  ==> 1 (stable)
;;  ==> 2 (testing raw)
;; Minor could be:
;;  ==> 0 (pair, release, stable)
;;  ==> 1 (odd, current, unstable)
;;
;; Emacs version:
;;  ==> 28 (Emacs 28)
;;
;; Platform version:
;;  ==> l (Linux)
;;  ==> n (netbsd)
;;  ==> o (openbsd)
;;  ==> w (windows)
;;  ==> x (os x)
;;
;; Last summary changelog: 0.3(23)-l - 1.0(28)-l
;;  ==> Ported all features to a stable version

;; ---------------------------------------------------------------------------
;; Important keybindings
;; ---------------------------------------------------------------------------

;; Selective undo
;; modify a buffer, select region, Control+_, and undo the region

;; Disabling Transient Mark Mode
;; M-x transient-mark-mode
;; Then use regions and use C-x C-x to exchange cursor and mark.
;; Normally M-% (query-replace) performs replacements within the region,
;; if the mark is active.

;; C-x C-u in a region, put in upper case the text in a region
;; (put 'upcase-region 'disabled nil)

;; Other common or useful tasks

;; Track changes;
;; http://www.emacswiki.org/emacs/TrackChanges

;; Revert buffer
;; http://www.emacswiki.org/emacs/RevertBuffer

;; Mark commands
;; http://www.emacswiki.org/emacs/MarkCommands
;; ---------------------------------------------------------------------------
;; Highlighting
;; ---------------------------------------------------------------------------

;; highlight region between point and mark
(transient-mark-mode t)
;; highlight during query
(setq query-replace-highlight t)

;; highlight incremental search
(setq search-highlight t)

;; Show matching parenthesis. How can you live without it.
(show-paren-mode t)

;; ---------------------------------------------------------------------------
;; Behaviour
;; --------------------------------------------------------------------------

;; don't make pesky backup files
(setq make-backup-files nil)
;; don't use version numbers for backup files
(setq version-control 'never)
;; Open unidentified files in text mode
(setq default-major-mode 'text-mode)
;; Do only one line scrolling.
(setq scroll-step 1)
;; Don't wrap long lines.
(set-default 'truncate-lines t)
;; Make the region visible (but only up to the next operation on it)
(setq transient-mark-mode t)
;; Colours ("Colors" in some other languages)
;; Give me colours in major editing modes!
(require 'font-lock)
(global-font-lock-mode t)
;; Don't add new lines to the end of a file when using down-arrow key
(setq next-line-add-newlines nil)
;; Dont show the GNU splash screen
;(setq inhibit-startup-message t)
;; Make all "yes or no" prompts show "y or n" instead
(fset 'yes-or-no-p 'y-or-n-p)

;; ---------------------------------------------------------------------------
;; Editing modes
;; ----------------------------------------------------------------------------

(setq auto-mode-alist
'(("\\.[Cc][Oo][Mm]\\'" . text-mode)
("\\.bat\\'" . bat-generic-mode)
("\\.inf\\'" . inf-generic-mode)
("\\.rc\\'" . rc-generic-mode)
("\\.reg\\'" . reg-generic-mode)
("\\.cob\\'" . cobol-mode)
("\\.cbl\\'" . cobol-mode)
("\\.te?xt\\'" . text-mode)
("\\.c\\'" . c-mode)
("\\.h\\'" . c++-mode)
("\\.tex$'". LaTeX-mode)
("\\.sty$'". LaTeX-mode)
("\\.bbl$'". LaTeX-mode)
("\\.bib$'". BibTeX-mode)
("\\.el\\'" . emacs-lisp-mode)
("\\.scm\\'" . scheme-mode)
("\\.l\\'" . lisp-mode)
("\\.lisp\\'" . lisp-mode)
("\\.f\\'" . fortran-mode)
("\\.F\\'" . fortran-mode)
("\\.for\\'" . fortran-mode)
("\\.p\\'" . pascal-mode)
("\\.pas\\'" . pascal-mode)
("\\.ad[abs]\\'" . ada-mode)
("\\.\\([pP][Llm]\\|al\\)\\'" . perl-mode)
('\\.cgi"'" . perl-mode)
("\\.s?html?\\'" . sgml-mode)
("\\.idl\\'" . c++-mode)
("\\.cc\\'" . c++-mode)
("\\.hh\\'" . c++-mode)
("\\.hpp\\'" . c++-mode)
("\\.C\\'" . c++-mode)
("\\.H\\'" . c++-mode)
("\\.cpp\\'" . c++-mode)
("\\.[cC][xX][xX]\\'" . c++-mode)
("\\.hxx\\'" . c++-mode)
("\\.c\\+\\+\\'" . c++-mode)
("\\.h\\+\\+\\'" . c++-mode)
("\\.m\\'" . objc-mode)
("\\.java\\'" . java-mode)
("\\.ma?k\\'" . makefile-mode)
("\\(M\\|m\\|GNUm\\)akefile\\(\\.in\\)?'". makefile-mode)
("\\.am\\'" . makefile-mode)
("\\.mms\\'" . makefile-mode)
("\\.texinfo\\'" . texinfo-mode)
("\\.te?xi\\'" . texinfo-mode)
("\\.s\\'" . asm-mode)
("\\.S\\'" . asm-mode)
("\\.asm\\'" . asm-mode)
("ChangeLog\\'" . change-log-mode)
("change\\.log\\'" . change-log-mode)
("changelo\\'" . change-log-mode)
("ChangeLog\\.[0-9]+\\'" . change-log-mode)
("changelog\\'" . change-log-mode)
("changelog\\.[0-9]+\\'" . change-log-mode)
("\\$CHANGE_LOG\\$\\.TXT'". change-log-mode)
("\\.scm\\.[0-9]*\\'" . scheme-mode)
("\\.[ck]?sh\\''\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
("\\(/\\|\\`\\)\\.\\(bash_profile\\|z?login\\|bash_login\\|z?logout\\)\\'" . sh-mode)
("\\(/\\|\\`\\)\\.\\(bash_logout\\|[kz]shrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
("\\.mm\\'" . nroff-mode)
("\\.me\\'" . nroff-mode)
("\\.ms\\'" . nroff-mode)
("\\.man\\'" . nroff-mode)
("\\.[12345678]\\'" . nroff-mode)
("\\.TeX\\'" . TeX-mode)
("\\.sty\\'" . LaTeX-mode)
("\\.cls\\'" . LaTeX-mode)
("\\.clo\\'" . LaTeX-mode)
("\\.bbl\\'" . LaTeX-mode)
("\\.bib\\'" . BibTeX-mode)
("\\.m4\\'" . m4-mode)
("\\.mc\\'" . m4-mode)
("\\.mf\\'" . metafont-mode)
("\\.mp\\'" . metapost-mode)
("\\.vhdl?\\'" . vhdl-mode)
("\\.article\\'" . text-mode)
("\\.letter\\'" . text-mode)
("\\.tcl\\'" . tcl-mode)
("\\.exp\\'" . tcl-mode)
("\\.itcl\\'" . tcl-mode)
("\\.itk\\'" . tcl-mode)
("\\.icn\\'" . icon-mode)
("\\.sim\\'" . simula-mode)
("\\.mss\\'" . scribe-mode)
("\\.f90\\'" . f90-mode)
("\\.lsp\\'" . lisp-mode)
("\\.awk\\'" . awk-mode)
("\\.prolog\\'" . prolog-mode)
("\\.tar\\'" . tar-mode)
("\\.\\(arc\\|zip\\|lzh\\|zoo\\|jar\\)\\'" . archive-mode)
("\\.\\(ARC\\|ZIP\\|LZH\\|ZOO\\|JAR\\)\\'" . archive-mode)
("\\`/tmp/Re'". text-mode)
("/Message[0-9]*\\'" . text-mode)
("/drafts/[0-9]+\\'" . mh-letter-mode)
("\\.zone\\'" . zone-mode)
("\\`/tmp/fol/'". text-mode)
("\\.y\\'" . c-mode)
("\\.lex\\'" . c-mode)
("\\.oak\\'" . scheme-mode)
("\\.sgml?\\'" . sgml-mode)
("\\.xml\\'" . sgml-mode)
("\\.dtd\\'" . sgml-mode)
("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
("\\.idl\\'" . c++-mode)
("[]>:/\\]\\..*emacs\\'" . emacs-lisp-mode)
("\\`\\..*emacs\\'" . emacs-lisp-mode)
("[:/]_emacs\\'" . emacs-lisp-mode)
("\\.org\\'" . org-mode)
("\\.ml\\'" . lisp-mode)
("\\.tex$'". LaTeX-mode)
("\\.sty$'". LaTeX-mode)
("\\.bbl$'". LaTeX-mode)
("\\.bib$'". BibTeX-mode)
("\\.cls$'". LaTeX-mode)
("\\.clo$'". LaTeX-mode)
("\\.pdf$'". doc-view-mode)))

;; ---------------------------------------------------------------------------
;; Modeline
;; ---------------------------------------------------------------------------

;; Current line & column of cursor in the mode line (bar at the bottom)
(line-number-mode 1)
(setq column-number-mode t)
;; show current function in modeline
(which-func-mode t)
;; Display time in the mode line
;; Put this line last to prove (by the time in the mode line)
;; that the .emacs loaded without error to this point.

;; Alternative (too long, use calendar)
;;(setq display-time-day-and-date t )

;; Alternative (too long, replace by short format)
;;(setq display-time-24hr-format t)
;;(display-time)

(display-time-mode 1)
;; ---------------------------------------------------------------------------
;; Auto Completion
;; ---------------------------------------------------------------------------

;; ensure abbrev mode is always on
(setq-default abbrev-mode t)
;; do not bug me about saving my abbreviations
(setq save-abbrevs nil)
;; load up modes I use
(require 'cc-mode)
(require 'perl-mode)
(require 'cperl-mode)
(require 'sh-script)
(require 'shell)
;; (require 'tex-site) ;; I use AUCTeX
;; (require 'latex) ;; needed to define LaTeX-mode-hook under AUCTeX
;; (require 'tex) ;; needed to define TeX-mode-hook under AUCTeX
;; (require 'python) ;; I use python.el from Emacs CVS, uncomment if you do also
;; load up abbrevs for these modes

;; Remember that to use msf-abbrev we need to launch in emacs:
;; M-x msf-abbrev-scan-modes <CR>
;; c-mode <CR>

;; Commented abbrev mode in macos
;; (add-to-list 'load-path '~/.emacs.d/lisp')
;; (require 'msf-abbrev)
;; (setq msf-abbrev-verbose t) ;; optional
;; (setq msf-abbrev-root '~/.emacs.d/mode-abbrevs')
;; (global-set-key (kbd 'C-c l') 'msf-abbrev-goto-root)
;; (global-set-key (kbd 'C-c a') 'msf-abbrev-define-new-abbrev-this-mode)

;; Smart tab
(define-key c-mode-map (kbd "TAB") 'smart-tab)
(defun smart-tab ()
'This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line.'
(interactive)
(if (minibufferp)
(minibuffer-complete)
(if mark-active
(indent-region (region-beginning)
(region-end))
(if (looking-at "\\_>")
(hippie-expand nil)
(indent-for-tab-command)))))

;; ---------------------------------------------------------------------------
;; IRC / iMSN / Chat
;; ---------------------------------------------------------------------------

;; ERC
(require 'erc)
(setq erc-mode-line-format "%t %a")

;; Enable sound in ERC
(require 'erc-sound)
(erc-sound-enable)

;; ERC autojoin -multiple servers with multiple channels-
;;(setq erc-autojoin-channels-alist
;; '(('#emacs-es' '#emacs' '#gnus' '#stumpwm' '#zsh' '##security')))

;;(erc :server 'irc.freenode.net' :port 6667 nick 'nickname')

;; ---------------------------------------------------------------------------
;; GTK customizing
;; ---------------------------------------------------------------------------

;; Change GTK fonts size, etc
;; IN OS X do not change due to is cute by default
;(cond
; ((eq system-type 'gnu/linux)
; (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 (:stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 70 :width normal :foundry 'unknown' :family '-cronyx-fixed-medium-r-normal--10-*-75-75-c-60-koi8-r'))))) ; DejaVu Sans
; )
;)

;; Show in title Frame as: computer@host:/path/file
(setq frame-title-format `(,(user-login-name) '@' ,(system-name) ":%f" ))

;; ---------------------------------------------------------------------------
;; Scheme
;; ---------------------------------------------------------------------------

;; Setting scm (requires apt-get install scm) a scheme compiler run via M-x scheme-mode
(setq scheme-program-name "scm")
(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.
'(canlock-password "XXXXXXXXXXXXXXXXXXXXXXXXXXXX")
'(org-agenda-files nil)
'(package-selected-packages
'(remark-mode elpy markdown-mode markdown-mode+ impatient-mode magit latex-preview-pane geiser)))

;; ---------------------------------------------------------------------------
;; Geiser with racket
;; ---------------------------------------------------------------------------

; Steps to install and configure geiser
; 1. Download geiser (it is just a wrapper)
; 2. Install racket (it is the scheme compiler implementation itself) apt-get install racket
; 2. Add the load-file
; 3. Add the binary for geiser racket
; 4. M-x geiser
; 5. Select racket

;(load-file '~/.emacs.d/geiser/elisp/geiser.el')
;; Temporary solution
;(load-file '/etc/emacs/site-start.d/50geiser.el')
;(load-file '/usr/share/emacs/site-lisp/geiser/geiser.el')
(setq geiser-racket-binary "/usr/bin/racket")
(setq geiser-scheme-dir "/usr/share/geiser")
;; M-x geiser (scheme interactive for emacs)

;; ---------------------------------------------------------------------------
;; General keys for Lisp (autocomplete, compile, eval, indentation, etc)
;; ---------------------------------------------------------------------------

;;; some keys F5 to F9 are free examples
(global-set-key [f5] 'lisp-complete-symbol)
(global-set-key [f6] '(lambda () (interactive) (kill-buffer (current-buffer))))
(global-set-key [S-f7] 'compile)

; TAB = Autocompletion
; Intro = INTRO + indentation
(define-key global-map (kbd "RET") 'newline-and-indent)
(define-key lisp-mode-map (kbd "TAB") 'lisp-complete-symbol)

;; ---------------------------------------------------------------------------
;; CLisp
;; ---------------------------------------------------------------------------

;(setq inferior-lisp-program '/usr/bin/clisp')

;; ---------------------------------------------------------------------------
;; SBCL
;; ---------------------------------------------------------------------------

(setq inferior-lisp-program "/usr/bin/sbcl")

;; ---------------------------------------------------------------------------
;; SLIME
;; ---------------------------------------------------------------------------

; SLIME will require set inferior-lisp-program variable

; SLIME directory where it is installed
;(add-to-list 'load-path "~/.emacs.d/slime/")

; Include
;(require 'slime)

; Setup
;(slime-setup)

;; ---------------------------------------------------------------------------
;; Development: Debugger
;; ---------------------------------------------------------------------------

;; GDB (Debugger)
;; Split windows for gdb screens
(setq gdb-many-windows t
gdb-show-main t)

;; ---------------------------------------------------------------------------
;; Frames and windows sizes
;; ---------------------------------------------------------------------------

;; Initial size and position of frame and variable width font
;; (sizes with menubar, toolbar and scrollbar)
;; (set-frame-width (selected-frame) 177)
;; (set-frame-height (selected-frame) 45)
;; (set-frame-position (selected-frame) 0 0)

;; (sizes without menubar, toolbar, and scrollbar) and variable width font
;(set-frame-width (selected-frame) 179)
;(set-frame-height (selected-frame) 47)
;(set-frame-position (selected-frame) 2 2)

;; default-frame-alist (properties same than initial-frame-alist) and variable width font
;(setq default-frame-alist '((top . 2) (left . 2) (width . 179) (height . 47)))
;; LAST OK for variable width font, next two lines, please uncomment if required
;(setq default-frame-alist '((top . 3) (left . 845) (width . 162) (height . 83)))
;(setq initial-frame-alist '((top . 3) (left . 2) (width . 162) (height . 83)))

;; Other Alternatives (options for fonts depending of fonts installed and computer):
;; Replaced GTK fonts size (above) by a fixed width font
;(set-frame-font "-cronyx-fixed-medium-r-normal--10-*-75-75-c-60-koi8-r")
;(set-default-font "-cronyx-fixed-medium-r-normal--10-*-75-75-c-60-koi8-r")

;(add-to-list 'default-frame-alist '((font . '-*-fixed-*-*-*-*-6-*-*-*-*-*-*-*')))
;(add-to-list 'default-frame-alist '((font . '-cronyx-fixed-medium-r-normal--10-*-75-75-c-60-koi8-r')))
;(add-to-list 'initial-frame-alist '((font . '-cronyx-fixed-medium-r-normal--10-*-75-75-c-60-koi8-r')))

;(set-frame-font "-xos4-Terminus-bold-normal-normal-*-14-*-*-*-c-80-iso10646-1")
;(set-default-font "-xos4-Terminus-bold-normal-normal-*-14-*-*-*-c-80-iso10646-1")

;(add-to-list 'default-frame-alist '((font . '-*-fixed-*-*-*-*-6-*-*-*-*-*-*-*')))
;(add-to-list 'default-frame-alist '((font . '-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1')))
;(add-to-list 'initial-frame-alist '((font . '-xos4-Terminus-normal-normal-normal-*-14-*-*-*-c-80-iso10646-1')))

;; Disabling menubar, toolbar and scrollbar
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

;; Confortable fonts (big) - Recommended -
;; Initial size and position of frame and fixed width font

; Frames for T61P
;(setq default-frame-alist '((top . 16) (left . 832) (width . 90) (height . 52)))
;(setq initial-frame-alist '((top . 16) (left . 1) (width . 90) (height . 52)))

; Frames for T61
;(setq default-frame-alist '((top . 22) (left . 685) (width . 73) (height . 44)))
;(setq initial-frame-alist '((top . 22) (left . 1) (width . 73) (height . 44)))

; Frames for W520
;(setq default-frame-alist '((top . 22) (left . 685) (width . 83) (height . 52)))
;(setq initial-frame-alist '((top . 22) (left . 1) (width . 83) (height . 52)))

;; Important
;; ---------
;; Some theme from color-themes are conflicting with the previous sets,
;; as it is setting some fonts, then, not default-frame-alist have effect before,
;; but here, until this conflict is fixed, it is possible to apply font to the initial
;; frame, but not to the default new ones created with C-x 5 2, as it is not applying
;; the theme properly.
;;
;; - So, this one is working without new frames, if you want small fonts.
;; - If you want big fonts, just comment below lines.
;; - If you want small fonts with new frames working, then conflict must be fixed
;; between color-theme and those lines, too lazy to fix now

;; Confortable fonts (small-medium) - Recommended - Cool fonts if want small

;;(setq default-frame-alist '((top . 16) (left . 2) (width . 102) (height . 70)))
;;(setq initial-frame-alist '((top . 16) (left . 1) (width . 102) (height . 70)))
;;(add-to-list 'default-frame-alist
;; '(font . '-xos4-Terminus-normal-normal-normal-*-12-*-*-*-c-80-iso10646-1'))

;; Create fonttest.el add some lines for setting the fonts and test launching emacs with
;; 'emacs -q -l fonttest.el' to test conflicts

;; Specific final configuration frames for W520 frame and windows size in Emacs

(setq initial-frame-alist '((top . 22) (left . 1) (width . 83) (height . 52)))
;; IMPORTANT, set .Xdefaults like that:
;Emacs.font:Terminus-12
;Emacs*foreground: white
;Emacs*background: black

;; ---------------------------------------------------------------------------
;; Calendar
;; ---------------------------------------------------------------------------

;; Show calendar on start up
;(calendar)

;; ---------------------------------------------------------------------------
;; Emacs w3m-lnum
;; ---------------------------------------------------------------------------

;; This will print out the link numbers in an emacs-w3m buffer
(add-to-list 'load-path "~/.emacs.d/w3m-lnum/w3m-lnum.el")

;; Load w3m
;(require 'w3m-lnum)
;; (defun jao-w3m-go-to-linknum ()
;; 'Turn on link numbers and ask for one to go to.'
;; (interactive)
;; (let ((active w3m-link-numbering-mode))
;; (when (not active) (w3m-link-numbering-mode))
;; (unwind-protect
;; (w3m-move-numbered-anchor (string-to-number (read-string 'Anchor number: ')))
;; (when (not active) (w3m-link-numbering-mode)))))

;; (define-key w3m-mode-map 'f' 'jao-w3m-go-to-linknum)
(require 'w3m-lnum)

;; (defun jao-w3m-go-to-linknum ()
;; 'Turn on link numbers and ask for one to go to.'
;; (interactive)
;; (let ((active w3m-link-numbering-mode))
;; (when (not active) (w3m-link-numbering-mode))
;; (unwind-protect
;; (w3m-move-numbered-anchor (string-to-number (read-string 'Anchor number: ')))

;; (when (not active) (w3m-link-numbering-mode)))))

;; (define-key w3m-mode-map 'f' 'jao-w3m-go-to-linknum)

(add-hook 'w3m-mode-hook 'w3m-lnum-mode)

;; Use:
;; L i -> (w3m-lnum-images) images links
;; L f -> (w3m-lnum-follow) follow links
;; L -> (w3m-lnum-goto)
;; L -> (w3m-lnum-mode) toggle lnum keys mode
;; L -> (w3m-lnum-print-this-url)
;; L u -> (w3m-lnum-universal)
;; L -> (w3m-lnum-download-this-url)
;; L -> (w3m-lnum-)
;; L -> (w3m-lnum-)

;; ---------------------------------------------------------------------------
;; Browser: W3M
;; ---------------------------------------------------------------------------

;; Find w3m.el in PATH. Requires apt-get install w3m w3m-img
(add-to-list 'load-path "/usr/share/emacs/site-lisp/w3m")

;; Load w3m
(require 'w3m-load)
(require 'w3m)

;; Display images automatically with w3m
(setq w3m-default-display-inline-images t)

(setq browse-url-browser-function 'w3m-browse-url)
(setq w3m-cookie-accept-bad-cookies t)

(setq w3m-add-user-agent nil

w3m-default-display-inline-images t
w3m-default-save-directory "~/.emacs.d/.w3m"

w3m-favicon-use-cache-file t
w3m-init-file "~/.emacs.d/.emacs-w3m"

w3m-key-binding (quote info)

w3m-profile-directory "~/.emacs.d/.w3m"
w3m-resize-images t

w3m-use-cookies t
w3m-key-binding (quote info)

w3m-display-inline-image t
mm-text-html-renderer 'w3m
mm-inline-text-html-with-images t

mm-inline-large-images t)

;; The new w3m frame is in white color
;(add-hook 'w3m-mode-hook 'w3m-white-color-mode)
;; When killed the w3m frame will be black color again
;(add-hook 'kill-buffer-hook 'w3m-dark-color-mode)

; (defun w3m-dark-color-mode()
; (set-background-color 'Black')
; (set-foreground-color 'White')
; )

; (defun w3m-green-color-mode()
; (set-background-color 'Green')
; (set-foreground-color 'Black')
; )

; (defun w3m-white-color-mode()
; (set-background-color 'White')
; (set-foreground-color 'Black')
; )

;; Create new frames when opening a link
;; Define the colors
;; (defun black-on-white ()
;; (interactive)
;; (set-background-color 'black')
;; (set-foreground-color 'white'))
;; ;; Define the new frame
;; (defun make-w3m-frame ()
;; (interactive)
;; (select-frame (make-frame))
;; (black-on-white)
;; (w3m))
;; Create new frame when open a new link
;(add-hook 'w3m-mode-hook 'make-w3m-frame)

;; Open urls in new tabs from a new frame
;; (defun w3m-new-tab ()
;; (interactive)
;; (w3m-copy-buffer nil nil nil t))

;; (defun w3m-browse-url-new-tab (url &optional new-session)
;; (interactive)
;; (w3m-new-tab)
;; (w3m-browse-url url))

;; (setq browse-url-browser-function 'w3m-browse-url
;; browse-url-new-window-flag t)

;;(setq browse-url-browser-function 'w3m-browse-url-new-tab)

(setq browse-url-browser-function 'browse-url-firefox
browse-url-new-window-flag t
browse-url-firefox-new-window-is-tab t)

;; ---------------------------------------------------------------------------
;; EWW Browser
;; ---------------------------------------------------------------------------

;; Set eww the default browser
;; (setq browse-url-browser-function 'eww-browse-url)

;; (when (fboundp 'eww)
;; (progn
;; (defun xah-rename-eww-hook ()
;; 'Rename eww browser's buffer so sites open in new page.'
;; (rename-buffer 'eww' t))
;; (add-hook 'eww-mode-hook 'xah-rename-eww-hook)))

;; ---------------------------------------------------------------------------
;; Customizing personal keybindings
;; ---------------------------------------------------------------------------

;; ZOOM KEYBINDINGS
;; ----------------
;; C-+ zoom in
;; C-- zoom out
;; C-0 zoom reset

;; Firefox-like zooming of fonts.
(setq default-font-zoom-index 2)
(setq font-zoom-index default-font-zoom-index)

;
(setq font-zoom-list
(list "-*-fixed-*-*-*-*-6-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-13-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-17-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-18-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-24-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-36-*-*-*-*-*-*-*"
"-*-fixed-*-*-*-*-48-*-*-*-*-*-*-*"))

(defun font-zoom-increase-font-size ()
(interactive)
(progn
(setq font-zoom-index (min (- (length font-zoom-list) 1)
(+ font-zoom-index 1)))
(set-frame-font (nth font-zoom-index font-zoom-list))))

(defun font-zoom-decrease-font-size ()
(interactive)
(progn
(setq font-zoom-index (max 0 (- font-zoom-index 1)))
(set-frame-font (nth font-zoom-index font-zoom-list))))

(defun font-zoom-reset-font-size ()
(interactive)
(progn
(set-frame-font (nth font-zoom-index font-zoom-list))))

(define-key global-map (read-kbd-macro "C--") 'font-zoom-decrease-font-size)
(define-key global-map (read-kbd-macro "C-=") 'font-zoom-increase-font-size)
(define-key global-map (read-kbd-macro "C-0") 'font-zoom-reset-font-size)

;; ---------------------------------------------------------------------------
;; XLicense
;; ---------------------------------------------------------------------------

(load-library "~/.emacs.d/xlicense.el")

(define-abbrev-table 'global-abbrev-table
'(
("$$license" '' license-skeleton)
))

(add-hook 'c-mode-hook (function (lambda nil (abbrev-mode 1))))
(add-hook 'c++-mode-hook (function (lambda nil (abbrev-mode 1))))

;; ---------------------------------------------------------------------------
;; Org-mode configuration
;; ---------------------------------------------------------------------------

(setq org-log-done 'time)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

;; Connect agenda with org files
(setq org-agenda-files (list "~/all/NOW/tasks.org"))

;; ORG+Tasks managing
;; Use C-c C-c to finish a simple task
;; Use C-c C-t to close the full set of tasks
;; Use C-c a t to enter in todo 'all' list

;; ORG+Tasks priorities
;; C-c , to set tasks priority (priority must be on the top of org file)
;; C-c , + increase priority
;; C-c , - decrease priority

;; ORG+Agenda
;; C-c C-d for insert a deadline a set of tasks
;; Use C-c C-s for schedule a set of tasks
;; Once select the data press enter and
;; Use C-c a a for org-agenda (investigate)
;; Now pres 'l' (lower case L) to set log mode on

;; ORG+check
;; C-c / d Check deadlines
;; C-c / b Check schedules and deadlines
;; C-c / a Check deadlines after date

;; ORG+display
;; C-c - Change numeration (DO NOT USE ON THE TITLES as TODO word will be ignored)

(add-to-list 'load-path (expand-file-name "~/.emacs.d/ch/"))
(require 'org-checklist)

;; Tracking habits

;; Show images inline when opening an org file
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)

;; ---------------------------------------------------------------------------
;; Cscope + xcscope
;; ---------------------------------------------------------------------------

; requires apt-get install cscope and then download xcscope.el and put in place and load-file from .emacs
;; Official website of cscope: http://cscope.sourceforge.net/
;; Official website of xcscope: http://linux.die.net/man/1/xcscope

;; With cscope
;; cscope-indexer -r -v in the dir to create database (recursive and verbose)
(load-file "~/.emacs.d/xcscope/xcscope.el")
(require 'xcscope)

;; Some easier keybindings to remember
(define-key global-map [(ctrl f3)] 'cscope-set-initial-directory)
(define-key global-map [(ctrl f4)] 'cscope-unset-initial-directory)
(define-key global-map [(ctrl f5)] 'cscope-find-this-symbol)
(define-key global-map [(ctrl f6)] 'cscope-find-global-definition)
(define-key global-map [(ctrl f7)] 'cscope-find-global-definition-no-prompting)
(define-key global-map [(ctrl f8)] 'cscope-pop-mark)
(define-key global-map [(ctrl f9)] 'cscope-next-symbol)
(define-key global-map [(ctrl f10)] 'cscope-next-file) ; p -> prev inside
(define-key global-map [(ctrl f11)] 'cscope-prev-symbol) ; n -> next inside

(define-key global-map [(ctrl f12)] 'cscope-prev-file)
(define-key global-map [(meta f9)] 'cscope-display-buffer)
(define-key global-map [(meta f10)] 'cscope-display-buffer-toggle)

;; Default keybindings with C-c s prefix (needs to be editing source code for that lex, yacc, c or c++)

; These pertain to find symbols
; C-c s s Find symbol.
; C-c s d Find global definition.
; C-c s g Find global definition (alternate binding).
; C-c s G Find global definition without prompting.
; C-c s c Find functions calling a function.
; C-c s C Find called functions (list functions called from a function).
; C-c s t Find text string.
; C-c s e Find egrep pattern.
; C-c s f Find a file.
; C-c s i Find files #including a file.

; These pertain to navigation through the search results:
; C-c s b Display *cscope* buffer.
; C-c s B Auto display *cscope* buffer toggle.
; C-c s n Next symbol.
; C-c s N Next file.
; C-c s p Previous symbol.
; C-c s P Previous file.
; C-c s u Pop mark.

; These pertain to setting and unsetting the variable, 'cscope-initial-directory', (location searched for the cscope database directory):
; C-c s a Set initial directory.
; C-c s A Unset initial directory.

; These pertain to cscope database maintenance:
; C-c s L Create list of files to index.
; C-c s I Create list and index.
; C-c s E Edit list of files to index.
; C-c s W Locate this buffer's cscope directory ( 'W' --> 'where' ).
; C-c s S Locate this buffer's cscope directory. (alternate binding: 'S' --> 'show' ).
; C-c s T Locate this buffer's cscope directory. (alternate binding: 'T' --> 'tell' ).
; C-c s D Dired this buffer's directory.

; Some interesting variables to configure are:
; cscope-truncate-lines, cscope-use-relative-paths, cscope-index-recursively, cscope-name-line-width, cscope-do-not-update-database, cscope-display-cscope-buffer, cscope-database-regexps

;; ---------------------------------------------------------------------------
;; TAGS, ETAGS, CTAGS
;; ---------------------------------------------------------------------------

; With ETAGS
; Launch in console for the current directory in c/c++: etags *.c *.h
; Launch in console for the whole tree in c/c++: find . -name '*.[cChH]' | etags -
; M-. : ‘find-tag‘; look for a tag
; M-, : ‘tags-loop-continue‘; continue to the same occurrence of the tag searched
; M-* : ‘pop-tag-mark‘; return the cursor at the starting point of the searching of the tag
; (not keybinding) : ‘tags-search‘; search for a tag
; (not keybinding) : ‘tags-query-replace‘; replace a tag
; (not keybinding) : 'tags-apropos' : regexp for a tag
; (not keybinding) : ‘list-tags‘; list the tags from a file
; C-u – M-. ; moves to the previous tag
; C-u M-. ; moves to the next tag
; C-x 4 . : ‘find-tag-other-window’; search for a tag and show in a different window
; C-u 5 . : ‘find-tag-other-frame’; search for a tag and show in a different frame
; M-/ ; autocompletion using dabbrev (is taking care of ETAGS)
; M-/ M-/ (or more repetitions); autocompletion with the second, third, etc... option
; (not keybinding) : 'select-tags-table' : select a different table tags
; (not keybinding) : 'visit-tags-table' : shows the table of tags

;; ---------------------------------------------------------------------------
;; GTAGS
;; ---------------------------------------------------------------------------

;; (defun gtags-root-dir ()
;; 'Returns GTAGS root directory or nil if doesn't exist.'
;; (with-temp-buffer
;; (if (zerop (call-process 'global' nil t nil '-pr'))
;; (buffer-substring (point-min) (1- (point-max)))
;; nil)))

;; (defun gtags-update ()
;; 'Make GTAGS incremental update'
;; (call-process 'global' nil nil nil '-u'))

;; (defun gtags-update-hook ()
;; (when (gtags-root-dir)
;; (gtags-update)))

;; (add-hook 'after-save-hook #'gtags-update-hook)

;; ;(global-set-key (kbd 'C-c b') 'gtags-root-dir)


;; Global location and ggtags
(add-to-list 'load-path "~/.emacs.d/ggtags/")
(load-file "~/.emacs.d/ggtags/ggtags-0.7.12.el")

;; type M-x ggtags-mode to enable minor mode
;; M-. find definitions
;; M-] finds references
;; M-* abort
;; M-n or M-p go to next or previous tags
;; M-o toggles full abbrev
;; M-{ or M-} prev or next file

;; ;; enable ggtags-mode for c/c++/java modes
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
(ggtags-mode 1))))

;; next step is enable cedet + semantic + ggtags support

;; ---------------------------------------------------------------------------
;; Undo
;; ---------------------------------------------------------------------------

;; Undo
;; C-_
;; Redo
;; C-g C-_
;; Check utree and http://stackoverflow.com/questions/3527142/how-do-you-redo-changes-after-undo-with-emacs
;; C-x z and type z as much as needed

;; ---------------------------------------------------------------------------
;; C indentation
;; ---------------------------------------------------------------------------

; Set basic indentation in c of 4 spaces
(setq-default c-basic-offset 4)

;; ---------------------------------------------------------------------------
;; TABs vs Spaces
;; ---------------------------------------------------------------------------

(setq-default indent-tabs-mode 'nil)
;; M-x mark-defun RET TAB RET fixes the function, though %)

;; ---------------------------------------------------------------------------
;; Linum (line numbers) M-x linum-mode to enable
;; ---------------------------------------------------------------------------

(load-file "~/.emacs.d/linum/linum.el")
(require 'linum)
(setq linum-format "%d ")
;(autoload 'linum 'linum' 'Line numbers for buffers.' t)
(add-hook 'find-file-hook (lambda () (linum-mode 1)))

;; ---------------------------------------------------------------------------
;; AucTeX
;; ---------------------------------------------------------------------------

(add-to-list 'load-path "~/.emacs.d/auctex-11.87/")
(add-to-list 'load-path "~/.emacs.d/auctex-11.87/preview/")
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq-default TeX-PDF-mode t)

;; AucTeX autocompletion (it autocompletes from scratch)
;; Use C-RET

;; Use ESC-TAB or C-M-i for 'normal' autocompletion

;; M-/ is the default completion thing in emacs

;; Re-define for LaTeX-mode, use TAB for auto-completion
(eval-after-load 'latex
'(define-key LaTeX-mode-map [(tab)] 'TeX-complete-symbol))

;; C-c C-c to check errors in Latex (if errors check with C-c `)
;; C-c C-p C-d preview-document

;; ---------------------------------------------------------------------------
;; Doc View
;; ---------------------------------------------------------------------------

;(add-to-list 'load-path "~/.emacs.d/docview/")
(require 'doc-view)

(defun tex-view ()
(interactive)
(tex-send-command "xpdf" (tex-append tex-print-file ".pdf")))

;; ---------------------------------------------------------------------------
;; Column marker
;; ---------------------------------------------------------------------------

(add-to-list 'load-path "~/.emacs.d/column-marker/")
(require 'column-marker)
; ; C-u 81 M-x column-marker-1
(add-hook 'c-mode-hook (lambda () (interactive) (column-marker-1 81)))
(add-hook 'c++-mode-hook (lambda () (interactive) (column-marker-1 81)))
(add-hook 'lisp-mode-hook (lambda () (interactive) (column-marker-1 81)))

; Use 'C-c m' interactively to highlight with column-marker-1
(global-set-key [?\C-c ?m] 'column-marker-1)
; All you need to add column markers
;(column-marker-create column-marker-4 hi-green-b)

;; ---------------------------------------------------------------------------
;; Highlight columns
;; ---------------------------------------------------------------------------

;; Highlight lines with >80 columns
; Highlight lines with more than 80 lines in lisp, c and c++ languages
;(add-hook 'emacs-lisp-mode-hook '(lambda () (highlight-lines-matching-regexp ".\{81\}" "hi-green-b")))
;(add-hook 'c++-mode-hook '(lambda () (highlight-lines-matching-regexp ".\{81\}" "hi-green-b")))
;(add-hook 'c-mode-hook '(lambda () (highlight-lines-matching-regexp ".\{81\}" "hi-green-b")))

(let ((whitespace-line-column 81) ;80 is the default
(whitespace-style '(lines-tail))) ;or '(lines) for the whole line
(whitespace-mode 1))

;; ---------------------------------------------------------------------------
;; iswitchb (work with buffers confortably)
;; ---------------------------------------------------------------------------

; Remember use C-x b and C-s or C-r to shift or unshift the buffer
; also chars could be used to filter the buffer and ENTER or TAB
; could be used to confirm the switch
(require 'iswitchb)
(iswitchb-mode)

; iswitchb ignores
(add-to-list 'iswitchb-buffer-ignore "^ ")
(add-to-list 'iswitchb-buffer-ignore "*Messages*")
(add-to-list 'iswitchb-buffer-ignore "*ECB")
(add-to-list 'iswitchb-buffer-ignore "*Buffer")
(add-to-list 'iswitchb-buffer-ignore "*Completions")
(add-to-list 'iswitchb-buffer-ignore "*ftp ")
(add-to-list 'iswitchb-buffer-ignore "*bsh")
(add-to-list 'iswitchb-buffer-ignore "*jde-log")
(add-to-list 'iswitchb-buffer-ignore "^[tT][aA][gG][sS]$")

;; ---------------------------------------------------------------------------
;; Compile
;; ---------------------------------------------------------------------------

; Compile and handling regions for errors
(global-set-key (kbd "C-c c") 'compile)

;; ---------------------------------------------------------------------------
;; Comment regions
;; ---------------------------------------------------------------------------

(global-set-key (kbd "C-c ,") 'comment-region)
(global-set-key (kbd "C-c .") 'uncomment-region)

;; ---------------------------------------------------------------------------
;; EasyPG (GPG for emacs)
;; ---------------------------------------------------------------------------

(require 'epa)
(require 'epa-file)
(epa-file-enable)

; EPG support for GNUS
(setq gnus-treat-x-pgp-sig t
mm-verify-option 'always
mm-decrypt-option 'always)

;; To cipher a region
;; M-x epa-encrypt-region OR global F11
(global-set-key [f11] 'epa-encrypt-region)


;; To uncipher a region
;; M-x epa-decrypt-region OR global F12
(global-set-key [f12] 'epa-decrypt-region)


;; To cipher a file
;; Option1) create directly a .gpg file and edit with emacs
;; Option2) from console use command-line gpg
;; Option3) cipher the whole file using regions

;; W s to gets message verified?

;; ---------------------------------------------------------------------------
;; Whites (white-space) show blanks
;; ---------------------------------------------------------------------------

;; M-x whitespace-mode to enable

;; Reduce colors and chars in whitespace-mode
(setq whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark)))

;; Show Pilcrow sign, etc (xahlee.org/emacs/whitespace-mode.html)
(setq whitespace-display-mappings
'(
(space-mark 32 [183] [46]) ;; Normal space
(space-mark 160 [164] [95])
(space-mark 2208 [2212] [95])
(space-mark 2336 [2340] [95])
(space-mark 3616 [3620] [95])
(space-mark 3872 [3876] [95])
(newline-mark 10 [182 10]) ; newline
(tab-mark 9 [9655 9] [92 9]) ; TAB
)
)

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

;; ---------------------------------------------------------------------------
;; Regions
;; ---------------------------------------------------------------------------

;; Important keybinding C-M-\ for indent region

;; ---------------------------------------------------------------------------
;; TRAMP
;; ---------------------------------------------------------------------------

;;(require 'tramp)
;; changed now 2021

;; C-x C-f /remotehost:filename RET (or /method:user@remotehost:filename)
;; C-x C-f /su::/etc/hosts
;; C-x C-f /sudo::/etc/hosts

; Enable for debugging purposes
;(setq tramp-debug-buffer t)
;(setq tramp-verbose 10)

;; /<user>@<host>:/path/to/file or
;; /<protocol>:<user>@<host>:/path/to/file,

;; ---------------------------------------------------------------------------
;; Informational current character
;; ---------------------------------------------------------------------------

;; M-x what-cursor-position or C-x =

;; ---------------------------------------------------------------------------
;; See the power of emacs
;; ---------------------------------------------------------------------------

;; M-x butterfly -> amazying

;; ---------------------------------------------------------------------------
;; Display colours
;; ---------------------------------------------------------------------------

;; M-x list-colors-display to see all colours

;; ---------------------------------------------------------------------------
;; Narrowing buffer contents
;; ---------------------------------------------------------------------------

;; Keybindings
;; C-x n w -> widen
;; C-x n n -> narrow to region
;; C-x n p -> narrow to page
;; C-x n d -> narrow to function
;; C-x n s -> narrow to subtree

(put 'narrow-to-region 'disabled nil)
;(put 'narrow-to-defun 'disabled nil)
;(put 'narrow-to-page 'disabled nil)

; More info at: http://emacs-fu.blogspot.fi/2010/08/narrowing-buffer-contents.html
; More info at: http://www.emacswiki.org/emacs/BasicNarrowing

;; ---------------------------------------------------------------------------
;; Smooth scrolling
;; ---------------------------------------------------------------------------

;; scroll one line at a time (less jumpy than defaults)
;;(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
;;(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
;;(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
;;(setq scroll-step 1) ;; keyboard scroll one line at a time

;; ---------------------------------------------------------------------------
;; Reminders
;; ---------------------------------------------------------------------------

; Erase all reminders and rebuilt reminders for today from the agenda
(defun bh/org-agenda-to-appt ()
(interactive)
(setq appt-time-msg-list nil)
(org-agenda-to-appt))

; Rebuild the reminders everytime the agenda is displayed
(add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)

; This is at the end of my .emacs - so appointments are set up when Emacs starts
; This line is currently failing, need more investigation
;(bh/org-agenda-to-appt)

; Activate appointments so we get notifications
(appt-activate t)

; If we leave Emacs running overnight - reset the appointments one minute after midnight
(run-at-time "24:01" nil 'bh/org-agenda-to-appt)

;; Show agenda on startup (remember remove splash screen)
;(org-todo-list t)
;; FAIL
;(org-agenda-list)

;; ---------------------------------------------------------------------------
;; MELPA packages
;; ---------------------------------------------------------------------------

;; MELPHA to get latest git version
;(require 'package)
;(add-to-list 'package-archives
; '('marmalade' . 'http://marmalade-repo.org/packages/'))
; You don't need this one if you prefer marmalade and released versions:
; (add-to-list 'package-archives
; '('melpa' . 'http://melpa.milkbox.net/packages/'))
; (package-initialize)

;; ---------------------------------------------------------------------------
;; MELPA
;; ---------------------------------------------------------------------------

; ("melpa" . "http://melpa.org/packages/" t)
; '("melpa" . "http://melpa.milkbox.net/packages/") t)

; (require 'package)
; (add-to-list 'package-archives
; '("melpa" . "http://melpa.org/packages/") t)

; (require 'package)
; (add-to-list 'package-archives
; '("melpa-stable" . "https://stable.melpa.org/packages/"))
; ;(package-initialize)

;;----------------------------------------------------------
;; mu4e email client
;;----------------------------------------------------------

;(add-to-list 'load-path '~/.emacs.d/dotEmacs/mu4e')
;(add-to-list 'load-path '/usr/local/share/emacs/site-lisp/mu4e')
;(add-to-list 'load-path '/home/LOGIN/.emacs.d/mu')

;(require 'mu4e)
;; IMPORTANT: you need to:
;; 1. Create the folder 'Maildir' in case does not exist
;; 2. Turn off secure apps authentication in google settings
;; (normally you get a warning in your email about this option)
;; 3. Check also the two steps authentication
;; 4. Install sqlite and mu4e from commandline (apt or whatever)
;; (setq mu4e-maildir '~/Maildir')
;; (setq mu4e-drafts-folder '/Drafts')
;; (setq mu4e-sent-folder '/Sent')
;; (setq mu4e-trash-folder '/Trash')
;; (setq mu4e-refile-folder '/Archives')

;; ;; don't save message to Sent Messages, Gmail/IMAP takes care of this
;; (setq mu4e-sent-messages-behavior 'delete)
;; setup some handy shortcuts
;; you can quickly switch to your Inbox -- press ``ji''
;; then, when you want archive some messages, move them to
;; the 'All Mail' folder by pressing ``ma''.

;; (setq mu4e-maildir-shortcuts
;; '( ('/INBOX' . ?i)
;; ('/[Gmail].sent' . ?s)
;; ('/[Gmail].trash' . ?t)
;; ('/[Gmail].all' . ?a)))

;; ;; allow for updating mail using 'U' in the main view:
;; (setq mu4e-get-mail-command 'offlineimap')

;; (setq mu4e-get-mail-command 'getmail'
;; mu4e-update-interval 300
;; mu4e-attachment-dir '~/Downloads')
;; (setq
;; user-mail-address 'email@domain'
;; user-full-name 'your full name')
;;message-signature
;;(concat
;;'overdrive (Your Full Name)\n'
;;'Email: email@domain\n'
;;'Blog: www.blackhats.es\n'
;;'Douban: www.linkedin.com/in/YOURUSERNAME'
;; '\n'))

;(setq message-kill-buffer-on-exit t)

;(setq
; mu4e-view-show-images t
; mu4e-view-image-max-width 800)

;(setq mu4e-compose-dont-reply-to-self t)

;(add-hook 'mu4e-compose-mode-hook (lambda () (buffer-face-set 'bold-italic)))

;;; Org mode compatibility

;; Use `org-store-link' to store links, and `org-insert-link' to paste them

;;(require 'org-mu4e)

;; sending mail -- replace USERNAME with your gmail username
;; also, make sure the gnutls command line utils are installed
;; package 'gnutls-bin' in Debian/Ubuntu

;;(require 'smtpmail)
;; (setq message-send-mail-function 'smtpmail-send-it
;; starttls-use-gnutls t
;; smtpmail-starttls-credentials '(('smtp.gmail.com' 587 nil nil))
;; smtpmail-auth-credentials
;; '(('smtp.gmail.com' 587 'renws1990@gmail.com' nil))
;; smtpmail-default-smtp-server 'smtp.gmail.com'
;; smtpmail-smtp-server 'smtp.gmail.com'
;; smtpmail-smtp-service 587)

;; don't keep message buffers around
;; (setq message-kill-buffer-on-exit t)

;; (setq mu4e-refile-folder
;; (lambda (msg)
;; (cond

;; messages to the mu mailing list go to the /mu folder
;; ((mu4e-message-contact-field-matches msg :to
;; 'ADDRESS')
;; '/FOLDER')

;; messages with football or soccer in the subject go to /football
;; ((string-match 'PATTERN\\|PATTERN'
;; (mu4e-message-field msg :subject))
;; '/FOLDER')

;; messages sent by me go to the sent folder
;; ((find-if
;; (lambda (addr)
;; (mu4e-message-contact-field-matches msg :from addr))
;; mu4e-user-mail-address-list)
;; mu4e-sent-folder)
;; ;; everything else goes to /archive
;; ;; important to have a catch-all at the end!
;; (t '/archive'))))

;; ;; MAILDIRS EXTENSION
;; (add-to-list 'load-path '/home/LOGIN/.emacs.d/mu4e-maildirs-extension')
;; (require 'mu4e-maildirs-extension)
;; (mu4e-maildirs-extension)
;; mu4e-maildirs-extension-parse '/Maildir')

;;----------------------------------------------------------
;; GNUS dired with mu4e
;;----------------------------------------------------------

;; Attaching files with C-c <RET> C-a

;; (require 'gnus-dired)
;; ;; make the `gnus-dired-mail-buffers' function also work on
;; ;; message-mode derived modes, such as mu4e-compose-mode
;; (defun gnus-dired-mail-buffers ()
;; 'Return a list of active message buffers.'
;; (let (buffers)
;; (save-current-buffer
;; (dolist (buffer (buffer-list t))
;; (set-buffer buffer)
;; (when (and (derived-mode-p 'message-mode)
;; (null message-sent-message-via))
;; (push (buffer-name buffer) buffers))))
;; (nreverse buffers)))

;; (setq gnus-dired-mail-mode 'mu4e-user-agent)
;; (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)

;; ;; Viewing inline images
;; ;; enable inline images
;; (setq mu4e-view-show-images t)
;; ;; use imagemagick, if available
;; (when (fboundp 'imagemagick-register-types)
;; (imagemagick-register-types))

;;----------------------------------------------------------
;; LaTeX preview
;;----------------------------------------------------------

;; Latex preview inside emacs intead okular or any ext app:
;(add-hook 'doc-view-mode-hook
; 'auto-revert-mode)
(setq text-mode-hook '(lambda() (flyspell-mode t) ))
(add-hook 'LaTeX-mode-hook 'flyspell-mode)

; Preview in the next frame constantly
;(add-hook 'LaTeX-mode-hook 'latex-preview-pane-mode)

(add-hook 'LaTeX-mode-hook
(lambda()
(local-set-key [C-tab] 'TeX-complete-symbol)))
(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.
'(erc-input-face ((t (:foreground "medium spring green"))))
'(erc-my-nick-face ((t (:foreground "red" :weight bold)))))
;; Hack mode, you would need to remove one parenthesis from the top and disable the next line
;;'(erc-notice-face ((t (:foreground "green" :weight bold)))))

;;----------------------------------------------------------
;; org-protocol
;;----------------------------------------------------------

(server-start)
(require 'org-protocol)

;; (setq org-protocol-default-template-key 'l')
;; (setq org-capture-templates
;; '(('t' 'Todo' entry (file+headline 'Dropbox/LIPT/tasks.org' 'Tasks')
;; '* TODO %?\n %i\n %a')
;; ('l' 'Link' entry (file+olp 'Dropbox/LIPT/tasks.org' 'Web Links')
;; '* %a\n %?\n %i')
;; ('j' 'Journal' entry (file+datetree 'ALL/notes/journal.org')
;; '* %?\nEntered on %U\n %i\n %a')))
(setq org-capture-templates
(quote (("r" "Reference" entry (file "Dropbox/LIPT/bookmarks.org")
"* %?\n\n%u\n" )
("f" "Firefox" entry (file "Dropbox/LIPT/bookmarks.org")
"* %c%?\n" )
)))

;;----------------------------------------------------------
;; Special characters
;;----------------------------------------------------------

; Decode chars
; Eg. C-x 8 _ 2 (sub script 2)
; Eg. C-x 8 ^ 2 (super script 2)
(require 'iso-transl)

(iso-transl-define-keys
`(("^0" . ,(vector (decode-char 'ucs #x2070)))
("^4" . ,(vector (decode-char 'ucs #x2074))) ; 1-3 already defined
("^5" . ,(vector (decode-char 'ucs #x2075)))
("^6" . ,(vector (decode-char 'ucs #x2076)))
("^7" . ,(vector (decode-char 'ucs #x2077)))
("^8" . ,(vector (decode-char 'ucs #x2078)))
("^9" . ,(vector (decode-char 'ucs #x2079)))
("^+" . ,(vector (decode-char 'ucs #x207A)))
("^-" . ,(vector (decode-char 'ucs #x207B)))
("^=" . ,(vector (decode-char 'ucs #x207C)))
("^(" . ,(vector (decode-char 'ucs #x207D)))
("^)" . ,(vector (decode-char 'ucs #x207E)))
("_0" . ,(vector (decode-char 'ucs #x2080)))
("_1" . ,(vector (decode-char 'ucs #x2081)))
("_2" . ,(vector (decode-char 'ucs #x2082)))
("_3" . ,(vector (decode-char 'ucs #x2083)))
("_4" . ,(vector (decode-char 'ucs #x2084)))
("_5" . ,(vector (decode-char 'ucs #x2085)))
("_6" . ,(vector (decode-char 'ucs #x2086)))
("_7" . ,(vector (decode-char 'ucs #x2087)))
("_8" . ,(vector (decode-char 'ucs #x2088)))
("_9" . ,(vector (decode-char 'ucs #x2089)))
("_+" . ,(vector (decode-char 'ucs #x208A)))
("_-" . ,(vector (decode-char 'ucs #x208B)))
("_=" . ,(vector (decode-char 'ucs #x208C)))
("_(" . ,(vector (decode-char 'ucs #x208D)))
("_)" . ,(vector (decode-char 'ucs #x208E)))))

;; Greek letters
;; by default can be done with C-c C-x \ GREEK_LETTER (use TAB)
;; Just type e.g.:
;; M-g a to write alpha
;; M-g b to write beta
(global-set-key (kbd "M-g a") "α")
(global-set-key (kbd "M-g b") "β")
(global-set-key (kbd "M-g g") "γ")
(global-set-key (kbd "M-g d") "δ")
(global-set-key (kbd "M-g e") "ε")
(global-set-key (kbd "M-g z") "ζ")
(global-set-key (kbd "M-g h") "η")
(global-set-key (kbd "M-g q") "θ")
(global-set-key (kbd "M-g i") "ι")
(global-set-key (kbd "M-g k") "κ")
(global-set-key (kbd "M-g l") "λ")
(global-set-key (kbd "M-g m") "μ")
(global-set-key (kbd "M-g n") "ν")
(global-set-key (kbd "M-g x") "ξ")
(global-set-key (kbd "M-g o") "ο")
(global-set-key (kbd "M-g p") "π")
(global-set-key (kbd "M-g r") "ρ")
(global-set-key (kbd "M-g s") "σ")
(global-set-key (kbd "M-g t") "τ")
(global-set-key (kbd "M-g u") "υ")
(global-set-key (kbd "M-g f") "ϕ")
(global-set-key (kbd "M-g j") "φ")
(global-set-key (kbd "M-g c") "χ")
(global-set-key (kbd "M-g y") "ψ")
(global-set-key (kbd "M-g w") "ω")
(global-set-key (kbd "M-g A") "Α")
(global-set-key (kbd "M-g B") "Β")
(global-set-key (kbd "M-g G") "Γ")
(global-set-key (kbd "M-g D") "Δ")
(global-set-key (kbd "M-g E") "Ε")
(global-set-key (kbd "M-g Z") "Ζ")
(global-set-key (kbd "M-g H") "Η")
(global-set-key (kbd "M-g Q") "Θ")
(global-set-key (kbd "M-g I") "Ι")
(global-set-key (kbd "M-g K") "Κ")
(global-set-key (kbd "M-g L") "Λ")
(global-set-key (kbd "M-g M") "Μ")
(global-set-key (kbd "M-g N") "Ν")
(global-set-key (kbd "M-g X") "Ξ")
(global-set-key (kbd "M-g O") "Ο")
(global-set-key (kbd "M-g P") "Π")
(global-set-key (kbd "M-g R") "Ρ")
(global-set-key (kbd "M-g S") "Σ")
(global-set-key (kbd "M-g T") "Τ")
(global-set-key (kbd "M-g U") "Υ")
(global-set-key (kbd "M-g F") "Φ")
(global-set-key (kbd "M-g J") "Φ")
(global-set-key (kbd "M-g C") "Χ")
(global-set-key (kbd "M-g Y") "Ψ")
(global-set-key (kbd "M-g W") "Ω")

;;----------------------------------------------------------
;; Robot framework
;;----------------------------------------------------------

(load-file "~/.emacs.d/robot-mode/robot-mode.el")
(require 'robot-mode)

;;----------------------------------------------------------
;; Python Development Setup
;;----------------------------------------------------------

;; Enable elpy
;(require 'elpy)
;(elpy-enable)

;; Use IPython for REPL

;; (setq python-shell-interpreter 'jupyter'
;; python-shell-interpreter-args 'console --simple-prompt'
;; python-shell-prompt-detect-failure-warning nil)
;; (add-to-list 'python-shell-completion-native-disabled-interpreters
;; 'jupyter')

;; Enable Flycheck
(when (require 'flycheck nil t)
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode))

;; Enable autopep8
;; (require 'py-autopep8)
;; (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)

;(require 'carbon-font)
;(fixed-width-set-default-fontset
; "-apple-inconsolata-medium-r-normal--14-*-*-*-*-*-iso10646-1")

;; ---------------------------------------------------------------------------
;; Color theme
;; ---------------------------------------------------------------------------

;;(add-to-list 'custom-theme-load-path
;; (file-name-as-directory "/home/LOGIN/.emacs.d/replace-colorthemes"))

;;(load-theme 'oswald t t)
;;(enable-theme 'oswald)

;;(set-default-font "Terminus-12")
;(set-default-font 'set-default-font "-xos4-terminus-bold-r-normal--12-120-72-72-c-60-iso8859-15")
(setq default-frame-alist '((top . 22) (left . 685) (width . 83) (height . 52)))
;(add-to-list 'default-frame-alist '(font . "-xos4-terminus-bold-r-normal--16-120-72-72-c-60-iso8859-15"))

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0_2")
(require 'color-theme)
(color-theme-initialize)
(color-theme-tty-dark)

; Other cool themes
;(color-theme-charcoal-personal)
;(color-theme-hober2)
;(color-theme-blackboard)
;(color-theme-tomtt)
;(color-theme-twilight)
;(color-theme-dark-erc)
;(color-theme-goldenrod)
;(color-theme-less)
;(color-theme-subdued)
;(color-theme-akk)

;; ---------------------------------------------------------------------------
;; Advanced highlight (see also 'highlight' section)
;; ---------------------------------------------------------------------------

;(setq search-highlight t) ; Highlight search object
;(setq query-replace-highlight t) ; Highlight query object
(setq mouse-sel-retain-highlight t) ; Keep mouse high-lightening
(set-face-background 'region "red") ; Set region background color
(set-face-foreground 'region "black") ; Set region foreground color
; next to rows fails for some reason on 27.10.2018
;(set-face-background 'isearch-lazy-highlight-face "yellow") ; Set isearch background color
;(set-face-foreground 'isearch-lazy-highlight-face "black") ; Set isearch foreground color
(set-face-background 'isearch "white") ; Set highlight background color
(set-face-foreground 'isearch "black") ; Set highlight foreground color
; blue-white
; green-black

; Disabled for a moment
(set-face-background 'modeline "blue")
(set-face-foreground 'modeline "white")
(set-face-background 'mode-line-buffer-id "blue")
(set-face-foreground 'mode-line-buffer-id "white")
(set-face-foreground 'which-func "white")
(set-face-background 'which-func "blue")

;; Overwrite the modeline theme BUG FOUND!
(set-face-background 'mode-line-buffer-id "grey")
(set-face-foreground 'mode-line-buffer-id "black")

;; Test change modeline (CORRECT) - Conflicting with previous set-face-background and foreground
(set-face-background 'modeline "dark slate blue")
(set-face-foreground 'modeline "White")

; hacker mode
;(add-to-list 'default-frame-alist '(foreground-color . "green"))
;(add-to-list 'default-frame-alist '(background-color . "black"))

;; M-x list-faces-display
;; will show difference faces available

Leave a Reply

You must be logged in to post a comment.