Configuracion Emacs ~/.emacs.d/

Cargar modulos descargados en ~/.emacs.d/custom/

(let ((default-directory "~/.emacs.d/custom/"))

Multiples Modos mmm-mode

(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class nil "\\.php3?\\'" 'html-php)
    :submode php-mode
    :front "<\\?\\(php\\)?"
    :back "\\?>")))
(autoload 'php-mode "php-mode" "PHP editing mode" t)
(add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))


  ;;     (standard-display-ascii ?\t "» ")
       (setq tab-width 2)
       (setq-default tab-width 2)
       ;;(whitespace-tab-width tab-width)
       (setq-default indent-tabs-mode t)
       (setq c-basic-offset 2)
       (setq whitespace-style '(tabs tab-mark newline ))
       ;;(setq c-basic-indent 2)

;;  (mapc
;;   (lambda (mode)
;;     (font-lock-add-keywords
;;      mode
;;      '(("ARR" 0 'whitespace-tab)
;;        ;;("\u00BB[[:space:]]" 0 'whitespace-tab))
;;        ("\u00BB[[:blank:]]" 0 'whitespace-tab))
;;      )
;;     )
;;   '(text-mode latex-mode html-mode emacs-lisp-mode exinfo-mode php-mode org-mode)
;;   )

;;  (setq whitespace-display-mappings
;;   '(
;;     (space-mark   ?\     [? ]) ;; use space not dot
;;     (space-mark   ?\xA0  [?\u00A4]     [?_])
;;     (space-mark   ?\x8A0 [?\x8A4]      [?_])
;;     (space-mark   ?\x920 [?\x924]      [?_])
;;     (space-mark   ?\xE20 [?\xE24]      [?_])
;;     (space-mark   ?\xF20 [?\xF24]      [?_])
;;     (newline-mark ?\n    [?$ ?\n])
;;     (tab-mark     ?\t    [?\u00BB ?\t] [?\\ ?\t])))
  • Indent TABS :
;;(setq-default indent-tabs-mode t)
;;(setq tab-width 3) ; or any other preferred value
;;(highlight-indentation-mode 1)
;;(set-face-backgrxound 'highlight-indentation-face "#e3e3d3")
;;(set-face-background 'highlight-indentation-current-column-face "#c3b3b3")
;;(require 'indent-guide)

Carga Plugin Evil evil-mode

(require 'evil)
(evil-mode 1)

Carga Org-Mode

org-mode es un administrador de información personal y una herramienta fuera de linea(herramienta de bosquejo) para emacs. Este documento intenta dar al lector un acercamiento a los principios basicos de operacion.

  • Instalar org-mode M-x package-install org
  • Links :
    • C-c C-l : Crea un nuevo link
    • C-c c : Almacena una posicion en un archivo para crearlo con C-c C-l en otro archivo
    • C-c C-o : Abre un Link
  • Exportar :
    • C-c C-e : Exporta en distintos formatos un archivo org
    • C-c C-e : Exportar .org a otros formatos
  • Check/Describe Variables :
    • C-h v : Describe Variable
    • C-h a : Describe Hotkey
    • C-h ? : Muestra ayuda
  • Tablas, Estas se crean así tal cual |-Tab
  • Bloques de codigo/Source Blocks :
    • <s TAB : En un buffer el snippet <s TAB nos crea un bloque
    • C-c ‘ : Es posible modificar codigo de un bloque en un nuevo buffer con C-c ‘
    • C-c ; : Agrega commentario al inicio de una entrada
    • C-c C-c : Evalua un block de codigo
  • Includes/Incluir :
#+INCLUDE: "~/.local/scripts/1024x768-1280x1024" src bash :lines "3-5"
#+INCLUDE: "~/.local/scripts/1024x768-1280x1024" src bash
  • Agenda :
    • C-c C-d : Set deadline date
    • C-c C-t | Shift-[Left|Right] : DONE, TODO stuff
    • C-c C-s : Set schedule date
    • C-c a : Agenda View
    • En un buffer es posible añadir más estados de agenda :
      • C-c C-c : ACTIVAR SEQ_TODO ya definido en buffer
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-done t)

Markdown-Mode markdown-mode

(use-package markdown-mode
  :ensure t
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))

NerdTree Like neotree

(require 'neotree)
(global-set-key [f8] 'neotree-toggle)

PHP Plugins

(eval-after-load 'php-mode
    '(require 'php-ext))
(with-eval-after-load 'php-mode
    (define-key php-mode-map (kbd "C-c C--") 'php-current-class)
    (define-key php-mode-map (kbd "C-c C-=") 'php-current-namespace))
(add-hook 'php-mode-hook
'(lambda ()
    (require 'company-php)
    (company-mode t)
    (ac-php-core-eldoc-setup) ;; enable eldoc
    (make-local-variable 'company-backends)
    (add-to-list 'company-backends 'company-ac-php-backend)))
(setq auto-mode-alist
    '(("\\.php" . php-mode)) auto-mode-alist))

(add-hook 'after-init-hook 'global-company-mode)
(run-hooks 'after-init-hook)
;;; test-ac-php.el ends here

(require 'cl)
(require 'php-mode)
(add-hook 'php-mode-hook
'(lambda ()
    (auto-complete-mode t)
    (require 'ac-php)
    (setq ac-sources  '(ac-source-php ))
    (yas-global-mode 1)
    (ac-php-core-eldoc -setup ) ;; enable eldoc
    (define-key php-mode-map  (kbd "C-]") 'ac-php-find-symbol-at-point) ;;goto define
    (define-key php-mode-map  (kbd "C-t") 'ac-php-location-stack-back)    ;;go back

(require 'flymake-php)
(add-hook 'php-mode-hook 'flymake-php-load)

Autocompletar web-mode

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

(autoload 'php-mode "php-mode" "Major mode for editing PHP code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))

Org-Mode with CalDav org-caldav & org-agenda

(require 'org-caldav)

(with-eval-after-load 'org-caldav
  (setq org-caldav-url ""
  ;;org-caldav-calendar-id "personal"
  ;;org-caldav-inbox "~/org-caldav/"
  ;;org-caldav-files '("~/org-caldav/" "~/org-caldav/")
  ;;org-caldav-files '("~/org-caldav/")
  org-icalendar-timezone "America/Santiago"
  org-caldav-debug-level 2))

  (setq org-caldav-calendars
  '( (:calendar-id "diy" :files ("~/org-caldav/") :inbox "~/org-caldav/")
  (:calendar-id "estudios" :files ("~/org-caldav/") :skip-conditions (regexp "soccer") :inbox "~/org-caldav/")
  (:calendar-id "personal" :files ("~/org-caldav/") :skip-conditions (regexp "soccer") :inbox "~/org-caldav/") ) )

  (setq org-agenda-files (list "~/org-agenda/" "~/org-agenda/" "~/org-caldav"))

Comprobador de Sintaxis flycheck

(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

Undo-Tree Undo-Tree

  • C-x u : Visualizar arbol.

IDO InteractivelyDoThings & Smex : ido-completing-read-plus

Es una nueva rama de ido-ubiquitous

(require 'ido)
(ido-mode t)
(ido-everywhere 1)
;;Melpa M-x package-install ido-completing+
(require 'ido-completing-read+)
(ido-ubiquitous-mode 1)

M-x ido para los comandos usados comunmente :

(require 'smex)   ; Not needed if you use package.el
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay
      ; when Smex is auto-initialized on its first run.

(global-set-key (kbd "C-c i") 'smex)
(global-set-key (kbd "C-c I") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

Helm & Helm-Projectile & Helm-Smex helm, helm-ag, helm-projectile, helm-smex, helm-descbinds

(require 'helm)
(require 'helm-config)
(require 'helm-projectile)

(global-set-key (kbd "M-x")       #'helm-M-x)
(global-set-key (kbd "C-x C-m")   #'helm-M-x)
(global-set-key (kbd "C-x r b")   #'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f")   #'helm-find-files)
(global-set-key (kbd "C-x b")     #'helm-mini)
(global-set-key (kbd "C-x C-b")   #'helm-buffers-list)
(global-set-key (kbd "C-x C-r")   #'helm-recentf)
(global-set-key (kbd "C-x c") nil) ;; Remove the old keybinding
(global-set-key (kbd "C-x c y")   #'helm-show-kill-ring)
(global-set-key (kbd "C-x c Y")   #'helm-all-mark-rings)

(global-set-key (kbd "M-s o")     #'helm-swoop)
(global-set-key (kbd "M-s /")     #'helm-multi-swoop)
(global-set-key (kbd "C-c h o")   #'helm-occur)

(global-set-key (kbd "C-c h x")   #'helm-register)
(global-set-key (kbd "C-c h g")   #'helm-google-suggest)
(global-set-key (kbd "C-c h M-:") #'helm-eval-expression-with-eldoc)
(global-set-key (kbd "C-c h")     #'helm-command-prefix)
;;(global-set-key (kbd "C-M-z") #'helm-resume)

(setq helm-split-window-inside-p t)
(setq helm-M-x-always-save-history t)
(setq helm-M-x-reverse-history t)
(setq helm-always-two-windows t)
(setq helm-autoresize-max-height 20)
(setq helm-autoresize-mode nil)
(setq helm-descbinds-mode t)
(setq helm-descbinds-window-style (quote split-window))
(setq helm-display-buffer-default-height 30)
(setq helm-display-header-line nil)
(setq helm-echo-input-in-header-line t)
(setq helm-ff-file-name-history-use-recentf t)
(setq helm-move-to-line-cycle-in-source nil)
(setq helm-prevent-escaping-from-minibuffer t)
(setq helm-scroll-amount 8)

(require 'helm-smex)
(global-set-key [remap execute-extended-command] #'helm-smex)
(global-set-key (kbd "M-X") #'helm-smex-major-mode-commands)

(require 'helm-descbinds)
(helm-mode 1)

Projectile projectile


Muestra numero de linea

(setq linum-format "%d ")
(setq linum-format "%4d \u2502 ")
(add-hook 'prog-mode-hook 'linum-mode)        ;; Esta linea convierte de 256 a 8 colores.
(add-hook 'text-mode-hook 'linum-mode)        ;; Esta linea convierte de 256 a 8 colores.
(add-hook 'org-mode-hook 'linum-mode)       ;; Esta linea convierte de 256 a 8 colores.
;;(global-linum-mode t)
;;(setq-default left-fringe-width  10)
;;(setq-default right-fringe-width  0)
;;(set-face-attribute 'fringe nil :background "black")
;;(set-window-margins nil 1)

Ilumina la linea del cursor

(global-hl-line-mode 1)

Grabar el historial del mini buffer M-x

(savehist-mode 1)

Grabar Sessiones Emacs

(desktop-save-mode 1)

Org2Blog ox-wp-crayon.el, org2blog

(require 'xml-rpc)
(require 'org2blog-autoloads)
(require 'auth-source)
(require 'org2blog)

(add-to-list 'auth-sources "~/.netrc")
(setq auth-sources '(

(setq org2blog/wp-default-title "Hola Mundillo")

;;Ojo!! en vez de ocupar ' se utiliza `
(setq org2blog/wp-blog-alist
         :url ""
         :username ,(car (auth-source-user-and-password ""))
         :password ,(cadr (auth-source-user-and-password ""))
         :default-title "Nueva Entrada"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)
         :url ""
         :username ,(car (auth-source-user-and-password ""))
         :password ,(cadr (auth-source-user-and-password ""))
         :default-title "Nueva Entrada"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)))

;;(require 'ox-wp-crayon)
;;(setq org2blog/wp-use-sourcecode-shortcode t)
;;(setq org2blog/wp-sourcecode-default-params t)
;;(setq org2blog/wp-sourcecode-langs
;;'("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi"
;;"erlang" "fsharp" "diff" "ditaa" "groovy" "javascript" "js" "java" "javafx" "matlab"
;;"objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql"
;;"vb" "xml" "sh" "elisp" "R" "org" "lisp" "emacs-lisp" "lua" "sql" "org" "haskell"
;;"c++" "python" "php" "mysql" "ruby"))

(setq org2blog/wp-use-sourcecode-shortcode nil)
(setq org2blog/wp-sourcecode-langs
    '("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi"
    "erlang" "fsharp" "diff" "ditaa" "groovy" "javascript" "js" "java" "javafx" "matlab"
    "objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql"
    "vb" "xml" "sh" "elisp" "R" "org" "lisp" "emacs-lisp" "lua" "sql" "org" "haskell"
    "c++" "python" "php" "mysql" "ruby"))
(setq org-src-fontify-natively t)

YasSnippets yasnippet

;;(add-to-list 'warning-suppress-types '(yasnippet backquote-change))

GIT magit


M-x load-file <ret> X-x eval-buffer <ret> M-x byte-recompile-directory ~/.emacs.d/elpa/ C-q <tab> : ????

M-x, IDO’s Alternatives


;;(setq load-path
;;  (append '("~/.emacs.d/polymode/"  "~/.emacs.d/polymode/modes")
;;    load-path))
;;(add-hook 'after-init-hook #'global-flycheck-mode)

;;(require 'poly-R)
;;(require 'poly-markdown)
;;(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
;;;;; R modes
;;(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
;;(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
;;(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

;;(require 'mmm-mode)
;;(setq mmm-global-mode 'maybe)
;;(mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
;; '((html-php
;;    :submode php-mode
;;    :front "<\\?\\(php\\)?"
;;    :back "\\?>")))
;;(autoload 'php-mode "php-mode" "PHP editing mode" t)
;;(add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *