Jun 22

.emacs

Tag: admin @ 12:24 am

Las secciones 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:

;; —————————————————————————
;; File: .emacs
;; Author: Borja <user.name@member.fsf.org>
;; Description: emacs configuration file
;; —————————————————————————
;;
;;            /–> Major (Global change)
;;           /
;;          /     /–> Emacs version
;;         /    /
;; Version 0.4(23)l –> Platform version
;;            \
;;              \-> Minor (Local change)
;;
;; Major could be:
;;  ==> 0 (stable)
;;  ==> 1 (unstable)
;;
;; Minor could be:
;;  ==> 1 (release)
;;  ==> 2 (current)
;;
;; Emacs version:
;;  ==> 21 (Emacs 21)
;;  ==> 22 (Emacs 22)
;;  ==> 23 (Emacs 23)
;;
;; Platform version:
;;  ==> l (Linux)
;;  ==> n (netbsd)
;;  ==> o (openbsd)
;;  ==> w (windows)
;;  ==> x (os x)
;;
;; Last summary changelog: 0.3(23)-l – 0.4(23)-l
;;  ==> Ported wombat theme
;
;; —————————————————————————
;; Configuration variables
;; —————————————————————————
;; system-type could be:
;;  -> gnu/linux
;;  -> windows-nt
;;  -> darwin
;
;; —————————————————————————
;; 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)
(“\\.ml\\’” . lisp-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.
;; Unnaproved (too long, use calendar)
;;(setq display-time-day-and-date t )
;; Unnaproved (too long, replace by short format)
;;(setq display-time-24hr-format t)
;;(display-time)
(display-time-mode 1)
;; The mode line (bar at the bottom)
;; ENABLE ONLY WITHOUT COLOR-THEMES (IF NOT WE ARE CHANING SOMETIMES THE MODELINE)
;; (add-hook ‘font-lock-mode-hook
;;           ‘(lambda ()
;;              (set-face-background ‘modeline               “White”)
;;              (set-face-foreground ‘modeline               “Blue”)
;; ))
;; IMPORTANT: Modeline format has problems with ERC mode, we should not modify
;; Testing phase (unnaproved change)
;;
;; Modeline format (put in order parameters shown in modeline)
;; (setq-default mode-line-format
;;       (list “-”
;;          ’mode-line-modified
;;          ’mode-line-frame-identification
;;          ’mode-line-buffer-identification
;;                  ’which-func-format
;;            ’(line-number-mode “–L%l–”)
;;          ’(column-number-mode “C%c–”)
;;          ’”P%p–”
;;          ’”( ” mode-name ” /” minor-mode-alist ” )   “
;;          ’global-mode-string
;;       )
;; )
; [Disabled] Test change modeline
;(set-face-background ‘modeline               “dark slate blue”)
;(set-face-foreground ‘modeline               “White”)
;
;; —————————————————————————
;; 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 ‘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)))))
; TAB = Autocompletion (smarttab)
; Intro = INTRO + indentation (mapped function to keybinding)
; M-TAB = complete-symbol (dabbrev – uses ETAGS)
(define-key global-map (kbd “RET”) ‘newline-and-indent)
(define-key lisp-mode-map (kbd “TAB”) ‘lisp-complete-symbol)
;
;; —————————————————————————
;; Mail / Mailings / News (GNUS)
;; —————————————————————————
;; POP3 configuration [Disabled]
;; Reason: We have had problems with the configuration and not info available
;; (pop :server “pop3.gmail.com” :user: “user.name”)
;; IMAP configuration
(setq gnus-select-method
‘(nnimap “imap.gmail.com”
(nnimap-address “imap.gmail.com”)
(nnimap-server-port 993)
(nnimap-stream ssl)
(nnimap-authinfo-file “~/.authinfo”)
;;        nnimap-split-inbox ‘(“INBOX”) ;; THIS LINE BLOCK GMAIL?
;; “G e” and editing the select method for “nnimap+personal:INBOX”
;; Referring to user.name@gmail.com (personal account)
;; (nnimap “personal”
;;       (nnimap-address “imap.gmail.com”)
;;       (nnimap-directory “~/Mail/var/nnimap/personal”))
;; “G e” and editing the select method for “nnimap+technical:INBOX”
;; Referring to user.name@gmail.com (technical account)
;; (nnimap “technical”
;;       (nnimap-address “imapgmail”)
;;       (nnimap-directory “~/Mail/var/nnimap/technical”))
))
; Require NNIR
;(require ‘nnir)
; Secondary account
;; (add-to-list ‘gnus-secondary-select-methods ‘(nnimap “imap.gmail.com”
;;     (nnimap-stream ssl)
;;     (nnimap-address “imap.gmail.com”)
;;     (nnimap-server-port 993)
;;                    (nnimap-authinfo-file “~/.authinfo2″)
;;     (nnir-search-engine imap)))
;; IMAP troubleshooting with GMAIL
;; Please refer to: http://www.emacswiki.org/emacs/GnusGmail
;; Steps to avoid problems with gnus gmail with imap servers as
;; sometimes flags are not set correctly depending of:
;;
;; A) If Gnus agent is enabled
;; B) If gmail groups are not added following some specific steps
;;
;; A) To disable gnus agent there are 2 options:
;; ———————————————
;; 1) Adding this line to .emacs or .gnus
;;(setq gnus-agent nil)
;; 2) Disabling by hand gnus agent for some specific server.
;;    A) M-x gnus
;;    B) In main gnu menu press ^ to go to the *Server* buffer list.
;;    C) Over gmail imap server press J r.
;;
;; B) Steps required for adding gmail groups and avoid problems
;; ———————————————
;;    A) M-x gnus
;;    B) In main gnu menu press S s and add required groups.
;;    C) After that, put the cursor over each new group.
;;    D) Press G c and press DONE.
;;    E) Repeat C and D steps for each new group.
;; REM TO COMMENT
(setq nnmail-crosspost nil)
(global-set-key “\C-xm” ‘gnus-group-mail)
(global-set-key “\C-x4m” ‘gnus-group-mail) ;;; doesn’t get another window but TOUGH for now!
;; REM TO COMMENT
(setq gnus-treat-buttonize t)
;; Sort thread by date and never sort by score
(setq gnus-thread-sort-functions
‘(
;; Interesting option: sort by number [but disabled]
;;        gnus-thread-sort-by-number
gnus-thread-sort-by-date
(not gnus-thread-sort-by-total-score)))
;; Always display empty topics
(add-hook ‘gnus-group-mode-hook ‘gnus-topic-mode)
;; Tunning gnus summary line format and topic format
;; This is for email list
(setq gnus-summary-line-format “%U%R%[%4k%] MSG:%0.3N – %d %B (%s) `%a`\n”)
;; This is for topic list
(setq gnus-topic-line-format “%i%([ %n -- %A ]%)%v\n”)
;; SMTP configuration
(require ‘smtpmail)
(setq mail-from-style’angles
;`user-full-name <user-mail-address>’
user-mail-address “user.name@member.fsf.org”
send-mail-function ‘smtpmail-send-it
message-send-mail-function ‘smtpmail-send-it
smtpmail-smtp-server “smtp.gmail.com”
smtpmail-smtp-service 587
smtpmail-debug-info t
;; New conf.
user-full-name “Borja”
user-mail-address “user.name@member.fsf.org”
smtpmail-debug-verb t
fetchflag “\\Seen”
;; Signature [Disabled]
; message-signature-file “~/emacs/signature”
smtpmail-starttls-credentials ‘((“smtp.gmail.com” 587 nil
nil))
smtpmail-auth-credentials ‘((“smtp.gmail.com” 587
“user.name@gmail.com” nil)))
;; Use smtp with SSL
(setq smtpmail-use-starttls t)
;; GNUS Filters
;;
;; IMPORTANT: apply filters in gmail.com directly to gain time
;; but remember that email filters not always are enough powerfull
;; as mails are filtered ALWAYS following alphabetically order
;; and some emails could match with more than ONE group for some reason
;;
;; Filters applied locally (slow)
;; ——————————
;; TODO: list id does not works with GMAIL, replace by To and Cc rules…
(setq nnimap-split-inbox “INBOX”
nnimap-split-rule
‘(
;; ** PLEASE READ CAREFULLY **
;; Local split rules
;; This is required if you don’t want to split mails in server side for
;; gmail or other clients, but in gmail List-id does not works for some
;; weird reason, so we need to check To or Cc fields. Why this is required?
;; because gmail cannot apply rules in some priority order, only alphabetically
;; also filter this in local, means *SLOW* download messages.
;; Remember that locally is saved a nnimap cache, so when it is filtered the
;; first time, same message is not filtered again if you add a new rule that match
(“Active” “^To:.*user.name@gmail.com”)
(“Active” “^Cc:.*user.name@gmail.com”)
(“GNU/emacs-bug-tracker” “^To:.*emacs-bug-tracker@gnu.org”)
(“GNU/emacs-bug-tracker” “^Cc:.*emacs-bug-tracker@gnu.org”)
(“GNU/emacs-bug-gnu-emacs” “^To:.*bug-gnu-emacs@gnu.org”)
(“GNU/emacs-bug-gnu-emacs” “^Cc:.*bug-gnu-emacs@gnu.org”)
(“GNU/emacs-bug-gnu-emacs” “^To:.*emacs-pretest-bug@gnu.org”)
(“GNU/emacs-bug-gnu-emacs” “^Cc:.*emacs-pretest-bug@gnu.org”)
(“GNU/emacs-bug-gnu-emacs” “^To:.*@emacsbugs.donarmstrong.com”)
(“GNU/emacs-bug-gnu-emacs” “^Cc:.*@emacsbugs.donarmstrong.com”)
(“GNU/emacs-bug-gnu-emacs” “^From:.*owner@emacsbugs.donarmstrong.com”)
(“GNU/emacs-bidi” “^To:.*emacs-bidi@gnu.org”)
(“GNU/emacs-bidi” “^Cc:.*emacs-bidi@gnu.org”)
(“GNU/emacs-commit” “^To:.*emacs-commit@gnu.org”)
(“GNU/emacs-commit” “^Cc:.*emacs-commit@gnu.org”)
(“GNU/emacs-diffs” “^To:.*emacs-diffs@gnu.org”)
(“GNU/emacs-diffs” “^Cc:.*emacs-diffs@gnu.org”)
(“GNU/emacs-help-gnu-emacs” “^To:.*help-gnu-emacs@gnu.org”)
(“GNU/emacs-help-gnu-emacs” “^Cc:.*help-gnu-emacs@gnu.org”)
(“GNU/emacs-info-gnu-emacs” “^To:.*info-gnu-emacs@gnu.org”)
(“GNU/emacs-info-gnu-emacs” “^Cc:.*info-gnu-emacs@gnu.org”)
(“GNU/emacs-devel” “^To:.*emacs-devel@gnu.org”)
(“GNU/emacs-devel” “^Cc:.*emacs-devel@gnu.org”)
(“GNU/emacs-es” “^To:.*emacs-es@gnu.org”)
(“GNU/emacs-es” “^Cc:.*emacs-es@gnu.org”)
(“Gnus” “^To:.*info-gnus-english@gnu.org”)
(“Gnus” “^Cc:.*info-gnus-english@gnu.org”)
(“Stump” “^To:.*stumpwm-devel@nongnu.org”)
(“Stump” “^Cc:.*stumpwm-devel@nongnu.org”)
(“OpenBSD-advocacy” “^To:.*advocacy@openbsd.org”)
(“OpenBSD-advocacy” “^Cc:.*advocacy@openbsd.org”)
(“OpenBSD-announce” “^To:.*announce@openbsd.org”)
(“OpenBSD-announce” “^Cc:.*announce@openbsd.org”)
(“OpenBSD-security-announce” “^To:.*security-announce@openbsd.org”)
(“OpenBSD-security-announce” “^Cc:.*security-announce@openbsd.org”)
(“OpenBSD-bugs” “^To:.*bugs@openbsd.org”)
(“OpenBSD-bugs” “^Cc:.*bugs@openbsd.org”)
(“OpenBSD-bugs” “^To:.*bugs@cvs.openbsd.org”)
(“OpenBSD-bugs” “^Cc:.*bugs@cvs.openbsd.org”)
(“OpenBSD-source-changes” “^To:.*source-changes@openbsd.org”)
(“OpenBSD-source-changes” “^Cc:.*source-changes@openbsd.org”)
(“OpenBSD-source-changes” “^To:.*source-changes@cvs.openbsd.org”)
(“OpenBSD-source-changes” “^Cc:.*source-changes@cvs.openbsd.org”)
(“OpenBSD-source-changes” “^To:.*gnats@openbsd.org”)
(“OpenBSD-source-changes” “^Cc:.*gnats@openbsd.org”)
(“OpenBSD-misc” “^To:.*misc@openbsd.org”)
(“OpenBSD-misc” “^Cc:.*misc@openbsd.org”)
(“OpenBSD-ports” “^To:.*ports@openbsd.org”)
(“OpenBSD-ports” “^Cc:.*ports@openbsd.org”)
(“OpenBSD-ports” “^To:.*ports-changes@cvs.openbsd.org”)
(“OpenBSD-ports” “^Cc:.*ports-changes@cvs.openbsd.org”)
(“OpenBSD-ports-bugs” “^To:.*ports-bugs@openbsd.org”)
(“OpenBSD-ports-bugs” “^Cc:.*ports-bugs@openbsd.org”)
(“OpenBSD-ports-security” “^To:.*ports-security@openbsd.org”)
(“OpenBSD-ports-security” “^Cc:.*ports-security@openbsd.org”)
(“OpenBSD-ports-changes” “^To:.*ports-changes@openbsd.org”)
(“OpenBSD-ports-changes” “^Cc:.*ports-changes@openbsd.org”)
(“OpenBSD-ports-changes” “^To:.*ports-changes@cvs.openbsd.org”)
(“OpenBSD-ports-changes” “^Cc:.*ports-changes@cvs.openbsd.org”)
(“OpenBSD-tech” “^To:.*tech@openbsd.org”)
(“OpenBSD-tech” “^Cc:.*tech@openbsd.org”)
(“OpenBSD-www” “^To:.*www@openbsd.org”)
(“OpenBSD-www” “^Cc:.*www@openbsd.org”)
(“OpenBSD-x11″ “^To:.*x11@openbsd.org”)
(“OpenBSD-x11″ “^Cc:.*x11@openbsd.org”)
(“OpenBSD-ipv6″ “^To:.*ipv6@openbsd.org”)
(“OpenBSD-ipv6″ “^Cc:.*ipv6@openbsd.org”)
(“OpenBSD-smp” “^To:.*smp@openbsd.org”)
(“OpenBSD-smp” “^Cc:.*smp@openbsd.org”)
(“OpenBSD-mexico” “^To:.*OpenBSD-Mexico@googlegroups.com”)
(“OpenBSD-mexico” “^Cc:.*OpenBSD-Mexico@googlegroups.com”)
(“GNU/libstdc++” “^To:.*libstdc++-help@gcc.gnu.org”)
(“GNU/libstdc++” “^Cc:.*libstdc++-help@gcc.gnu.org”)
(“GNU/libstdc++” “^To:.*libstdc++@gcc.gnu.org”)
(“GNU/libstdc++” “^Cc:.*libstdc++@gcc.gnu.org”)
(“GNU/gcc-help” “^To:.*gcc-help@gnu.org”)
(“GNU/gcc-help” “^Cc:.*gcc-help@gnu.org”)
(“GNU/gcc-help” “^To:.*gcc-help@gcc.gnu.org”)
(“GNU/gcc-help” “^Cc:.*gcc-help@gcc.gnu.org”)
(“GNU/gcc” “^To:.*gcc@gnu.org”)
(“GNU/gcc” “^Cc:.*gcc@gnu.org”)
(“GNU/gcc” “^To:.*gcc@gcc.gnu.org”)
(“GNU/gcc” “^Cc:.*gcc@gcc.gnu.org”)
(“GNU/gcc” “^To:.*gcc-patches@gcc.gnu.org”)
(“GNU/gcc” “^Cc:.*gcc-patches@gcc.gnu.org”)
(“GNU/g++” “^To:.*help-gplusplus@gnu.org”)
(“GNU/g++” “^Cc:.*help-gplusplus@gnu.org”)
(“POSIX-threads” “^To:.*c++-pthreads@codesourcery.com”)
(“POSIX-threads” “^Cc:.*c++-pthreads@codesourcery.com”)
(“Lang-asm” “^To:.*comp.lang.asm@googlegroups.com”)
(“Lang-asm” “^Cc:.*comp.lang.asm@googlegroups.com”)
(“Lang-c” “^To:.*comp.lang.c@googlegroups.com”)
(“Lang-c” “^Cc:.*comp.lang.c@googlegroups.com”)
(“Lang-c++” “^To:.*comp.lang.c++@googlegroups.com”)
(“Lang-c++” “^Cc:.*comp.lang.c++@googlegroups.com”)
(“Lang-c++” “^Subject:.*comp.lang.c++*”)
(“GNU/make” “^To:.*help-make@gnu.org”)
(“GNU/make” “^Cc:.*help-make@gnu.org”)
(“GNU/autoconf” “^To:.*autoconf@gnu.org”)
(“GNU/autoconf” “^Cc:.*autoconf@gnu.org”)
(“GNU/automake” “^To:.*automake@gnu.org”)
(“GNU/automake” “^Cc:.*automake@gnu.org”)
(“GNU/binutils” “^To:.*binutils-help@sourceware.org”)
(“GNU/binutils” “^Cc:.*binutils-help@sourceware.org”)
(“GNU/binutils” “^To:.*binutils@sourceware.org”)
(“GNU/binutils” “^Cc:.*binutils@sourceware.org”)
(“GNU/binutils” “^To:.*binutils@sources.redhat.com”)
(“GNU/binutils” “^Cc:.*binutils@sources.redhat.com”)
(“GIT” “^To:.*git@gnu.org”)
(“GIT” “^Cc:.*git@gnu.org”)
(“GIT” “^To:.*vger@kernel.org”)
(“GIT” “^Cc:.*vger@kernel.org”)
(“GIT” “^To:.*git@vger.kernel.org”)
(“GIT” “^Cc:.*git@vger.kernel.org”)
(“GNU/screen-devel” “^To:.*screen-devel@gnu.org”)
(“GNU/screen-devel” “^Cc:.*screen-devel@gnu.org”)
(“GNU/screen-users” “^To:.*screen-users@gnu.org”)
(“GNU/screen-users” “^Cc:.*screen-users@gnu.org”)
(“NetBSD-kern” “^To:.*tech-kern@netbsd.org”)
(“NetBSD-kern” “^Cc:.*tech-kern@netbsd.org”)
(“NetBSD-net” “^To:.*tech-net@netbsd.org”)
(“NetBSD-net” “^Cc:.*tech-net@netbsd.org”)
(“Blackhat” “^To:.*@blackhat-whitehat.com”)
(“Blackhat” “^Cc:.*@blackhat-whitehat.com”)
;; ***************************
;; ** PLEASE READ CAREFULLY **
;; ***************************
;; List-id split rules (only works on gmail server side with gmail account)
;; but it works fine with other IMAP servers
;; (“GNU/emacs-bug-tracker” “^List-Id:.*emacs-bug-tracker\\.gnu.org”)
;; (“GNU/emacs-bug-gnu-emacs” “^List-Id:.*bug-gnu-emacs\\.gnu.org”)
;; (“GNU/emacs-bidi” “^List-Id:.*emacs-bidi\\.gnu.org”)
;; (“GNU/emacs-commit” “^List-Id:.*emacs-commit\\.gnu.org”)
;; (“GNU/emacs-diffs” “^List-Id:.*emacs-diffs\\.gnu.org”)
;; (“GNU/emacs-help-gnu-emacs” “^List-Id:.*help-gnu-emacs\\.gnu.org”)
;; (“GNU/emacs-info-gnu-emacs” “^List-Id:.*info-gnu-emacs\\.gnu.org”)
;; (“GNU/emacs-devel” “^List-Id:.*emacs-devel\\.gnu.org”)
;; (“GNU/emacs-es” “^List-Id:.*emacs-es\\.es\\.gnu\\.org”)
;; (“Gnus” “^List-Id:.*info-gnus-english\\.gnu\\.org”)
;; (“OpenBSD-advocacy” “^List-Id:.*advocacy\\.openbsd.org”)
;; (“OpenBSD-announce” “^List-Id:.*announce\\.openbsd.org”)
;; (“OpenBSD-security-announce” “^List-Id:.*security-announce\\.openbsd.org”)
;; (“OpenBSD-bugs” “^List-Id:.*bugs\\.openbsd.org”)
;; (“OpenBSD-source-changes” “^List-Id:.*source-changes\\.openbsd.org”)
;; (“OpenBSD-source-changes” “^To:.*gnats@openbsd.org”)
;; (“OpenBSD-source-changes” “^Cc:.*gnats@openbsd.org”)
;; (“OpenBSD-misc” “^List-Id:.*misc\\.openbsd.org”)
;; (“OpenBSD-ports” “^List-Id:.*ports\\.openbsd.org”)
;; (“OpenBSD-ports-bugs” “^List-Id:.*ports-bugs\\.openbsd.org”)
;; (“OpenBSD-ports-security” “^List-Id:.*ports-security\\.openbsd.org”)
;; (“OpenBSD-ports-changes” “^List-Id:.*ports-changes\\.openbsd.org”)
;; (“OpenBSD-tech” “^List-Id:.*tech\\.openbsd.org”)
;; (“OpenBSD-www” “^To:.*www\\.openbsd.org”)
;; (“OpenBSD-www” “^Cc:.*www\\.openbsd.org”)
;; (“OpenBSD-www” “^List-Id:.*www\\.openbsd.org”)
;; (“OpenBSD-x11″ “^List-Id:.*x11\\.openbsd.org”)
;; (“OpenBSD-ipv6″ “^List-Id:.*ipv6\\.openbsd.org”)
;; (“OpenBSD-smp” “^List-Id:.*smp\\.openbsd.org”)
;; (“OpenBSD-mexico” “^List-Id:.*OpenBSD-Mexico\\.googlegroups.com”)
;; (“GNU/libstdc++” “^List-Id:.*libstdc++-help\\.gcc\\.gnu\\.org”)
;; (“GNU/gcc-help” “^List-Id:.*gcc-help\\.gnu\\.org”)
;; (“GNU/gcc” “^List-Id:.*gcc\\.gnu\\.org”)
;; (“GNU/g++” “^List-Id:.*help-gplusplus\\.gnu\\.org”)
;; (“POSIX-threads” “^List-Id:.*c++-pthreads\\.codesourcery\\.com”)
;; (“Lang-asm” “^List-Id:.*comp.lang.asm\\.googlegroups.com”)
;; (“Lang-c” “^List-Id:.*comp.lang.c\\.googlegroups.com”)
;; (“Lang-c++” “^List-Id:.*comp.lang.c++\\.googlegroups.com”)
;; (“GNU/make” “^List-Id:.*help-make\\.gnu\\.org”)
;; (“GNU/autoconf” “^List-Id:.*autoconf\\.gnu\\.org”)
;; (“GNU/automake” “^List-Id:.*automake\\.gnu\\.org”)
;; (“GNU/binutils” “^List-Id:.*binutils-help\\.sourceware.org”)
;; (“GIT” “^List-Id:.*git\\.gnu.org”)
;; (“GIT” “^List-Id:.*vger\\.kernel.org”)
;; (“GNU/screen-devel” “^List-Id:.*screen-devel\\.gnu\\.org”)
;; (“GNU/screen-users” “^List-Id:.*screen-users\\.gnu\\.org”)
;; (“NetBSD-kern” “^List-Id:.*tech-kern\\.netbsd.org”)
;; (“NetBSD-net” “^List-Id:.*tech-net\\.netbsd.org”)
;; (“Blackhat” “^List-Id:.*\\.blackhat-whitehat\\.com”)
)
)
;; Save sent emails
(setq gnus-message-archive-group “sent-mail”)
;; Permanent topics
(add-hook ‘gnus-group-mode-hook ‘gnus-topic-mode)
;; Display empty topics
(setq gnus-topic-display-empty-topics t)
;; Display empty groups
(setq gnus-permanently-visible-groups “.*.*”)
(setq gnus-fetch-old-headers t)
(setq gnus-show-all-threads t)
(setq gnus-invalid-group-regexp “[:`'\"]\\|^$”)
;; Display images in gnus for attached emails
;; Note: Press ‘X m’ to extract all parts of the message and save them as files
(setq mm-inline-text-html-with-images t)
;; Hack show GNUS (test phase)
;;  Test phase: FAILED
;;  Reason: Gnus is not working properly with wider windows than default and toggle-truncate-lines
;;
;; (setq gnus-thread-sort-functions
;;       ‘(gnus-thread-sort-by-number
;;  gnus-thread-sort-by-date
;;  gnus-thread-sort-by-total-score))
;; (setq gnus-summary-line-format
;;       “%U%R%z %d %I%(%[%-25,25n%]%) %s\n”)
;; (gnus-add-configuration
;;  ’(article
;;    (horizontal 1.0
;;         (vertical 60 (group 1.0))
;;         (vertical 1.0
;;     (summary 0.20 point)
;;     (article 1.0)))))
;; (gnus-add-configuration
;;  ’(summary
;;    (horizontal 1.0
;;         (vertical 60 (group 1.0))
;;         (vertical 1.0 (summary 1.0 point)))))
;; End of Hack show GNUS (test phase)
;
;; —————————————————————————
;; IRC / iMSN / Chat
;; —————————————————————————
;; ERC
(require ‘erc)
(setq erc-mode-line-format “%t %a”)
;; Enable sound in ERC
(require ‘erc-sound)
(erc-sound-enable)
;; ERC exclude events with lots of traffic
(setq erc-track-exclude
‘(“#emacs”
“#lisp”
“#scheme”))
;; ERC autojoin -multiple servers with multiple channels- [enabled]
(setq erc-autojoin-channels-alist
‘((“freenode.net” “#emacs-es” “#emacs” “#gnus” “#org-mode”)
(“irc-hispano.org” “#asm” “#c” “#c++” “#programacion” “#coders” “#hacking”)))
;; ERC Cloaking
(erc-autojoin-mode 0)
(add-hook ‘erc-server-NOTICE-functions ‘ted-post-cloak-autojoin)
(defun ted-post-cloak-autojoin (proc parsed)
“Autojoin iff NickServ tell us to.”
(with-current-buffer (process-buffer proc)
(when (and (string-equal “irc.freenode.net”
(erc-response.sender parsed))
(string-match “.*NickServ set your hostname to.*”
(erc-response.contents parsed)))
(erc-autojoin-channels erc-session-server (erc-current-nick))
nil)))
;; [Disabled] to avoid erc when emacs opened
;(erc :server “irc.freenode.net” :port 6667 :nick “overdrive”)
;(erc :server “irc-hispano.org” :port 6667 :nick “overdrive”)
;
;; —————————————————————————
;; 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
;    )
;)
;; Replaced GTK fonts size (above) by a fixed width font
;(set-frame-font “-*-fixed-*-*-*-*-13-*-*-*-*-*-*-*”) ;; THIS DOES NOT WORK
;(set-default-font “-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*”) ;; WITHOUT ABOVE LINE WORKING IS INSUFFICIENT
;(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”)))
;; Add in .Xdefaults these lines (after apt-get install xfonts-terminus):
;; emacs.font:terminus-10
;; 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 “529d2ff4b73d049252daadede971ffb9d1cfb21c”)
‘(ecb-options-version “2.40″)
; ‘(global-semantic-tag-folding-mode t nil (semantic-util-modes))
‘(semantic-idle-scheduler-idle-time 3)
‘(semantic-self-insert-show-completion-function (lambda nil (semantic-ia-complete-symbol-menu (point)))))
;
;; —————————————————————————
;; Development
;; —————————————————————————
;; 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)))
;; Initial size and position of frame and fixed width font
;(setq default-frame-alist ‘((top . 2) (left . 875) (width . 98) (height . 77)))
;(setq initial-frame-alist ‘((top . 2) (left . 70) (width . 98) (height . 77)))
;; For Apocalipsis computer with two widescreens 22″ (1680×1050 x 2 monitors) and terminus-10 font
(setq default-frame-alist ‘((top . 0) (left . 1680) (width . 207) (height . 72)))
(setq initial-frame-alist ‘((top . 0) (left . 0) (width . 207) (height . 72)))
;; Disabling menubar, toolbar and scrollbar
(menu-bar-mode -1)
;; [IMPORTANT] Disable scroll-bar-mode and tool-bar-mode when emacs without gtk support
;;            or unsupported options built.
(scroll-bar-mode -1)
(tool-bar-mode -1)
;; Show calendar on start up [Disabled]
;(calendar)
;
;; —————————————————————————
;; W3M (Browser)
;; —————————————————————————
;; [Disabled] w3m in macos
;(require ‘w3m)
;(add-to-list ‘load-path “/usr/local/share/emacs/site-lisp/w3m”)
(add-to-list ‘load-path “/home/overdrive/app/emacs-w3m”)
;(require ‘w3m-load)
(require ‘w3m)
;; New configuration w3m for OpenBSD
;(add-to-list ‘load-path “/usr/local/share/emacs/site-lisp/w3m”)
;(add-to-list ‘load-path “/usr/share/emacs/site-lisp/w3m/w3m.el”)
;; Load in window system
;(if window-system
;    (require ‘w3m-load)
;    (require ‘w3m-load)
;)
;; Display images automatically with w3m
(setq w3m-default-display-inline-images t)
;; Default browser when url is clicked
(setq browse-url-browser-function ‘w3m-browse-url)
;; Accept bad cookies
(setq w3m-cookie-accept-bad-cookies t)
;; Resize images, display large images, use cookies, html renderer, use cache
(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)
;; W3M Reverse color mode [Disabled hook as fixed in other way]
;; Hook : 1) destruction w3m
;;        2) switch between buffers
;;        3) switch to other mode
;;        4) more?
(defun w3m-reverse-color-mode ()
(set-background-color “White”)
(set-foreground-color “Black”)
)
(defun w3m-reverse-color-mode2()
(set-background-color “Green”)
(set-foreground-color “Black”)
)
;(add-hook ‘w3m-mode-hook ‘w3m-reverse-color-mode)
;(add-hook ‘kill-buffer-hook ‘w3m-reverse-color-mode2)
;; W3M auto new white frame [Enabled]
(defun black-on-white ()  [11:50]
(interactive)
(set-background-color “white”)
(set-foreground-color “black”))
(defun make-w3m-frame ()
(interactive)
(select-frame (make-frame))
(black-on-white)
(w3m))
(add-hook ‘w3m-mode-hook ‘make-w3m-frame)
;; [TODO] check if this line is from W3M section
(put ‘narrow-to-region ‘disabled nil)
;
;; —————————————————————————
;; Color theme
;; —————————————————————————
; [Enabled] temporary color-theme
(add-to-list ‘load-path “/home/overdrive/color-theme-6.6.0″)
(require ‘color-theme)
(color-theme-initialize)
; Disabled for Testin
(if (display-graphic-p)
;    (color-theme-subdued)
(color-theme-tty-dark)   ; X
(color-theme-wombat)) ; console
;; Top3 color-themes
;(color-theme-overdrive) ; for console
;(color-theme-tty-dark) ; for X
;(color-theme-wombat) ; both
;; Other interesting themes [Commentted]
;(color-theme-goldenrod)
;(color-theme-dark-erc)
;(color-theme-word-perfect)
;(color-theme-hober)
;(color-theme-matrix)
;(color-theme-black-on-gray)
;(color-theme-dark-blue)
;(color-theme-aalto-light)
;(color-theme-billw)
;(color-theme-subdued)
;(color-theme-akk)
;(color-theme-lethe)
;(color-theme-calm-forest)
;(color-theme-vim-colors)
;(color-theme-clarity)
; Favourite themes [Some of them require downloading 'by hand']
;(color-theme-charcoal-personal)
;(color-theme-hober2)
;(color-theme-blackboard)
;(color-theme-tomtt)
;(color-theme-twilight)
; Test change modeline
(set-face-background ‘modeline               “white”)
(set-face-foreground ‘modeline               “blue”)
;
;; —————————————————————————
;; 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)
;
;; —————————————————————————
;; XML RPC (required by openpaste)
;; —————————————————————————
(add-to-list ‘load-path “~/emacslisp”)
(require ‘xml-rpc)
;
;; —————————————————————————
;; Openpaste (script that pastes in openpaste some region)
;; —————————————————————————
;; ‘require’ is valid instead ‘autoload’, as autoload is not loading anything,
;; so it saves memory until it is used the function. So [Disabled] require.
(require ‘openpaste)
;(autoload ‘openpaste-region “openpaste”)
;; Set any key bind to openpaste [Disabled] as it is not critical
;; (setq openpaste-secret-key …opcional…)
;; Emacs list autocompletion functions [TODO]
;; All libc functions
;; `-> http://www.gnu.org/s/libc/manual/html_node/Function-Index.html
;; How to do it
;; `-> http://openpaste.org/17583/inline/
;
;; —————————————————————————
;; Yasnippet (template autocompletion, etc) from google
;; —————————————————————————
(add-to-list ‘load-path “~/emacslisp/yasnippet”)
(require ‘yasnippet)
(yas/initialize)
(yas/load-directory “~/emacslisp/yasnippet/snippets”)
;
;; —————————————————————————
;; 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]$”)
;
;; —————————————————————————
;; CEDET
;; —————————————————————————
(load-file “~/cedet-1.0pre6/common/cedet.el”) ;; Enable Project Management system
(global-ede-mode 1) ;; Enable prototype help and smart completion
(semantic-load-enable-code-helpers) ;; Enable template insertion menu
(global-srecode-minor-mode 1) ;; Enable SRECode
(global-semantic-show-parser-state-mode 1) ;; Enable semantic parser
;; Author CEDET conf
(semantic-load-enable-excessive-code-helpers)
(semantic-load-enable-semantic-debugging-helpers)
(setq senator-minor-mode-name “SN”)
(setq semantic-imenu-auto-rebuild-directory-indexes nil)
(global-semantic-mru-bookmark-mode 1)
(require ‘semantic-decorate-include)
;; GCC Setup
(require ‘semantic-gcc)
;; Smart completions
(require ‘semantic-ia)
;; Require semanticdb
(require ‘semanticdb)
(setq-mode-local c-mode semanticdb-find-default-throttle
‘(project unloaded system recursive))
(setq-mode-local c++-mode semanticdb-find-default-throttle
‘(project unloaded system recursive))
(setq-mode-local erlang-mode semanticdb-find-default-throttle
‘(project unloaded system recursive))
(require ‘eassist)
;; Customisation of modes
(defun my-cedet-hook ()
(local-set-key [(control return)] ‘semantic-ia-complete-symbol-menu)
(local-set-key “\C-c?” ‘semantic-ia-complete-symbol)
(local-set-key “\C-c>” ‘semantic-analyze-inline)
(local-set-key “\C-c=” ‘semantic-decoration-include-visit)
(local-set-key “\C-cj” ‘semantic-ia-fast-jump)
(local-set-key “\C-cq” ‘semantic-ia-show-doc)
(local-set-key “\C-cs” ‘semantic-ia-show-summary)
(local-set-key “\C-cp” ‘semantic-analyze-proto-impl-toggle)
)
;(add-hook ‘semantic-init-hooks ‘my-cedet-hook)
(add-hook ‘c-mode-common-hook ‘my-cedet-hook)
(add-hook ‘lisp-mode-hook ‘my-cedet-hook)
(add-hook ‘emacs-lisp-mode-hook ‘my-cedet-hook)
;(add-hook ‘erlang-mode-hook ‘my-cedet-hook)
(defun my-c-mode-cedet-hook ()
(local-set-key “.” ‘semantic-complete-self-insert)
(local-set-key “>” ‘semantic-complete-self-insert)
(local-set-key “\C-ct” ‘eassist-switch-h-cpp)
(local-set-key “\C-xt” ‘eassist-switch-h-cpp)
(local-set-key “\C-ce” ‘eassist-list-methods)
(local-set-key “\C-c\C-r” ‘semantic-symref)
)
(add-hook ‘c-mode-common-hook ‘my-c-mode-cedet-hook)
;(global-semantic-folding-mode 1)
(global-semantic-tag-folding-mode 1)
;; EDE customisation
(require ‘semantic-lex-spp)
(global-ede-mode t)
;; GNU global support
(require ‘semanticdb-global)
;; xcscope, probably lines are not required
;(load-file “/usr/share/emacs/site-lisp/xcscope.el”)
;(require ‘xcscope)
;; These lines referring to semanticdb-enable-gnu-global-databases
;; are using global that it is a cscope program, cscope program means an
;; external program to emacs, so you need to install global via apt-get or similar
(semanticdb-enable-gnu-global-databases ‘c-mode)
(semanticdb-enable-gnu-global-databases ‘c++-mode)
;; C
(semantic-add-system-include “/usr/include/” ‘c-mode)
(semantic-add-system-include “/usr/lib/gcc/x86_64_linux-gnu/4.3.4/include/” ‘c-mode)
(semantic-add-system-include “/usr/include/bits/” ‘c-mode)
(semantic-add-system-include “/usr/include/asm/” ‘c-mode)
;; C++
(semantic-add-system-include “/usr/include” ‘c++-mode)
(semantic-add-system-include “/usr/lib/gcc/x86_64_linux-gnu/4.3.4/include/” ‘c++-mode)
;; Speedbar
(add-hook ‘speedbar-load-hook
(lambda ()
(require ‘semantic-sb)))
;; PROBLEM WITH MACOS BELOW LINES (possible path problem – boost)
;; cpp-tests project definition
; (setq cpp-tests-project
; (ede-cpp-root-project “cpp-tests” :file”~/projects/lang-exp/cpp/CMakeLists.txt”
; :system-include-path ‘(”/home/ott/exp/include”
; “/home/ott/exp/include/boost-1_38″)
; :local-variables ‘(
; (compile-command .”cd ~/projects/lang-exp/cpp/; make -j2″)
; )
; ))
;; PROBLEM WITH THIS, POSSIBLE SQUID-GSB PATH
; (setq squid-gsb-project
;  (ede-cpp-root-project “squid-gsb” :file “~/projects/squid-gsb/README”
;  :system-include-path
;    ‘(”/home/ott/exp/include””/home/ott/exp/include/boost1_38″)
;  :local-variables ‘(
;   (compile-command .”cd ~/projects/squid-gsb/Debug/; make -j2″)
;  )
;  ))
;; My functions for EDE
(defun my-ede-get-local-var (fname var)
”fetch given variable var from :local-variables of project of file fname”
(let* ((current-dir (file-name-directory fname))
(prj (ede-current-project current-dir)))
(when prj
(let* ((ov (oref prj local-variables))
(lst (assoc var ov)))
(when lst
(cdr lst))))))
;; Setup compile package
;; TODO: allow to specify function as compile-command
(require ‘compile)
(setq compilation-disable-input nil)
(setq compilation-scroll-output t)
(setq mode-compile-always-save-buffer-p t)
(defun My-Compile ()
“Saves all unsaved buffers, and runs ‘compile’.”
(interactive)
(save-some-buffers t)
(compile (or (my-ede-get-local-var (buffer-file-name (current-buffer)) ‘compile-command) compile-command)))
(global-set-key [f9] ‘My-Compile)
;
;; —————————————————————————
;; ECB (Emacs Code Browser)
;; —————————————————————————
;; Add to the PATH ECB directory
(add-to-list ‘load-path “~/ecb-2.40″)
;; Load ecb.el
(load-file “~/ecb-2.40/ecb.el”)
;; Require ECB (ECB-options are available from now)
(require ‘ecb)
;; Load ECB after starting it (fast loading but ECB-* and semantic-options available from ECB)
(require ‘ecb-autoloads)
;
;; —————————————————————————
;; Emacs magic (C and C++ extension by MaciekzGdanska)
;; —————————————————————————
;; See demo at www.youtube.com/watch?v=C0qblk1BQrl
(load-file “~/emacsmagic/magic.el”)
;
;; —————————————————————————
;; Linum (line numbers) M-x linum-mode to enable
;; —————————————————————————
(load-file “~/emacslinenum/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)))
;
;; —————————————————————————
;; 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
)
)
;
;; —————————————————————————
;; EasyPG (GPG for emacs)
;; —————————————————————————
(require ‘epa)
(require ‘epa-file)
;; EPA already enable by default in V.23
;(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?
;
;; —————————————————————————
;; AuCTEX
;; —————————————————————————
;; Please firstly go to the official page of auctex, download, ./configure && make
;; Later include these lines and a couple of skeletons. Do not make install as
;; we could later change easily AuCTEX version to use from emacs.
(add-to-list ‘load-path “~/auctex-11.85/preview/”)
(add-to-list ‘load-path “~/auctex-11.85/”)
;(load “auctex”)
(load “preview-latex.el” nil t t)
(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
;; added by overdrive
(setq preview-image-type ‘pnm)
;(add-hook ‘LaTeX-mode-hook (lambda ()
;     (TeX-fold-mode 1)))
(setq preview-auto-reveal t)
(add-hook ‘latex-mode-hook ‘preview-buffer)
(setq reftex-plug-into-AUCTeX t)
(eval-after-load ‘autoinsert
‘(progn
(delete (assoc ‘latex-mode auto-insert-alist) auto-insert-alist)
(add-to-list ‘auto-insert-alist (cons ‘latex-mode
‘insert-skeleton-latex))))
(global-set-key [?\M-|]          ’self-insert-command)
;
;; —————————————————————————
;; Licenses (insert)
;; —————————————————————————
;; GPLv3 for multifile source project (replace DESCRIPTION-FILE-OF-PROJECT and PROJECT-NAME)
(defun gpl-m ()
“Insert standard GPL header for multifile project.”
(interactive “*”)
(insert-string
“/* DESCRIPTION-FILE-OF-PROJECT.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by Borja (user.name@member.fsf.org).
This file is part of PROJECT-NAME.
PROJECT-NAME 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.
PROJECT-NAME 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 PROJECT-NAME.  If not, see <http://www.gnu.org/licenses/>. */
“))
;; GPLv3 for standalone source project (replace PROJECT-NAME)
(defun gpl-s ()
“Insert standard GPL header for one file project.”
(interactive “*”)
(insert-string
“/* PROJECT-NAME.
Copyright (C) 2010 Free Software Foundation, Inc.
Contributed by User Name (user.name@member.fsf.org).
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 <http://www.gnu.org/licenses/>.
“))
;
;; —————————————————————————
;; Scroll (Disabled)
;; —————————————————————————
; (set-scroll-bar-mode ‘right)
; (setq
;   scroll-margin 0
;   scroll-conservatively 100000
;   scroll-preserve-screen-position 1)
;
;; —————————————————————————
;; Cursor depending of mode
;; —————————————————————————
;; Change cursor color according to mode; inspired by
;; http://www.emacswiki.org/emacs/ChangingCursorDynamically
(setq djcb-read-only-color       “gray”)
;; valid values are t, nil, box, hollow, bar, (bar . WIDTH), hbar,
;; (hbar. HEIGHT); see the docs for set-cursor-type
(setq djcb-read-only-cursor-type ‘hbar)
(setq djcb-overwrite-color       “red”)
(setq djcb-overwrite-cursor-type ‘box)
(setq djcb-normal-color          ”yellow”)
(setq djcb-normal-cursor-type    ’bar)
(defun djcb-set-cursor-according-to-mode ()
“change cursor color and type according to some minor modes.”
(cond
(buffer-read-only
(set-cursor-color djcb-read-only-color)
(setq cursor-type djcb-read-only-cursor-type))
(overwrite-mode
(set-cursor-color djcb-overwrite-color)
(setq cursor-type djcb-overwrite-cursor-type))
(t
(set-cursor-color djcb-normal-color)
(setq cursor-type djcb-normal-cursor-type))))
(add-hook ‘post-command-hook ‘djcb-set-cursor-according-to-mode)
;
;; —————————————————————————
;; Tramp
;; —————————————————————————
;; Examples (for more details please check www.gnu.org/software/tramp)
;; C-x C-f /etc/hosts -> local file as current user
;; C-x C-f /sudo:root@localhost:/etc/hosts -> local file as root
;; C-x C-f /sudo::/etc/hosts -> local file as root
;; C-x C-f /user@domain.org:/etc/hosts -> remote file as some user
;
;; —————————————————————————
;; Emacs daemon aka Emacsclient
;; —————————————————————————
;; Examples
;; $ emacs –daemon -> launch emacs as a daemon
;; $ emacsclient -c -> launch emacs client frames
;; $ emacsclient -t -> launch emacs client frames with-no-windows
;; $ emacsclient -c -n -> launch emacs client without controlling terminal for the emacsclient to finish
;; $ emacsclient -c -a nano -> Alternative edutir if emacs client fails
;; Add in your .xinitrc to launch emacs –daemon when X start
;; From console
;;  emacs –daemon &
;; From emacs
;;  M-x server-start
;; For kill emacsdaemon launch (WARNING: do not have any unsaved data or other emacsen running):
;; $ pkill -TERM -u $USER emacs
;; Also could be configured default EDITOR via adding this lines in your .bashrc or .zshenv:
;; EDITOR=”emacsclient -c”
;; VISUAL=”emacsclient -c”
;
;; —————————————————————————
;; WC (originally from emacs-fu) changed name by convention and shortcut
;; —————————————————————————
(defun wc (&optional begin end)
“count words between BEGIN and END (region); if no region defined, count words in buffer”
(interactive “r”)
(let ((b (if mark-active begin (point-min)))
(e (if mark-active end (point-max))))
(message “Word count: %s” (how-many “\\w+” b e))))
;
;; —————————————————————————
;; Registers (adding list-register feature)
;; —————————————————————————
;; Adding register views (keystroke using an unmapped key)
(add-to-list ‘load-path “~/listregister/”)
(require ‘list-register)
(global-set-key (kbd “C-x r v”) ‘list-register)
;
;; —————————————————————————
;; Emacs splash image
;; —————————————————————————
;; Changing according to my style (default/mango/steel)
;; Important designer and for instructions at www.ee.ryerson.ca/~elf/emacs/logo/logo-appendix.html
;(setq fancy-splash-image (expand-file-name “~/emacs-splash/mango.xpm”))
;; —————————————————————————
;; GIT Support
;; —————————————————————————
;; Requires apt-get install git-core
(load “/usr/share/doc/git-core/contrib/emacs/git.el”)
(load “/usr/share/doc/git-core/contrib/emacs/git-blame.el”)
(load “~/emacs/lisp/vc-git.el”)
(add-to-list ‘vc-handled-backends ‘GIT)
;; Disabled git-emacs
;(add-to-list ‘load-path “~/git-emacs-1.0/”)
;(require ‘git-emacs)
;
;; —————————————————————————
;; Typing in Emacs
;; —————————————————————————
(add-to-list ‘load-path “~/typing”)
(require ‘typing)
;
;; —————————————————————————
;; Doxymacs
;; —————————————————————————
;; Doxymacs path
(add-to-list ‘load-path “~/doxymacs-1.8.0/lisp”)
(require ‘doxymacs)
;; Invoke manually M-x doxymacs-mode
;(add-hook ‘c-mode-hook ‘doxymacs-mode)
;; This does not work and was incorrectly put in documentation of doxymacs in INSTALL file
;(add-hook ‘c-mode-common-hook ‘doxymacs-mode)
;; This works (thanks to offby1)
(add-hook ‘c-mode-common-hook (lambda () (doxymacs-mode 1)))
;(defun my-doxymacs-font-lock-hook ()
;  (if (or (eq major-mode ‘c-mode) (eq major-mode ‘c++-mode))
;      (doxymacs-font-lock)))
;(add-hook ‘font-lock-mode-hook ‘my-doxymacs-font-lock-hook)
;;  This will add the Doxygen keywords to c-mode and c++-mode only.
;; – Default key bindings are:
;;   – C-c d ? will look up documentation for the symbol under the point.
;;   – C-c d r will rescan your Doxygen tags file.
;;   – C-c d f will insert a Doxygen comment for the next function.
;;   – C-c d i will insert a Doxygen comment for the current file.
;;   – C-c d ; will insert a Doxygen comment for the current member.
;;   – C-c d m will insert a blank multi-line Doxygen comment.
;;   – C-c d s will insert a blank single-line Doxygen comment.
;;   – C-c d @ will insert grouping comments around the current region.
;
;; —————————————————————————
;; C compilation and fast hotkeys (required be at the end to avoid overlap)
;; —————————————————————————
;; Compile and handling regions for errors
;; (require ‘cc-mode) required, but included previously in this .emacs, so ignored here
(define-key c-mode-map (kbd “C-c c”) ‘compile)
(define-key c-mode-map (kbd “C-c ,”) ‘comment-region)
(define-key c-mode-map (kbd “C-c .”) ‘uncomment-region)
(define-key c-mode-map (kbd “C-c C-c”) ‘next-error)
;
;; —————————————————————————
;; WARNING SECTION – UNSTABLE / Level I
;; —————————————————————————
;; Emacs can autoload functions that are located in files not inmediately loaded when org-mode starts
(require ‘org-install)
;; Check ModifierKeys from emacswiki (in console Windowskey is mapped to Meta)
;; org-mode activation
(add-to-list ‘auto-mode-alist ‘(“\\.org\\’” . org-mode))
(global-set-key (kbd “s-b”) ‘org-store-link) ;; bookmarks
(global-set-key (kbd “s-a”) ‘org-agenda) ;; agenda
(global-set-key (kbd “s-l”) ‘org-agenda-list) ;; list agenda
;; Unknown feature so disabled
;(global-set-key (kbd “s-b”) ‘org-iswitchb)
(global-set-key (kbd “s-t”) ‘org-todo-list) ;; TODO
;; C-c C-c -> activates current tags
;; TAB -> motion
;; C-c C-l -> activates current link
;; usual files / buffers DISABLED
;(global-set-key (kbd “s-E”) (lambda()(interactive)(find-file “~/.emacs”)))
;(global-set-key (kbd “s-S”) (lambda()(interactive)(switch-to-buffer “*scratch*”)))
;(global-set-key (kbd “s-M”) (lambda()(interactive)(switch-to-buffer “*Messages*”)))
;
;; —————————————————————————
;; WARNING SECTION – UNSTABLE / Level II (doubt and misc)
;; —————————————————————————
;;
;; *** WARNING *** WARNING *** WARNING *** WARNING ***
;;
;; *** BELOW CODE IS HIGHLY UNSTABLE AND UNTESTED ***
;;
;; *** WARNING *** WARNING *** WARNING *** WARNING ***
;;
;; —————————————————————————
;; MacOS X calendar init
;(defvar OS “OSX”)
;(cond ((equal OS “OSX”) (calendar)))
;; Doc-view
;(require ‘doc-view)
;; Tex view
(defun tex-view ()
(interactive)
(tex-send-command “xpdf” (tex-append tex-print-file “.pdf”)))
;; Some keys F5 to F9 are free
(global-set-key [f5]          ’lisp-complete-symbol)
(global-set-key [f6]          ’(lambda () (interactive) (kill-buffer (current-buffer))))
(global-set-key [S-f7]        ’compile)
;; Curious command
;; M-x butterfly
;; To see all colours
;; M-x list-colors-display
;; Backups
;(setq backup-directory-alist ‘((“.” . “.~”)))
;(setq backup-directory-alist (list (cons “.*” (expand-file-name “~/.emacsbackup/”))))
;; Check all fonts
;; M-x set-default-font TAB
;; Important keybinding
;; C-x C-x toggle position between cursor and mark
;; ERC jump to event
;; C-c C-SPC
;; Lisp devel
;; Mark set
;; C-x C-e eval lisp function
;; C-u C-x C-e debug breakpoint
;
;; org-mode Hack found at http://orgmode.org/worg/org-hacks.php#sec-13
;; Requires activate org-mode when .org file is loaded? is that pending?
; (setq ba/org-adjust-tags-column t)
; (defun ba/org-adjust-tags-column-reset-tags ()
;   “In org-mode buffers it will reset tag position according to
; `org-tags-column’.”
;   (when (and
;          (not (string= (buffer-name) “*Remember*”))
;          (eql major-mode ‘org-mode))
;     (let ((b-m-p (buffer-modified-p)))
;       (condition-case nil
;           (save-excursion
;             (goto-char (point-min))
;             (command-execute ‘outline-next-visible-heading)
;             ;; disable (message) that org-set-tags generates
;             (flet ((message (&rest ignored) nil))
;               (org-set-tags 1 t))
;             (set-buffer-modified-p b-m-p))
;         (error nil)))))
; (defun ba/org-adjust-tags-column-now ()
;   “Right-adjust `org-tags-column’ value, then reset tag position.”
;   (set (make-local-variable ‘org-tags-column)
;        (- (- (window-width) (length org-ellipsis))))
;   (ba/org-adjust-tags-column-reset-tags))
; (defun ba/org-adjust-tags-column-maybe ()
;   “If `ba/org-adjust-tags-column’ is set to non-nil, adjust tags.”
;   (when ba/org-adjust-tags-column
;     (ba/org-adjust-tags-column-now)))
; (defun ba/org-adjust-tags-column-before-save ()
;   “Tags need to be left-adjusted when saving.”
;   (when ba/org-adjust-tags-column
;      (setq org-tags-column 1)
;      (ba/org-adjust-tags-column-reset-tags)))
; (defun ba/org-adjust-tags-column-after-save ()
;   “Revert left-adjusted tag position done by before-save hook.”
;   (ba/org-adjust-tags-column-maybe)
;   (set-buffer-modified-p nil))
;; automatically align tags on right-hand side
; (add-hook ‘window-configuration-change-hook
;           ‘ba/org-adjust-tags-column-maybe)
; (add-hook ‘before-save-hook ‘ba/org-adjust-tags-column-before-save)
; (add-hook ‘after-save-hook ‘ba/org-adjust-tags-column-after-save)
; (add-hook ‘org-agenda-mode-hook ‘(lambda ()
;                                   (setq org-agenda-tags-column (- (window-width)))))
;
;; End of .emacs

Leave a Reply

You must be logged in to post a comment.