diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..305397e --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,15 @@ +Changelog + +* Remove cruft files + +* Reorganize file structure + +* Add ability to publish html from emacs org files + +* Corrections / edits to c-ide.org + +* Remove javascript statcounter and disqus comments + +* Present (some) animated gif demos side-by-side + +* Present more commands in table format diff --git a/README.md b/README.md index 81d4620..e696899 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,33 @@ Emacs Mini Manual ================= -Check it out: http://tuhdo.github.io/emacs-tutor.html +1. The manual is viewable at: + https://boruch-baum.github.io/emacs_mini_manual/ -If you can improve, feel free to create pull request. The Org files are in emacs-tutor/ library. +2. The page names are: + + * Emacs Mini Manual (Part 1) - The Basics + + * Emacs Mini Manual (Part 2) - Lisp Primer: Why Parentheses Matter + + * Emacs Mini Manual (Part 3) - Customizing And Extending Emacs + + * Setup C/C++ Development Environment for Emacs + + + See also related repository + https://github.com/Boruch-Baum/emacs-c-ide-demo + + * A Package in a league of its own: Helm + + * Exploring large projects with Projectile and Helm Projectile + + * Emacs for Programming Languages course on Coursera + + * Setup Emacs with PDF Tools and Xwidgets web browser on Windows + +3. The pages are produced from emacs org files, which are in the `org' + folder. See `org/publish.el' for how to convert them to html. + +4. This is a fork of https://github.com/tuhdo/tuhdo.github.io + + + Refer to CHANGELOG file for how I've altered it. diff --git a/TODO b/TODO new file mode 100644 index 0000000..a51c327 --- /dev/null +++ b/TODO @@ -0,0 +1,87 @@ +TODO + +* Incorporate appropriate information from the ggtags readme file. + +* List components to be installed by demo, and the corresponding + debian packages. + +* Determine whether ebrowse.org is cruft. + +* Determine whether anything useful is in c-ide-irony_bak.org. + +* Edit animated gifs to be more likely to be legible and totally + visible on a screen. + +* Take all code from the demo repository, incorporate it into the org + files of this repository as babel-org source, from which to build + the demo. That way the code will always be in sync with the + snippets of the org files. + +* Is cscope integration coveered? + (require 'xcscope) + (setq cscope-do-not-update-database t) + +* ido-imenu + (defun ido-imenu () + "Update the imenu index and then use ido to select a symbol to + navigate to. + Symbols matching the text at point are put first in the completion + list." + (interactive) + (imenu--make-index-alist) + (let ((name-and-pos '()) + (symbol-names '())) + (flet ((addsymbols + (symbol-list) + (when (listp symbol-list) + (dolist (symbol symbol-list) + (let ((name nil) (position nil)) + (cond + ((and (listp symbol) (imenu--subalist-p symbol)) + (addsymbols symbol)) + + ((listp symbol) + (setq name (car symbol)) + (setq position (cdr symbol))) + + ((stringp symbol) + (setq name symbol) + (setq position + (get-text-property 1 'org-imenu-marker + symbol)))) + + (unless (or (null position) (null name)) + (add-to-list 'symbol-names name) + (add-to-list 'name-and-pos (cons name + position)))))))) + (addsymbols imenu--index-alist)) + ;; If there are matching symbols at point, put them at the + beginning + ;; of `symbol-names'. + (let ((symbol-at-point (thing-at-point 'symbol))) + (when symbol-at-point + (let* ((regexp (concat (regexp-quote symbol-at-point) "$")) + (matching-symbols + (delq nil (mapcar + (lambda (symbol) + (if (string-match regexp symbol) + symbol)) + symbol-names)))) + (when matching-symbols + (sort matching-symbols (lambda (a b) (> (length a) + (length b)))) + (mapc + (lambda (symbol) + (setq symbol-names (cons symbol (delete symbol + symbol-names)))) + matching-symbols))))) + (let* ((selected-symbol (ido-completing-read "Symbol? " + symbol-names)) + (position (cdr (assoc selected-symbol name-and-pos)))) + (push-mark) + (if (overlayp position) + (goto-char (overlay-start position)) + (goto-char position))))) + (global-set-key (kbd "C-x C-i") 'ido-imenu) + +* icicles, imenu-anywhere, imenu+, imenus diff --git a/c-ide.html b/docs/c-ide.html similarity index 52% rename from c-ide.html rename to docs/c-ide.html index ea45737..a01be13 100644 --- a/c-ide.html +++ b/docs/c-ide.html @@ -3,30 +3,22 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - C/C++ Development Environment for Emacs + + - - + -
- - - - -

Back to Table of Contents

-

C/C++ Development Environment for Emacs

Table of Contents

@@ -274,16 +182,19 @@

Table of Contents

read it offline: https://github.com/tuhdo/tuhdo.github.io

-
-

Introductory demos

-
-
+
+

1 Introductory demos

+
+

+Here are some visual examples of the emacs IDE in action: +

  • Switching between .h and .c/.cpp anywhere in the project like Linux kernel. If more than one file exists, it displays a list of possible candidates. The command collects files of the same names -but different across the project:
  • +but different across the project: +
@@ -293,8 +204,9 @@

Introductory demos

    -
  • Jump around Linux kernel source with ease using helm-gtags. The -demo begins when "START" appears at the bottom:
  • +
  • Jumping around Linux kernel source with ease using helm-gtags. The +demo begins when "START" appears at the bottom: +
@@ -304,18 +216,18 @@

Introductory demos

+ -
  • Static outline tree as a file browser:
  • +
  • Static outline tree as a file browser: +
  • @@ -325,7 +237,8 @@

    Introductory demos

    @@ -335,7 +248,8 @@

    Introductory demos

    @@ -345,7 +259,8 @@

    Introductory demos

    @@ -355,7 +270,8 @@

    Introductory demos

    @@ -365,7 +281,8 @@

    Introductory demos

    @@ -388,7 +305,8 @@

    Introductory demos

    @@ -398,7 +316,8 @@

    Introductory demos

    @@ -408,7 +327,8 @@

    Introductory demos

    @@ -418,7 +338,8 @@

    Introductory demos

    @@ -428,7 +349,8 @@

    Introductory demos

    @@ -436,270 +358,365 @@

    Introductory demos

    helm-man-woman.gif

    + + -
    -

    Quick setup

    -
    -
    - -

    -I've prepared an Emacs repository that is properly configured for -demonstration purposes. You can clone it and play with it without having to -manually copy and paste all the setup Elisp code -throughout the guide. When installed and run the first time, the demo -repository will download from melpa, install, and compile all the packages -it needs. Note that depending on your internet connection and processor speeds, -this may take a while. -

    - -
      -
    1. Install GNU Global from your distribution's package manager (Linux / Mac) or from the Win32 port (Windows). If none is available, download the sources here and manually build the package.

      -
    2. Backup your ~/.emacs.d elsewhere.

    3. -
    4. If emacs is not already running, start it.

    5. -
    6. Update your melpa database: M-x package-list-packages

    7. -
    8. Clone the repository into your ~/.emacs.d folder. -

      -
      git clone https://github.com/tuhdo/emacs-c-ide-demo.git ~/.emacs.d
      -  
      -

    9. -
    10. You may possibly want to edit your new ~/.emacs.d/init.el file for two options. -

        -
      1. The demo repository can use either helm-gtags (the default), or ggtags. - If you want to use ggtags, comment this line in init.el: -

        -
        (require 'setup-helm-gtags)
        -       
        -
        - And uncomment this line: -
        -
        ;; (require 'setup-ggtags)
        -       
        -
        -

      2. -
      3. The demo uses Helm. If you're not already familiar with Helm, read - my guide. - If you don't want to use Helm, also comment this line in init.el: -

        -
        (require 'setup-helm)
        -        
        -
        -

      4. -
      -
    - -

    That does it! To start using the demo, just type M-x load-file RET init.el. Continue reading this guide for its operational directions, without needing to bother to perform any more installations or elisp evaluations.

    - - -
    -

    Source code navigation

    -
    -
    -
    -

    Prerequisite:

    -
    -
      -
    • Know how to use package.el and MELPA. If you don't know how to -use, read the guide How to use Emacs package manager.
    • +
      +

      2 Setup

      +
      +
      +
      +

      2.1 Quick setup

      +
      +

      +I've prepared a github repository (URL below) with the configuration +files to properly install and configure the components of the emacs +IDE, and with a sample C project to play with. When installed and run +the first time, the demo repository will download from MELPA, +install and compile all the packages it needs. Note that depending on +your internet connection and processor speeds, this may take a while, +but that shouldn't stop you from continuing with this guide; the next +section can be followed using a second instance of emacs, and without +the IDE components. +

      -
    • Install GNU Global from your distribution's package manager (Linux / Mac) or from the Win32 port (Windows). If none is available, download the sources here and manually build the package. Do be aware that it is remotely possible that your package manager might install an -outdated version that might impair some functionality of helm-gtags. -

    • +

      +If you don't wish to use the github repository, you can manually +install the components, and use the .el files of the demo as a +reference sample configuration. +

      -
    • Install ggtags. After installing ggtags from MELPA, add this code -snippet to setup ggtags and key bindings:
    • -
    +

    +Steps to install the 'quick setup': +

    +
      +
    • Install GNU Global from your distribution's package manager (Linux / +Mac) or from the Win32 port (Windows). If none is available, +download the source here and manually build the package. +
    • +
    • If emacs is not already running, start it. +
    • +
    • Update your MELPA database: M-x package-list-packages. (reference: +How to use Emacs package manager). +
    • +
    • Get a local copy of the repository. +
    • +
    -
    (require 'ggtags)
    -(add-hook 'c-mode-common-hook
    -          (lambda ()
    -            (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
    -              (ggtags-mode 1))))
    -
    -(define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
    -(define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history)
    -(define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference)
    -(define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file)
    -(define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags)
    -(define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags)
    -
    -(define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark)
    +
    # Three ways. There are more...
    +wget https://github.com/Boruch-Baum/emacs-c-ide-demo/archive/master.zip && unzip master.zip
    +wget https://github.com/Boruch-Baum/emacs-c-ide-demo/archive/master.tar.gz && tar -xf master.tar.gz
    +git clone --depth=1 https://github.com/Boruch-Baum/emacs-c-ide-demo.git
     
    +
      +
    • Copy the sub-folder emacs_ide_demo_config into your ~/.emacs.d/ + folder. +
    • +
    • The other sub-folder, emacs_ide_demo_project has a sample skeleton +project. Use it in place or copy it elsewhere as convenient. +
    • +
    • You may possibly want to make a change to your new +~/.emacs.d/emacs_ide_demo_config/init.el file. By default, the +demo uses helm (reference) and helm-gtags, but if you don't want to +use helm, the alternative is to use ggtags. Here's how to make +that change.
        -
      • Or, helm + helm-gtags. Helm is awesome and if you are going to use -Helm, please read the Helm guide. Remember to setup Helm before -using helm-gtags. You can use this sample configuration. When -includes the above file in your ~/.emacs.d, remember to add -(require 'setup-helm) to your init.el.
      • -
      +
    • comment these lines in init.el:
      -
      (setq
      - helm-gtags-ignore-case t
      - helm-gtags-auto-update t
      - helm-gtags-use-input-at-cursor t
      - helm-gtags-pulse-at-cursor t
      - helm-gtags-prefix-key "\C-cg"
      - helm-gtags-suggested-key-mapping t
      - )
      -
      -(require 'helm-gtags)
      -;; Enable helm-gtags-mode
      -(add-hook 'dired-mode-hook 'helm-gtags-mode)
      -(add-hook 'eshell-mode-hook 'helm-gtags-mode)
      -(add-hook 'c-mode-hook 'helm-gtags-mode)
      -(add-hook 'c++-mode-hook 'helm-gtags-mode)
      -(add-hook 'asm-mode-hook 'helm-gtags-mode)
      -
      -(define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
      -(define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select)
      -(define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
      -(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
      -(define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
      -(define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history)
      +
      (require 'setup-helm)
      +(require 'setup-helm-gtags)
       

      -Before using the ggtags or helm-gtags, remember to create a GTAGS -database by running gtags at your project root in terminal: +And uncomment this line:

      -
      $ cd /path/to/project/root
      -$ gtags
      +
      ;; (require 'setup-ggtags)
       
      +
    • +
    + + +
  • M-x load-library RET emacs_ide_init +
  • +

    -After this, a few files are created: +As mentioned earlier, the first time you load the library, it will +perform a series of downloads, installs and compiles, which may take a +while, but you can still continue with the next section of this guide +in a second instance of emacs, even without any of the IDE components.

    +
    +
    -
    +
    +

    2.2 Not-so-quick setup

    +
    -
    $ ls G*
    -GPATH   GRTAGS  GTAGS
    -
    -
    +

    +If your operating system distribution has already prepared all or some of the emacs IDE components as packages, then it stands to reason that it recommends you use those instead of downloading from MELPA. +

    + +

    +You can use your distribution's package manager to install any components so prepared, and afterwards perform the 'quick setup' instructions above. +

    + +

    +If you use your distribution's package manager to install any components AFTER performing the 'quick setup', you will need to then manually delete the initially downloaded library from your ~/.emacs.d/elpa folder. +

    +

    +The emacs ide components are: +

      -
    • GTAGS: definition database
    • -
    • GRTAGS: reference database
    • -
    • GPATH: path name database
    • +
    • TODO +

    -If you use ggtags, you have a command for creating GTAGS database, -that is ggtags-create-tags; this is recommended way when using -ggtags, to let it know where the project root is. +Let's use debian as an example linux distribution. At the time of this writing, debian had packaged the following components:

    +
      +
    • TODO +
    • +
    +
    -
    -

    Basic movements

    -
    -
      -
    • -C-M-f runs forward-sexp, move forward over a balanced -expression that can be a pair or a symbol. Demo: +

      +

      3 Basic source code navigation

      +
      +

      +Even without any IDE components installed, emacs already has features +useful for operating on source code.

      + -
      -

      forward-func.gif -

      -
      -
    • -C-M-b runs backward-sexp, move backward over a balanced -expression that can be a pair or a symbol. Demo: -

      +
    • ++-
      -

      backward-func.gif -

      -
      ++ + + + + + + + + + + + + + -
    • -C-M-k runs kill-sexp, kill balanced expression -forward that can be a pair or a symbol. Demo: -

      +
    • + + + + + + + + + -
      -

      kill-func-body.gif -

      -
      + + + + + -
    • -C-M-<SPC> or C-M-@ runs mark-sexp, put mark after -following expression that can be a pair or a symbol. Demo: -

      +
    • + + + + + + + + + -
      -

      mark-func-body.gif -

      -
      + + + + + + +
      KeyBinding Function 
      C-M-fforward-sexpmove forward over a balanced expression that can be a pair or a symbol.
      C-M-bbackward-sexpmove backward over a balanced expression that can be a pair or a symbol.
      C-M-kkill-sexpkill balanced expression forward that can be a pair or a symbol.
      C-M-<SPC> or C-M-@mark-sexpput mark after following expression that can be a pair or a symbol.
      C-M-abeginning-of-defunmove point to beginning of a function.
      C-M-eend-of-defunmove point to end of a function.
      C-M-hmark-defunput a region around whole current or following function.
      +
      -
    • -C-M-a runs beginning-of-defun, which moves point to beginning of -a function. Demo: -

      +
      +

      3.1 Demos

      +
      + -
      -

      beginning-of-defun.gif -

      -
      ++-
    • -C-M-e runs end-of-defun, which moves point to end of a -function. Demo: -

      +
    • ++ + + + + + + -
      -

      end-of-defun.gif -

      -
      + + + + + -
    • -C-M-h runs mark-defun, which put a region around whole current -or following function. Demo: -

      +
    • + + + + + + + + + -
      -

      mark-defun.gif +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      C-M-f runs forward-sexp, to move forward C-M-b runs backward-sexp, to move backward
      over a balanced expression that can be a pair or a symbol. over a balanced expression that can be a pair or a symbol.
      forward-func.gif backward-func.gif
         
      C-M-k runs kill-sexp, to kill balanced expression C-M-<SPC> or C-M-@ runs mark-sexp, to put mark after
      forward that can be a pair or a symbol. following expression that can be a pair or a symbol.
      kill-func-body.gif mark-func-body.gif
         
      C-M-a runs beginning-of-defun, to move point to beginning of C-M-e runs end-of-defun, to move point to end of a
      a function. function.
      beginning-of-defun.gif end-of-defun.gif
         
      C-M-h runs mark-defun, to put a region around whole current  
      or following function.  
      mark-defun.gif  
      +
      +
      +
    + +
    +

    4 Source code navigation

    +
    +

    +At this point, we begin using components of our emacs IDE, so if +you're using the demo to perform its install, you'll need to wait for +that to finish, and to close the second instance of emacs that you +were using in the previous section. +

    +
    +
    +

    4.1 Package preparation

    +
    +

    +If you didn't use the the demo to install the emacs IDE components, +you'll now need to install GNU Global, and you'll need to install from +MELPA your choice of either ggtags or the pair of packages helm + +helm-gtags. In the demo package, the elisp code used to setup those packages can be found in setup-helm-tags.el / setup-ggtags.el.

    -
    -
    -
    -

    Basic concepts of tag

    -
    + +
    +

    4.2 Basic concepts of tags

    +

    -A tag is a name of an entity in source code. An entity can be a -variable, a method definition, an include-operator… A tag contains -information such as name of the tag (the name of the variable, -class, method), location of this tag in source code and which file it -belongs to. As an example, GNU Global generates three tag databases: +Source code navigation done by IDEs employs a concept called tags, a +term for an entity in source code. An entity can be a variable, a +method definition, an include-operator… A tag contains information +such as name of the tag (the name of the variable, class, method), +location of this tag in source code and which file it belongs to. As +an example, GNU Global generates three tag databases:

      -
    • GTAGS: definition database
    • -
    • GRTAGS: reference database
    • -
    • GPATH: path name database
    • +
    • GTAGS: definition database +
    • +
    • GRTAGS: reference database +
    • +
    • GPATH: path name database +

    @@ -716,24 +733,38 @@

    Basic

    -
    -

    Find definitions in current buffer

    -
    +
    +

    4.3 Tag database creation

    +

    -The Imenu facility offers a way to find the major definitions, such as -function definitions, variable definitions in a file by name. ggtags -can integrate Imenu: +Were you not using the emacs (or some other) IDE, the way to +create a GTAGS database would be to run gtags at your project root in +terminal:

    -
    -
    (setq-local imenu-create-index-function #'ggtags-build-imenu-index)
    +
    $ cd /path/to/project/root
    +$ gtags
     
    +

    +With the emacs IDE, configured as recommended with the snippets above, +just type C-c g c, which will run either the helm-gtags-create-tags or ggtags-create-tags emacs command. +

    -If you use Helm, use moo-jump-local from function-args package. You -can use it as an outline tree like in other IDEs. Here is a demo: +Just to be certain that the database was created, type M-! ls G* to have emacs run the shelll command ls G* and display the output in a dedicated window. You should see the three files GPATH, GRTAGS, and GTAGS. +

    +
    +
    +
    +

    4.4 Find definitions in current buffer

    +
    + +

    +If you use Helm, use moo-jump-local from function-args package. (But +helm seems to have imenu integration now). You can use it as an +outline tree like in other IDEs. Here is a demo:

    @@ -744,9 +775,9 @@

    Find d

    -
    -

    Find definitions in project

    -
    +
    +

    4.5 Find definitions in project

    +
    • Using gtags: by default, M-. runs ggtags-find-tag-dwim when ggtags-mode is enabled. The command ggtags-find-tag-dwim jump to @@ -755,18 +786,22 @@

      Find d
      • If the tag at point is a definition, ggtags jumps to a reference. If there is more than one reference, it displays a list -of references.
      • +of references. +
      • If the tag at point is a reference, ggtags jumps to tag -definition.
      • +definition. + -
      • If the tag at point is an include header, it jumps to that header.
      • -

    • +
    • If the tag at point is an include header, it jumps to that header. +
    • +
    +

    You can jump back to original location where you invoked -ggtags-find-tag-dwim by M-,, which runs pop-tag-mark (if you +ggtags-find-tag-dwim by M-,=, which runs =pop-tag-mark (if you follow my key bindings).

    @@ -781,7 +816,7 @@

    Find d s to invoke Isearch on candidate buffer list.

    -
    +

    ggtags-definitions.png @@ -797,11 +832,12 @@

    Find d
  • Using helm-gtags: If key bindings are properly setup as above, M-. runs helm-gtags-dwim, which behaves the same as ggtags-find-tag-dwim. Similarly, you jump back to original -location by using M-,, which runs tags-loop-continue (Emacs -default).
  • +location by using M-,=, which runs =tags-loop-continue (Emacs +default). + -
    +

    helm-gtags-definitions.png @@ -835,12 +871,13 @@

    Find d

    -
    -

    Find references in project

    -
    +
    +

    4.6 Find references in project

    +
    • Using ggtags: Either run ggtags-find-tag-dwim or -ggtags-find-reference, which only finds references.
    • +ggtags-find-reference, which only finds references. +
    • Using helm-gtags: Either run helm-gtags-dwim or helm-gtags-find-rtags, bound to C-c g r, which only finds @@ -848,15 +885,19 @@

      Find r
      • if point is inside a function, the prompt will be default to the -function name.
      • +function name. +
      • If point is on a function, it lists references of that functions -immediately.
      • +immediately. +
      • If point is on a variable, helm-gtags-find-rtags won't have any effect. You should use helm-gtags-find-symbol, which is bound to -C-c g s.
      • -

    • +C-c g s. + +
    +

    @@ -866,9 +907,9 @@

    Find r

    -
    -

    Find functions that current functions call

    -
    +
    +

    4.7 Find functions that current functions call

    +

    If you want to list all the functions that the current function - the function that point is inside - calls, you can do that with @@ -878,17 +919,19 @@

    Find f

    -
    -

    Find files in project

    -
    +
    +

    4.8 Find files in project

    +
    • Using ggtags: Run ggtags-find-file to find a file from all the files indexed. If point is on an included header file, -ggtags-find-tag-dwim automatically jumps to the file.
    • +ggtags-find-tag-dwim automatically jumps to the file. +
    • Using helm-gtags: Run helm-gtags-find-files to find files matching regexp. If point is on an included header file, -helm-gtags-dwim automatically jumps to the file.
    • +helm-gtags-dwim automatically jumps to the file. +

    @@ -901,26 +944,28 @@

    Find f

    -
    -

    View visited tags with tag stack

    -
    +
    +

    4.9 View visited tags with tag stack

    +
    • Using ggtags: As you know that you can jump back with -pop-tag-mark (bound to M-,), you can also view a list of visited -tags using ggtags-view-tag-history, which is bound to C-c g +pop-tag-mark (bound to M-,=), you can also view a list of visited + tags using =ggtags-view-tag-history, which is bound to C-c g h. It displays visited tags from newest to oldest, that is from top -to bottom.
    • +to bottom. +
    • Using helm-gtags: Similarly, helm-gtags also has the command helm-gtags-show-stack that shows visited tags from newest to -oldest, from top to bottom.
    • +oldest, from top to bottom. +
    -
    -

    Browse source tree with Speedbar file browser

    -
    +
    +

    5 Browse source tree with Speedbar file browser

    +

    If you want a static outline tree, Emacs also has a more one: Speedbar. To use Speed bar, M-x speedbar and a frame that contains @@ -940,22 +985,29 @@

    Browse source tree with Speedb

      -
    • Use SPC to open the children of a node.
    • +
    • Use SPC to open the children of a node. +
    • RET to open the node in another window. If node is a file, open that file; if node is a directory, enter that directory; if node is -a tag in a file, jump to the location of that tag in the file.
    • +a tag in a file, jump to the location of that tag in the file. + -
    • U to go up parent directory.
    • +
    • U to go up parent directory. +
    • -
    • n or p moves to next or previous node.
    • +
    • n or p moves to next or previous node. +
    • -
    • M-n or M-p moves to next or previous node at the current level.
    • +
    • M-n or M-p moves to next or previous node at the current level. +
    • b switches to buffer list using Speedbar presentation. You can -also open children of each buffer.
    • +also open children of each buffer. + -
    • f switches back to file list.
    • +
    • f switches back to file list. +

    @@ -964,14 +1016,15 @@

    Browse source tree with Speedb
    -
    (setq speedbar-show-unknown-files t)
    +
    (setq speedbar-show-unknown-files t)
     

    -
    -

    Package: sr-speedbar

    -
    +
    +

    5.1 Package: sr-speedbar

    +
    +

    However, you may feel that a frame is difficult to use. To solve this issue, you need sr-speedbar, which can be installed via @@ -980,10 +1033,12 @@

    Packa
    • To open sr-speedbar, execute the command sr-speedbar-open or -sr-speedbar-toggle.
    • +sr-speedbar-toggle. +
    • To close sr-speedbar, execute the command sr-speedbar-close or -sr-speedbar-toggle again.
    • +sr-speedbar-toggle again. +

    @@ -996,13 +1051,17 @@

    Packa
    • Automatically switches directory tree - when you switch buffer - to -the default-directory of current buffer.
    • -
    • Use an Emacs window instead of frame, make it easier to use.
    • +the default-directory of current buffer. + +
    • Use an Emacs window instead of frame, make it easier to use. +
    • C-x 1 deletes every window except Speedbar, so you won't have to -open again.
    • +open again. +
    • You can prevent C-x o to jump to sr-speedbar window by setting sr-speedbar-skip-other-window-p to `t`. You can still move to -sr-speedbar window using either the mouse or windmove.
    • +sr-speedbar window using either the mouse or windmove. +

    @@ -1014,9 +1073,11 @@

    Packa

      -
    • The first child is always the return type, void.
    • +
    • The first child is always the return type, void. +
    • The subsequent children are function parameters. Inside each -function parameter node is its type.
    • +function parameter node is its type. +
    @@ -1027,9 +1088,9 @@

    Packa

    -
    -

    General completion with company-mode

    -
    +
    +

    6 General completion with company-mode

    +

    company-mode is a text completion framework for Emacs. The name stands for "complete anything". It uses pluggable back-ends and @@ -1048,8 +1109,8 @@

    General completion with company
    -
    (require 'company)
    -(add-hook 'after-init-hook 'global-company-mode)
    +
    (require 'company)
    +(add-hook 'after-init-hook 'global-company-mode)
     
    @@ -1075,9 +1136,9 @@

    General completion with company

    -
    -

    Demo project

    -
    +
    +

    7 Demo project

    +

    I uploaded a demo project for you to play with completion feature here. The project has this structure: @@ -1108,8 +1169,8 @@

    Demo project

    -
    void filename_func1();
    -int filename_func2(int a, int b);
    +
    void filename_func1();
    +int filename_func2(int a, int b);
     
    @@ -1119,11 +1180,11 @@

    Demo project

    -
    #include "filename.h"
    +
    #include "filename.h"
     
    -void filename_func1() { }
    +void filename_func1() { }
     
    -int filename_func2(int a, int b) { }
    +int filename_func2(int a, int b) { }
     
    @@ -1137,18 +1198,18 @@

    Demo project

    -
    -

    Source code completion using Clang

    -
    +
    +

    8 Source code completion using Clang

    +

    To use company-mode with Clang, add this configuration:

    -
    (setq company-backends (delete 'company-semantic company-backends))
    -(define-key c-mode-map  [(tab)] 'company-complete)
    -(define-key c++-mode-map  [(tab)] 'company-complete)
    +
    (setq company-backends (delete 'company-semantic company-backends))
    +(define-key c-mode-map  [(tab)] 'company-complete)
    +(define-key c++-mode-map  [(tab)] 'company-complete)
     
    @@ -1157,8 +1218,7 @@

    Source code completion using Cl

      -
    • -company-clang: use clang to retrieve completion candidates. You +

    • company-clang: use clang to retrieve completion candidates. You will have completion with system header files, but not your project. By default, company-complete already includes company-clang backend, so you can use company-complete to @@ -1168,7 +1228,6 @@

      Source code completion using Cl company-clang, because it has higher precedence in company-backends. company-semantic will be discuss in the CEDET section. -

      To retrieve completion candidates for your projects, you will have @@ -1178,10 +1237,11 @@

      Source code completion using Cl
      -
      ((nil . ((company-clang-arguments . ("-I/home/<user>/project_root/include1/"
      -                                     "-I/home/<user>/project_root/include2/")))))
      +
      ((nil . ((company-clang-arguments . ("-I/home/<user>/project_root/include1/"
      +                                     "-I/home/<user>/project_root/include2/")))))
       
      -

    • +

    +

    @@ -1218,7 +1278,8 @@

    Source code completion using Cl
  • company-gtags: use GTAGS database from GNU Global to retrieve completion candidates. It displays ALL completion candidates in GTAGS database regarding of scope. Use company-gtags to provide -code completion in your current project.
  • +code completion in your current project. +

    @@ -1226,17 +1287,17 @@

    Source code completion using Cl

      -
    • Create a .dir-locals.el at project_root.
    • -
    • -Add this Emacs Lisp code: -

      +
    • Create a .dir-locals.el at project_root. +
    • +
    • Add this Emacs Lisp code:
      -
      ((nil . ((company-clang-arguments . ("-I/home/<user>/project_root/include1/"
      -                                     "-I/home/<user>/project_root/include2/")))))
      +
      ((nil . ((company-clang-arguments . ("-I/home/<user>/project_root/include1/"
      +                                     "-I/home/<user>/project_root/include2/")))))
       
      -
    • +

    +

    @@ -1245,14 +1306,15 @@

    Source code completion using Cl
    • Enter any source file and start completion. You will see that -company-clang correctly retrieves completion candidates in those directories.
    • +company-clang correctly retrieves completion candidates in those directories. +

    -
    -

    Header file completion with company-c-headers package

    -
    +
    +

    9 Header file completion with company-c-headers package

    +

    company-c-headers provides auto-completion for C/C++ headers using Company. After installing from MELPA, set it up: @@ -1260,7 +1322,7 @@

    Heade
    -
    (add-to-list 'company-backends 'company-c-headers)
    +
    (add-to-list 'company-backends 'company-c-headers)
     
    @@ -1280,7 +1342,7 @@

    Heade
    -
    (add-to-list 'company-c-headers-path-system "/usr/include/c++/4.8/")
    +
    (add-to-list 'company-c-headers-path-system "/usr/include/c++/4.8/")
     
    @@ -1292,35 +1354,36 @@

    Heade

    -
    -

    CEDET

    -
    +
    +

    10 CEDET

    +
    -
    -

    What is CEDET?

    -
    +
    +

    10.1 What is CEDET?

    +

    -CEDET is a (C)ollection of (E)macs (D)evelopment (E)nvironment (T)ools written -with the end goal of creating an advanced development environment in -Emacs. CEDET includes common features such as intelligent completion, -source code navigation, project management, code generation with -templates . CEDET also provides a framework for working with -programming languages; support for new programming languages can be -added and use CEDET to provide IDE-like features. +CEDET is a (C)ollection of (E)macs (D)evelopment (E)nvironment (T)ools +written with the end goal of creating an advanced development +environment in Emacs. CEDET includes common features such as +intelligent completion, source code navigation, project management, +code generation with templates . CEDET also provides a framework for +working with programming languages; support for new programming +languages can be added and use CEDET to provide IDE-like features.

    -CEDET can give you code completion, but this process takes time and can block -your Emacs while it is doing so. If you have large project, you may not want to -use CEDET for code completion. But, you can use CEDET perfectly for utilities -that work at file scope i.e. refactoring local variables in a function in a file. +CEDET can give you code completion, but this process takes time and +can block your Emacs while it is doing so. If you have large project, +you may not want to use CEDET for code completion. But, you can use +CEDET perfectly for utilities that work at file scope i.e. refactoring +local variables in a function in a file.

    -
    -

    Why use CEDET?

    -
    +
    +

    10.2 Why use CEDET?

    +

    CEDET is simple to setup and portable (right winthin Emacs and written entirely with Emacs Lisp). Without CEDET, you have to use external @@ -1366,17 +1429,17 @@

    Why use CEDET?

    -
    -

    Installation

    -
    +
    +

    10.3 Installation

    +

    CEDET was merged into Emacs since 23.2. You do not need to install CEDET manually. However, you can also use the development repository that contains latest bug fixes and more features. Nevertheless, the built-in Emacs is still adequate for daily usage and convenient for -trying out before actually cloning and use the development -version. Skip this section if you only want to try Emacs. Come back -later if you really like it. +trying out before actually cloning and use the development version. +Skip this section if you only want to try Emacs. Come back later if +you really like it.

    @@ -1397,9 +1460,9 @@

    Installation

    -
    cd cedet
    -make # wait for it to complete
    -cd contrib
    +
    cd cedet
    +make # wait for it to complete
    +cd contrib
     make
     
    @@ -1411,16 +1474,16 @@

    Installation

    -
    (load-file (concat user-emacs-directory "/cedet/cedet-devel-load.el"))
    -(load-file (concat user-emacs-directory "cedet/contrib/cedet-contrib-load.el"))
    +
    (load-file (concat user-emacs-directory "/cedet/cedet-devel-load.el"))
    +(load-file (concat user-emacs-directory "cedet/contrib/cedet-contrib-load.el"))
     
    -
    -

    Semantic minor modes

    -
    +
    +

    10.4 Semantic minor modes

    +

    Semantic is a package that provides language-aware editing commands based on source code parsers. Parsing is a process of analyzing source @@ -1437,25 +1500,26 @@

    Semantic minor modes

    -
    • Setup Semantic
      +
      1. Setup Semantic

        To enable code completion using Semantic, add the following code:

        -
        (require 'cc-mode)
        -(require 'semantic)
        +
        (require 'cc-mode)
        +(require 'semantic)
         
        -(global-semanticdb-minor-mode 1)
        -(global-semantic-idle-scheduler-mode 1)
        +(global-semanticdb-minor-mode 1)
        +(global-semantic-idle-scheduler-mode 1)
         
        -(semantic-mode 1)
        +(semantic-mode 1)
         
        -
      2. +
      +
    • -
    • Command: semantic-mode
      +
    • Command: semantic-mode

      This command activates semantic-mode. In Semantic mode, Emacs parses the buffers you visit for their semantic content. The parsing looks @@ -1484,9 +1548,10 @@

      Semantic minor modes

      -
    • +
    + -
  • Command: global-semanticdb-minor-mode
    +
  • Command: global-semanticdb-minor-mode

    As mentioned above, Semantic caches parsing result for future use. To do that, semanticdb-minor-mode must be activated. In @@ -1495,9 +1560,10 @@

    Semantic minor modes

    semanticdb-default-save-directory variable. The default directory is ~/.emacs.d/semanticdb.

    -
  • +
    + -
  • Command: global-semantic-idle-scheduler-mode
    +
  • Command: global-semantic-idle-scheduler-mode

    When semantic-idle-scheduler-mode is enabled, Emacs periodically checks to see if the buffer is out of date, and reparses while the @@ -1509,8 +1575,9 @@

    Semantic minor modes

    semantic-idle-scheduler-mode, Emacs keeps track live changes of your source code.

    -
  • -
  • Add more system include paths
    +
    +
  • +
  • Add more system include paths

    By default, Semantic automatically includes some default system include paths such as /usr/include, /usr/local/include… You can @@ -1522,9 +1589,9 @@

    Semantic minor modes

    -
    (semantic-add-system-include "/usr/include/boost" 'c++-mode)
    -(semantic-add-system-include "~/linux/kernel")
    -(semantic-add-system-include "~/linux/include")
    +
    (semantic-add-system-include "/usr/include/boost" 'c++-mode)
    +(semantic-add-system-include "~/linux/kernel")
    +(semantic-add-system-include "~/linux/include")
     
    @@ -1533,8 +1600,9 @@

    Semantic minor modes

    semantic-add-system-include
    .

    -
  • -
  • Completion using company-mode
    +
    +
  • +
  • Completion using company-mode

    company-mode provides a command called company-semantic that uses SemanticDB to retrieve completion candidates. Function interface of @@ -1545,12 +1613,13 @@

    Semantic minor modes

    -
  • +
    +
    -
    -

    CEDET can do more

    -
    +
    +

    10.5 CEDET can do more

    +

    This guide only covers a portion of CEDET. Since Semantic parses source code and creates a database for code completion, it would be @@ -1612,9 +1681,9 @@

    CEDET can do more

    -
    -

    Source code navigation using Senator

    -
    +
    +

    10.6 Source code navigation using Senator

    +

    Senator is a part of CEDET. Senator stands for SEmantic NAvigaTOR. Senator provides some useful commands for operating on @@ -1627,21 +1696,21 @@

    Source c

    -
    -

    Navigation

    -
    +
    +

    10.6.1 Navigation

    +
    +

    Senator provides commands for navigating by tag.

    • C-c , n runs senator-next-tag, navigate to the next Semantic -tag.
    • +tag. + -
    • -C-c , p runs senator-previous-tag, navigate to the previous +

    • C-c , p runs senator-previous-tag, navigate to the previous Semantic tag. -

      Here is how both of those commands work: @@ -1656,14 +1725,13 @@

      Navigation

      As you see,the C macro (in the screenshot, its DECLARE_COMPLETION) is not considered a tag. -

    • +

      + -
    • -senator-jump (only available in CEDET bzr), specify a tag to jump +

    • senator-jump (only available in CEDET bzr), specify a tag to jump to. TAB for a list of available Semantic tags in current buffer, similar to TAB in M-x in stock Emacs. If you use Helm, use moo-jump-local from the package function-args instead. -

      Demo (helm-mode is disabled): @@ -1673,16 +1741,15 @@

      Navigation

      senator-jump.gif

      -
    • +
    + -
  • -C-c , u runs senator-go-to-up-reference, move up one reference +

  • C-c , u runs senator-go-to-up-reference, move up one reference level from current tag. An upper reference level of a tag is the source that defines the tag or includes the tag. This is incredibly useful when you want to jump from a function declaration in a class to its definition, or jump to the class that a function belongs to, quickly. -

    @@ -1698,7 +1765,8 @@

    Navigation

    function belongs. Class PIC32F42 has its parent class Microcontrller, and I run C-c , u again to move point to Microcontrller class. At this point, I cannot move further. -

  • +

    +

    @@ -1711,19 +1779,19 @@

    Navigation

    -
    -

    Copy/Paste

    -
    +
    +

    10.6.2 Copy/Paste

    +
    +
    • C-c , M-w runs senator-copy-tag, take the current tag, and place -it in the tag ring.
    • +it in the tag ring. + -
    • -C-c , C-w runs senator-kill-tag, take the current tag, place it +

    • C-c , C-w runs senator-kill-tag, take the current tag, place it in the tag ring, and kill it. Killing the tag removes the text for that tag, and places it into the kill ring. Retrieve that text with C-y. -

      The above commands are basically like normal M-w and C-w, but are @@ -1743,33 +1811,34 @@

      Copy/Paste

      As you see, the function body and its interface is killed and yanked back with C-y. You can also see that the function parameter, aside from its name, its type is also removed when the command is executed. -

    • +

      + -
    • -C-c , C-y runs senator-yank-tag, yank a tag from the tag +

    • C-c , C-y runs senator-yank-tag, yank a tag from the tag ring. The form the tag takes is different depending on where it is being yanked to. For example, in previous example with C-c , C-w, when you run C-y, it yanks the whole thing including function interface and its body. C-c , C-y only yanks the function interface. -

      senator-yank-tag.gif

      -
    • +
    +
  • C-c , r runs senator-copy-tag-to-register, copy the current tag into a register. With prefix argument will delete the text of the -tag to the kill ring.
  • +tag to the kill ring. +
    -
    -

    Obsolete commands

    -
    +
    +

    10.6.3 Obsolete commands

    +

    Senator also provides commands for code completion: senator-complete-symbol and senator-completion-menu-popup. Code @@ -1783,9 +1852,9 @@

    Obsolete commands

    -
    -

    (Optional) Project management with EDE

    -
    +
    +

    10.7 (Optional) Project management with EDE

    +

    EDE, short for Emacs Development Environment, is a generic interface for managing projects. In EDE, a project hierarchy matches a directory @@ -1805,8 +1874,8 @@

    (Optional)
    -
    (require 'ede)
    -(global-ede-mode)
    +
    (require 'ede)
    +(global-ede-mode)
     
    @@ -1820,14 +1889,16 @@

    (Optional)

      -
    • Create a new file called cedet-projects.el in ~/.emacs.d/.
    • -
    • In this file, add a new ede-cpp-root-project in this form:
    • +
    • Create a new file called cedet-projects.el in ~/.emacs.d/. +
    • +
    • In this file, add a new ede-cpp-root-project in this form: +
    -
    (ede-cpp-root-project "project_root"
    -                      :file "/dir/to/project_root/Makefile")
    +
    (ede-cpp-root-project "project_root"
    +                      :file "/dir/to/project_root/Makefile")
     
    @@ -1840,17 +1911,18 @@

    (Optional)

      -
    • Add include directories specific to the project and in your system:
    • +
    • Add include directories specific to the project and in your system: +
    -
    (ede-cpp-root-project "project_root"
    -                      :file "/dir/to/project_root/Makefile"
    -                      :include-path '("/include1"
    -                                      "/include2") ;; add more include
    -                      ;; paths here
    -                      :system-include-path '("~/linux"))
    +
    (ede-cpp-root-project "project_root"
    +                      :file "/dir/to/project_root/Makefile"
    +                      :include-path '("/include1"
    +                                      "/include2") ;; add more include
    +                      ;; paths here
    +                      :system-include-path '("~/linux"))
     
    @@ -1897,28 +1969,33 @@

    (Optional)
    • EDE, short for Emacs Development Environment, is a generic interface -for managing projects.
    • +for managing projects. +
    • EDE enables Semantic to find sources and perform project level -completions.
    • +completions. +
    • To add a C/C++ project, simply create a project definition with this -template in a file, such as ede-projects.el:
    • +template in a file, such as ede-projects.el: +
    -
    (ede-cpp-root-project "project_root"
    -                      :file "/dir/to/project_root/Makefile"
    -                      :include-path '("/include1"
    -                                      "/include2") ;; add more include
    -                      ;; paths here
    -                      :system-include-path '("~/linux"))
    +
    (ede-cpp-root-project "project_root"
    +                      :file "/dir/to/project_root/Makefile"
    +                      :include-path '("/include1"
    +                                      "/include2") ;; add more include
    +                      ;; paths here
    +                      :system-include-path '("~/linux"))
     
      -
    • Load ede-projects.el when Emacs start.
    • +
    • Load ede-projects.el when Emacs start. +
    • If you have opening files, either close or refresh it with M-x - semantic-force-refresh to make Semantic aware of new changes.
    • + semantic-force-refresh to make Semantic aware of new changes. +

    @@ -1928,18 +2005,22 @@

    (Optional)

      -
    • EDE is older, Projectile appears recently.
    • +
    • EDE is older, Projectile appears recently. +
    • EDE manages project files to integrate with specific build system and generate corresponding build file (such as Makefile; these features are not covered in this guide). Projectile provides generic file management operations such as quickly jump to file/directory in -project, list buffers that belong to current project…
    • +project, list buffers that belong to current project… +
    • EDE is part of CEDET suite; it is geared toward Semantic. For example, we used EDE to tell Semantic where to retrieve correct include paths for current project to perform smart completion in previous section. Projectile provides a generic interface for -managing your project under a VCS or some supported build system.
    • -
    • Projectile is easier to learn than EDE.
    • +managing your project under a VCS or some supported build system. + +
    • Projectile is easier to learn than EDE. +

    @@ -1953,25 +2034,35 @@

    (Optional)

    -
    -

    Code refactoring

    -
    +
    +

    11 Code refactoring

    +

    You can use this package, Semantic Refactor for refactoring in small scale. The package offers the following feature:

      -
    • Context-sensitive menu offers appropriate refactoring actions
    • -
    • Generate class implementation (also handles nested class and class template)
    • -
    • Generate class getters and setters
    • -
    • Generate function implementation (also handles function template)
    • -
    • Generate function prototype
    • -
    • Convert function to function pointer
    • -
    • Convert function to function parameter
    • -
    • Move semantic units (class, function, variable)
    • -
    • Extract function with proper type information
    • -
    • Precise local variable rename
    • +
    • Context-sensitive menu offers appropriate refactoring actions +
    • +
    • Generate class implementation (also handles nested class and class template) +
    • +
    • Generate class getters and setters +
    • +
    • Generate function implementation (also handles function template) +
    • +
    • Generate function prototype +
    • +
    • Convert function to function pointer +
    • +
    • Convert function to function parameter +
    • +
    • Move semantic units (class, function, variable) +
    • +
    • Extract function with proper type information +
    • +
    • Precise local variable rename +

    @@ -1980,9 +2071,9 @@

    Code refactoring

    -
    -

    Navigate system include path

    -
    +
    +

    12 Navigate system include path

    +

    Up until now we were only navigating code in a project using GNU Global. How about jumping to system include headers? You have a few @@ -1990,9 +2081,9 @@

    Navigate system

    -
    -

    Using Semantic with semantic-ia-fast-jump command

    -
    +
    +

    12.1 Using Semantic with semantic-ia-fast-jump command

    +

    Semantic provides a jump command based on the parsed tags produced by the Semantic C/C++ parser. To jump to any code in system include path, @@ -2001,8 +2092,8 @@

    Using Semantic -
    (semantic-add-system-include "/usr/local/include")
    -(semantic-add-system-include "~/linux/include")
    +
    (semantic-add-system-include "/usr/local/include")
    +(semantic-add-system-include "~/linux/include")
     

    @@ -2031,9 +2122,9 @@

    Using Semantic

    -
    -

    Using generated database from GNU Global

    -
    +
    +

    12.2 Using generated database from GNU Global

    +

    GNU Global has an environment variable named GTAGSLIBPATH. This variable holds GTAGS database of external libraries that your project @@ -2052,30 +2143,32 @@

    Using gene
    • Export this environment variable in your shell init file, such as -.bashrc or .zshrc:
    • +.bashrc or .zshrc: +
    -
    export GTAGSLIBPATH=$HOME/.gtags/
    +
    export GTAGSLIBPATH=$HOME/.gtags/
     
      -
    • Execute these commands in your terminal:
    • +
    • Execute these commands in your terminal: +
    -
    # Create a directory for holding database, since
    -# you cannot create a database in your system paths
    +
    # Create a directory for holding database, since
    +# you cannot create a database in your system paths
     mkdir ~/.gtags
     
    -# Create symbolic links to your external libraries
    +# Create symbolic links to your external libraries
     ln -s /usr/include usr-include
     ln -s /usr/local/include/ usr-local-include
     
    -# Generate GNU Global database
    +# Generate GNU Global database
     gtags -c
     
    @@ -2109,9 +2202,9 @@

    Using gene

    -
    -

    Project management with Projectile

    -
    +
    +

    13 Project management with Projectile

    +

    Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without @@ -2140,7 +2233,7 @@

    Project ma
    -
    (projectile-global-mode)
    +
    (projectile-global-mode)
     
    @@ -2149,14 +2242,22 @@

    Project ma

      -
    • Jump to any file in the project: C-c p f.
    • -
    • Jump to any directory in the project: C-c p d.
    • -
    • List buffers local to current project: C-c p b.
    • -
    • Jump to recently visited files in project: C-c p e.
    • -
    • Grep in project: C-c p g s
    • -
    • Multi-occur in project buffers: C-c p o.
    • -
    • Simple refactoring with text replace in current project: C-c p r.
    • -
    • Switch visited projects (visited once an Projectile remembers): C-c p p.
    • +
    • Jump to any file in the project: C-c p f. +
    • +
    • Jump to any directory in the project: C-c p d. +
    • +
    • List buffers local to current project: C-c p b. +
    • +
    • Jump to recently visited files in project: C-c p e. +
    • +
    • Grep in project: C-c p g s +
    • +
    • Multi-occur in project buffers: C-c p o. +
    • +
    • Simple refactoring with text replace in current project: C-c p r. +
    • +
    • Switch visited projects (visited once an Projectile remembers): C-c p p. +

    @@ -2165,13 +2266,15 @@

    Project ma
    • Run compilation command at project root: C-c p c. By default, -Projectile prompts the make command.
    • +Projectile prompts the make command. +
    • Switch between .h and .c or .cpp: C-c p a. If the filename - without file extension - of current editing buffer is part of other files, those files are listed as well. If there is only one file with the same name but different extension, switch immediately. Here -is a demo:
    • +is a demo: +
    @@ -2187,13 +2290,13 @@

    Project ma

    -
    -

    Source code information

    -
    +
    +

    14 Source code information

    +
    -
    -

    Command: global-semantic-idle-summary-mode

    -
    +
    +

    14.1 Command: global-semantic-idle-summary-mode

    +

    This mode, when enabled, displays function interface in the minibuffer: @@ -2218,15 +2321,15 @@

    Command: -
    (global-semantic-idle-summary-mode 1)
    +
    (global-semantic-idle-summary-mode 1)
     

    -
    -

    Command: global-semantic-stickyfunc-mode

    -
    +
    +

    14.2 Command: global-semantic-stickyfunc-mode

    +

    When enable, this mode shows the function point is currently in at the first line of the current buffer. This is useful when you have a very @@ -2245,7 +2348,7 @@

    Command: -
    (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
    +
    (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
     

    @@ -2264,16 +2367,16 @@

    Command: -
    (require 'stickyfunc-enhance)
    +
    (require 'stickyfunc-enhance)
     

    -
    -

    Using ggtags + eldoc

    -
    +
    +

    14.3 Using ggtags + eldoc

    +

    You can also use ggtags for displaying function interface at point in minibuffer: @@ -2281,7 +2384,7 @@

    Using ggtags +
    -
    (setq-local eldoc-documentation-function #'ggtags-eldoc-function)
    +
    (setq-local eldoc-documentation-function #'ggtags-eldoc-function)
     
    @@ -2291,22 +2394,22 @@

    Using ggtags +

    -
    -

    Source code documentation

    -
    +
    +

    15 Source code documentation

    +
    -
    -

    Command: man

    -
    +
    +

    15.1 Command: man

    +

    To read the documentation for symbol at point or a man entry of your choice, invoke M-x man.

    -
    -

    Command: helm-man-woman

    -
    +
    +

    15.2 Command: helm-man-woman

    +

    If you use Helm, you should be able to use the command helm-man-woman, which is bound to C-c h m if you follow my Helm @@ -2321,13 +2424,13 @@

    Command: h

    -
    -

    Source code editing

    -
    +
    +

    16 Source code editing

    +
    -
    -

    Folding

    -
    +
    +

    16.1 Folding

    +

    Emacs has a minor mode called hs-minor-mode that allows users to fold and hide blocks of text. Blocks are defined by regular @@ -2342,102 +2445,65 @@

    Folding

    -
    (add-hook 'c-mode-common-hook   'hs-minor-mode)
    +
    (add-hook 'c-mode-common-hook   'hs-minor-mode)
     

    Default key bindings:

    - - +
    -++ +-+ - - + + + - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - + + + - - + + + - - - - - - - - + + + - - + + +
    KeyBindingKeyBinding 
    C-c @ C-cCommand: hs-toggle-hiding
     Toggle hiding/showing of a block
    C-c @ C-hCommand: hs-hide-blockC-c @ C-chs-toggle-hidingToggle hiding/showing of a block
     Select current block at point and hide it
    C-c @ C-lCommand: hs-hide-level
     Hide all block with indentation levels
     below this block
    C-c @ C-sCommand: hs-show-blockC-c @ C-hhs-hide-blockSelect current block at point and hide it
     Select current block at point and show it.
    C-c @ C-M-hCommand: hs-hide-allC-c @ C-lhs-hide-levelHide all block with indentation levels below this block
     Hide all top level blocks, displayingC-c @ C-shs-show-blockSelect current block at point and show it.
     only first and last lines.
    C-c @ C-M-sCommand: hs-show-allC-c @ C-M-hhs-hide-allHide all top level blocks, displaying only first and last lines.
     Show everythingC-c @ C-M-shs-show-allShow everything
    @@ -2447,7 +2513,8 @@

    Folding

      -
    • Command: hs-toggle-hiding
    • +
    • Command: hs-toggle-hiding +
    @@ -2458,9 +2525,9 @@

    Folding

    -
    -

    Narrowing

    -
    +
    +

    16.2 Narrowing

    +

    Narrowing means making only a text portion in current buffer visible. Narrowing is useful when you want to perform text editing on @@ -2475,65 +2542,53 @@

    Narrowing

    Default key bindings:

    - - +
    -++ +-+ - - + + + - - + + + - - - - - - - - + + + - - - - - - - - - - - - - + + +
    KeyBindingKeyBinding 
    C-x n dCommand: narrow-to-defunC-x n dnarrow-to-defunNarrow buffer to current function at point
     Narrow buffer to current function at point
    C-x n rCommand: narrow-to-regionC-x n nnarrow-to-regionNarrow buffer to active region
    C-x n nNarrow buffer to active region
    C-x n wCommand: widen
     Widen bufferC-x n wwidenWiden buffer
    -
    -

    Identation

    -
    +
    +

    16.3 Identation

    +
    -
    -

    Setup default C style

    -
    +
    +

    16.3.1 Setup default C style

    +

    Emacs offers some popular C coding styles. Select the one suitable for you: @@ -2541,28 +2596,28 @@

    Setup default C s
    -
    ;; Available C style:
    -;; “gnu”: The default style for GNU projects
    -;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book
    -;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
    -;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
    -;; “stroustrup”: What Stroustrup, the author of C++ used in his book
    -;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
    -;; “linux”: What the Linux developers use for kernel development
    -;; “python”: What Python developers use for extension modules
    -;; “java”: The default style for java-mode (see below)
    -;; “user”: When you want to define your own style
    -(setq
    - c-default-style "linux" ;; set style to "linux"
    - )
    +
    ;; Available C style:
    +;; “gnu”: The default style for GNU projects
    +;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book
    +;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
    +;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
    +;; “stroustrup”: What Stroustrup, the author of C++ used in his book
    +;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
    +;; “linux”: What the Linux developers use for kernel development
    +;; “python”: What Python developers use for extension modules
    +;; “java”: The default style for java-mode (see below)
    +;; “user”: When you want to define your own style
    +(setq
    + c-default-style "linux" ;; set style to "linux"
    + )
     

    -
    -

    Setup indentation

    -
    +
    +

    16.3.2 Setup indentation

    +

    By default, Emacs won't indent when press RET because the command bound to RET is newline. You can enable automatic indentation by @@ -2571,7 +2626,7 @@

    Setup indentation

    -
    (global-set-key (kbd "RET") 'newline-and-indent)  ; automatically indent when press RET
    +
    (global-set-key (kbd "RET") 'newline-and-indent)  ; automatically indent when press RET
     
    @@ -2583,17 +2638,17 @@

    Setup indentation

    -
    ;; activate whitespace-mode to view all whitespace characters
    -(global-set-key (kbd "C-c w") 'whitespace-mode)
    +
    ;; activate whitespace-mode to view all whitespace characters
    +(global-set-key (kbd "C-c w") 'whitespace-mode)
     
    -;; show unncessary whitespace that can mess up your diff
    -(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
    +;; show unncessary whitespace that can mess up your diff
    +(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
     
    -;; use space to indent by default
    -(setq-default indent-tabs-mode nil)
    +;; use space to indent by default
    +(setq-default indent-tabs-mode nil)
     
    -;; set appearance of a tab that is represented by 4 spaces
    -(setq-default tab-width 4)
    +;; set appearance of a tab that is represented by 4 spaces
    +(setq-default tab-width 4)
     
    @@ -2610,9 +2665,9 @@

    Setup indentation

    -
    -

    Package: clean-aindent-mode

    -
    +
    +

    16.3.3 Package: clean-aindent-mode

    +

    When you press RET to create a newline and got indented by eletric-indent-mode, you have appropriate whitespace for @@ -2627,17 +2682,17 @@

    Package: clean-ainde
    -
    ;; Package: clean-aindent-mode
    -(require 'clean-aindent-mode)
    -(add-hook 'prog-mode-hook 'clean-aindent-mode)
    +
    ;; Package: clean-aindent-mode
    +(require 'clean-aindent-mode)
    +(add-hook 'prog-mode-hook 'clean-aindent-mode)
     

    -
    -

    Package: dtrt-indent

    -
    +
    +

    16.3.4 Package: dtrt-indent

    +

    A minor mode that guesses the indentation offset originally used for creating source code files and transparently adjusts the corresponding @@ -2662,9 +2717,9 @@

    Package: dtrt-indent
    -
    ;; Package: dtrt-indent
    -(require 'dtrt-indent)
    -(dtrt-indent-mode 1)
    +
    ;; Package: dtrt-indent
    +(require 'dtrt-indent)
    +(dtrt-indent-mode 1)
     
    @@ -2677,15 +2732,15 @@

    Package: dtrt-indent
    -
    (setq dtrt-indent-verbosity 0)
    +
    (setq dtrt-indent-verbosity 0)
     

    -
    -

    Package: ws-butler

    -
    +
    +

    16.3.5 Package: ws-butler

    +

    ws-butler helps managing whitespace on every line of code written or edited, in an unobtrusive, help you write clean code without noisy @@ -2695,9 +2750,11 @@

    Package: ws-butler

  • Only lines touched get trimmed. If the white space at end of buffer is changed, then blank lines at the end of buffer are truncated -respecting require-final-newline.
  • +respecting require-final-newline. + -
  • Trimming only happens when saving.
  • +
  • Trimming only happens when saving. +
  • @@ -2713,18 +2770,18 @@

    Package: ws-butler

    -
      ;; Package: ws-butler
    -(require 'ws-butler)
    -(add-hook 'c-mode-common-hook 'ws-butler-mode)
    +
      ;; Package: ws-butler
    +(require 'ws-butler)
    +(add-hook 'c-mode-common-hook 'ws-butler-mode)
     
    -
    -

    Code template using yasnippet

    -
    +
    +

    16.4 Code template using yasnippet

    +

    YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function @@ -2740,9 +2797,9 @@

    Code template using yasnippet
    -
    ;; Package: yasnippet
    -(require 'yasnippet)
    -(yas-global-mode 1)
    +
    ;; Package: yasnippet
    +(require 'yasnippet)
    +(yas-global-mode 1)
     
    @@ -2758,9 +2815,9 @@

    Code template using yasnippet
    -
    for (i = 0; i < N; i++) {
    +
    for (i = 0; i < N; i++) {
         ...point will be here....
    -}
    +}
     
    @@ -2770,9 +2827,9 @@

    Code template using yasnippet

    -
    -

    Package: smartparens

    -
    +
    +

    16.5 Package: smartparens

    +

    smartparens is a minor mode that provides many features for manipulating pairs. Pair can be simple as parentheses or brackets, or @@ -2783,17 +2840,17 @@

    Package: smartparens
    -
      ;; Package: smartparens
    -(require 'smartparens-config)
    -(show-smartparens-global-mode +1)
    -(smartparens-global-mode 1)
    -
    -;; when you press RET, the curly braces automatically
    -;; add another newline
    -(sp-with-modes '(c-mode c++-mode)
    -  (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
    -  (sp-local-pair "/*" "*/" :post-handlers '((" | " "SPC")
    -                                            ("* ||\n[i]" "RET"))))
    +
      ;; Package: smartparens
    +(require 'smartparens-config)
    +(show-smartparens-global-mode +1)
    +(smartparens-global-mode 1)
    +
    +;; when you press RET, the curly braces automatically
    +;; add another newline
    +(sp-with-modes '(c-mode c++-mode)
    +  (sp-local-pair "{" nil :post-handlers '(("||\n[i]" "RET")))
    +  (sp-local-pair "/*" "*/" :post-handlers '((" | " "SPC")
    +                                            ("* ||\n[i]" "RET"))))
     
    @@ -2804,9 +2861,9 @@

    Package: smartparens

    -
    -

    Compilation Support

    -
    +
    +

    17 Compilation Support

    +

    Compilation mode turns each error message in the buffer into a hyperlink. You can click on each error, or execute a key binding like @@ -2816,73 +2873,64 @@

    Compilation Support

    The following key bindings are available:

    - - +
    -+-+ - - + + - - + + - - + - - + + - - + - - + + - - + - - + + - - + - - + + - - + - - + + - - + - - + + - - + - - + + - - + - - + +
    KeyDescriptionKeyDescription
    C-oDisplay matched location, but do not switch point to matched bufferC-oDisplay matched location, but do not switch point to matched buffer
    M-nMove to next error message, but do not visit error locationM-nMove to next error message, but do not visit error location
    M-pMove to next previous message, but do not visit error locationM-pMove to next previous message, but do not visit error location
    M-g nMove to next error message, visit error locationM-g nMove to next error message, visit error location
    M-g pMove to previous error message, visit error locationM-g pMove to previous error message, visit error location
    RETVisit location of error at poiintRETVisit location of error at poiint
    M-{Move point to the next error message or match occurring in a different fileM-{Move point to the next error message or match occurring in a different file
    M-}Move point to the previous error message or match occurring in a different fileM-}Move point to the previous error message or match occurring in a different file
    qQuit *compilation* bufferqQuit *compilation* buffer
    @@ -2895,10 +2943,10 @@

    Compilation Support

    -
    (global-set-key (kbd "<f5>") (lambda ()
    -                               (interactive)
    -                               (setq-local compilation-read-command nil)
    -                               (call-interactively 'compile)))
    +
    (global-set-key (kbd "<f5>") (lambda ()
    +                               (interactive)
    +                               (setq-local compilation-read-command nil)
    +                               (call-interactively 'compile)))
     
    @@ -2947,18 +2995,19 @@

    Compilation Support

    store a window configuration that contains it into a register, so you can always jump back to project root any where, any time and run compilation command. If you do not use know how to use registers to -store window configurations, read it here. +store window configurations, read it here.

    -
    -

    Debugging

    -
    +
    +

    18 Debugging

    +
    -
    -

    With GDB Many Windows

    -
    +
    +

    18.1 With GDB Many Windows

    +
    +

    Emacs has built-in frontend support for GDB that provides IDE-like interface. It has a layout like this: @@ -2977,13 +3026,13 @@

    With GDB Many Windows

    -
    (setq
    - ;; use gdb-many-windows by default
    +
    (setq
    + ;; use gdb-many-windows by default
      gdb-many-windows t
     
    - ;; Non-nil means display source file containing the main routine at startup
    + ;; Non-nil means display source file containing the main routine at startup
      gdb-show-main t
    - )
    + )
     
    @@ -3010,32 +3059,32 @@

    With GDB Many Windows

    - + - + -  -  +  +  -1. GUD interaction buffer -2. Locals/Registers buffer +1. GUD interaction buffer +2. Locals/Registers buffer -3. Primary Source buffer -4. I/O buffer for debugging program +3. Primary Source buffer +4. I/O buffer for debugging program -5. Stack buffer -6. Breakpoints/Threads buffer +5. Stack buffer +6. Breakpoints/Threads buffer @@ -3047,36 +3096,44 @@

    With GDB Many Windows

    • gdb-display-gdb-buffer (Cell 1): This is where you enter gdb commands, the same as in terminal. When you kill this buffer, other -GDb buffers are also killed and debugging session is terminated.
    • +GDb buffers are also killed and debugging session is terminated. +
    • gdb-display-locals-buffer (Cell 2): display local variables and its values in current stack frame. Please refer to GNU Manual - -Other GDB Buffers for usage of the buffer.
    • +Other GDB Buffers for usage of the buffer. +
    • gdb-display-registers-buffer (Cell 2): registers values are displayed here. Please refer to GNU Manual - Other GDB Buffers for -usage of the buffer.
    • +usage of the buffer. +
    • Your source buffer (Cell 3): Your source code for stepping through out the debugging session. Please refer to GNU Manual - Source -Buffers for usage of the buffer.
    • +Buffers for usage of the buffer. +
    • gdb-display-io-buffer (Cell 4): This is where your program displays output and accepts input. In stock GDB (Command Line Interface), you enter input whenever a program asks for one under GDB prompt. Using gdb-many-windows, you must enter program input -here.
    • +here. +
    • gdb-display-stack-buffer (Cell 5): Display function call -stack. Please refer to GNU Manual - Stack buffer for usage.
    • +stack. Please refer to GNU Manual - Stack buffer for usage. +
    • gdb-display-breakpoints-buffer (Cell 6): Display a list of breakpoints. Please refere to GNU Manual - Breakpoints Buffer for -usage of the buffer.
    • +usage of the buffer. +
    • gdb-display-threads-buffer (Cell 6): Display running threads in your programs. Please refer to GNU Manual - Threads Buffer and -Multithreaded Debugging for usage of the buffer.
    • +Multithreaded Debugging for usage of the buffer. +

    @@ -3086,8 +3143,10 @@

    With GDB Many Windows

    • gdb-display-disassembly-buffer: displays the current frame as -assembly code.
    • -
    • gdb-display-memory-buffer: displays a portion of program memory.
    • +assembly code. + +
    • gdb-display-memory-buffer: displays a portion of program memory. +

    @@ -3102,9 +3161,9 @@

    With GDB Many Windows

    -
    -

    With Grand Unified Debugger - GUD

    -
    +
    +

    18.2 With Grand Unified Debugger - GUD

    +

    The Grand Unified Debugger, or GUD for short, is an Emacs major mode for debugging. It works on top of command line debuggers. GUD handles @@ -3153,21 +3212,9 @@

    With Grand Unified Debugger - GUD

    - -
    - - - comments powered by Disqus +

    Created: 2016-12-09 Fri 12:23

    +

    Emacs 24.5.1 (Org mode 8.2.10)

    +

    Validate

    diff --git a/emacs-for-proglang.html b/docs/emacs-for-proglang.html similarity index 63% rename from emacs-for-proglang.html rename to docs/emacs-for-proglang.html index 7d564d6..937470c 100644 --- a/emacs-for-proglang.html +++ b/docs/emacs-for-proglang.html @@ -3,30 +3,22 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - Emacs for Programming Languages course on Coursera + + - - + - + - -
    - - - - -

    Back to Table of Contents

    -

    Emacs for Programming Languages course on Coursera

    @@ -260,13 +210,13 @@

    Table of Contents

    first. Racket and Ruby will come later.

    -
    -

    Before using Emacs:

    -
    +
    +

    1 Before using Emacs:

    +
    -
    -

    Emacs and SML in Linux:

    -
    +
    +

    1.1 Emacs and SML in Linux:

    +

    Easy way to install if you are using Ubuntu: sudo apt-get install emacs smlnj. If you use other Linux distributions, use the package @@ -285,16 +235,18 @@

    Emacs

    -
    -

    Emacs and SML Installation on Windows

    -
    +
    +

    1.2 Emacs and SML Installation on Windows

    +
    • If you don't have Emacs yet, download the 64 bit version here: http://sourceforge.net/projects/emacsbinw64/, unpackage it to C:\Program Files\ , then create a shortcut in your desktop to -runemacs.exe, an executable in the emacs\bin directory.
    • +runemacs.exe, an executable in the emacs\bin directory. + -
    • Now, clone my Emacs kit:
    • +
    • Now, clone my Emacs kit: +
    @@ -305,7 +257,8 @@

    Emacs
    • Or, if you don't have git, download release package in either zip or -tar.gz format at: https://github.com/tuhdo/emacs-proglang/releases.
    • +tar.gz format at: https://github.com/tuhdo/emacs-proglang/releases. +
    • You should unpackage into ~/.emacs.d. But before that, you must define your HOME and PATH directory.The path ~/ stands for $HOME @@ -313,10 +266,10 @@

      Emacs and the user can put whatever he/she wants there. PATH is an environment variable in Linux that makes the shell see executable programs, so you can execute them by specifying the program name -only. We can use the same thing in Windows.

    • +only. We can use the same thing in Windows. + -
    • -In Windows, to set your HOME variable: left clicking My Computer +

    • In Windows, to set your HOME variable: left clicking My Computer -> Properties -> Advanced System Settings -> Advanced -> Environment Variables -> New. Then enter HOME in Variable name, and a path of your choice in Variable value. After this, @@ -325,16 +278,15 @@

      Emacs directory. For example, if you home directory that you assigned to the HOME variable is C:\home\, then you must put .emacs.d there. -

      emacs_home.png

      -

    • +

    + -
  • -Now that you created a HOME variable, you need to create one more: +

  • Now that you created a HOME variable, you need to create one more: PATH variable. Emacs searches for any program in PATH variable. Click New, then enter PATH into Variable name. In Variable value, if you install SML using the standard installer, @@ -342,13 +294,13 @@

    Emacs into the text field. In the future, if you want to add more locations that contain programs Emacs can see, add more path and separate each path by a semicolon. -

    emacs_path.png

    -

  • +
    +

    @@ -359,9 +311,9 @@

    Emacs

    -
    -

    Optional but recommended: Swap Control and Capslock

    -
    +
    +

    1.3 Optional but recommended: Swap Control and Capslock

    +

    Swapping Control and Capslock, in general, is not required to make the best out of Emacs, if you at least use regular key PC keyboard or @@ -378,24 +330,24 @@

    Option

    -
    -

    Windows

    -
    +
    +

    1.3.1 Windows

    +
    -
    -

    Linux

    -
    +
    +

    1.3.2 Linux

    +

    Put this in your shell init file (.bashrc, .zshrc…):

    -
    /usr/bin/setxkbmap -option "ctrl:swapcaps"
    +
    /usr/bin/setxkbmap -option "ctrl:swapcaps"
     
    @@ -405,35 +357,38 @@

    Linux<

    -
    -

    Mac OS X

    -
    +
    +

    1.3.3 Mac OS X

    +

    Follow this answer on StackOverflow: Emacs on Mac OS X Leopard key bindings

    -
    -

    If you don't like to swap Capslock and Control…

    -
    +
    +

    1.3.4 If you don't like to swap Capslock and Control…

    +

    You can use your palm to press Control in standard PC keyboard.

    -
    -

    Optional: changing Emacs look and feel

    -
    +
    +

    1.4 Optional: changing Emacs look and feel

    +

    You can change Emacs look and feel easily:

      -
    • Press Alt + x.
    • -
    • Type customize-theme (you can press TAB to complete).
    • -
    • There are some default themes there, select the one you want.
    • +
    • Press Alt + x. +
    • +
    • Type customize-theme (you can press TAB to complete). +
    • +
    • There are some default themes there, select the one you want. +

    @@ -441,8 +396,10 @@

    Option

    @@ -450,31 +407,34 @@

    Option

      -
    • Press Alt + x.
    • -
    • Type list-packages.
    • +
    • Press Alt + x. +
    • +
    • Type list-packages. +
    • Search for the theme names using Control + s. After you press Control + s, enter the theme name and press Control + s again for it to jump to the matched text. The theme names are above the preview picture in the first website; for the second website, you replace the space by dash character. For example, if a theme named "Lush Theme", to search for this theme in package list, enter -"lush-theme".
    • +"lush-theme". +

    -
    -

    General basic Emacs commands

    -
    +
    +

    2 General basic Emacs commands

    +

    I took some parts from my other guide Emacs Mini Manual (PART 1) - THE BASICS. I recommend you to follow the mini manual when you have time.

    -
    -

    Command

    -
    +
    +

    2.1 Command

    +

    In Emacs, every user interaction is a function execution. You press a key to insert a character, Emacs runs self-insert-command. There are @@ -486,11 +446,13 @@

    Comma programming languages, and are used for implementing features in Emacs. Users do not need to care about these functions, unless they want to implement something or modifying the -implementations. +implementations. +
  • Commands: Commands are like functions, but interactive. It means, commands are features provided to users and users -directly use them.
  • +directly use them. +

    @@ -499,9 +461,9 @@

    Comma

    -
    -

    Emacs Key Notation

    -
    +
    +

    2.2 Emacs Key Notation

    +

    Taken from here: EmacsWiki

    @@ -510,67 +472,67 @@

    Emacs - + - + -Prefix -Meaning +Prefix +Meaning -C- -(press and hold) the Control key +C- +(press and hold) the Control key -M- -the Meta key (the Alt key, on most keyboards) +M- +the Meta key (the Alt key, on most keyboards) -S- -the Shift key (e.g.‘S-TAB’ means Shift Tab) +S- +the Shift key (e.g.‘S-TAB’ means Shift Tab) -DEL -the Backspace key (not the Delete key). Inside Emacs, DEL +DEL +the Backspace key (not the Delete key). Inside Emacs, DEL -  -is written as <backspace>. +  +is written as <backspace>. -RET -the Return or Enter key +RET +the Return or Enter key -SPC -the Space bar key +SPC +the Space bar key -ESC -the Escape key +ESC +the Escape key -TAB -the TAB key +TAB +the TAB key @@ -626,24 +588,28 @@

    Emacs

    -
    -

    Emacs Keys are easy to remember

    -
    +
    +

    2.3 Emacs Keys are easy to remember

    +

    The key bindings have a few simple and easy to remember rules:

    • C-x prefix is for default and global bindings that comes with -Emacs.
    • -
    • C-c prefix is for users to define.
    • +Emacs. + +
    • C-c prefix is for users to define. +
    • C-u is for altering behaviors of commands. That is, one command can behave differently depend on how many C-u you pressed first before executing a command. Mostly you just have to hit C-u -once.
    • +once. +
    • C-<number> like C-1, C-2… is similar to C-u, but passing a number to a command. Usually, the number specifies how many times -you want to repeat a command.
    • +you want to repeat a command. +

    @@ -656,20 +622,19 @@

    Emacs example, command like helm-do-grep (the command belongs to Helm, a 3rd party extension to Emacs) can have a key binding like C-c h g. The h stands for Helm and g stands for grep. So, key -bindings are not difficult to remember. +bindings are not difficult to remember.

    -
    -

    Some basic commands

    -
    +
    +

    2.4 Some basic commands

    +
    +
      -
    • -Open file: C-x C-f and browse to the file. You can fuzzy match +

    • Open file: C-x C-f and browse to the file. You can fuzzy match candidates in current directory, e.g "fob" or "fbr" will complete -"foobar". -

      +"foobar".

      C-l to go back to parent directory and C-j to go down to current @@ -678,7 +643,7 @@

      Some

      C-z to see a list of actions that you can apply on highlighting -candidate, TAB to view a file content without visiting it. +candidate, TAB to view a file content without visiting it.

      @@ -688,32 +653,39 @@

      Some

      C-c d on a file to delete it. -

    • +

      +
    • Open recently opened files: C-x b contains a list of opened files and recently opened files. To move between these lists, use left/right arrow keys or use C-o. You can type part of a desired filename and -narrow down.
    • +narrow down. +
    • Close file: C-x k, select a buffer to close. Buffers are simply your opened files, for now. By default, your current editing -buffer is at the top. Press RET to confirm killing the buffer.
    • +buffer is at the top. Press RET to confirm killing the buffer. +
    -
    -

    Basic motion commands

    -
    +
    +

    2.4.1 Basic motion commands

    +

    These key bindings are also used by popular shells such as bash or zsh. I highly recommended you to master these key bindings.

      -
    • Move forward one char: C-f (f stands for forward)
    • -
    • Move backward one char: C-b (b stands for backward)
    • -
    • Move upward one line: C-p (p stands for previous)
    • -
    • Move downward one line: C-n (n stands for next)
    • +
    • Move forward one char: C-f (f stands for forward) +
    • +
    • Move backward one char: C-b (b stands for backward) +
    • +
    • Move upward one line: C-p (p stands for previous) +
    • +
    • Move downward one line: C-n (n stands for next) +

    @@ -722,10 +694,14 @@

    Basic

      -
    • Move to beginning of line: C-a
    • -
    • Move to end of line: C-e
    • -
    • Move forward one word, M-f.
    • -
    • Move backward one word, M-b.
    • +
    • Move to beginning of line: C-a +
    • +
    • Move to end of line: C-e +
    • +
    • Move forward one word, M-f. +
    • +
    • Move backward one word, M-b. +

    @@ -733,18 +709,28 @@

    Basic

      -
    • Scroll forward one screen: C-v, page down
    • -
    • Scroll backward one screen: M-v, page up
    • -
    • Move to the beginning of a sentence: M-a
    • -
    • Move to the end of a sentence: M-e
    • -
    • Recenter a screen: M-l
    • +
    • Scroll forward one screen: C-v, page down +
    • +
    • Scroll backward one screen: M-v, page up +
    • +
    • Move to the beginning of a sentence: M-a +
    • +
    • Move to the end of a sentence: M-e +
    • +
    • Recenter a screen: M-l +
    • Re-position cursor to the top, middle and bottom of the current -screen: M-r
    • -
    • Move to top of the buffer: M-<
    • -
    • Move to end of the buffer: M->
    • -
    • Move to the nth character: M-g c (c stands for character)
    • +screen: M-r + +
    • Move to top of the buffer: M-< +
    • +
    • Move to end of the buffer: M-> +
    • +
    • Move to the nth character: M-g c (c stands for character) +
    • Move to the nth line: M-g l for Emacs < 23.2, M-g g for emacs >= -23.2) (l/g stands for line)
    • +23.2) (l/g stands for line) +

    @@ -764,9 +750,9 @@

    Basic

    -
    -

    Incremental search

    -
    +
    +

    2.4.2 Incremental search

    +

    So, you want to look for something in the buffer? C-s invokes isearch-forward, allows you to look forward from the current point @@ -787,30 +773,43 @@

    Incre

    -
    -

    Basic editing commands:

    -
    +
    +

    2.4.3 Basic editing commands:

    +

    In Emacs, kill means Cut in other editors. These key bindings also work under the terminal.

      -
    • Kill a character at the cursor: C-d
    • +
    • Kill a character at the cursor: C-d +
    • Kill entire line: C-S-DEL (remember, DEL is your <backspace> - key), or C-w (not in stock Emacs)
    • -
    • Kill forward to the end of a word from current cursor: M-d
    • + key), or C-w (not in stock Emacs) + +
    • Kill forward to the end of a word from current cursor: M-d +
    • Kill backward to the beginning of a word from the current cursor: -M-DEL
    • -
    • Kill all spaces at cursor: M-\
    • -
    • Kill all spaces except one at cursor: M-SPC
    • -
    • Kill to the end of line: C-k
    • -
    • Kill a sentence: M-k
    • -
    • Undo: C-/
    • -
    • Redo: C-?
    • -
    • Open a list of killed texts: M-y (not in stock Emacs)
    • -
    • Duplicate line/region: M-c (not in stock Emacs)
    • -
    • Indent whole buffer: C-c i (not in stock Emacs)
    • +M-DEL + +
    • Kill all spaces at cursor: M-\ +
    • +
    • Kill all spaces except one at cursor: M-SPC +
    • +
    • Kill to the end of line: C-k +
    • +
    • Kill a sentence: M-k +
    • +
    • Undo: C-/ +
    • +
    • Redo: C-? +
    • +
    • Open a list of killed texts: M-y (not in stock Emacs) +
    • +
    • Duplicate line/region: M-c (not in stock Emacs) +
    • +
    • Indent whole buffer: C-c i (not in stock Emacs) +

    @@ -824,20 +823,24 @@

    Basic
    • If you do not highlight a text region, M-; adds a comment to the -end of line.
    • +end of line. +
    • If you do not highlight a text region and comment is at the end of -line, M-; comments the whole line (not in stock Emacs).
    • +line, M-; comments the whole line (not in stock Emacs). +
    • If you do not highlight a text region and your current line is being -commented, M-; uncomments the whole line (not in stock Emacs).
    • +commented, M-; uncomments the whole line (not in stock Emacs). +
    • If you highlight a region (i.e. with a mouse), M-; comments out -the region.
    • +the region. +

    -
    -

    Buffer commands

    -
    +
    +

    2.4.4 Buffer commands

    +

    Buffer is where you edit your file content. Buffer holds content of a file temporarily. Anything you write into the buffer won't make @@ -874,72 +877,72 @@

    Buffe - + - + -Key -Binding +Key +Binding -C-x C-s -Command: save-buffer +C-x C-s +Command: save-buffer -  -Save the buffer at point +  +Save the buffer at point -C-x C-w -Command: write-file +C-x C-w +Command: write-file -  -Save the buffer to a different file +  +Save the buffer to a different file -C-x b -Command: switch-to-buffer +C-x b +Command: switch-to-buffer -  -Switch to a different buffer +  +Switch to a different buffer -C-x k -Command: kill-buffer +C-x k +Command: kill-buffer -  -Kill a buffer. RET to kill the +  +Kill a buffer. RET to kill the -  -currently active one +  +currently active one

    -
    -

    Window commands

    -
    +
    +

    2.4.5 Window commands

    +

    Unlike other editors, Emacs can split your frame area into multiple smaller areas. Each such area is called a window. You can divide a frame @@ -999,18 +1002,16 @@

    Windo

    -
    -

    Commands for SML

    -
    +
    +

    3 Commands for SML

    +

    You need these three essential commands to work with your SML assignments. All the demos begin when you see START at the bottom:

      -
    • -C-c C-s runs command sml-prog-proc-switch-to -

      +
    • C-c C-s runs command sml-prog-proc-switch-to

      Description: Start SML REPL. @@ -1020,11 +1021,10 @@

      Comma

      sml-start-proc.gif

      -

    • +
    + -
  • -C-c C-b runs command sml-prog-proc-send-buffer -

    +
  • C-c C-b runs command sml-prog-proc-send-buffer

    Description: Send the current editing buffer to SML REPL for @@ -1035,11 +1035,10 @@

    Comma

    sml-send-buffer.gif

    -

  • +
    + -
  • -C-c C-r runs Command: sml-prog-proc-send-region -

    +
  • C-c C-r runs Command: sml-prog-proc-send-region

    Description: Similar to sml-prog-proc-send-buffer, but instead @@ -1051,7 +1050,8 @@

    Comma

    sml-send-region.gif

    -

  • +
    +

    @@ -1059,66 +1059,64 @@

    Comma

      -
    • -C-c h i runs command helm-semantic-or-imenu that lists variable +

    • C-c h i runs command helm-semantic-or-imenu that lists variable and function definitions in current buffer. -

      sml-helm-imenu.gif

      -
    • +

    + -
  • -Auto-completion: pressing TAB brings up an interface for +

  • Auto-completion: pressing TAB brings up an interface for identifier completion. If you type a few characters and stop for a little moment, a completion popup appears with suitable candidates. -

    sml-completion.gif

    -
  • +
    +
    -
    -

    Commands for Racket

    -
    +
    +

    4 Commands for Racket

    +
    -
    -

    Editing support: You don't have to fight the parentheses

    -
    +
    +

    4.1 Editing support: You don't have to fight the parentheses

    +
    -
    -

    Automatic indentation

    -
    +
    +

    4.1.1 Automatic indentation

    +
      -
    • -aggressive-indent is a minor mode that keeps your code always +

    • aggressive-indent is a minor mode that keeps your code always indented. It reindents after every command. It is available for Lisp modes (such as Racket, Common Lisp, Emacs Lisp…) in this distribution for the course. -

      aggressive-indent.gif

      -
    • +
    +
  • You can also run C-c i to indents whole buffer. In Lisp modes, you won't need it; but for other programming modes, C-c i is always -useful.
  • +useful. +
    -
    -

    Automatic comment

    -
    +
    +

    4.1.2 Automatic comment

    +

    comment-dwim2 is a package that provides extended features compare with the original command comment-dwim. dwim stands for do what i @@ -1138,47 +1136,42 @@

    Autom

    -
    -

    Basic navigation for Lisp expressions

    -
    +
    +

    4.2 Basic navigation for Lisp expressions

    +
      -
    • -C-M-f binds to forward-sexp, move forward over a balanced; +

    • C-M-f binds to forward-sexp, move forward over a balanced; C-M-b binds to backward-sexp, move backward over a balanced expression. Demo: -

      forward-backward-parens.gif

      -
    • +
    + -
  • -C-M-k binds to kill-sexp, kill balanced expression +

  • C-M-k binds to kill-sexp, kill balanced expression forward. Demo: -

    kill-sexp.gif

    -
  • +
    + -
  • -C-M-t binds to transpose-sexps, transpose expressions. Demo: -

    +
  • C-M-t binds to transpose-sexps, transpose expressions. Demo:

    transpose-sexp.gif

    -
  • +
    + -
  • -C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after +

  • C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after following expression. Demo: -

    @@ -1195,7 +1188,8 @@

    Basic in this cheatsheet. In my prebuilt Emacs configuration for you, it uses smartparens package, but smartparens also includes all the features of ParEdit. -

  • +

    +
  • In my Emacs kit for this course, C-j is bound to helm-semantic-or-imenu. It is a convenient way to navigate between @@ -1204,7 +1198,8 @@

    Basic variable definition), the highlighter is positioned at the tag in the Helm buffer. This, in combination with C-<down> and C-<up> to move between definitions in your buffer. You can use this command -to move around buffer effectively.

  • +to move around buffer effectively. +

    @@ -1218,15 +1213,18 @@

    Basic
    • First, I use helm-semantic-or-imenu to move to the function -helm-define-key-with-subkeys and move point there.
    • +helm-define-key-with-subkeys and move point there. +
    • Then, I start helm-semantic-or-imenu again and -helm-define-key-with-subkeys is pre-selected.
    • +helm-define-key-with-subkeys is pre-selected. +
    • Then, I move point to the variable helm-map and execute helm-semantic-or-imenu again on two function: helm-next-source and helm-previous-source. This time, instead of showing the current definition I'm operating in (which is helm-map), it shows the other two definitions in Helm Semantic buffer. This is because -I supplied a prefix argument before running the command.
    • +I supplied a prefix argument before running the command. +
    @@ -1237,13 +1235,13 @@

    Basic

    -
    -

    Geiser commands

    -
    +
    +

    4.3 Geiser commands

    +
    -
    -

    What is Geiser?

    -
    +
    +

    4.3.1 What is Geiser?

    +

    From the homepage:

    @@ -1253,7 +1251,7 @@

    What with one or more Scheme interpreters to keep the Lisp Machine Spirit alive. It draws inspiration (and a bit more) from environments such as Common Lisp’s Slime, Factor’s FUEL, Squeak or Emacs itself, and does -its best to make Scheme hacking inside Emacs (even more) fun. +its best to make Scheme hacking inside Emacs (even more) fun.

    @@ -1262,21 +1260,33 @@

    What

      -
    • Form evaluation in the context of the current file’s module.
    • -
    • Macro expansion.
    • -
    • File/module loading and/or compilation.
    • +
    • Form evaluation in the context of the current file’s module. +
    • +
    • Macro expansion. +
    • +
    • File/module loading and/or compilation. +
    • Namespace-aware identifier completion (including local bindings, -names visible in the current module, and module names).
    • -
    • Autodoc: the echo area shows information about the signature of the procedure/macro around point automatically.
    • -
    • Jump to definition of identifier at point.
    • -
    • Access to documentation (including docstrings when the implementation provides it).
    • -
    • Listings of identifiers exported by a given module.
    • -
    • Listings of callers/callees of procedures (only available in Guile Scheme).
    • +names visible in the current module, and module names). + +
    • Autodoc: the echo area shows information about the signature of the procedure/macro around point automatically. +
    • +
    • Jump to definition of identifier at point. +
    • +
    • Access to documentation (including docstrings when the implementation provides it). +
    • +
    • Listings of identifiers exported by a given module. +
    • +
    • Listings of callers/callees of procedures (only available in Guile Scheme). +
    • Rudimentary support for debugging (when the REPL provides a -debugger) and error navigation.
    • -
    • Support for multiple, simultaneous REPLs.
    • +debugger) and error navigation. + +
    • Support for multiple, simultaneous REPLs. +
    • Support for image display in those Schemes that treat them as first -class values.
    • +class values. +

    @@ -1286,12 +1296,14 @@

    What

    -
    -

    Basic workflow

    -
    +
    +

    4.3.2 Basic workflow

    +
      -
    • Split your Emacs in two windows: one for source code, one for REPL
    • -
    • Write some code in source buffer.
    • +
    • Split your Emacs in two windows: one for source code, one for REPL +
    • +
    • Write some code in source buffer. +
    • Evaluate whole buffer and switch to the context of that buffer with C-c C-a. When you write a Racket file, you are writing a module. To use definitions in the module, you have to switch to that @@ -1301,8 +1313,10 @@

      Basic can also use C-c C-b to execute current file without switching to the REPL. This is useful when you want to write and run test continuously, i.e. write a few tests then execute, then write a few -more and test a few more etc…

    • -
    • Play with your code in the REPL and see the result instantly.
    • +more and test a few more etc… + +
    • Play with your code in the REPL and see the result instantly. +

    @@ -1324,102 +1338,103 @@

    Basic

    -
    -

    Programming assistance

    -
    +
    +

    4.3.3 Programming assistance

    +

    Geiser also provides common features found in IDE:

      -
    • -Autodoc: The minibuffer shows information about the signature of the +

    • Autodoc: The minibuffer shows information about the signature of the function/macro around point automatically. It is enabled by default when geiser-mode is activated. -

      repl-autodoc.png

      -
    • +
    +
  • Code completion: Geiser uses Emacs's default completion-at-point command to provide completion candidates. By default, it is bound to C-M-i (the equivalent of M-TAB); in my Emacs configuration for this guide, I bound it to TAB for buffers with Geiser mode for -convenience.
  • +convenience. +
  • Jump to definition: You can jump to any symbol at point in a Racket buffer while Geiser REPL is active with M-.. To go back to -where you were, use M-,.
  • +where you were, use *M-,*. + -
  • -Open documentation at point: For any symbol, you can execute C-c +

  • Open documentation at point: For any symbol, you can execute C-c C-d C-d to open a buffer that has a brief summary of that symbol, along with two buttons for accessing either its actual source code: [source] button or its HTML documentation in an external browser: [manual] button. -

    repl-mod.png

    -
  • +
    +
  • More evaluation commands: These commands works at expression -level.
  • +level. + -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    KeyCommandDescriptionKeyCommandDescription
    C-M-xgeiser-eval-definitionEval definition around point. For example, ifC-M-xgeiser-eval-definitionEval definition around point. For example, if
      point is inside a variable or function definition,  point is inside a variable or function definition,
      this command evaluates the whole definition form  this command evaluates the whole definition form
    C-x C-egeiser-eval-last-sexpEval sexp before pointC-x C-egeiser-eval-last-sexpEval sexp before point
    C-c C-rgeiser-eval-regionEval regionC-c C-rgeiser-eval-regionEval region
    @@ -1433,9 +1448,9 @@

    Progr

    -
    -

    Conclusion

    -
    +
    +

    5 Conclusion

    +

    That's it for the basics. I hope it provides you a much better experience with SML and Geiser for the course. You can learn more about Emacs in @@ -1445,21 +1460,9 @@

    Concl

    - -
    - - - comments powered by Disqus +

    Created: 2016-12-06 Tue 01:42

    +

    Emacs 24.5.1 (Org mode 8.2.10)

    +

    Validate

    - \ No newline at end of file + diff --git a/emacs-tutor.html b/docs/emacs-tutor1.html similarity index 61% rename from emacs-tutor.html rename to docs/emacs-tutor1.html index 2c15848..8e5ff8c 100644 --- a/emacs-tutor.html +++ b/docs/emacs-tutor1.html @@ -3,30 +3,22 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - Emacs Mini Manual (PART 1) - THE BASICS + + - - + - + - -
    - - - - -

    Back to Table of Contents

    -

    Emacs Mini Manual (PART 1) - THE BASICS

    Table of Contents

    @@ -316,26 +206,29 @@

    Table of Contents

    • Please remember that you can always access a section using the floating table of contents at the upper-right corner of your -screen.
    • +screen. +
    • Many people asked how this manual can be "mini", since it is pretty big for an online single page article. Yes, if this page is exported to PDF, it is more than 40 pages. However, this manual is "mini" relative to the size of the official Emacs manual, which is more -than 600 pages. That's why.
    • +than 600 pages. That's why. +
    • If you find the page is loading too slow for you, you can always clone the git repo of this mini manual and read it offline: -https://github.com/tuhdo/tuhdo.github.io
    • +https://github.com/tuhdo/tuhdo.github.io +
    -
    -

    Why Emacs?

    -
    +
    +

    1 Why Emacs?

    +

    In Emacs, you can do many things aside from editing. Emacs is a programming platform, not just another editor in the sense that people -think. For more details, read the Appendix. +think. For more details, read the Appendix.

    @@ -352,137 +245,126 @@

    Why Em

      -
    • -Performance: Editing a 39MB C source file with no problem. But well, +

    • Performance: Editing a 39MB C source file with no problem. But well, it's not your favorite editor's fault if it crashes from editing such a large source file. -

      performance.gif

      -
    • +

    +
  • Programming:
      -
    • -Jump to any header file: -

      +
    • Jump to any header file:

      jump_headers.gif

      -
    • +
  • + -
  • -Autocompletion: Pay attention to completion candidates when +

  • Autocompletion: Pay attention to completion candidates when include <linux/printk.h> is present and when it's not. -

    auto_complete.gif

    -
  • +
    + -
  • -Showing function arguments: -

    +
  • Showing function arguments:

    func_args.jpg

    -
  • +
    + -
  • -Quickly comment multiple lines: -

    +
  • Quickly comment multiple lines:

    comment.gif

    -
  • +
    + -
  • -GDB: -

    +
  • GDB: -
    +

    gdb-many-windows.gif

    -
  • - +
    + + + -
  • -Diff between current editing file and latest file revision: -

    +
  • Diff between current editing file and latest file revision:

    vc-diff.jpg

    -
  • +
    + -
  • -Magit: From unstage -> stage -> commit -> push -

    +
  • Magit: From unstage -> stage -> commit -> push

    magit.gif

    -
  • +
    + -
  • -Live Grep: -

    +
  • Live Grep:

    live_grep.gif

    -
  • +
    + -
  • -Quickly select any file in a directory under a Version Control +

  • Quickly select any file in a directory under a Version Control System, for example from the Linux kernel. Note that in the demos you may see me type in the commands. You can think of it like the start menu in Windows, but those commands can actually be executed quickly with a shortcut. -

    helm-projectile-find-files-1.gif

    -
  • +
    + -
  • -Quickly select any file/directory from a previous working session: -

    +
  • Quickly select any file/directory from a previous working session:

    helm-buffer-list.gif

    -
  • +
    + -
  • -Emacs is a PDF Reader: I can search text in the PDF file with +

  • Emacs is a PDF Reader: I can search text in the PDF file with highlighting and a table of contents side by side. All can be controlled with keyboard. -

    emacs-read-pdf.gif/ -

  • +

    +

    @@ -491,9 +373,9 @@

    Why Em

    -
    -

    Why this guide?

    -
    +
    +

    2 Why this guide?

    +

    Let's look at part of the Emacs manual:

    @@ -538,9 +420,9 @@

    Why th

    -
    -

    A bit of history

    -
    +
    +

    3 A bit of history

    +

    Quote from GNU Emacs homepage:

    @@ -564,9 +446,9 @@

    A bit

    -
    -

    "I don't want a complicated editor, I want something simple like Notepad"

    -
    +
    +

    4 "I don't want a complicated editor, I want something simple like Notepad"

    +

    Well, that's your choice. But I suggest that writing code without any support is harmful. @@ -642,13 +524,18 @@

    "I don

      -
    • Manually typing does not make you smarter. Not in any form.
    • -
    • Manually typing does not make you a better programmer.
    • +
    • Manually typing does not make you smarter. Not in any form. +
    • +
    • Manually typing does not make you a better programmer. +
    • Manually typing or other tedious tasks (navigating the file system, remembering changes you made to your files…) are a waste of time if -automating is possible. Automate as much as you can.
    • -
    • Good editors help you automate boring tasks.
    • -
    • Typing too much potentially leads to RSI.
    • +automating is possible. Automate as much as you can. + +
    • Good editors help you automate boring tasks. +
    • +
    • Typing too much potentially leads to RSI. +

    @@ -658,13 +545,13 @@

    "I don

    -
    -

    Installation

    -
    +
    +

    5 Installation

    +
    -
    -

    Linux:

    -
    +
    +

    5.1 Linux:

    +

    Easy way to install if you are using Ubuntu: sudo apt-get install emacs. If you use other Linux distributions, use the package manager @@ -678,27 +565,34 @@

    Linux:

      -
    • Install GTK 3: sudo apt-get install libgtk-3-dev libgtk-3-common libgtk-3-0
    • -
    • Download Emacs; or if you prefer the latest Emacs, get it from source: git clone http://repo.or.cz/r/emacs.git
    • +
    • Install GTK 3: sudo apt-get install libgtk-3-dev libgtk-3-common libgtk-3-0 +
    • +
    • Download Emacs; or if you prefer the latest Emacs, get it from source: git clone http://repo.or.cz/r/emacs.git +
    • If you download from the homepage, unpackage: tar xvf - emacs-*.tar.gz
    • + emacs-*.tar.gz +
    • Install GTK: sudo apt-get install libgtk-3-dev libgtk-3-common libgtk-3-0. You have to use gtk3 to be able to use true type -fonts.
    • -
    • cd emacs-<version>*
    • -
    • ./autogen.sh
    • -
    • -Add prefix and path to where you want to install. This is useful if +fonts. +

    • +
    • cd emacs-<version>* +
    • +
    • ./autogen.sh +
    • +
    • Add prefix and path to where you want to install. This is useful if you work on a remote server without root access: ./configure --with-x-toolkit=gtk3 [--prefix=/path/to/dir] -

      You should use GTKx 3, so you will be able to use true type fonts such as Inconsolata for a better Emacs experience. -

    • -
    • make
    • -
    • sudo make install
    • +

      + +
    • make +
    • +
    • sudo make install +

    @@ -717,10 +611,14 @@

    Linux:

      -
    • Download and unpackage as above.
    • -
    • ./configure --without-x [--prefix=/path/to/dir]
    • -
    • make
    • -
    • sudo make install
    • +
    • Download and unpackage as above. +
    • +
    • ./configure --without-x [--prefix=/path/to/dir] +
    • +
    • make +
    • +
    • sudo make install +

    @@ -734,7 +632,7 @@

    Linux:
    -
    alias em='emacs'
    +
    alias em='emacs'
     
    @@ -744,9 +642,9 @@

    Linux:

    -
    -

    Windows:

    -
    +
    +

    5.2 Windows:

    +

    You can either download it on GNU Emacs homepage or better, download the latest 64 bit version: @@ -760,9 +658,9 @@

    Window

    -
    -

    Mac OS X:

    -
    +
    +

    5.3 Mac OS X:

    +

    Download compiled Emacs for Mac OS X: http://emacsformacosx.com/.

    @@ -775,9 +673,9 @@

    Mac OS

    -
    -

    Swap Control and Capslock

    -
    +
    +

    6 Swap Control and Capslock

    +

    Swapping Control and Capslock, in general, is not required to make the best out of Emacs, if you at least use a regular key PC keyboard or @@ -794,24 +692,24 @@

    Swap

    -
    -

    Windows

    -
    +
    +

    6.1 Windows

    +
    -
    -

    Linux

    -
    +
    +

    6.2 Linux

    +

    Put this in your shell init file (.bashrc, .zshrc…):

    -
    /usr/bin/setxkbmap -option "ctrl:swapcaps"
    +
    /usr/bin/setxkbmap -option "ctrl:swapcaps"
     
    @@ -821,31 +719,31 @@

    Linux

    -
    -

    Mac OS X

    -
    +
    +

    6.3 Mac OS X

    +

    Follow this answer on StackOverflow: Emacs on Mac OS X Leopard key bindings

    -
    -

    If you don't like to swap Capslock and Control…

    -
    +
    +

    6.4 If you don't like to swap Capslock and Control…

    +

    You can use your palm to press Control in standard PC keyboard.

    -
    -

    Concepts

    -
    +
    +

    7 Concepts

    +
    -
    -

    Command

    -
    +
    +

    7.1 Command

    +

    In Emacs, every user interaction is a function execution. You press a key to insert a character, Emacs runs self-insert-command. There are @@ -857,11 +755,13 @@

    Comma programming languages, and are used for implementing features in Emacs. Users do not need to care about these functions, unless they want to implement something or modify an existing -implementation. +implementation. +
  • Commands: Commands are like functions, but interactive. It means, commands are features provided to users and users -directly use them.
  • +directly use them. +

    @@ -870,9 +770,9 @@

    Comma

    -
    -

    Emacs Key Notation

    -
    +
    +

    7.2 Emacs Key Notation

    +

    Taken from here: EmacsWiki

    @@ -881,67 +781,67 @@

    Emacs - + - + -Prefix -Meaning +Prefix +Meaning -C- -(press and hold) the Control key +C- +(press and hold) the Control key -M- -the Meta key (the Alt key, on most keyboards) +M- +the Meta key (the Alt key, on most keyboards) -S- -the Shift key (e.g.‘S-TAB’ means Shift Tab) +S- +the Shift key (e.g.‘S-TAB’ means Shift Tab) -DEL -the Backspace key (not the Delete key). Inside Emacs, DEL +DEL +the Backspace key (not the Delete key). Inside Emacs, DEL -  -is written as <backspace>. +  +is written as <backspace>. -RET -the Return or Enter key +RET +the Return or Enter key -SPC -the Space bar key +SPC +the Space bar key -ESC -the Escape key +ESC +the Escape key -TAB -the TAB key +TAB +the TAB key @@ -997,24 +897,28 @@

    Emacs

    -
    -

    Emacs Keys are easy to remember

    -
    +
    +

    7.3 Emacs Keys are easy to remember

    +

    The key bindings have a few simple and easy to remember rules:

    • C-x prefix is for default and global binding that come with -Emacs.
    • -
    • C-c prefix is for users to define.
    • +Emacs. + +
    • C-c prefix is for users to define. +
    • C-u is for altering behaviors of commands. That is, one command can behave differently depending on how many C-u you pressed first before executing a command. Mostly you just have to hit C-u -once.
    • +once. +
    • C-<number> like C-1, C-2… is similar to C-u, but passing a number to a command. Usually, the number specifies how many times -you want to repeat a command.
    • +you want to repeat a command. +

    @@ -1032,13 +936,13 @@

    Emacs

    -
    -

    Ask for help - from Emacs

    -
    +
    +

    7.4 Ask for help - from Emacs

    +
    -
    -

    Built-in help system

    -
    +
    +

    7.4.1 Built-in help system

    +

    I will describe some most useful commands based on my experience. I will not list all, so you have to rely on Emacs to get your @@ -1089,9 +993,9 @@

    Built

    -
    -

    Info

    -
    +
    +

    7.4.2 Info

    +

    M-x info or C-h i to see all the Info manual in Emacs. If you want to learn more about Emacs, after reading my series of manuals, @@ -1111,27 +1015,29 @@

    Info<

    -
    -

    Man

    -
    +
    +

    7.4.3 Man

    +

    You can view man pages with two commands:

      -
    • M-x man: Get a UNIX manual page and put it in a buffer.
    • +
    • M-x man: Get a UNIX manual page and put it in a buffer. +
    • M-x woman: Browse UN*X man page for TOPIC (Without using external Man program). It means, you can view man page without having the man program installed, while the man command above invokes -external man program.
    • +external man program. +
    -
    -

    Point

    -
    +
    +

    7.5 Point

    +

    Point is your current cursor position. From now on, instead of saying "current cursor", I say "point". @@ -1139,9 +1045,9 @@

    Point

    -
    -

    Opening files

    -
    +
    +

    7.6 Opening files

    +

    Let's learn one especially handy command. M-x find-, then press TAB. You will see Emacs offers you a list of possible commands with @@ -1158,12 +1064,18 @@

    Openi

      -
    • file_a_1.c
    • -
    • file_a_2.c
    • -
    • file_a_3.c
    • -
    • file_b_1.c
    • -
    • file_b_1.h
    • -
    • file_b_2.c
    • +
    • file_a_1.c +
    • +
    • file_a_2.c +
    • +
    • file_a_3.c +
    • +
    • file_b_1.c +
    • +
    • file_b_1.h +
    • +
    • file_b_2.c +

    @@ -1216,9 +1128,9 @@

    Openi

    -
    -

    Ido mode

    -
    +
    +

    7.7 Ido mode

    +

    Emacs has an interesting feature called Ido, short for Interactively Do Things. In essence, Ido is a superior interface @@ -1261,16 +1173,19 @@

    Ido m
    • If you want to use wildcard expression, you have to temporary revert -to ordinary find-file via C-f.
    • +to ordinary find-file via C-f. +
    • If you want to select the current directory, C-d. This invokes Dired file manager to open the directory and list the files in current directory. You will learn Dired in later section. For now, if you open the directory, close the current listing by C-x k and -press RET.
    • +press RET. +
    • You select a directory in find-file prompt by pressing RET, not -TAB like ordinary find-file.
    • +TAB like ordinary find-file. +

    @@ -1282,9 +1197,9 @@

    Ido m

    -
    -

    Buffer

    -
    +
    +

    7.8 Buffer

    +

    Buffer is where you edit your file content. Buffer holds content of a file temporarily. Anything you write into the buffer won't make @@ -1321,72 +1236,72 @@

    Buffe - + - + -Key -Binding +Key +Binding -C-x C-s -Command: save-buffer +C-x C-s +Command: save-buffer -  -Save the buffer at point +  +Save the buffer at point -C-x C-w -Command: write-file +C-x C-w +Command: write-file -  -Save the buffer to a different file +  +Save the buffer to a different file -C-x b -Command: switch-to-buffer +C-x b +Command: switch-to-buffer -  -Switch to a different buffer +  +Switch to a different buffer -C-x k -Command: kill-buffer +C-x k +Command: kill-buffer -  -Kill a buffer. RET to kill the +  +Kill a buffer. RET to kill the -  -currently active one +  +currently active one

    -
    -

    Major mode

    -
    +
    +

    7.9 Major mode

    +

    Major modes provide specialized facilities for working on a particular file type, such as syntax highlighting for a programming language. @@ -1404,9 +1319,9 @@

    Major

    -
    -

    Minor mode

    -
    +
    +

    7.10 Minor mode

    +

    Minor modes are optional features which you can turn on or off, not necessarily specific to a type of file or buffer. For example, Auto @@ -1417,9 +1332,9 @@

    Minor

    -
    -

    Basic buffer managements

    -
    +
    +

    7.11 Basic buffer managements

    +

    So, you learn how to open file and create buffer of that file. In other editors, you got something called "tabs". Every time you open a @@ -1456,7 +1371,7 @@

    Basic
    -
    (global-set-key (kbd "C-x C-b") 'ibuffer)
    +
    (global-set-key (kbd "C-x C-b") 'ibuffer)
     
    @@ -1477,15 +1392,19 @@

    Basic
  • First, open many files with different extensions. The Emacs source you used for installation is an great practice target. If you use a built binary, download it and unpackage. Let's assume you download -and unpackage it at ~/Downloads/emacs-24.3.
  • +and unpackage it at ~/Downloads/emacs-24.3. +
  • C-x C-f, navigate to emacs-24.3/lisp/ and open all Lisp files: -*.el. If you use Ido, remember to C-f before type into the prompt
  • +*.el. If you use Ido, remember to C-f before type into the prompt +
  • C-x C-f, navigate to emacs-24.3/src/ and open all C files: -*.c.
  • +*.c. + -
  • Open ibuffer by C-x C-b. You see a huge list of buffers.
  • +
  • Open ibuffer by C-x C-b. You see a huge list of buffers. +
  • @@ -1493,43 +1412,46 @@

    Basic

      -
    • -Suppose that you want to work with C code. / m and enter a major +

    • Suppose that you want to work with C code. / m and enter a major mode to select buffers that belong to this major mode. Prefix / in ibuffer groups filtering commands. TAB to see a list of major modes: -

      ibuffer-filter-major.gif

      -
    • +

    + -
  • Enter c-mode.
  • +
  • Enter c-mode. +
  • Only C buffers remain. But you open buffers in two major modes: c-mode and emacs-lisp-mode. You can create each group for one by pressing / g, and give the group a name. Only execute / g after -executing any filtering commands.
  • +executing any filtering commands. +
  • Up to this point, the filtering is still applied. Press / / to -remove previous filter and return the full buffer list.
  • +remove previous filter and return the full buffer list. +
  • Let's create another group based filtering. / m and enter emacs-lisp-mode. Create another group with / g and give it a name. Now, every time you open files that their buffers satisfy the -filtering criteria, the buffers are put into appropriate groups.
  • +filtering criteria, the buffers are put into appropriate groups. +
  • To open a buffer, o or C-o. o opens a buffer and switch point to it. C-o leaves point on the buffer list. Let's open a buffer with o and C-o. To switch back to the other buffer, do C-x o. C-x o executes other-window command, which cycles among the opening buffers (technically the buffers are in Emacs "windows", -and you are cycling "windows", but we will get to that later).
  • +and you are cycling "windows", but we will get to that later). + -
  • -Either using C-o or o creates another buffer below, leaving +

  • Either using C-o or o creates another buffer below, leaving you two horizontal buffers. You probably don't like the layout because you have a big screen. If you use o, C-x o to switch back to the list and C-x 1 to close other buffer. If you have multiple buffers @@ -1538,40 +1460,45 @@

    Basic active buffer, C-x 0. C-x 3 to create a vertical buffer to the right. It creates an exact duplicate of the active buffer. Now, o on any C buffer again, and point is in that buffer: -

    c-x-3.gif

    -

  • +
    +
  • Edit something in the buffer. Switch back to ibuffer and press g, which runs the command ibuffer-update to refresh the list. You will see an asterisk on the left of your just edited -buffer. It indicates that buffer has been modified.
  • +buffer. It indicates that buffer has been modified. + -
  • -You can also mark a buffer by pressing m on multiple entries to +

  • You can also mark a buffer by pressing m on multiple entries to perform various operations: -

      -
    • view: press A to view the marked buffers
    • +
    • view: press A to view the marked buffers +
    • -
    • save: press S to save the marked buffers
    • +
    • save: press S to save the marked buffers +
    • -
    • close: press D to close the marked buffers
    • +
    • close: press D to close the marked buffers +
    • -
    • revert: press V to discard changes to the marked buffers
    • +
    • revert: press V to discard changes to the marked buffers +

    To unmark a buffer, press u on the marked entries. -

  • +

    +
  • Another way to open the buffer: e (enter), f (find) or RET to bury and replace the list with selected buffer. Switch back to -the list using C-x C-b again.
  • +the list using C-x C-b again. +

    @@ -1580,11 +1507,15 @@

    Basic

      -
    • C-x C-b to open ibuffer.
    • -
    • o or C-o to open a buffer at point.
    • +
    • C-x C-b to open ibuffer. +
    • +
    • o or C-o to open a buffer at point. +
    • e, f or RET bury the buffer list and replace it with the -buffer content.
    • -
    • = to compare the current buffer content with its file.
    • +buffer content. + +
    • = to compare the current buffer content with its file. +

    @@ -1593,187 +1524,190 @@

    Basic

      -
    • Filtering commands:
    • +
    • Filtering commands: +
    -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingsKeyBindings
    / mAdd a filter by a major mode/ mAdd a filter by a major mode
    / nAdd a filter by buffer name./ nAdd a filter by buffer name.
    / cAdd a filter by buffer content./ cAdd a filter by buffer content.
    / fAdd a filter by filename/ fAdd a filter by filename
    / >Add a filter by buffer size/ >Add a filter by buffer size
    / <Add a filter by buffer size/ <Add a filter by buffer size
    / /Remove all filters in effect/ /Remove all filters in effect
      -
    • Filter group commands:
    • +
    • Filter group commands: +
    -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingsKeyBindings
    / gCreate a filter group from filters/ gCreate a filter group from filters
    TABMove to next filter groupTABMove to next filter group
    M-pMove to previous filter groupM-pMove to previous filter group
    / \Remove all active filter groups/ \Remove all active filter groups
    / SSave the current groups with a name/ SSave the current groups with a name
    / RRestore previously saved groups/ RRestore previously saved groups
    / XDelete previously saved groups/ XDelete previously saved groups
      -
    • Sorting commands:
    • +
    • Sorting commands: +
    -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingsKeyBindings
    ,Rotate between sorting modes=,=Rotate between sorting modes
    s iReverse current sorting orders iReverse current sorting order
    s aSort buffers by alphabets aSort buffers by alphabet
    s fSort buffers by filenames fSort buffers by filename
    s vSort buffers by last viewing times vSort buffers by last viewing time
    s sSort buffers by sizes sSort buffers by size
    s mSort buffers by major modess mSort buffers by major modes
    @@ -1784,9 +1718,9 @@

    Basic

    -
    -

    Bookmark: save locations across Emacs sessions

    -
    +
    +

    7.12 Bookmark: save locations across Emacs sessions

    +

    When you read books, you usually cannot read all at once and place a bookmark to go back to continue reading later. Emacs allows you to @@ -1797,57 +1731,57 @@

    Bookm - + - + -Key -Binding +Key +Binding -C-x r m -Command: bookmark-set +C-x r m +Command: bookmark-set -  -Set bookmark at point. After executing the command, a prompt asks for a name. +  +Set bookmark at point. After executing the command, a prompt asks for a name. -  -Enter the name and RET. +  +Enter the name and RET. -C-x r b -Command: bookmark-jump +C-x r b +Command: bookmark-jump -  -Jump to a saved bookmark, specified by user. TAB for getting bookmark list. +  +Jump to a saved bookmark, specified by user. TAB for getting bookmark list. -  -  +  +  -C-x r l -Command: bookmark-bmenu-list +C-x r l +Command: bookmark-bmenu-list -  -Open the list of all bookmarks. +  +Open the list of all bookmarks. @@ -1871,9 +1805,12 @@

    Bookm

      -
    • Dired buffers
    • -
    • Info buffers
    • -
    • Man pages
    • +
    • Dired buffers +
    • +
    • Info buffers +
    • +
    • Man pages +

    @@ -1884,112 +1821,112 @@

    Bookm - + - + -Key -Binding +Key +Binding -RET -Open a bookmark. +RET +Open a bookmark. -  -After you opened the bookmark, you can go back to bookmark list +  +After you opened the bookmark, you can go back to bookmark list -  -by C-x r l. +  +by C-x r l. -1 -Open a bookmark and close other buffers +1 +Open a bookmark and close other buffers -n -Go to next entry +n +Go to next entry -p -Go to previous entry +p +Go to previous entry -s -Save the current bookmark list to file. +s +Save the current bookmark list to file. -o -Open bookmark in other window and move point to it. If you +o +Open bookmark in other window and move point to it. If you -  -want to view side by side, C-x 3 to create a vertical buffer +  +want to view side by side, C-x 3 to create a vertical buffer -  -and bookmark will be opened in the vertical buffer. +  +and bookmark will be opened in the vertical buffer. -C-o -Similar to o but point remains on the bookmark list. +C-o +Similar to o but point remains on the bookmark list. -r -Rename bookmark at point. +r +Rename bookmark at point. -m -Mark bookmark at point for displaying. +m +Mark bookmark at point for displaying. -v -Display all marked bookmarks. +v +Display all marked bookmarks. -d -Flag bookmark for deletion. +d +Flag bookmark for deletion. -x -Delete flagged bookmarks. +x +Delete flagged bookmarks. -u -Unmark marked or flagged bookmarks. +u +Unmark marked or flagged bookmarks. @@ -2000,27 +1937,34 @@

    Bookm
    • Open files and create a few bookmarks. C-x r b to switch between -them.
    • +them. +
    • C-h i to open Info. Pick a node and enter as deep as you -want. Then bookmark and kill current Info buffer.
    • -
    • C-x r l to open the bookmark list and practice the key bindings in the table.
    • +want. Then bookmark and kill current Info buffer. + +
    • C-x r l to open the bookmark list and practice the key bindings in the table. +

    -
    -

    Basic motion commands

    -
    +
    +

    7.13 Basic motion commands

    +

    These key bindings are also used by popular shells such as bash or zsh. I highly recommended you to master these key bindings.

      -
    • Move forward one char: C-f (f stands for forward)
    • -
    • Move backward one char: C-b (b stands for backward)
    • -
    • Move upward one line: C-p (p stands for previous)
    • -
    • Move downward one line: C-n (n stands for next)
    • +
    • Move forward one char: C-f (f stands for forward) +
    • +
    • Move backward one char: C-b (b stands for backward) +
    • +
    • Move upward one line: C-p (p stands for previous) +
    • +
    • Move downward one line: C-n (n stands for next) +

    @@ -2029,10 +1973,14 @@

    Basic

      -
    • Move to beginning of line: C-a
    • -
    • Move to end of line: C-e
    • -
    • Move forward one word, M-f.
    • -
    • Move backward one word, M-b.
    • +
    • Move to beginning of line: C-a +
    • +
    • Move to end of line: C-e +
    • +
    • Move forward one word, M-f. +
    • +
    • Move backward one word, M-b. +

    @@ -2040,18 +1988,28 @@

    Basic

      -
    • Scroll forward one screen: C-v, page down
    • -
    • Scroll backward one screen: M-v, page up
    • -
    • Move to the beginning of a sentence: M-a
    • -
    • Move to the end of a sentence: M-e
    • -
    • Recenter a screen: C-l
    • +
    • Scroll forward one screen: C-v, page down +
    • +
    • Scroll backward one screen: M-v, page up +
    • +
    • Move to the beginning of a sentence: M-a +
    • +
    • Move to the end of a sentence: M-e +
    • +
    • Recenter a screen: C-l +
    • Re-position point to the top, middle and bottom of the current -screen: M-r
    • -
    • Move to top of the buffer: M-<
    • -
    • Move to end of the buffer: M->
    • -
    • Move to the nth character: M-g c (c stands for character)
    • +screen: M-r + +
    • Move to top of the buffer: M-< +
    • +
    • Move to end of the buffer: M-> +
    • +
    • Move to the nth character: M-g c (c stands for character) +
    • Move to the nth line: M-g l for Emacs < 23.2, M-g g for emacs >= -23.2) (l/g stands for line)
    • +23.2) (l/g stands for line) +

    @@ -2066,85 +2024,89 @@

    Basic

    -
    -

    Useful built-in key bindings for navigating pairs

    -
    +
    +

    7.14 Useful built-in key bindings for navigating pairs

    +
    +
      -
    • -C-M-f binds to forward-sexp, move forward over a balanced +

    • C-M-f binds to forward-sexp, move forward over a balanced expression. Demo: -

      forward-sexp.gif

      -
    • +
    + -
  • -C-M-b binds to backward-sexp, move backward over a balanced +

  • C-M-b binds to backward-sexp, move backward over a balanced expression. Demo: -

    backward-sexp.gif

    -
  • +
    + -
  • -C-M-k binds to kill-sexp, kill balanced expression +

  • C-M-k binds to kill-sexp, kill balanced expression forward. Demo: -

    kill-sexp.gif

    -
  • +
    + -
  • -C-M-t binds to transpose-sexps, transpose expressions. Demo: -

    +
  • C-M-t binds to transpose-sexps, transpose expressions. Demo:

    transpose-sexp.gif

    -
  • +
    + -
  • -C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after +

  • C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after following expression. Demo: -

    mark-sexp.gif

    -
  • +
    +
    -
    -

    Basic editing commands

    -
    +
    +

    7.15 Basic editing commands

    +

    In Emacs, kill means Cut in other editors. These key bindings also work under the terminal.

      -
    • Kill a character at the point: C-d
    • -
    • Kill entire line: C-S-DEL (remember, DEL is your <backspace> key)
    • -
    • Kill forward to the end of a word from current point: M-d
    • +
    • Kill a character at the point: C-d +
    • +
    • Kill entire line: C-S-DEL (remember, DEL is your <backspace> key) +
    • +
    • Kill forward to the end of a word from current point: M-d +
    • Kill backward to the beginning of a word from the current point: -M-DEL
    • -
    • Kill all spaces at point: M-\
    • -
    • Kill all spaces except one at point: M-SPC
    • -
    • Kill to the end of line: C-k
    • -
    • Kill a sentence: M-k
    • +M-DEL + +
    • Kill all spaces at point: M-\ +
    • +
    • Kill all spaces except one at point: M-SPC +
    • +
    • Kill to the end of line: C-k +
    • +
    • Kill a sentence: M-k +

    @@ -2158,16 +2120,18 @@

    Basic
    • If you do not highlight a text region, M-; adds a comment to the -end of line.
    • +end of line. +
    • If you highlight a region (i.e. with a mouse), M-; comments out -the region.
    • +the region. +

    -
    -

    Dynamic Abbreviations

    -
    +
    +

    7.16 Dynamic Abbreviations

    +

    Dynamic Abbreviations are a completion feature in Emacs, but work for text and is context-independent. After you type a word once, if you @@ -2181,20 +2145,26 @@

    Dynam

      -
    • Type "thisIsaVeryVeryVeryVeryLongWord" into a buffer of your choice.
    • -
    • Add newline or whitespace.
    • -
    • Type "thisIs" and M-/. Great, Emacs automatically completes for you.
    • +
    • Type "thisIsaVeryVeryVeryVeryLongWord" into a buffer of your choice. +
    • +
    • Add newline or whitespace. +
    • +
    • Type "thisIs" and M-/. Great, Emacs automatically completes for you. +
    • Type "random" into your buffer and M-/. You will see Emacs -tell your that no dynamic abbreviations found.
    • +tell your that no dynamic abbreviations found. +
    • Type "randomWord" and add a whitespace. Now, type "random" and M-/ again. Emacs can now happily complete "random" for you. Remember that -to let Emacs remember your words, you have to type a complete word.
    • +to let Emacs remember your words, you have to type a complete word. +

    -
    -

    Kill ring

    -
    +
    +

    7.17 Kill ring

    +
    +

    Kill ring is the list of previously killed contents. You can insert the most recently killed element by C-y. @@ -2222,22 +2192,29 @@

    Kill

      -
    • Kill the three lines with C-k, from top to bottom.
    • +
    • Kill the three lines with C-k, from top to bottom. +
    • -
    • C-y or C-1 C-y, you will see ccc got inserted.
    • +
    • C-y or C-1 C-y, you will see ccc got inserted. +
    • C-2 C-y, you will see bbb got inserted; C-y again, you will -see bbb got inserted again. bbb now becomes head of the list.
    • +see bbb got inserted again. bbb now becomes head of the list. +
    • C-2 C-y, you will see aaa got inserted; C-y again, you will -see aaa got inserted again. aaa now bedcomes head of the list.
    • +see aaa got inserted again. aaa now bedcomes head of the list. + -
    • Insert the 3 lines and kill all again.
    • +
    • Insert the 3 lines and kill all again. +
    • C-3 C-y, you will see aaa got inserted; C-y again, you will -see aaa got inserted again. aaa now bedcomes head of the list
    • +see aaa got inserted again. aaa now bedcomes head of the list + -
    • … and so on …
    • +
    • … and so on … +

    @@ -2265,9 +2242,9 @@

    Kill

    -
    -

    Mark and region

    -
    +
    +

    7.18 Mark and region

    +

    Mark is a record of a position in a buffer. It's like when reading a book, you record various places in a book and these records are called @@ -2288,37 +2265,46 @@

    Mark

      -
    • Place a mark in buffer with C-SPC C-SPC. Let's call this mark A.
    • +
    • Place a mark in buffer with C-SPC C-SPC. Let's call this mark A. +
    • Move to another place in the buffer, place another mark with C-SPC -C-SPC. this is mark B.
    • +C-SPC. this is mark B. + -
    • Move to another place and C-SPC C-SPC again. This is mark C.
    • +
    • Move to another place and C-SPC C-SPC again. This is mark C. +
    • Now press C-u C-SPC. You can see point goes back to mark -B.
    • +B. + -
    • C-u C-SPC again. Point goes back to mark A.
    • +
    • C-u C-SPC again. Point goes back to mark A. +
    • -
    • C-u C-SPC again. Point goes back to mark C.
    • +
    • C-u C-SPC again. Point goes back to mark C. +
    • Let's create a region: C-SPC, then move point forward. What -happened?
    • +happened? +
    • The highlighted area is called a region. You can perform editing commands on the region:
        -
      • C-w to kill the region
      • -
      • M-w to copy the region
      • -
      • C-y to yank (equivalent to paste) the region.
      • -
    • +
    • C-w to kill the region +
    • +
    • M-w to copy the region +
    • +
    • C-y to yank (equivalent to paste) the region. +
    • +
    + -
  • -Let's copy or kill a region; you should select a big region. Now +

  • Let's copy or kill a region; you should select a big region. Now yank (paste) it elsewhere. After yanking, you notice point is not at the original location anymore. If you want to return to the where you yanked, C-u C-SPC or C-x C-x. -

    When you yank, you create a mark at point before the new content is @@ -2356,13 +2342,14 @@

    Mark

    Practice until you get used to these two commands. -

  • +

    +

    -
    -

    Mark ring

    -
    +
    +

    7.19 Mark ring

    +

    Emacs stores buffer marks in a list, that's why you are able to cycle through various marks in the exercise above. You can cycle through the @@ -2373,9 +2360,9 @@

    Mark

    -
    -

    Global mark ring

    -
    +
    +

    7.20 Global mark ring

    +

    Mark ring is local to each buffer. If you switch to another buffer, you have a new local mark ring. @@ -2393,9 +2380,9 @@

    Globa

    -
    -

    Undo/redo

    -
    +
    +

    7.21 Undo/redo

    +

    To undo: C-/ or C-x u

    @@ -2416,9 +2403,12 @@

    Undo/

      -
    • insert: "aaa"
    • -
    • insert: "bbb"
    • -
    • insert: "ccc"
    • +
    • insert: "aaa" +
    • +
    • insert: "bbb" +
    • +
    • insert: "ccc" +

    @@ -2434,11 +2424,16 @@

    Undo/

      -
    • insert: "aaa"
    • -
    • insert: "bbb"
    • -
    • insert: "ccc"
    • -
    • undo insert: "ccc"
    • -
    • undo insert: "bbb"
    • +
    • insert: "aaa" +
    • +
    • insert: "bbb" +
    • +
    • insert: "ccc" +
    • +
    • undo insert: "ccc" +
    • +
    • undo insert: "bbb" +

    @@ -2470,17 +2465,17 @@

    Undo/

    -
    -

    Search for text

    -
    +
    +

    7.22 Search for text

    +

    Content search is an essential feature in every editor. Emacs has many built-in tools for this problem.

    -
    -

    Incremental search

    -
    +
    +

    7.22.1 Incremental search

    +

    So, you want to look for something in the buffer? C-s invokes isearch-forward, allows you to look forward from the current point @@ -2538,8 +2533,10 @@

    Incre

      -
    • M-p moves to the previous input.
    • -
    • M-n moves to the next input.
    • +
    • M-p moves to the previous input. +
    • +
    • M-n moves to the next input. +

    @@ -2555,99 +2552,99 @@

    Incre - + - + -Key -Binding +Key +Binding -M-s . -Command: isearch-forward-symbol-at-point +M-s . +Command: isearch-forward-symbol-at-point -  -Feed the symbol at point to C-s +  +Feed the symbol at point to C-s -  -perform search +  +perform search -M-s o -Command: occur +M-s o +Command: occur -  -Run occur +  +Run occur -M-s h . -Command: highlight-symbol-at-point +M-s h . +Command: highlight-symbol-at-point -  -Highlight the symbol at point +  +Highlight the symbol at point -M-s h l -Command: highlight-lines-matching-regexp +M-s h l +Command: highlight-lines-matching-regexp -  -Highlight lines that match input regexp +  +Highlight lines that match input regexp -M-s h r -Command: highlight-regexp +M-s h r +Command: highlight-regexp -  -Highlight according to regexp +  +Highlight according to regexp -M-s h u -Command: unhighlight-regexp +M-s h u +Command: unhighlight-regexp -  -Turn off highlighting strings that match +  +Turn off highlighting strings that match -  -regexp. +  +regexp.

    -
    -

    Occur

    -
    +
    +

    7.22.2 Occur

    +

    Command occur lists all line that match a string or a regexp and displays the search result in a buffer named *Occur*. occur is @@ -2670,10 +2667,13 @@

    Occur

      -
    • M-g n to go to next match.
    • -
    • C-x z to repeat previous command.
    • +
    • M-g n to go to next match. +
    • +
    • C-x z to repeat previous command. +
    • From now on, keep pressing z to repeat previous command until your -press a different character.
    • +press a different character. +

    @@ -2717,88 +2717,88 @@

    Occur - + - + -Key -Binding +Key +Binding -C-n -Go to next line +C-n +Go to next line -C-p -Go to previous line +C-p +Go to previous line -< -Go to beginning of buffer +< +Go to beginning of buffer -> -Go to end of buffer +> +Go to end of buffer -e -Edit current *Occur* buffer +e +Edit current *Occur* buffer -C-c C-c -When finish with editing, C-c C-c +C-c C-c +When finish with editing, C-c C-c -  -to exit editing mode +  +to exit editing mode -g -If your searching file is updated, +g +If your searching file is updated, -  -press g refreshes the *Occur* +  +press g refreshes the *Occur* -  -buffer to reflect the changes +  +buffer to reflect the changes -o -Jump to the match and switch point +o +Jump to the match and switch point -C-o -Jump to the match but point remain +C-o +Jump to the match but point remain -  -on *Occur* +  +on *Occur* @@ -2811,17 +2811,19 @@

    Occur

    -
    -

    Query replace

    -
    +
    +

    7.22.3 Query replace

    +

    To replace something, M-% to execute query-replace. M-% asks you two inputs:

      -
    • A string to be replaced.
    • -
    • A string to replace.
    • +
    • A string to be replaced. +
    • +
    • A string to replace. +

    @@ -2842,32 +2844,36 @@

    Query
    • It can be that left hand presses % (or S-5) and right hand presses -C-M-.
    • +C-M-. +
    • It can be that right hand presses C- first, then left hand presses -M-%.
    • +M-%. +

    -
    -

    Multi-occur

    -
    +
    +

    7.22.4 Multi-occur

    +

    It is the same as occur except it asks user for multiple buffers.

    • multi-occur asks for buffers to search. You enter buffer by buffer -until you give it empty input.
    • +until you give it empty input. +
    • multi-occur-in-matching-buffers requires a regexp, and it searches -for occurences in buffers that match the regexp.
    • +for occurences in buffers that match the regexp. +
    -
    -

    Grep

    -
    +
    +

    7.22.5 Grep

    +

    M-x rgrep allows you to search for text with external grep command and displays the results in a buffer. The good thing about running @@ -2909,103 +2915,103 @@

    Grep< - + - + -Key -Description +Key +Description -TAB -Go to next match, but do not display matched buffer +TAB +Go to next match, but do not display matched buffer -S-TAB -Go to previous match, but do not display matched buffer +S-TAB +Go to previous match, but do not display matched buffer -{ -Go to previous file, do not display matched buffer +{ +Go to previous file, do not display matched buffer -} -Go to next file, do not display matched buffer +} +Go to next file, do not display matched buffer -C-o -Display matched location, but do not switch point to matched buffer +C-o +Display matched location, but do not switch point to matched buffer -  -(Only available in Emacs > 24.3) +  +(Only available in Emacs > 24.3) -n -Display next matched buffer, but do not switch point +n +Display next matched buffer, but do not switch point -p -Display previous matched buffer, but do not switch point +p +Display previous matched buffer, but do not switch point -M-g n -Display next matched buffer, switch point to matched position +M-g n +Display next matched buffer, switch point to matched position -M-g p -Display previous matched buffer, switch point to matched position +M-g p +Display previous matched buffer, switch point to matched position -RET -Display matched location, switch point to matched bufer +RET +Display matched location, switch point to matched bufer -SPC -Scroll down, equivalent to C-v +SPC +Scroll down, equivalent to C-v -S-SPC -Scroll up, equivalent to M-v +S-SPC +Scroll up, equivalent to M-v -g -Refresh the *grep* buffer with previously executed command +g +Refresh the *grep* buffer with previously executed command -q -Quit *grep* buffer +q +Quit *grep* buffer @@ -3020,9 +3026,9 @@

    Grep<

    -
    -

    Modeline

    -
    +
    +

    7.23 Modeline

    +

    The mode line is the empty area below the buffer. It has useful summary information about the buffer shown in the window. @@ -3032,7 +3038,7 @@

    Model The text displayed in the mode line has the following format:

    -
    +

    cs:ch-fr | buf | pos line | (major minor)

    @@ -3071,10 +3077,12 @@

    Model
    • This shows two dashes (‘–’) if the buffer displayed in the window has the same contents as the corresponding file on the disk; i.e., -if the buffer is “unmodified”.
    • +if the buffer is “unmodified”. +
    • If the buffer is modified, it shows two stars (‘**’). For a read-only buffer, it shows ‘%*’ if the buffer is modified, and ‘%%’ -otherwise. You can see that in the picture, the buffer is modified.
    • +otherwise. You can see that in the picture, the buffer is modified. +

    @@ -3129,9 +3137,9 @@

    Model

    -
    -

    Minibuffer

    -
    +
    +

    7.24 Minibuffer

    +

    Minibuffer is the small area at the bottom of your Emacs screen.

    @@ -3154,9 +3162,12 @@

    Minib

      -
    • M-p moves to the previous input in minibuffer history.
    • -
    • M-n moves to the next input in minibuffer history.
    • -
    • M-r searches for an input that matches the supplied regexp.
    • +
    • M-p moves to the previous input in minibuffer history. +
    • +
    • M-n moves to the next input in minibuffer history. +
    • +
    • M-r searches for an input that matches the supplied regexp. +

    @@ -3166,9 +3177,9 @@

    Minib

    -
    -

    Echo area

    -
    +
    +

    7.25 Echo area

    +

    Minibuffer can be used for output as well. The echo area is used for displaying messages made with the message primitive, and for echoing @@ -3182,9 +3193,10 @@

    Echo

    -
    -

    Frames

    -
    +
    +

    7.26 Frames

    +
    +

    An application window in an operating system is called a Frame in Emacs. So, you execute Emacs from the command line and open Emacs, @@ -3215,155 +3227,155 @@

    Frame - + - + -Key -Binding +Key +Binding -C-x 5 C-f -Command: find-file-other-frame +C-x 5 C-f +Command: find-file-other-frame -  -Open file in a different frame +  +Open file in a different frame -C-x 5 f -Command: find-file-other-frame +C-x 5 f +Command: find-file-other-frame -  -Same as C-x 5 C-f +  +Same as C-x 5 C-f -C-x 5 C-o -Command: display-buffer-other-frame +C-x 5 C-o +Command: display-buffer-other-frame -  -Open buffer in a different frame and move point there +  +Open buffer in a different frame and move point there -C-x 5 . -Command: find-tag-other-frame +C-x 5 . +Command: find-tag-other-frame -  -Find tag at point in a different frame +  +Find tag at point in a different frame -C-x 5 0 -Command: delete-frame +C-x 5 0 +Command: delete-frame -  -Delete the current frame point is in +  +Delete the current frame point is in -C-x 5 1 -Command: delete-other-frames +C-x 5 1 +Command: delete-other-frames -  -Delete other frames except the one at point +  +Delete other frames except the one at point -C-x 5 2 -Command: make-frame-command +C-x 5 2 +Command: make-frame-command -  -Create a frame +  +Create a frame -C-x 5 b -Command: switch-to-buffer-other-frame +C-x 5 b +Command: switch-to-buffer-other-frame -  -Same as C-x 5 C-o +  +Same as C-x 5 C-o -C-x 5 d -Command: dired-other-frame +C-x 5 d +Command: dired-other-frame -  -Open a Dired buffer in another frame +  +Open a Dired buffer in another frame -C-x 5 m -Command: compose-mail-other-frame +C-x 5 m +Command: compose-mail-other-frame -  -Open another frame for composing email +  +Open another frame for composing email -C-x 5 o -Command: other-frame +C-x 5 o +Command: other-frame -  -Cycle through available frames +  +Cycle through available frames -C-x 5 r -Command: find-file-read-only-other-frame +C-x 5 r +Command: find-file-read-only-other-frame -  -Open file for read only in another frame +  +Open file for read only in another frame

    -
    -

    Window

    -
    +
    +

    7.27 Window

    +

    Unlike other editors, Emacs can split your frame area into multiple smaller areas. Each such area is called a window. You can divide a frame @@ -3428,207 +3440,207 @@

    Windo - + - + -Key -Binding +Key +Binding -C-x 4 C-f -Command: find-file-other-window +C-x 4 C-f +Command: find-file-other-window -  -Just like find-file discussed earlier, except open file +  +Just like find-file discussed earlier, except open file -  -in new window. If the current frame only has one window, +  +in new window. If the current frame only has one window, -  -a new window is created. +  +a new window is created. -C-x 4 C-o -Command: display-buffer +C-x 4 C-o +Command: display-buffer -  -Select a buffer from buffer list and display it in another +  +Select a buffer from buffer list and display it in another -  -window but not move point to that window. +  +window but not move point to that window. -C-x 4 . -Command: find-tag-other-window +C-x 4 . +Command: find-tag-other-window -  -Open the tag at point in another window (more on this later) +  +Open the tag at point in another window (more on this later) -C-x 4 0 -Command: kill-buffer-and-window +C-x 4 0 +Command: kill-buffer-and-window -  -Just like C-x 0 but kill the buffer in that window as well. +  +Just like C-x 0 but kill the buffer in that window as well. -C-x 4 a -Command: add-change-log-entry-other-window +C-x 4 a +Command: add-change-log-entry-other-window -  -Open another buffer and allow you to record the change of +  +Open another buffer and allow you to record the change of -  -the current editing file. These days, you use version control +  +the current editing file. These days, you use version control -  -system to manage file changes,and Emacs does this better. +  +system to manage file changes,and Emacs does this better. -  -Probably this feature exists when thing like Git does not exist. +  +Probably this feature exists when thing like Git does not exist. -C-x 4 b -Command: switch-to-buffer-other-window +C-x 4 b +Command: switch-to-buffer-other-window -  -Open a selected buffer in another window and move point to +  +Open a selected buffer in another window and move point to -  -that window. +  +that window. -C-x 4 c -Command: clone-indirect-buffer-other-window +C-x 4 c +Command: clone-indirect-buffer-other-window -  -Clone the current buffer in another window and give it a +  +Clone the current buffer in another window and give it a -  -different buffer name. +  +different buffer name. -C-x 4 d -Command: dired-other-window +C-x 4 d +Command: dired-other-window -  -Open a dired buffer in another window. Dired is a built-int +  +Open a dired buffer in another window. Dired is a built-int -  -file manager in Emacs. We will discuss later. +  +file manager in Emacs. We will discuss later. -C-x 4 f -Command: find-file-other-window +C-x 4 f +Command: find-file-other-window -  -Same as C-x 4 C-f +  +Same as C-x 4 C-f -C-x 4 m -Command: compose-mail-other-window +C-x 4 m +Command: compose-mail-other-window -  -Write mail in other window. You can write email and send it +  +Write mail in other window. You can write email and send it -  -directly from Emacs. +  +directly from Emacs. -C-x 4 r -Command: find-file-read-only-other-window +C-x 4 r +Command: find-file-read-only-other-window -  -Similar to find-file-other-window, but open for read-only. +  +Similar to find-file-other-window, but open for read-only. -M-<next> -Command: scroll-other-window +M-<next> +Command: scroll-other-window -  -Scroll other window forward. +  +Scroll other window forward. -M-<prior> -Command: scroll-other-window-down +M-<prior> +Command: scroll-other-window-down -  -Scroll the other window backward. +  +Scroll the other window backward. @@ -3638,14 +3650,16 @@

    Windo

      -
    • Visit my manual again :)
    • +
    • Visit my manual again :) +
    • Or much faster, access it directly from Emacs with it amazing help system. So, if you want to know all key bindings to prefix C-x 4, just C-x 4 and then C-h. If you enter a prefix key and enter C-h after it, it will list all of the key bindings and commands start with that prefix. This is really nice, compare to other -editors that hide all this information deep within layers of menus.
    • +editors that hide all this information deep within layers of menus. +

    @@ -3654,9 +3668,9 @@

    Windo

    -
    -

    Prefix Arguments

    -
    +
    +

    7.28 Prefix Arguments

    +

    In Emacs, behind anything is a function. Functions can accept arguments. You can also pass arguments into Emacs commands to modify @@ -3728,9 +3742,9 @@

    Prefi

    -
    -

    Basic file management with Dired

    -
    +
    +

    7.29 Basic file management with Dired

    +

    Emacs has a built-in one called Dired, short for (Dir)ectory (Ed)itor. @@ -3742,39 +3756,40 @@

    Basic

    -
    -

    Enter Dired

    -
    +
    +

    7.29.1 Enter Dired

    +
    + -+-+ - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x dSelect directory of your choice and start Dired in that directoryC-x dSelect directory of your choice and start Dired in that directory
    C-x 4 dSelect directory of your choice and start Dired in another windows.C-x 4 dSelect directory of your choice and start Dired in another windows.
    C-x C-fSelect a directory to enter DiredC-x C-fSelect a directory to enter Dired
    @@ -3786,39 +3801,39 @@

    Enter

    -
    -

    Navigation

    -
    +
    +

    7.29.2 Navigation

    +
    -+-+ - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    nMove to next entry below point.nMove to next entry below point.
    pMove to previous entry above point.pMove to previous entry above point.
    C-sFind text using Isearch; useful for searching entries in DiredC-sFind text using Isearch; useful for searching entries in Dired
    @@ -3834,9 +3849,10 @@

    Navig

    -
    -

    Create files

    -
    +
    +

    7.29.3 Create files

    +
    +

    To create a new file in Dired, you use the same C-x C-f and C-x 4 C-f variant. @@ -3846,26 +3862,26 @@

    Creat - + - + -Key -Binding +Key +Binding -+ -Prompts for a directory name and create one after RET. ++ +Prompts for a directory name and create one after RET. -C-x C-f -Create a new file. This is your regular find-file. +C-x C-f +Create a new file. This is your regular find-file. @@ -3876,56 +3892,59 @@

    Creat
    • Create a new directory called dired_practice or a name of your -choice.
    • -
    • Create a new file of your choice.
    • +choice. + +
    • Create a new file of your choice. +

    -
    -

    Visit files

    -
    +
    +

    7.29.4 Visit files

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    f or e or RETOpen current file at point.f or e or RETOpen current file at point.
    oOpen file at point in another window.oOpen file at point in another window.
    C-oOpen file at point in another window, but do not select that window.C-oOpen file at point in another window, but do not select that window.
    vOpen file for read only.vOpen file for read only.
    ^Open parent directory and create another Dired buffer of parent directory^Open parent directory and create another Dired buffer of parent directory
    @@ -3934,30 +3953,33 @@

    Visit Exercise:

      -
    • Assume you are in your newly created directory in previous section.
    • -
    • Go up to the parent directory using ^.
    • +
    • Assume you are in your newly created directory in previous section. +
    • +
    • Go up to the parent directory using ^. +
    • Open another directory. You will enter that directory, and a new -buffer is created for listing the content of that directory.
    • -
    • Go up to the parent directory using ^.
    • -
    • Repeat opening and go up parent directory a few times.
    • -
    • -C-x b and TAB. You will see a bunch of opened directory through +buffer is created for listing the content of that directory. +

    • +
    • Go up to the parent directory using ^. +
    • +
    • Repeat opening and go up parent directory a few times. +
    • +
    • C-x b and TAB. You will see a bunch of opened directory through your filesystem navigation. Whenever you open a file or directory, using Dired or other methods, you have a buffer of that directory. -

      At this point, you may feel annoyed that Dired opens too many buffers and it will go out of control at some point. Worry not! That's why you have ibuffer. -

    • +

      + -
    • M-x ibuffer or C-x C-b if you've already replaced list-buffers.
    • -
    • -/ m and select dired-mode. / g and name the group Dired and +

    • M-x ibuffer or C-x C-b if you've already replaced list-buffers. +
    • +
    • / m and select dired-mode. / g and name the group Dired and you have a separate group for managing directories. No more cluttered view with other buffers. You can stop worrying now. -

      @@ -3972,10 +3994,14 @@

      Visit

        -
      • directory_root/dir1/dir2/dir3/dir4/
      • -
      • directory_root/dir2/dir2/dir3/dir4/
      • -
      • directory_root/dir5/dir6/dir7/dir8/
      • -
      • ….
      • +
      • directory_root/dir1/dir2/dir3/dir4/ +
      • +
      • directory_root/dir2/dir2/dir3/dir4/ +
      • +
      • directory_root/dir5/dir6/dir7/dir8/ +
      • +
      • …. +

      The layouts of top two directories are common when you have to @@ -3994,14 +4020,15 @@

      Visit can freely navigate the filesytem without having to remember the working directory to get back later, because you can easily go back to it quick and easy. -

    • +

      +

    -
    -

    File Marking

    -
    +
    +

    7.29.5 File Marking

    +

    You flag files for deletion. You mark files for everything else (i.e. copy, move, link files…). There are many marking commands for @@ -4014,42 +4041,42 @@

    File - + - + -Key -Binding +Key +Binding -m -mark the entry at point. You can mark more than one, either +m +mark the entry at point. You can mark more than one, either -  -downward or upward with prefix argument. +  +downward or upward with prefix argument. -% m -mark all files whose names match supplied regexp. +% m +mark all files whose names match supplied regexp. -% g -match all files whose contents match the supplied +% g +match all files whose contents match the supplied -  -regexp. This is the same as using Grep. +  +regexp. This is the same as using Grep. @@ -4061,9 +4088,9 @@

    File

    -
    -

    Operating on files

    -
    +
    +

    7.29.6 Operating on files

    +

    These commands use uppercase character. If you see an uppercase character for a command, it means S-<character>. @@ -4073,59 +4100,59 @@

    Opera - + - + -Key -Binding +Key +Binding -C -Prompt for a location to copy the file at point (if no file +C +Prompt for a location to copy the file at point (if no file -  -is marked) or marked files. +  +is marked) or marked files. -R -Prompt for a location to rename or move file at point (if no +R +Prompt for a location to rename or move file at point (if no -  -file is marked) or marked files. This is the same as mv +  +file is marked) or marked files. This is the same as mv -  -command in shell. +  +command in shell. -H -Prompt for a location to create a hard link. +H +Prompt for a location to create a hard link. -S -Prompt for a location to create a symbolic link. +S +Prompt for a location to create a symbolic link. -M -Change permission bits of file at point or marked files. +M +Change permission bits of file at point or marked files. @@ -4134,95 +4161,104 @@

    Opera Exercise:

      -
    • Create a new directory at the current directory.
    • +
    • Create a new directory at the current directory. +
    • Assume that your still keep the marked file in the above section; C and prompt for the directory you have created. RET to confirm -copying.
    • +copying. +
    • If you want to move marked files/directories, use R. If you want to rename, mark only a single file/directory and put a new name in -the rename prompt.
    • -
    • Enter the directory you have just copied the files.
    • +the rename prompt. + +
    • Enter the directory you have just copied the files. +
    • Move your cursor on a file and H to create a hard link. A prompt ask for destination and the link name. Create a link at the current -location with different name from the original file.
    • +location with different name from the original file. +
    • Move your cursor on a file and S to create a symolic link. A prompt ask for destination and the link name. Create a link at the current -location with different name from the original file.
    • +location with different name from the original file. +
    • Move your cursor on either the hardlink or symlink you created and -M and change the bit permission; set it to something like 000.
    • +M and change the bit permission; set it to something like 000. +
    • After that, press g to refresh the Dired buffer. Look at the original files the links point to, you will see the permission -attributes are cleared and you won't be able to access those files.
    • +attributes are cleared and you won't be able to access those files. +

    -
    -

    Deleting files

    -
    +
    +

    7.29.7 Deleting files

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    dflags file for deletion.dflags file for deletion.
    uremove flagged files.uremove flagged files.
    #flag all auto-save files (files whose names start and end with ‘#’).#flag all auto-save files (files whose names start and end with ‘#’).
    ~flag all backup files~flag all backup files
    % &*flag for deletion all files that match dired-garbage-files-regexp.% &*flag for deletion all files that match dired-garbage-files-regexp.
    % dflag files which matches a regexp.% dflag files which matches a regexp.
    xconfirm and delete flagged files.xconfirm and delete flagged files.
    -
    -

    Execute shell commands in Dired

    -
    +
    +

    7.29.8 Execute shell commands in Dired

    +

    Just like in a shell, you can execute commands in the current directory in Dired too. @@ -4232,67 +4268,68 @@

    Execu - + - + -Key -Binding +Key +Binding -! -execute a command on selected file or files. +! +execute a command on selected file or files. -& -execute a command on selected file or files asynchronously. +& +execute a command on selected file or files asynchronously.

    -
    -

    Compare files

    -
    +
    +

    7.29.9 Compare files

    +
    + -+-+ - - + + - - + + - - + +
    KeyBindingKeyBinding
    =compares the file at point with another file supplied by user from=compares the file at point with another file supplied by user from
     a file prompt in the minibuffer. a file prompt in the minibuffer.
    -
    -

    Subdirectories

    -
    +
    +

    7.29.10 Subdirectories

    +

    This is an exciting feature of Dired. In other file explorers, you get a tree to browse your directory. If you have a deep directory @@ -4326,22 +4363,27 @@

    Subdi

      -
    • Open a directory with subdirectories inside it.
    • -
    • Insert subdirectories with i.
    • +
    • Open a directory with subdirectories inside it. +
    • +
    • Insert subdirectories with i. +
    • Remember Bookmark? You can save Dired buffers with Bookmark for -later access. C-x r m and save the current Dired buffer with subdirectories.
    • -
    • Kill the current Dired buffer with subdirectories.
    • +later access. C-x r m and save the current Dired buffer with subdirectories. + +
    • Kill the current Dired buffer with subdirectories. +
    • Open the Dired buffer via the bookmark list C-x r l. You will see that not only your Dired buffer is fully restored, but your -subdirectories too.
    • +subdirectories too. +

    -
    -

    Registers

    -
    +
    +

    7.30 Registers

    +

    When I first heard about registers in Emacs, it scared me. I thought "Wow, what is this "register" thing? Am I going to work directly with @@ -4376,9 +4418,9 @@

    Regis

    -
    -

    Save window configuration

    -
    +
    +

    7.30.1 Save window configuration

    +

    One of the best uses of registers. It simply saves your current window configuration and restores the layout later. @@ -4408,47 +4450,47 @@

    Save - + - + -Key -Binding +Key +Binding -C-x r w REG -Command: window-configuration-to-register +C-x r w REG +Command: window-configuration-to-register -  -Save the window configuration of current frame into register REG +  +Save the window configuration of current frame into register REG -C-x r f REG -Command: frame-configuration-to-register +C-x r f REG +Command: frame-configuration-to-register -  -Save the state of all frames, including all their windows, in register REG +  +Save the state of all frames, including all their windows, in register REG -C-x r j REG -Command: jump-to-register +C-x r j REG +Command: jump-to-register -  -Jump to a register REG. +  +Jump to a register REG. @@ -4486,35 +4528,38 @@

    Save
    • Save a few window configurations into registers. I suggest that each window configuration should represent a workspace of a project. But -it could be anything you like, up to your imagination.
    • +it could be anything you like, up to your imagination. +
    • Go back and forth between window configurations by jumping into -appropriate registers.
    • +appropriate registers. +

    -
    -

    Save frame configuration

    -
    +
    +

    7.30.2 Save frame configuration

    +
    + -+-+ - - + + - - + +
    KeyBindingKeyBinding
    C-x r f REGSave current frame configuration into register REGC-x r f REGSave current frame configuration into register REG
    @@ -4534,18 +4579,22 @@

    Save

      -
    • Create a few frames with C-x 5 2, C-x 5 d, C-x 5 f
    • -
    • Save the frameset into a register.
    • -
    • Close all the frames except the main one.
    • +
    • Create a few frames with C-x 5 2, C-x 5 d, C-x 5 f… +
    • +
    • Save the frameset into a register. +
    • +
    • Close all the frames except the main one. +
    • Restore the frames by jumping to the register that stores the -frameset.
    • +frameset. +

    -
    -

    Save text

    -
    +
    +

    7.30.3 Save text

    +

    You can also save a region in registers.

    @@ -4554,36 +4603,36 @@

    Save - + - + -Key -Binding +Key +Binding -C-x r s REG -Command: copy-to-register +C-x r s REG +Command: copy-to-register -  -Copy region into register REG +  +Copy region into register REG -C-x r i REG -Command: insert-register +C-x r i REG +Command: insert-register -  -Insert text from register REG +  +Insert text from register REG @@ -4604,15 +4653,14 @@

    Save when registers are handy for storing many pieces of text without affecting the kill ring. For example, you read a manual (man page or info page), and you want to remember many keywords and paste it -somewhere later. Registers can help you with this use case. +somewhere later. Registers can help you with this use case. + -
  • -You can also use registers to save many code templates. For example, +

  • You can also use registers to save many code templates. For example, you can save a for loop template into register f, if template into register i, function definition into register F… This is really handy when you are learning a new language and keep forgetting syntax all the time. -

    For example, this C++11 code snippet would be hard to remember if @@ -4621,9 +4669,9 @@

    Save
    -
      auto it = find_if (vertices.begin(), vertices.end(), [&v_idx] (const Vertex& o) -> bool {
    -    return o.id == v_idx;
    -});
    +
    auto it = find_if (vertices.begin(), vertices.end(), [&v_idx] (const Vertex& o) -> bool {
    +    return o.id == v_idx;
    +});
     
    @@ -4632,7 +4680,8 @@

    Save until I remember it. This is much faster than to go back to the previous source location to look it up again, and would be time consuming if your source code is large. -

  • +

    +

    @@ -4640,43 +4689,46 @@

    Save

      -
    • Copy a few text snippets into registers.
    • -
    • Re-insert it in a buffer.
    • +
    • Copy a few text snippets into registers. +
    • +
    • Re-insert it in a buffer. +

    -
    -

    Save rectangles

    -
    +
    +

    7.30.4 Save rectangles

    +
    + -+-+ - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x r r REGCommand: copy-rectangle-to-registerC-x r r REGCommand: copy-rectangle-to-register
     Copy the region-rectangle into register REG Copy the region-rectangle into register REG
     With C-u prefix, delete it as well With C-u prefix, delete it as well
    @@ -4690,54 +4742,57 @@

    Save

      -
    • Save a few rectangles in registers a few times to get used to it.
    • -
    • Insert the rectangles in the registers into some buffer.
    • +
    • Save a few rectangles in registers a few times to get used to it. +
    • +
    • Insert the rectangles in the registers into some buffer. +

    -
    -

    Save position

    -
    +
    +

    7.30.5 Save position

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x r <SPC> REGCommand: point-to-registerC-x r <SPC> REGCommand: point-to-register
     Record the position of point and the current buffer in register REG Record the position of point and the current buffer in register REG
    C-x r j REGCommand: jump-to-registerC-x r j REGCommand: jump-to-register
     Jump to the position and buffer saved in register REG. If the buffer Jump to the position and buffer saved in register REG. If the buffer
     is killed, revisit the file and open the buffer, then jump. is killed, revisit the file and open the buffer, then jump.
    @@ -4767,65 +4822,76 @@

    Save

      -
    • Save a buffer position into register a with C-x r SPC a.
    • -
    • Move point else where.
    • -
    • Jump back to previous position with C-x r j a.
    • -
    • Move point backward a few characters.
    • -
    • Add some characters.
    • -
    • Jump back to position in register a with C-x r j a.
    • +
    • Save a buffer position into register a with C-x r SPC a. +
    • +
    • Move point else where. +
    • +
    • Jump back to previous position with C-x r j a. +
    • +
    • Move point backward a few characters. +
    • +
    • Add some characters. +
    • +
    • Jump back to position in register a with C-x r j a. +
    • You see that point does not jump to original position, but away from the original position a number of characters that is equal to the -number of your added characters.
    • -
    • Go to the beginning of line and RET to add a newline.
    • -
    • Jump back to position in register a with C-x r j a.
    • +number of your added characters. + +
    • Go to the beginning of line and RET to add a newline. +
    • +
    • Jump back to position in register a with C-x r j a. +
    • You see that point jumps to position in register a, but one line -below.
    • +below. +

    -
    -

    Save numbers

    -
    +
    +

    7.30.6 Save numbers

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-u number C-x r n REGCommand: number-to-registerC-u number C-x r n REGCommand: number-to-register
     Store number into register REG Store number into register REG
    C-u number C-x r + REGCommand: increment-registerC-u number C-x r + REGCommand: increment-register
     If REG contains a number, increment the If REG contains a number, increment the
     number in that register by number. number in that register by number.
    @@ -4840,18 +4906,21 @@

    Save

      -
    • Save a few numbers into registers.
    • -
    • Add a number of your choice into numbers saved in the registers.
    • +
    • Save a few numbers into registers. +
    • +
    • Add a number of your choice into numbers saved in the registers. +
    • Insert back the number in registers into a buffer, and see the -result.
    • +result. +

    -
    -

    Macro

    -
    +
    +

    7.31 Macro

    +

    Macro records your actions in Emacs and play back later.

    @@ -4860,32 +4929,32 @@

    Macro - + - + -Key -Binding +Key +Binding -f3 or C-x ( -Start recording macro +f3 or C-x ( +Start recording macro -f4 or C-x ) -Stop recording macro +f4 or C-x ) +Stop recording macro -C-x e or f4 -Playback macro +C-x e or f4 +Playback macro @@ -4937,17 +5006,23 @@

    Macro

      -
    • Place point at the beginning of the first line.
    • -
    • Press <f3>.
    • -
    • Use C-s to search-and-jump to the beginning of each character group (or C-f if you want something simple) and add whitespace.
    • -
    • Return to the beginning of next line. Press <f4> to finish recording.
    • +
    • Place point at the beginning of the first line. +
    • +
    • Press <f3>. +
    • +
    • Use C-s to search-and-jump to the beginning of each character group (or C-f if you want something simple) and add whitespace. +
    • +
    • Return to the beginning of next line. Press <f4> to finish recording. +
    • Continuously press <f4> and see Emacs playbacks the whole action -sequence you've just recorded.
    • +sequence you've just recorded. +
    • If you want to repeat more than 1 time, using prefix argument. If you want to repeat until the end of file, use prefix argument 0: C-u 0 <f4>. Alternatively, highlight the region of remaining lines, and C-x C-k r: run the last keyboard macro on each line -that begins in the region (apply-macro-to-region-lines).
    • +that begins in the region (apply-macro-to-region-lines). +
    @@ -5013,11 +5088,10 @@

    Macro
    • Create two buffers side by side with C-x b. Name the left buffer -buf1 and right buffer buf2.
    • -
    • -Yank the original data into buf1. Move point back to +buf1 and right buffer buf2. +

    • +
    • Yank the original data into buf1. Move point back to beginning of buffer. -

      That's set and done. Here is how it should look like: @@ -5027,90 +5101,91 @@

      Macro

      prepare_macro.gif

      -

    • -
    +

    + + + -
  • -Record: -

    +
  • Record:

    Point should be at buf1, at the first line of the data.

      -
    • Press <f3> to start.
    • -
    • -C-SPC then M-f. This marks the word machine1. Store this word +

    • Press <f3> to start. +
    • +
    • C-SPC then M-f. This marks the word machine1. Store this word into register a with C-x r s a. -

      reg_a.gif

      -
    • +
  • + -
  • -Move point to the beginning of the first MAC address. C-SPC then +

  • Move point to the beginning of the first MAC address. C-SPC then C-s and search to the first delimiter, which is an empty space " " in this case. C-b to move back to the end of the first MAC address. Store this region into register b with C-x r s b. -

    reg_b.gif

    -
  • +
    + -
  • -After that, move point to the beginning of the 2nd MAC address, +

  • After that, move point to the beginning of the 2nd MAC address, C-s to space and C-b to go back one character. Save the region into register c with C-x r s c. -

    reg_c.gif

    -
  • +
    + -
  • -Repeat for the last MAC address and save it in register d. -

    +
  • Repeat for the last MAC address and save it in register d.

    reg_d.gif

    -
  • +
    + -
  • Switch to the second buffer with C-x o:
  • -
  • -Insert the register from a to d according to the template: -

    +
  • Switch to the second buffer with C-x o: +
  • +
  • Insert the register from a to d according to the template:

    insert_buf2_macro.gif

    -
  • +
    + -
  • After inserting, move point to the next empty line.
  • -
  • Switch back to buf1 with C-x o.
  • -
  • Move to the beginning of next line.
  • -
  • Press <f4> to stop.
  • - +
  • After inserting, move point to the next empty line. +
  • +
  • Switch back to buf1 with C-x o. +
  • +
  • Move to the beginning of next line. +
  • +
  • Press <f4> to stop. +
  • + + -
  • -Play: -

    +
  • Play:

    Now you can play back your new keyboard macro to transform the remaining entries. -

  • +

    +

    @@ -5124,64 +5199,65 @@

    Macro

    -
    -

    Keyboard macro ring

    -
    +
    +

    7.31.1 Keyboard macro ring

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x C-k C-kCommand: kmacro-end-or-call-macro-repeatC-x C-k C-kCommand: kmacro-end-or-call-macro-repeat
     Execute the keyboard macro at the head of the ring Execute the keyboard macro at the head of the ring
    C-x C-k C-nCommand: kmacro-cycle-ring-nextC-x C-k C-nCommand: kmacro-cycle-ring-next
     Rotate the keyboard macro ring to the next macro Rotate the keyboard macro ring to the next macro
     (defined earlier). (defined earlier).
    C-x C-k C-pCommand: kmacro-cycle-ring-previousC-x C-k C-pCommand: kmacro-cycle-ring-previous
     Rotate the keyboard macro ring to the previous macro Rotate the keyboard macro ring to the previous macro
     (defined later) (defined later)
    @@ -5196,9 +5272,9 @@

    Keybo

    -
    -

    The Keyboard Macro Counter

    -
    +
    +

    7.31.2 The Keyboard Macro Counter

    +

    Each macro has a counter which is initialized to 0. Everytime a counter is inserted into the buffer, its value is incremented by 1. @@ -5208,84 +5284,84 @@

    The K - + - + -Key -Binding +Key +Binding -<f3> -Command: kmacro-start-macro-or-insert-counter +<f3> +Command: kmacro-start-macro-or-insert-counter -  -Insert the counter into the buffer and increase the counter +  +Insert the counter into the buffer and increase the counter -  -by 1. This is only applicable when a macro is recording +  +by 1. This is only applicable when a macro is recording -C-x C-k C-i -Command: kmacro-insert-counter +C-x C-k C-i +Command: kmacro-insert-counter -  -Insert the counter of current macro into the buffer +  +Insert the counter of current macro into the buffer -C-x C-k C-c -Command: kmacro-set-counter +C-x C-k C-c +Command: kmacro-set-counter -  -Change the counter value of current macro +  +Change the counter value of current macro -C-x C-k C-a -Command: kmacro-add-counter +C-x C-k C-a +Command: kmacro-add-counter -  -Add a number to the current keyboard macro counter. C-u +  +Add a number to the current keyboard macro counter. C-u -  -before running this command resets the counter back to +  +before running this command resets the counter back to -  -previous value +  +previous value -C-x C-k C-f -Command: kmacro-set-format +C-x C-k C-f +Command: kmacro-set-format -  -Specify the format for inserting the keyboard macro counter +  +Specify the format for inserting the keyboard macro counter @@ -5298,77 +5374,77 @@

    The K - + - + -Specification -Description +Specification +Description -%o -Insert base-eight representation of an integer. +%o +Insert base-eight representation of an integer. -%d -Insert base-ten representation of an integer. +%d +Insert base-ten representation of an integer. -%x -Insert base-sixteen representation of an integer. +%x +Insert base-sixteen representation of an integer. -%X -‘%x’ uses lower case and ‘%X’ uses upper case. +%X +‘%x’ uses lower case and ‘%X’ uses upper case. -%c -Insert the character which is the numerical value given. +%c +Insert the character which is the numerical value given. -%e -Insert exponential notation for a floating point number. +%e +Insert exponential notation for a floating point number. -%f -Insert decimal-point notation for a floating point number. +%f +Insert decimal-point notation for a floating point number. -%g -Insert notation for a floating point number, using either exponential notation or +%g +Insert notation for a floating point number, using either exponential notation or -  -decimal-point notation, whichever is shorter. +  +decimal-point notation, whichever is shorter. -%% -Insert a single ‘%’. This format specification is unusual in in that it does not use +%% +Insert a single ‘%’. This format specification is unusual in in that it does not use -  -a value. For example, (format "%% %d" 30) returns "% 30". +  +a value. For example, (format "%% %d" 30) returns "% 30". @@ -5379,9 +5455,12 @@

    The K

      -
    • 0x%x
    • -
    • Project %d:
    • -
    • Plain text
    • +
    • 0x%x +
    • +
    • Project %d: +
    • +
    • Plain text +

    @@ -5410,16 +5489,23 @@

    The K

      -
    • C-x C-k C-f and enter this format: - Step %d of 5:
    • -
    • <f3> to start recording.
    • +
    • C-x C-k C-f and enter this format: - Step %d of 5: +
    • +
    • <f3> to start recording. +
    • <f3> again to insert the first counter value, which is - Step 0 - of 5:
    • -
    • RET to move to the next line.
    • -
    • <f4> to stop recording.
    • + of 5: + +
    • RET to move to the next line. +
    • +
    • <f4> to stop recording. +
    • Now press <f4> as many time as you want and see header prefix got -inserted with incremental values.
    • +inserted with incremental values. +
    • You can insert the text any value by simply set the counter with -C-x C-k C-c.
    • +C-x C-k C-c. +

    @@ -5438,24 +5524,32 @@

    The K
    • C-x C-k C-f and enter a format like this: %d (or a base number -of your choice).
    • -
    • Initialize the macro counter to a number of your choice.
    • -
    • <f3> to start recording.
    • +of your choice). + +
    • Initialize the macro counter to a number of your choice. +
    • +
    • <f3> to start recording. +
    • If you want the numbers to be 5 units (or any number greater than 1) apart from each other, C-x C-k a to add a number to the counter. If you only want to increase by 1, skip this step because -the default is 1.
    • -
    • <f3> to insert the first number.
    • -
    • SPC to create a separator.
    • -
    • <f4> to stop recording.
    • -
    • Now <f4> repeatedly to see numbers getting generated.
    • +the default is 1. + +
    • <f3> to insert the first number. +
    • +
    • SPC to create a separator. +
    • +
    • <f4> to stop recording. +
    • +
    • Now <f4> repeatedly to see numbers getting generated. +

    -
    -

    Macros with Variations

    -
    +
    +

    7.31.3 Macros with Variations

    +

    Macro is excellent for repetitive editing tasks. However, sometimes you have a repetitive task that can make use of macro, but not always @@ -5474,44 +5568,44 @@

    Macro - + - + -Response -Action +Response +Action -Y -Finish this iteration normally and continue with the next. +Y +Finish this iteration normally and continue with the next. -N: -Skip the rest of this iteration, and start the next. +N: +Skip the rest of this iteration, and start the next. -RET -Stop the macro entirely right now. +RET +Stop the macro entirely right now. -C-l -Redisplay the screen, then ask again. +C-l +Redisplay the screen, then ask again. -C-r -Start editing at point. C-M-c to go back to macro execution +C-r +Start editing at point. C-M-c to go back to macro execution @@ -5540,7 +5634,8 @@

    Macro

      -
    • First, copy this template:
    • +
    • First, copy this template: +
    @@ -5550,68 +5645,77 @@

    Macro

      -
    • <f3> to start recording.
    • -
    • C-y to yank the template.
    • -
    • Move point to positions that need modifications, then C-x q.
    • -
    • <f4> to stop recording.
    • +
    • <f3> to start recording. +
    • +
    • C-y to yank the template. +
    • +
    • Move point to positions that need modifications, then C-x q. +
    • +
    • <f4> to stop recording. +
    • Now <f4> and you will see the macro stops at the positions where -you pressed C-x q before and ask for your action.
    • -
    • C-r to edit. After done editing, C-M-c to go back.
    • +you pressed C-x q before and ask for your action. + +
    • C-r to edit. After done editing, C-M-c to go back. +
    • You are asked the same question as before. If you still miss something, C-r to edit again. Otherwise, press y to proceed to -the next point.
    • -
    • Continue until the end of macro.
    • +the next point. + +
    • Continue until the end of macro. +

    -
    -

    Naming and Saving Macro

    -
    +
    +

    7.31.4 Naming and Saving Macro

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x C-k nCommand: kmacro-name-last-macrC-x C-k nCommand: kmacro-name-last-macr
     Give a command name (for the duration of the Emacs session) Give a command name (for the duration of the Emacs session)
     to themost recently defined keyboard macro. to themost recently defined keyboard macro.
    C-x C-k bCommand: kmacro-bind-to-keyC-x C-k bCommand: kmacro-bind-to-key
     Bind the most recently defined keyboard macro to a key sequence Bind the most recently defined keyboard macro to a key sequence
     (for the duration of the session) (for the duration of the session)
    @@ -5639,34 +5743,40 @@

    Namin

      -
    • Record some keyboard macros.
    • -
    • Give the macros names with C-x C-k n.
    • -
    • Bind the macros to C-x C-k 1, C-x C-k 2… with C-x C-k b.
    • +
    • Record some keyboard macros. +
    • +
    • Give the macros names with C-x C-k n. +
    • +
    • Bind the macros to C-x C-k 1, C-x C-k 2… with C-x C-k b. +
    • Create the file ~/.emacs.d/init.el. If you do not have the -directory and the file, create it with find-file.
    • +directory and the file, create it with find-file. +
    • Create the file ~/.emacs.d/macros with find-file. You should be -inside the buffer of this file after creating it.
    • -
    • Save the macros with M-x insert-kbd-macro.
    • -
    • -To save you trouble of reloading the macro file manually, put this +inside the buffer of this file after creating it. +

    • +
    • Save the macros with M-x insert-kbd-macro. +
    • +
    • To save you trouble of reloading the macro file manually, put this Emacs Lisp code inside ~/.emacs.d/init.el: -

      -
      (load-file "~/.emacs.d/macros")
      +
      (load-file "~/.emacs.d/macros")
       

      The above code essentially loads a file at a path. Only files that are Emacs Lisp source code are valid. -

    • +

      +
    • Now, every time Emacs starts, it will automatically load the macros file. By default, Emacs loads any Emacs Lisp code at ~/.emacs.d/init.el when it starts. Since you put the above code in -init.el, your macros file is also loaded.
    • +init.el, your macros file is also loaded. +

    @@ -5688,10 +5798,13 @@

    Namin
    • Create two buffers side by side with C-x b. Name the left buffer -buf1 and right buffer buf2.
    • +buf1 and right buffer buf2. +
    • Yank the original data into buf1, then move point back to -beginning of buffer:
    • -
    +beginning of buffer: + + +
    @@ -5716,9 +5829,7 @@

    Namin

      -
    • -Record: -

      +
    • Record:

      Point should be at buf1, at the first line of the data. Let's @@ -5727,77 +5838,79 @@

      Namin

        -
      • <f3> to start.
      • -
      • -C-SPC then M-f. This mark the word machine1. Store this word +

      • <f3> to start. +
      • +
      • C-SPC then M-f. This mark the word machine1. Store this word into register a with C-x r s a. -

        reg_a.gif

        -
      • +

    + -
  • -Move point to the beginning of the first MAC address. C-SPC then +

  • Move point to the beginning of the first MAC address. C-SPC then C-s and search to the first delimiter, which is an empty space " " in this case. C-b to move back to the end of the first MAC address. Store this region into register b with C-x r s b. -

    reg_b.gif

    -
  • +
    + -
  • -After that, move point to the beginning of the 2nd MAC address, +

  • After that, move point to the beginning of the 2nd MAC address, C-s to space and C-b to go back one character. Save the region into register c with C-x r s c. -

    reg_c.gif

    -
  • +
    + -
  • -Repeat for the last MAC address and save it in register d. -

    +
  • Repeat for the last MAC address and save it in register d.

    reg_d.gif

    -
  • +
    + -
  • Move point to the beginning of next line.
  • +
  • Move point to the beginning of next line. +
  • <f4> to stop. C-x C-k n and save the macro with the name -save-macs.
  • +save-macs. +

    Let's create the second macro command, insert-macs:

      -
    • Switch to the second buffer with C-x o:
    • -
    • <f3> to start recording.
    • -
    • -Insert the register from a to d according to the template: -

      +
    • Switch to the second buffer with C-x o: +
    • +
    • <f3> to start recording. +
    • +
    • Insert the register from a to d according to the template:

      insert_buf2_macro.gif

      -
    • +
    + -
  • After inserting, move point to the next empty line.
  • -
  • <f4> to stop. C-x C-k n and save the macro with the name insert-macs.
  • +
  • After inserting, move point to the next empty line. +
  • +
  • <f4> to stop. C-x C-k n and save the macro with the name insert-macs. +
  • We have two important macros now. Let's put them back together: @@ -5805,78 +5918,86 @@

    Namin
    • Switch back to buf1 with C-x o. Point should be on the second -entry.
    • -
    • <f3> to start recording.
    • +entry. + +
    • <f3> to start recording. +
    • M-x save-macs; after executing this command, point moves to the -next line.
    • +next line. +
    • C-x o to switch to buf2. Point should be after the first -insertion of machine1.
    • +insertion of machine1. +
    • M-x insert-macs; data get inserted into the buffer after this -command.
    • -
    • C-x o to switch back to buf1.
    • -
    • Press <f4> to stop.
    • -
    +command. + +
  • C-x o to switch back to buf1. +
  • +
  • Press <f4> to stop. +
  • + + -
  • -Play: -

    +
  • Play:

    You can play back your new keyboard macro to transform the remaining entries. -

  • +

    +

    -
    -

    Edit Keyboard Macro

    -
    +
    +

    7.31.5 Edit Keyboard Macro

    +
    + -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyBindingKeyBinding
    C-x C-k C-eCommand: kmacro-edit-macroC-x C-k C-eCommand: kmacro-edit-macro
     Edit the last defined keyboard macro Edit the last defined keyboard macro
    C-x C-k e name <RET>Command: edit-kbd-macroC-x C-k e name <RET>Command: edit-kbd-macro
     Edit a previously defined keyboard macro name Edit a previously defined keyboard macro name
    C-x C-k lCommand: kmacro-edit-lossageC-x C-k lCommand: kmacro-edit-lossage
     Treat the last 300 keystrokes as a keyboard macro Treat the last 300 keystrokes as a keyboard macro
    @@ -5892,16 +6013,18 @@

    Edit
    • C-u <f3>: Re-execute last keyboard macro, then append keys to its -definition.
    • +definition. +
    • C-u C-u <f3>: Append keys to the last keyboard macro without -re-executing it.
    • +re-executing it. +

    -
    -

    Interactive Keyboard Macro Editing:

    -
    +
    +

    7.31.6 Interactive Keyboard Macro Editing:

    +

    C-x C-k SPC runs kmacro-step-edit-macro that allows you to view commands of the last keyboard macro, one by one at a time, like a @@ -5912,9 +6035,10 @@

    Inter

    -
    -

    Tips for using macro effectively

    -
    +
    +

    7.31.7 Tips for using macro effectively

    +
    +
    • Find a pattern: after going through all the exercises, you can see that a successful macro is a macro that is repeatable, when a @@ -5923,26 +6047,31 @@

      Tips condition. If you data does not have a pattern, try to organize it in a repeatable way. As you can see in the exercises, data are laid out in a way that macro can be repeatable naturally: each line is an -iteration.

    • +iteration. +
    • You can also use a macro for almost anything unrelated to text in Emacs. For example, you can create a macro to run find-file and to -go to ~/Downloads.
    • +go to ~/Downloads. +
    • Use registers: As you see in the exercises, macro is a fine way to store information. You can use registers as a temporary information holder and organize those information into an arbitrary structure -later.
    • +later. +
    • Do it slowly and think before you do: Don't rush yourself. Do it slowly enough that you are sure when you press some keys and execute -some commands, it is correct.
    • -
    • Break large macro into smaller macros.
    • +some commands, it is correct. + +
    • Break large macro into smaller macros. +
    -
    -

    Version Control

    -
    +
    +

    7.32 Version Control

    +

    This section is taken directly from GNU Emacs Tour, with improvements. @@ -5981,109 +6110,109 @@

    Versi - + - + -Key -Binding +Key +Binding -C-x v = -Command: vc-diff +C-x v = +Command: vc-diff -  -Displays a diff showing the changes you've made to the current files. +  +Displays a diff showing the changes you've made to the current files. -C-x v ~ -Commmand: vc-revision-other-window +C-x v ~ +Commmand: vc-revision-other-window -  -Prompts you for a version number and shows you that version of the current +  +Prompts you for a version number and shows you that version of the current -  -file in another window. +  +file in another window. -C-x v g -Command: vc-annotate +C-x v g +Command: vc-annotate -  -Displays an annotated version of the file showing, for each line, +  +Displays an annotated version of the file showing, for each line, -  -the commit where that line was last changed and by whom. On any +  +the commit where that line was last changed and by whom. On any -  -line you can press l to view the log message for that commit or d +  +line you can press l to view the log message for that commit or d -  -to view the associated diff. +  +to view the associated diff. -C-x v l -Command: vc-print-log +C-x v l +Command: vc-print-log -  -Displays a log of previous changes to the file. When point is +  +Displays a log of previous changes to the file. When point is -  -on a particular log entry, you can press d to view the diff +  +on a particular log entry, you can press d to view the diff -  -associated with that change or f to view that version of the file. +  +associated with that change or f to view that version of the file. -C-x v u -Command: vc-revert +C-x v u +Command: vc-revert -  -Revert working copies of the selected fileset to their repository +  +Revert working copies of the selected fileset to their repository -  -contents. This asks for confirmation if the buffer contents are not +  +contents. This asks for confirmation if the buffer contents are not -  -identical to the working revision (except for keyword expansion). +  +identical to the working revision (except for keyword expansion). @@ -6111,24 +6240,32 @@

    Versi

      -
    • First, download a random Git repository.
    • -
    • Open any file in the repository.
    • +
    • First, download a random Git repository. +
    • +
    • Open any file in the repository. +
    • Edit that file and save. Do it in various places, so we have many -hunks.
    • -
    • C-x v = to know precise what changes you made.
    • -
    • C-x v g to view who changes what line on what commit.
    • +hunks. + +
    • C-x v = to know precise what changes you made. +
    • +
    • C-x v g to view who changes what line on what commit. +
    • C-x v ~, select a commit. After selecting, the version of that -revision will be displayed in another buffer.
    • +revision will be displayed in another buffer. +
    • C-x v u to revert the buffer back to its original state, after you -done playing with it.
    • -
    • Rinse and repeat until it becomes part of your workflow.
    • +done playing with it. + +
    • Rinse and repeat until it becomes part of your workflow. +

    -
    -

    Shell

    -
    +
    +

    7.33 Shell

    +

    In Emacs, you have 3 types of shell commands: shell, term and eshell. @@ -6179,13 +6316,14 @@

    Shell

    -
    -

    Project: Browsing Linux kernel source code like a pro

    -
    +
    +

    8 Project: Browsing Linux kernel source code like a pro

    +
    -
    -

    Setup

    -
    +
    +

    8.1 Setup

    +
    +

    You have learned quite a bit about Emacs. Now, you can immediately use Emacs to do practical thing like jumping around a big source tree like @@ -6198,9 +6336,7 @@

    Setup

      -
    • -Linux: -

      +
    • Linux:

      Click here and download the latest stable GNU Global. Then change to @@ -6208,18 +6344,22 @@

      Setup steps:

        -
      • tar xvf global-<version>.tar.gz
      • -
      • cd global-<version>/
      • +
      • tar xvf global-<version>.tar.gz +
      • +
      • cd global-<version>/ +
      • If you have ctags installed, add the option --with-exuberant-ctags and supply the installed path: ./configure - [--with-exuberant-ctags=/usr/local/bin/ctags]
      • -
      • make
      • -
      • sudo make install
      • -

    • + [--with-exuberant-ctags=/usr/local/bin/ctags] + +
    • make +
    • +
    • sudo make install +
    • +
    + -
  • -Windows: -

    +
  • Windows:

    Click here and click "DOS and Windows 32 version" to download the @@ -6255,10 +6395,12 @@

    Setup

    path-variable-windows.jpg

    -

  • +

    +
  • Mac OSX: -Mac OSX version is distributed by MacPorts.
  • +Mac OSX version is distributed by MacPorts. +

    @@ -6274,9 +6416,9 @@

    Setup
    -
    (require 'package)
    -(add-to-list 'package-archives
    -       '("melpa" . "http://melpa.milkbox.net/packages/") t)
    +
    (require 'package)
    +(add-to-list 'package-archives
    +         '("melpa" . "http://melpa.milkbox.net/packages/") t)
     
    @@ -6314,10 +6456,10 @@

    Setup
    -
    (add-hook 'c-mode-common-hook
    -    (lambda ()
    -      (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
    -  (ggtags-mode 1))))
    +
    (add-hook 'c-mode-common-hook
    +      (lambda ()
    +        (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
    +      (ggtags-mode 1))))
     
    @@ -6337,18 +6479,17 @@

    Setup

    -
    -

    Browsing the kernel source tree

    -
    +
    +

    8.2 Browsing the kernel source tree

    +

    You can enjoy exploring the kernel source tree by following these steps:

      -
    • Clone the kernel source: git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ~/linux
    • -
    • -C-x d and navigate to ~/linux, then press Enter. -

      +
    • Clone the kernel source: git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ~/linux +
    • +
    • C-x d and navigate to ~/linux, then press Enter.
      @@ -6358,10 +6499,12 @@

      Brows

      Then, turn on ggtags: M-x ggtags-mode . -

    • +

      +
    • Emacs has a file explorer, as you've seen above, called Dired, -short for (Dir)ectory (Ed)it.
    • +short for (Dir)ectory (Ed)it. +
    • Before start browsing the kernel, you need to create a database for quick searching. Press M-x, type ggtags-create-tags. It asks for @@ -6369,7 +6512,8 @@

      Brows press Enter; ggtags asks whether you use ctags (which is another tag generating program, works with more languages but has less features). Type no, press Enter and wait for ggtags to -generate the database.

    • +generate the database. +
    @@ -6382,20 +6526,22 @@

    Brows
  • After the tag database is done generating, a message at the bottom of your Emacs prints a message GTAGS generated in ~/linux. Now you can start going anywhere in Linux source tree in an instant instead -of spending hours to grep!
  • +of spending hours to grep! +
  • Let's find a file in Linux. Every C program, whether large or small must have a main() function, and a file containing the -function. Let's find out where the main() of Linux kernel is.
  • +function. Let's find out where the main() of Linux kernel is. +
  • M-x, type ggtags-find-file. C-c M-f also executes ggtags-find-file. A prompt ask for a file to find. You can also -invoke ggtags-find-file with C-c M-f.
  • +invoke ggtags-find-file with C-c M-f. + -
  • Enter main.c to the prompt and press Enter.
  • -
  • -You will see a list of main.c files below in various directory: -

    +
  • Enter main.c to the prompt and press Enter. +
  • +
  • You will see a list of main.c files below in various directory:
    @@ -6411,24 +6557,24 @@

    Brows

    Press M-s s. A prompt appears waiting for something to search; type init/main.c. As you type, the candidate buffer got highlighted gradually. -

  • +

    +
  • Finally you get into the correct file. This is where Linux -starts after the bootloader stage.
  • +starts after the bootloader stage. + -
  • -Now, you see a lot of names in this file: variable names, function +

  • Now, you see a lot of names in this file: variable names, function names… Now, you want to find where all of these names are defined and where they are used. Let's scroll down a bit, either with Page Down key or scrolling with the mouse or search for it. If you want to search, press C-s and type kernel_init and press C-s repeatedly. C-s is available everywhere in Emacs. M-s s is just available in ggtags. You see a function declaration like this: -

    -
    static int kernel_init(void *);
    +
    static int kernel_init(void *);
     
    @@ -6470,7 +6616,7 @@

    Brows
    -
    #include <linux/kernel.h>
    +
    #include <linux/kernel.h>
     
    @@ -6540,15 +6686,16 @@

    Brows After this demo, are you convinced now? If you want to harness the power of Emacs even further, you need to learn Emacs properly. Finally, close everything you don't need with C-x k -

  • +

    +

    -
    -

    Extending Emacs Primer

    -
    +
    +

    9 Extending Emacs Primer

    +

    To let Emacs automatically load your configuration, save it to either of these three files: @@ -6568,17 +6715,17 @@

    Exten
    -
    (require 'package)
    -(add-to-list 'package-archives
    -       '("melpa" . "http://melpa.milkbox.net/packages/") t)
    +
    (require 'package)
    +(add-to-list 'package-archives
    +         '("melpa" . "http://melpa.milkbox.net/packages/") t)
     
    -(add-hook 'c-mode-common-hook
    -    (lambda ()
    -      (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
    -  (ggtags-mode 1))))
    +(add-hook 'c-mode-common-hook
    +      (lambda ()
    +        (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode)
    +      (ggtags-mode 1))))
     
     
    -(add-hook 'dired-mode-hook 'ggtags-mode)
    +(add-hook 'dired-mode-hook 'ggtags-mode)
     
    @@ -6589,9 +6736,9 @@

    Exten
    -
    (setq ido-enable-flex-matching t)
    -(setq ido-everywhere t)
    -(ido-mode 1)
    +
    (setq ido-enable-flex-matching t)
    +(setq ido-everywhere t)
    +(ido-mode 1)
     
    @@ -6607,19 +6754,23 @@

    Exten
    • Create a new file ~/.emacs.d/init.el with C-x C-f. After this, -the buffer is created for this new file.
    • +the buffer is created for this new file. +
    • M-w (copy) the above code snippet from *scratch* buffer and -C-y (paste) into the init.el buffer.
    • -
    • C-x C-s to save the buffer into file.
    • +C-y (paste) into the init.el buffer. + +
    • C-x C-s to save the buffer into file. +
    • Restart Emacs and test if it is effective. Try list-package to see if melpa is available. Try M-. in any source file in your linux kernel -directory to see if it works properly.
    • +directory to see if it works properly. +

    -
    -

    Conclusion

    -
    +
    +

    10 Conclusion

    +

    That's it. Now you can start using Emacs for many things, from editing source code to managing files and reading documentation. I hope you @@ -6638,13 +6789,13 @@

    Concl

    -
    -

    Appendix

    -
    +
    +

    11 Appendix

    +
    -
    -

    Why Emacs? (Extended)

    -
    +
    +

    11.1 Why Emacs? (Extended)

    +

    Emacs allows you to do much more than just editing. Emacs is not a mere editor like others, either in terminal or in GUI. Emacs is a @@ -6667,9 +6818,9 @@

    Why E
    -
    (defun hello ()
    -  (interactive)
    -  (message "Hello World"))
    +
    (defun hello ()
    +  (interactive)
    +  (message "Hello World"))
     
    @@ -6699,9 +6850,9 @@

    Why E

    -
    -

    Other people's "Why Emacs?"

    -
    +
    +

    11.2 Other people's "Why Emacs?"

    +

    "Why Emacs?" by Fabrice Popinea. He is the maintainer of Emacs 64 bit on Windows. @@ -6727,9 +6878,9 @@

    Other

    -
    -

    More on Emacs history

    -
    +
    +

    11.3 More on Emacs history

    +

    Ever heard of a computing system called Lisp Machine? I bet many of you don't. Me, too, until I started using Emacs and gradually learned @@ -6821,21 +6972,9 @@

    More

    - -
    - - - comments powered by Disqus +

    Created: 2016-12-06 Tue 01:42

    +

    Emacs 24.5.1 (Org mode 8.2.10)

    +

    Validate

    - \ No newline at end of file + diff --git a/emacs-tutor2.html b/docs/emacs-tutor2.html similarity index 65% rename from emacs-tutor2.html rename to docs/emacs-tutor2.html index 2a58a8e..2951ab5 100644 --- a/emacs-tutor2.html +++ b/docs/emacs-tutor2.html @@ -4,10 +4,9 @@ Emacs Mini Manual (PART 2) - LISP PRIMER: WHY PARENTHESES MATTER - + - - + -
    - - - - -

    Back to Table of Contents

    -

    Emacs Mini Manual (PART 2) - LISP PRIMER: WHY PARENTHESES MATTER

    -

    Introduction - and why you should learn Lisp

    +

    1 Introduction - and why you should learn Lisp

    In this section, you can try out code by M-x ielm, then paste code @@ -194,7 +164,7 @@

    -

    Before we start

    +

    1.1 Before we start

    @@ -364,21 +334,21 @@

    -
    (1 2 3 4) ;;is a list that holds 4 numbers from 1 to 4
    +
    ’(1 2 3 4) ;;is a list that holds 4 numbers from 1 to 4
     
    -’("aa" "bb" "cc" "dd") ;;is a list that holds 4 strings: "aa", "bb", "cc", "dd"
    +’("aa" "bb" "cc" "dd") ;;is a list that holds 4 strings: "aa", "bb", "cc", "dd"
     
    - '() ;; an empty list, which is also an atom
    + '() ;; an empty list, which is also an atom
     
    -’(if a b c) ;;  a list that hold 4 symbol: if, a, b and c
    +’(if a b c) ;;  a list that hold 4 symbol: if, a, b and c
     
    - (if a b c) ;; is an if expression that executes if..then..else
    -           ;; logic in common programming languages. Expressions like if are
    -           ;; called *special form*
    + (if a b c) ;; is an if expression that executes if..then..else
    +           ;; logic in common programming languages. Expressions like if are
    +           ;; called *special form*
     
    -’(+ 1 2 3) ;; is a list consists of 4 elements: +, 1, 2 and 3
    +’(+ 1 2 3) ;; is a list consists of 4 elements: +, 1, 2 and 3
     
    - (+ 1 2 3)  ;; is a function call to function "+" (yes, "+" is a function)
    + (+ 1 2 3)  ;; is a function call to function "+" (yes, "+" is a function)
     

    @@ -403,7 +373,7 @@

    -
    if (condition) {
    -    ...statements...
    -} else {
    -    ...statements...
    -}
    +
    if (condition) {
    +    ...statements...
    +} else {
    +    ...statements...
    +}
     

    @@ -429,10 +399,10 @@

    -
    if condition:
    -    ...statements...
    -else:
    -    ...statements...
    +
    if condition:
    +    ...statements...
    +else:
    +    ...statements...
     

    @@ -445,10 +415,10 @@

    -
    '(if condition:
    -    ...statements
    -  else:
    -    ...statements...)
    +
    '(if condition:
    +    ...statements
    +  else:
    +    ...statements...)
     

    @@ -508,9 +478,9 @@

    -
    (if condition  ;; condition is a valid Lisp form
    -    ...do something if true...
    -  ...do something if false...)
    +
    (if condition  ;; condition is a valid Lisp form
    +    ...do something if true...
    +  ...do something if false...)
     

    @@ -543,10 +513,10 @@

    -
    '(if condition:
    -     ...statements...
    -  else:
    -     ...statements...)
    +
    '(if condition:
    +     ...statements...
    +  else:
    +     ...statements...)
     

    @@ -559,10 +529,10 @@

    -
    (if condition:
    -     ...statements...
    - else:
    -     ...statements...)
    +
    (if condition:
    +     ...statements...
    + else:
    +     ...statements...)
     

    @@ -573,9 +543,9 @@

    -
    (if condition
    -     ...statements...
    -     ...statements...)
    +
    (if condition
    +     ...statements...
    +     ...statements...)
     

    @@ -613,7 +583,7 @@

    -

    Beyond parentheses

    +

    1.4 Beyond parentheses

    You may ask, can you to create syntax without parentheses in Lisp? Of @@ -644,7 +614,7 @@

    -

    Syntax error

    +

    2 Syntax error

    Lisp syntax is simple: it's just a pair of parentheses, with things in @@ -653,7 +623,7 @@

    -

    Unbalanced parentheses:

    +

    2.1 Unbalanced parentheses:

    Do you miss an opening or closing parentheses, or do you insert @@ -664,9 +634,9 @@

    -
    for {set i 0} {$i < $n} {incr i} {
    -    ...do something...
    -}
    +
    for {set i 0} {$i < $n} {incr i} {
    +    ...do something...
    +}
     

    @@ -678,8 +648,8 @@

    -
    array set balloon {color red}
    -array get balloon
    +
    array set balloon {color red}
    +array get balloon
     

    @@ -691,7 +661,7 @@

    -

    Mini-language syntax error:

    +

    2.2 Mini-language syntax error:

    @@ -758,16 +728,16 @@

    -
    void add(int a, int b) {
    -    return a + b;
    -}
    +
    void add(int a, int b) {
    +    return a + b;
    +}
     
    -void main(int argc, const char* argv[]) {
    -    int a = 1;
    +void main(int argc, const char* argv[]) {
    +    int a = 1;
     
    -    add(a);
    -    add(a,b);
    -}
    +    add(a);
    +    add(a,b);
    +}
     

    @@ -785,7 +755,7 @@

    -

    Lisp Machine

    +

    4 Lisp Machine

    It would be a mistake when mention about history of Lisp without @@ -890,7 +860,7 @@

    -

    Conclusion

    +

    5 Conclusion

    diff --git a/docs/emacs-tutor3.html b/docs/emacs-tutor3.html new file mode 100644 index 0000000..dbbde7c --- /dev/null +++ b/docs/emacs-tutor3.html @@ -0,0 +1,4789 @@ + + + + +Emacs Mini Manual (PART 3) - CUSTOMIZING AND EXTENDING EMACS + + + + + + + + +
    +

    Emacs Mini Manual (PART 3) - CUSTOMIZING AND EXTENDING EMACS

    + +
    +

    1 Why customize and extend Emacs?

    +
    +

    +Emacs comes with default settings. Some interesting features are +disabled and hidden, i.e. ibuffer, Semantic, electric +modes… Probably, to make it more user friendly to new users and +make it behave more like "normal" editors, i.e. Normal users do not +expect automatic pairing of punctuation marks like parentheses, +brackets, curly brackets… +

    + +

    +Because the nature of Emacs is an extensible system, people write +extensions to improve Emacs and share with others. The extensions +improve various aspects of Emacs: Improve existing and add new editing +features, integrate 3rd party tools, add programming languages +supports, change Emacs appearance… Without the ability to extend, +Emacs will just be another obscure editor with some useful features +but cannot meet the demands of people, because different people have +different needs, and Emacs maintainers cannot provide them all and +integrate all into Emacs. With the ability to extend, people can bend +Emacs the way they want, much like Lisp. +

    + +

    +Unlike other editors which encourage users to stay with the default as +much as they can, Emacs encourages users to customize and extend Emacs +as much as they can. +

    + +

    +In the old days, when Emacs did not have a package manager and did +not have many learning resources, it's really uneasy to customize +Emacs, because to customize Emacs properly you have to read a decent +chunk of the Emacs Lisp manual. Many of us, including me, do not have +that luxury of time. The way I learned to customize Emacs was copying +little code snippets that solve specific problems - when I encountered +them - and paste everything in my ~/.emacs file. I also had to +download Emacs packages manually and load it manually in ~/.emacs. I +hope that this guide helps you to be at least as good as me in +customizing Emacs without having to spend a long time in collecting +configurations, or reading the whole Emacs Lisp manual. After you +finish this chapter, you can dive in the Emacs Lisp manually if you +want, and easier. +

    +
    +
    + +
    +

    2 Just enough Emacs Lisp

    +
    +

    +In this section, you only need to read and understand. I will list the +commonly used function used for customizing Emacs that we will use in +later sections. It's important that you understand the core +ideas. After you finish the sub-sections of this section, we will play +with Emacs Lisp code for customizing Emacs, and it's really fun to see +your Emacs "evolves" gradually. +

    + +

    +It's worth to review again. To read most of Lisp code, it is easy. You +only need to these rules: +

    + +
      +
    • Code that get executed is a pair of parentheses, with things in it: +(...). The first element always gets evaluated; your Lisp +environment (in our case, Emacs) determines which of the following 3 +forms the symbol in the first slot is, then acts accordingly: +
    • + +
    • Function form: if the first element points to a function definition, +then the following elements get evaluated from left to right and +finally passed into the function as arguments. + +

      +For example: +

      + +
      + +
      (message "Hello word %d" (+ 10 10))
      +
      +
      + +

      +message is a function that prints to echo area and *Message* +buffer (can be opened with C-h e). Emacs detects that message is a +function, then it evaluates the string "Hello world %d" and another +nested form (+ 10 10) sequentially. When Emacs gets to (+ 10 + 10), it evaluates the form and return 20. Then the string "Hello +world %d" and the number 20 are passed into message, and finally +output "Hello world 20" in the echo area and *Message* buffer. +

      +
    • + +
    • Special form: if the first element is one of predefined functions in +Emacs Lisp that need special rules and/or syntax, then the remaining +elements are evaluated depend on the rule of the predefined +functions. Special form is just function form, but handle the +remaining in its own way rather than using the default in function +form. That's why we call it special. + +

      +For example, if is a special form as we learned in previous part: +

      + +
      + +
      (if condition
      +    true-case
      +  false-case)
      +
      +
      + +

      +condition is a valid Lisp form; if it is evaluated to true (which +is anything not NIL, or the empty list ()), then the true case - +also a valid Lisp form - gets evaluated; otherwise the false case - +also a valid Lisp form - gets evaluated. +

      + +

      +Another special form is and. After Emacs determines the first +element is and special form, then it keeps evaluating the +remaining elements from left to right until one of the element +return false. If all elements get evaluated, and returns true. +

      +
    • + +
    • Macro form: if the first element is created by the function +defmacro (which you do not need to know at this stage), then Emacs +do not evaluate any remaining elements, but passes them in as +data. Macro is a way for programmers to create their own +mini-language that do not follow the evaluation rules predefined in +Emacs (function form and special form). If you read a form that is +not a function form or any predefined special form, don't panic! +It's a macro form. Programmers always provide documentations on how +to use their mini-languages. +
    • +
    + +

    +After all, those different forms are just under one category: +function. Function form is a regular function; special form is a +function with its own rule; macro form is a function that generate +code. +

    + +
      +
    • Data: has two types: +
    • + +
    • Atom: primitives such as number, string, symbol and NIL. +
    • + +
    • Non-atom: if you put a just before a form, it becomes +a list. Emacs treats these quoted forms as data. + +

      +Emacs also has other data types like array, hash-table… but list +is the most popular, used when performance is not needed. +

      +
    • +
    + +

    +In this section, I only explained the frequently used functions. In +the later sections, there are more functions used. I can't explain +them all. You should really work it out on your own gradually with +C-h f and C-h v. +

    +
    + +
    +

    2.1 Function: (setq [ SYM VAL ]…)

    +
    +

    +Comment: A really fundamental function for customizing Emacs +settings. An Emacs setting is really just a variable. Emacs has GUI +for changing setting, but setq a variable is also equivalent. +

    + +

    +Example: +

    + +
    + +
    (setq global-mark-ring-max 50000)
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +Set each SYM to the value of its VAL. +The symbols SYM are variables; they are literal (not evaluated). +The values VAL are expressions; they are evaluated. +Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. +The second VAL is not computed until after the first SYM is set, and so on; +each VAL can use the new value of variables set earlier in the `setq'. +The return value of the `setq' form is the value of the last VAL. +

    +
    +
    +
    + +
    +

    2.2 Function: (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)

    +
    +

    +Comment: This function allows you to load a file. FILE is the +a filename that is looked up in the variable load-path. Do you +notice &optional keyword? When you see this keyword, it means +everything after &optional is, optional. The parameters NOERROR, +NOMESSAGE, NOSUFFIX, MUST-SUFFIX are not required to be passed +into the function if you don't need. However, if you want to pass an +argument into the place of one a parameter, you must also pass +arguments to all the parameters to the left of your chosen +parameter. For example, if you want to pass an argument into +NOSUFFIX, you are required to pass arguments into NOERROR, +NOMESSAGE first. You are safe to ignore everything after your +chosen parameter, and in our example, it's MUST-SUFFIX. +

    + +

    +Example: +

    + +
    + +
    (load (substitute-in-file-name "$HOME/.emacs.d/module")) ;; first try to load module.elc; if not found, try to load module.el
    +(load (substitute-in-file-name "$HOME/.emacs.d/module.el")) ;; only load module.el
    +(load (substitute-in-file-name "$HOME/.emacs.d/module.elc")) ;; only load module.elc
    +(load "module") ; search for the file module.el or module.elc in variable load-path
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +Execute a file of Lisp code named FILE. +First try FILE with `.elc' appended, then try with `.el', then try +FILE unmodified (the exact suffixes in the exact order are determined +by `load-suffixes'). Environment variable references in FILE are +replaced with their values by calling `substitute-in-file-name'. This +function searches the directories in `load-path'. +

    + +

    +….(C-h f for more information)… +

    +
    +
    +
    +
    +

    2.3 Function: (require FEATURE &optional FILENAME NOERROR)

    +
    +

    +Comment: If you install a package from M-x list-packages, to +load that package, use (require 'installed-package). +

    + +

    +Example: For example, you installed package volatile-highlights, +to load it: +

    + +
    + +
    (require 'volatile-highlights)
    +
    +
    + +

    +Later in the guide, you will create your own custom modules that uses +provide function to provide new feature to Emacs. To use a feature, +the module must be activated with require. +

    + +

    +Built-in Documentation: +

    + +
    +

    +If feature FEATURE is not loaded, load it from FILENAME. +If FEATURE is not a member of the list `features', then the feature +is not loaded; so load the file FILENAME. +If FILENAME is omitted, the printname of FEATURE is used as the file name, +and `load' will try to load this name appended with the suffix `.elc' or +`.el', in that order. The name without appended suffix will not be used. +See `get-load-suffixes' for the complete list of suffixes. +If the optional third argument NOERROR is non-nil, +then return nil if the file is not found instead of signaling an error. +Normally the return value is FEATURE. +The normal messages at start and end of loading FILENAME are suppressed. +

    +
    +
    +
    + +
    +

    2.4 Function: (provide FEATURE &optional SUBFEATURES)

    +
    +

    +Comment: You can use this function at the end of a file to turn the +file into a loadable module that is only loaded when called with +require. +

    + +

    +Example: +

    + +

    +Suppose that in a file setup-editing.el, you put this line at the +bottom: +

    + +
    + +
    (provide 'setup-editing)
    +
    +
    + +

    +Then, even if you load it with load function, it won't be +activated. To activate, you have to execute (require +'setup-editing). +

    + +

    +Built-in Documentation: +

    + +
    +

    +Announce that FEATURE is a feature of the current Emacs. The optional +argument SUBFEATURES should be a list of symbols listing particular +subfeatures supported in this version of FEATURE. +

    +
    +
    +
    +
    +

    2.5 Function: (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)

    +
    +

    +Comment: Add an element ELEMENT to a list named LIST-VAR. +

    + +

    +Example: +

    + +
    + +
    (add-to-list 'load-path "~/.emacs.d/personal") ; add personal to load-path,
    +                                               ; so "load" function can search for files in it
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +Add ELEMENT to the value of LIST-VAR if it isn't there yet. +The test for presence of ELEMENT is done with `equal', or with +COMPARE-FN if that's non-nil. +If ELEMENT is added, it is added at the beginning of the list, +unless the optional argument APPEND is non-nil, in which case +ELEMENT is added at the end. +

    + +

    +The return value is the new value of LIST-VAR. +

    + +

    +This is handy to add some elements to configuration variables, +but please do not abuse it in Elisp code, where you are usually +better off using `push' or `cl-pushnew'. +

    + +

    +If you want to use `add-to-list' on a variable that is not +defined until a certain package is loaded, you should put the +call to `add-to-list' into a hook function that will be run only +after loading the package. `eval-after-load' provides one way to +do this. In some cases other hooks, such as major mode hooks, +can do the job. +

    +
    +
    +
    + +
    +

    2.6 Function: (add-hook HOOK FUNCTION &optional APPEND LOCAL)

    +
    +

    +Comment: A hook is a Lisp variable which holds a list of +functions, to be called on some well-defined occasion. (This is called +running the hook. You can search for hook using C-h v and enter +-hook suffix then TAB. Or you can find hooks in Customization Groups. +

    + +

    +Example: +

    + +
    + +
    (add-hook 'prog-mode-hook 'linum-mode)
    +
    +
    + +

    +After you add the function linum-mode - which activates line number +on the left margin of your Emacs - then every time you enter a +prog-mode, which is the root all programming major modes derive +from. A programming mode can be c-mode, asm-mode, +emacs-lisp-mode, java-mode… +

    + +

    +Built-in Documentation: +

    + +
    +

    +Add to the value of HOOK the function FUNCTION. +FUNCTION is not added if already present. +FUNCTION is added (if necessary) at the beginning of the hook list +unless the optional argument APPEND is non-nil, in which case +FUNCTION is added at the end. +

    + +

    +The optional fourth argument, LOCAL, if non-nil, says to modify +the hook's buffer-local value rather than its global value. +This makes the hook buffer-local, and it makes t a member of the +buffer-local value. That acts as a flag to run the hook +functions of the global value as well as in the local value. +

    + +

    +HOOK should be a symbol, and FUNCTION may be any valid function. If +HOOK is void, it is first set to nil. If HOOK's value is a single +function, it is changed to a list of functions. +

    +
    +
    +
    + +
    +

    2.7 Function: (global-set-key KEY COMMAND)

    +
    +

    +Comment: This function binds a command to a key, as you can see in +the function interface. +

    + +

    +Example: +

    + +

    +You can bind in one of the following ways: +

    + +
    + +
    (global-set-key (kbd "C-x C-b") 'ibuffer) ;; bind "C-x C-b" to ibuffer command
    +(global-set-key "\C-x\C-b" 'ibuffer)  ;; bind "C-x C-b to ibuffer command, but modifier 
    +                                      ;; keys must be escaped with the backslash
    +(global-set-key [?\C-x?\C-b] 'ibuffer) ;; use vector instead of a string
    +
    +
    + +

    +I recommend you to use (kbd ...) function because we can write key +bindings using our familiar key notations without adding unnecessary +characters. Vector is array in other languages. Vector was used for +mapping function keys, such as [left], [right], [up], [down], +[f1]...[f12]. But now, you can also map function keys in (kbd +...) function using angle brackets: +

    + +
    + +
    (global-set-key (kbd "<f3>") 'kmacro-start-macro-or-insert-counter)
    +
    +
    + +

    +Here are common function keys (remember to wrap them in a pair of +angle bracket): +

    + + + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyDescription
    left, up, right, downCursor arrow keys
    begin, end, home, next, priorOther cursor re-positioning keys
     prior means PageUp
     next means PageDOwn
    select, print, execute, backtabMiscellaneous keys
    insert, undo, redo, clearlinebacktab means S-TAB or C-iso-tab
    insertline, deleteline, insertchar, deletechar 
    f1, f2, ... F35Numbered function keys on top of your keyboard
    kp-add, kp-subtract, kp-multiply, kp-divideKeypad keys (to the right of the regular keyboard)
    kp-backtab, kp-space, kp-tab, kp-enter, with names or punctuation.
    kp-separator, kp-decimal, kp-equal 
      
    kp-0, kp-1, ... kp-9Keypad keys with digits.
      
    kp-f1, kp-f2, kp-f3, kp-f4Keypad PF keys.
    + +

    +Built-in Documentation: +

    + +
    +

    +Give KEY a global binding as COMMAND. +COMMAND is the command definition to use; usually it is +a symbol naming an interactively-callable function. +KEY is a key sequence; noninteractively, it is a string or vector +of characters or event types, and non-ASCII characters with codes +above 127 (such as ISO Latin-1) can be included if you use a vector. +

    + +

    +Note that if KEY has a local binding in the current buffer, +that local binding will continue to shadow any global binding +that you make with this function. +

    +
    +
    +
    +
    +

    2.8 Function: (define-key KEYMAP KEY DEF)

    +
    +

    +Comment: +

    + +

    +This function binds a definition DEF, usually a command, to a key +sequence KEY. A definition can be other things that you can find in +the built-in documentation. +

    + +

    +A key sequence (key, for short) is a sequence of input events that +have a meaning as a unit. Input events include characters, function +keys and mouse buttons—all the inputs that you can send to the +computer. A key sequence gets its meaning from its binding, which says +what command it runs. +

    + +

    +When a key sequence KEY is pressed, Emacs runs the associated +function. A keymap KEYMAP stores a list of bindings between KEY +and definition DEF. Major mode or minor mode uses keymap to provide +its own key bindings. A keymap usually has -mode-map suffix, +i.e. dired-mode-map; if you want to change or add a key binding in a +major mode or minor mode, you use define-key function like this: +

    + +

    +Example: +

    + +
    + +
    ;; Dired uses "e", "f" or RET to open a file
    +;; you can reuse one of these keys for different purpose
    +;; for example, you can bind it to wdired-change-to-wdired-mode
    +;; wdired-change-to-wdired-mode allows you to edit your Dired buffer
    +;; like a normal text buffer, such as edit file/directory names,
    +;; permission bits.. and then commit the changes to disk.
    +;;
    +;; "e" is short for "edit"
    +;; After finish your editing, "C-c C-c" to commit, "C-c C-k" to abort
    +(define-key dired-mode-map (kbd "e") 'wdired-change-to-wdired-mode)
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +In KEYMAP, define key sequence KEY as DEF. +KEYMAP is a keymap. +

    + +

    +KEY is a string or a vector of symbols and characters, representing a +sequence of keystrokes and events. Non-ASCII characters with codes +above 127 (such as ISO Latin-1) can be represented by vectors. +Two types of vector have special meanings: +[remap COMMAND] remaps any key binding for COMMAND. +[t] creates a default definition, which applies to any event with no +other definition in KEYMAP. +

    + +

    +DEF is anything that can be a key's definition: +nil (means key is undefined in this keymap), +a command (a Lisp function suitable for interactive calling), +a string (treated as a keyboard macro), +a keymap (to define a prefix key), +a symbol (when the key is looked up, the symbol will stand for its +function definition, which should at that time be one of the above, +or another symbol whose function definition is used, etc.), +a cons (STRING . DEFN), meaning that DEFN is the definition +(DEFN should be a valid definition in its own right), +or a cons (MAP . CHAR), meaning use definition of CHAR in keymap MAP, +or an extended menu item definition. +(See info node `(elisp)Extended Menu Items'.) +

    + +

    +If KEYMAP is a sparse keymap with a binding for KEY, the existing +binding is altered. If there is no binding for KEY, the new pair +binding KEY to DEF is added at the front of KEYMAP. +

    +
    +
    +
    +
    +

    2.9 Function: (defalias SYMBOL DEFINITION &optional DOCSTRING)

    +
    +

    +Comment: defalias allows you to rename a command. It is usually +used to abbreviate command name. +

    + +

    +Example: Put the following aliases in your init.el: +

    + +
    + +
    (defalias 'yes-or-no-p 'y-or-n-p) ; y or n is enough
    +(defalias 'list-buffers 'ibuffer) ; always use ibuffer
    +
    +                                        ; elisp
    +(defalias 'eb 'eval-buffer)
    +(defalias 'er 'eval-region)
    +(defalias 'ed 'eval-defun)
    +
    +                                        ; minor modes
    +(defalias 'wsm 'whitespace-mode)
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +Set SYMBOL's function definition to DEFINITION. +Associates the function with the current load file, if any. +The optional third argument DOCSTRING specifies the documentation string +for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string +determined by DEFINITION. +

    + +

    +Internally, this normally uses `fset', but if SYMBOL has a +`defalias-fset-function' property, the associated value is used instead. +

    + +

    +The return value is undefined. +

    +
    +
    +
    + +
    +

    2.10 Function: (mapc FUNCTION SEQUENCE)

    +
    +

    +Comment: mapc calls the function FUNCTION on each element of the +sequence SEQUENCE. +

    + +

    +Example: +

    + +
    + +
    ;; load every .el file inside ~/.emacs.d/custom/
    +(mapc 'load (directory-files "~/.emacs.d/custom" t ".*\.el"))
    +
    +
    + +

    +Built-in Documentation: +

    + +
    +

    +Apply FUNCTION to each element of SEQUENCE for side effects only. +Unlike `mapcar', don't accumulate the results. Return SEQUENCE. +SEQUENCE may be a list, a vector, a bool-vector, or a string. +

    +
    +
    +
    + +
    +

    2.11 Macro: (defun NAME ARGLIST &optional DOCSTRING DECL &rest BODY)

    +
    +

    +Comment: defun is a Lisp macro that allows you to define a +function, like any other language. A function is a collection of +Lisp forms to be executed. The return value is the last form. +

    + +

    +Example: +

    + +
      +
    • Create a normal function (Not available in M-x): +
    • +
    + +
    + +
    (defun demo ()
    +  (message "Hello World" number string))
    +
    +
    + +
      +
    • Create a command (Available in M-x): +
    • +
    +
    + +
    (defun demo ()
    +  (interactive)
    +  (message "Hello World"))
    +
    +
    + +

    +interactive is a special form that turns a function into a command +and allow a command to accept various types of prefix arguments, such +as a number, a string, symbol, buffer names… You can C-h f and +type interactive to find out more. +

    + +

    +Built-in Documentation: +

    + +
    +

    +Define NAME as a function. +The definition is (lambda ARGLIST [/DOCSTRING/] BODY…). +See also the function `interactive'. +DECL is a declaration, optional, of the form (declare DECLS…) where +/DECLS is a list of elements of the form (PROP . VALUES). These are +interpreted according to `defun-declarations-alist'. +The return value is undefined. +

    +
    +
    +
    +
    + +
    +

    3 Useful built-in key bindings for navigating pairs

    +
    + +
      +
    • C-M-f binds to forward-sexp, move forward over a balanced +expression. Demo: + + +
      +

      forward-sexp.gif +

      +
      +
    • + +
    • C-M-b binds to backward-sexp, move backward over a balanced +expression. Demo: + + +
      +

      backward-sexp.gif +

      +
      +
    • + +
    • C-M-k binds to kill-sexp, kill balanced expression +forward. Demo: + + +
      +

      kill-sexp.gif +

      +
      +
    • + +
    • C-M-t binds to transpose-sexps, transpose expressions. Demo: + + +
      +

      transpose-sexp.gif +

      +
      +
    • + +
    • C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after +following expression. Demo: + + +
      +

      mark-sexp.gif +

      +
      +
    • +
    +
    +
    + +
    +

    4 Let's supercharge Emacs

    +
    +

    +Throughout this section I will help you to extend Emacs with packages +that improves general Emacs features, such as Info, Dired, buffer +management… I will introduce you popular packages out there, but I +cannot present you all. The purpose of this guide is to help you get +really comfortable to Emacs package system, so you can extend Emacs +with packages from other people easily to fit your need. Writing your +own Emacs extension is a differnt story, and is beyond the scope of +this guide. +

    + +

    +I will introduce packages specialized for programming in later part: how +to setup programming environment for popular languages (C/C++, Lisp, +Python, Ruby…); each programming environment will have its own +chapter. In this part of the mini manual series, I only introduce +general packages for extending Emacs in various aspects. And you are +going to need some of these packages to setup your specialized +programming envrionment, so don't skip it. +

    + +

    +Don't be intimidated if you see many packages down there. Adding +packages and see it extends your Emacs is fun and addictive, like +playing video games. +

    + +

    +To remind you, Emacs always loads one of the three of the following +files when it starts: +

    + +
      +
    • ~/.emacs +
    • +
    • ~/.emacs.d/init +
    • +
    • ~/.emacs.d/init.el +
    • +
    + +

    +To apply a setting, move point to the end of a Lisp expression and +C-x C-e, which runs eval-last-sexp. Or, you can evaluate the whole +buffer with eval-buffer. +

    + +

    +When you want to complete function names in Emacs Lisp: C-M-i, +which runs completion-at-point. It will display a list of possible +candidates available in Emacs. As a reminder, if you want to quickly +complete some text, you can M-/, which runs dabbrev-expand. +

    + +

    +If a package uses new functions, I will introduce the functions in its +own sections just before we get to that package. I will only introduce +the basic usage of the functions. If you want to understand more, C-h +f and enter name of the function. All of the quoted function +descriptions are taken from C-h f. If you forget what a function +does and how to use it, C-h f to find out. Really, you should get +used to getting help from Emacs itself. +

    +
    + +
    +

    4.1 How to use Emacs package manager

    +
    +

    +Emacs has a package manager to make the task of installing, update and +removing easier, as well as inform users new packages created by the +community. Emacs gets a list of packages from sources, called package +archive. Package archive is the same as repository in +Linux. Currently, there are 3 package archives in Emacs: +

    + +
      +
    • built-in: limited number of packages, and not always up to date. +
    • +
    • Marmalade: more packages, but mostly outdated since people moved to MELPA. +
    • +
    • MELPA: the most popular and most up to date package archive, with +most number of packages. +
    • +
    + +

    +Marmalade and MELPA are not activated by default; you have to add them +manually. You only need to setup MELPA and that's enough to get all +the packages described in later sections. Add this code snippet to your +~/.emacs.d/init.el: +

    + +
    + +
    (require 'package)
    +(add-to-list 'package-archives
    +  '("melpa" . "http://melpa.milkbox.net/packages/") t)
    +
    +
    + +

    +Then, evaluate those two expressions with C-x C-e or eval-buffer. +

    + +

    +To open the package manager, M-x list-package. You will see a list +of packages. +

    + +
      +
    • To navigate the package list down and up using n and p. +
    • +
    • To view information of a package, press RET. +
    • +
    • To mark a package for install, press i. +
    • +
    • To mark a package for delete, press d. +
    • +
    • To unmark a package, press u. +
    • +
    • To execute the marked packages (either for install or delete), press x. +
    • +
    • To refresh and update the latest package list, press r. +
    • +
    • To update all packages, press U. +
    • +
    • To filter to a group of packages, press f. Press TAB to display +possible groups. +
    • +
    • To display these key bindings, press h. +
    • +
    + +

    +Exercise: Let's install a few packages in advance, so you won't +have to install the packages later. Install these packages: +

    + +
      +
    • volatile-highlights +
    • +
    • undo-tree +
    • +
    • yasnippet +
    • +
    +
    +
    + +
    +

    4.2 Customize Emacs

    +
    +
    +
    +

    4.2.1 Using GUI

    +
    +

    +If you want to change a specific setting, you need to change a +variable value. You wonder, there are so many variables to set. How do +you know which to which? Luckily, you don't have to manually guess +which variable to set. Emacs has a command for setting Emacs +internally, with a nice organization of settings, rather than randomly +set a variable that you randomly found. M-x customize to open a +window for customizing Emacs: +

    + + +
    +

    customize.jpg +

    +
    + +

    +You will see various categories for customizing Emacs. These +categories are called Customization Groups in Emacs. Let's try +setting something in Emacs: +

    + +
      +
    • Go to Editing -> Editing Basics -> move point to "Global +
    • +
    +

    +Mark ring Max: ". +

    +
      +
    • Change the value to 5000. +
    • +
    • Move point on State button. Press RET. +
    • +
    • A menu appears with the following choice: +
    • +
    + +

    +0 = Set for current Sesssion +This option is for trying out a new setting. If you close Emacs, the +old setting is restored. +

    + +

    +1 = Save for Future Sesssions +This option saves the new value permanently, so the next time you +start Emacs, it uses your saved setting. The new value is saved at +~/.emacs.d/init.el like this: +

    + +
    + +
    (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.
    + '(global-mark-ring-max 5000))
    +
    +
    + +

    +2 = Undo Edits: Undo to the previous value of a particular setting, if you haven't +set. +

    + +

    +3 = Revert This Sesssion's Customization: This restores the value of +the variable to the last saved value, and updates the text +accordingly. +

    + +

    +4 = Erase Customization: Reset to standard value and delete set +value in ~/emacs.d/init.el. +

    + +

    +7 = Add Comment: Sometimes you have something to say about your +customization. Write it using this option. +

    + +

    +: = Show Saved Lisp Expression: Show the actual variable +representation. If you open the menu again, the option : = Show Saved +Lisp Expression is changed to Show current value that switches back +to the nicer representation. +

    + +

    +Another way to change a setting is using C-h v, which runs +describe-variable that list all the available variables in your +Emacs and allow you to select one. You can also access the parent +group of a group or a variable. +

    + +

    +Aside from the general customize command, Emacs has many more +customization command: customize-group, customize-face… That +organize customization groups in different ways. However, in the scope +of this guide, we only use customize for customize Emacs generally +and customize-group to select a specific package for customizing, +and also find out which parent group the package belongs to, after you +finished installing from the package manager. +

    +
    +
    + +
    +

    4.2.2 Using Emacs Lisp

    +
    +

    +The above approach uses GUI, which makes Emacs look familiar to normal +users from other editors: using GUI to change the editors. However, it +has disadvantages: Monolithic. Although the settings are nicely +organized into groups, its underlying representation is not. After you +set and save something in whatever group, Emacs always add your +setting to the function custom-set-variables like this: +

    + +
    + +
    (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.
    + '(global-mark-ring-max 5000 nil nil "test"))
    +
    +
    + +

    +As you can read it the comment, custom-set-variables is expected to +be unique in your init file. If you have more, things go wrong. So, by +design, you cannot split the settings into logical groups of your +choice. +

    + +

    +For that reason, setq is the preferred method. But, you can use the +GUI with nice and logical grouping to guide you to the settings you +want to change. The grouping is nice, and for consistency, we should +organize our module structure based on the grouping in M-x +customize: +

    + +
      +
    • setup-editing.el for Editing group. +
    • +
    • setup-convenience.el for Convenience group. +
    • +
    • setup-files.el for Files group. +
    • +
    • setup-text.el for Text group. +
    • +
    • setup-data.el for Data group. +
    • +
    • setup-external.el for External group. +
    • +
    • setup-communication.el for Communication group. +
    • +
    • setup-programming.el for Programming group. +
    • +
    • setup-applications.el for Application group. +
    • +
    • setup-development.el for Development group. +
    • +
    • setup-environment.el for Environment group. +
    • +
    • setup-faces.el for Faces group. +
    • +
    • setup-help.el for Help group. +
    • +
    • setup-multimedia.el for Multimedia group. +
    • +
    • setup-local.el for Local group. +
    • +
    + +

    +Please note that even though you may see some packages are inside a +group in customize GUI, I still put in another group since I feel +such packages are more appropriate. So, if you see packages in my +setup are in different groups, don't be surprise. But it's just my +personal opinion. You can move it where you want. +

    + +

    +Exercise: +

    + +
      +
    • Create a directory: ~/.emacs.d/custom/ +
    • +
    • Create the above setup-*.el files under it. +
    • +
    • Load the files above using mapc: +
    • +
    + +
    + +
    (mapc 'load (directory-files "~/.emacs.d/custom" t ".*\.el"))
    +
    +
    + +

    +You already installed the package rebox2 in How to use Emacs package +manager section. When you mark a region and M-q, you can create the +above comment box. There are many styles, you can cycle by pressing +M-q repeatedly. +

    + +

    +Now, everything is prepared. We can really dive into customizing and +extending Emacs with 3rd party packages and various code snippets that +solve many little problems. In later sections, each is dedicated to a +category. But, please note that I only provide the customizations that +I found useful, not templates that you have to follow rigidly. You can +consider my customizations as an example for your own +customizations. You can use it either way: +

    + +
      +
    • Copy the sample configurations into your files and look back later +or just don't care. +
    • + +
    • Really control the customization process and make the customizations +actually yours, by reading the customization code and understand +what it does. +
    • +
    +
    +
    +
    + +
    +

    4.3 init.el

    +
    +

    +Sample init.el: +

    + + +
    + +
    ;; Add and enable MELPA
    +(require 'package)
    +(add-to-list 'package-archives
    +             '("melpa" . "http://melpa.milkbox.net/packages/") t)
    +(package-initialize)
    +
    +;; add your modules path
    +(add-to-list 'load-path "~/.emacs.d/custom/")
    +
    +;; load your modules
    +(require 'setup-applications)
    +(require 'setup-communication)
    +(require 'setup-convenience)
    +(require 'setup-data)
    +(require 'setup-development)
    +(require 'setup-editing)
    +(require 'setup-environment)
    +(require 'setup-external)
    +(require 'setup-faces-and-ui)
    +(require 'setup-files)
    +(require 'setup-help)
    +(require 'setup-programming)
    +(require 'setup-text)
    +(require 'setup-local)
    +
    +
    +
    + +
    +

    4.3.1 Package: workgroups2

    +
    + +

    +Author: +

    + +

    +Sergey Pashinin, sergey@pashinin.com +

    + +

    +Based on the original workgroups, created by tlh, thunkout@gmail.com. +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Workgroups is a session manager for Emacs. +

    + +
      +
    • It saves all your opened buffers, their location and sizes on disk +to restore later. +
    • + +
    • You can create several workspaces. +
    • +
    + +

    +You can also restore such buffers as: org-agenda, shell, magit-status, +help. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select workgroups2 package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: workgroups2               ;;
    +;;                                    ;;
    +;; GROUP: Convenience -> Workgroups   ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'workgroups2)
    +;; Change some settings
    +(workgroups-mode 1)
    +
    +
    + +

    +Remember to put the code at the bottom of init.el, after everything +is properly initialized. +

    + +

    +Usage: +

    + +

    +Most commands are bound to both <prefix> <key> and <prefix> C-<key>. +

    + +

    +By default prefix is: "C-c z" (To change it - see settings below) +

    + +
    +

    +<prefix> <key> +<prefix> c - create workgroup +<prefix> A - rename workgroup +<prefix> k - kill workgroup +<prefix> v - switch to workgroup +<prefix> C-s - save session +<prefix> C-f - load session +<prefix> 0..9 - switch to workgroup at index 0..9 +

    +
    + +

    +Do you remember how to use registers to store window configurations? +Registers are good, but it does not allow you to name window +configurations. It would be trouble when the number of window +configurations getting large. You will have to tediously remember +which register stores which configuration. +

    + +

    +With workgroups2, each window configuration is a workgroup, and you +can create as many workgroups and named it with <prefix> c; later, +you can switch back by <prefix> v. Because you can name your window +configurations, you don't have the burden to remember which to which +in registers. You can also save your window configurations to continue +using them in later Emacs sessions. +

    +
    +
    +
    + +
    +

    4.4 setup-editing.el

    +
    + +

    +Let's use setq to change Emacs the way we want. You should type in +the snippet below and use the completion key bindings until you get +used to it. Remember to include the line (provide 'setup-editing), +otherwise Emacs won't be able to load your module. +

    + +
    + +
    (provide 'setup-editing)
    +
    +;; GROUP: Editing -> Editing Basics
    +(setq global-mark-ring-max 5000         ; increase mark ring to contains 5000 entries
    +      mark-ring-max 5000                ; increase kill ring to contains 5000 entries
    +      mode-require-final-newline t      ; add a newline to end of file
    +      )
    +
    +;; default to 4 visible spaces to display a tab
    +(setq-default tab-width 4)
    +
    +(set-terminal-coding-system 'utf-8)
    +(set-keyboard-coding-system 'utf-8)
    +(set-language-environment "UTF-8")
    +(prefer-coding-system 'utf-8)
    +
    +(setq-default indent-tabs-mode nil)
    +(delete-selection-mode)
    +(global-set-key (kbd "RET") 'newline-and-indent)
    +
    +;; GROUP: Editing -> Killing
    +(setq
    + kill-ring-max 5000 ; increase kill-ring capacity
    + kill-whole-line t  ; if NIL, kill whole line and move the next line up
    + )
    +
    +;; show important whitespace in diff-mode
    +(add-hook 'diff-mode-hook (lambda ()
    +                            (setq-local whitespace-style
    +                                        '(face
    +                                          tabs
    +                                          tab-mark
    +                                          spaces
    +                                          space-mark
    +                                          trailing
    +                                          indentation::space
    +                                          indentation::tab
    +                                          newline
    +                                          newline-mark))
    +                            (whitespace-mode 1)))
    +
    +
    +
    + +
    +

    4.4.1 Customize built-in functions

    +
    +

    +Sometimes, we want to adjust or improve the behaviours of some +commands in certain contexts. Consider this situation: C-a, which +runs move-beginning-of-line, always move to the beginning of +line. However, sometimes we don't always to move to the beginning of +line, but move to the first non-whitespace character of that line. +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Customized functions                ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(defun prelude-move-beginning-of-line (arg)
    +  "Move point back to indentation of beginning of line.
    +
    +Move point to the first non-whitespace character on this line.
    +If point is already there, move to the beginning of the line.
    +Effectively toggle between the first non-whitespace character and
    +the beginning of the line.
    +
    +If ARG is not nil or 1, move forward ARG - 1 lines first. If
    +point reaches the beginning or end of the buffer, stop there."
    +  (interactive "^p")
    +  (setq arg (or arg 1))
    +
    +  ;; Move lines first
    +  (when (/= arg 1)
    +    (let ((line-move-visual nil))
    +      (forward-line (1- arg))))
    +
    +  (let ((orig-point (point)))
    +    (back-to-indentation)
    +    (when (= orig-point (point))
    +      (move-beginning-of-line 1))))
    +
    +(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line)
    +
    +(defadvice kill-ring-save (before slick-copy activate compile)
    +  "When called interactively with no active region, copy a single
    +line instead."
    +  (interactive
    +   (if mark-active (list (region-beginning) (region-end))
    +     (message "Copied line")
    +     (list (line-beginning-position)
    +           (line-beginning-position 2)))))
    +
    +(defadvice kill-region (before slick-cut activate compile)
    +  "When called interactively with no active region, kill a single
    +  line instead."
    +  (interactive
    +   (if mark-active (list (region-beginning) (region-end))
    +     (list (line-beginning-position)
    +           (line-beginning-position 2)))))
    +
    +;; kill a line, including whitespace characters until next non-whiepsace character
    +;; of next line
    +(defadvice kill-line (before check-position activate)
    +  (if (member major-mode
    +              '(emacs-lisp-mode scheme-mode lisp-mode
    +                                c-mode c++-mode objc-mode
    +                                latex-mode plain-tex-mode))
    +      (if (and (eolp) (not (bolp)))
    +          (progn (forward-char 1)
    +                 (just-one-space 0)
    +                 (backward-char 1)))))
    +
    +;; taken from prelude-editor.el
    +;; automatically indenting yanked text if in programming-modes
    +(defvar yank-indent-modes
    +  '(LaTeX-mode TeX-mode)
    +  "Modes in which to indent regions that are yanked (or yank-popped).
    +Only modes that don't derive from `prog-mode' should be listed here.")
    +
    +(defvar yank-indent-blacklisted-modes
    +  '(python-mode slim-mode haml-mode)
    +  "Modes for which auto-indenting is suppressed.")
    +
    +(defvar yank-advised-indent-threshold 1000
    +  "Threshold (# chars) over which indentation does not automatically occur.")
    +
    +(defun yank-advised-indent-function (beg end)
    +  "Do indentation, as long as the region isn't too large."
    +  (if (<= (- end beg) yank-advised-indent-threshold)
    +      (indent-region beg end nil)))
    +
    +(defadvice yank (after yank-indent activate)
    +  "If current mode is one of 'yank-indent-modes,
    +indent yanked text (with prefix arg don't indent)."
    +  (if (and (not (ad-get-arg 0))
    +           (not (member major-mode yank-indent-blacklisted-modes))
    +           (or (derived-mode-p 'prog-mode)
    +               (member major-mode yank-indent-modes)))
    +      (let ((transient-mark-mode nil))
    +        (yank-advised-indent-function (region-beginning) (region-end)))))
    +
    +(defadvice yank-pop (after yank-pop-indent activate)
    +  "If current mode is one of `yank-indent-modes',
    +indent yanked text (with prefix arg don't indent)."
    +  (when (and (not (ad-get-arg 0))
    +             (not (member major-mode yank-indent-blacklisted-modes))
    +             (or (derived-mode-p 'prog-mode)
    +                 (member major-mode yank-indent-modes)))
    +    (let ((transient-mark-mode nil))
    +      (yank-advised-indent-function (region-beginning) (region-end)))))
    +
    +;; prelude-core.el
    +(defun prelude-duplicate-current-line-or-region (arg)
    +  "Duplicates the current line or region ARG times.
    +If there's no region, the current line will be duplicated. However, if
    +there's a region, all lines that region covers will be duplicated."
    +  (interactive "p")
    +  (pcase-let* ((origin (point))
    +               (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
    +               (region (buffer-substring-no-properties beg end)))
    +    (-dotimes arg
    +      (lambda (n)
    +        (goto-char end)
    +        (newline)
    +        (insert region)
    +        (setq end (point))))
    +    (goto-char (+ origin (* (length region) arg) arg))))
    +
    +;; prelude-core.el
    +(defun indent-buffer ()
    +  "Indent the currently visited buffer."
    +  (interactive)
    +  (indent-region (point-min) (point-max)))
    +
    +;; prelude-editing.el
    +(defcustom prelude-indent-sensitive-modes
    +  '(coffee-mode python-mode slim-mode haml-mode yaml-mode)
    +  "Modes for which auto-indenting is suppressed."
    +  :type 'list)
    +
    +(defun indent-region-or-buffer ()
    +  "Indent a region if selected, otherwise the whole buffer."
    +  (interactive)
    +  (unless (member major-mode prelude-indent-sensitive-modes)
    +    (save-excursion
    +      (if (region-active-p)
    +          (progn
    +            (indent-region (region-beginning) (region-end))
    +            (message "Indented selected region."))
    +        (progn
    +          (indent-buffer)
    +          (message "Indented buffer.")))
    +      (whitespace-cleanup))))
    +
    +(global-set-key (kbd "C-c i") 'indent-region-or-buffer)
    +
    +;; add duplicate line function from Prelude
    +;; taken from prelude-core.el
    +(defun prelude-get-positions-of-line-or-region ()
    +  "Return positions (beg . end) of the current line
    +or region."
    +  (let (beg end)
    +    (if (and mark-active (> (point) (mark)))
    +        (exchange-point-and-mark))
    +    (setq beg (line-beginning-position))
    +    (if mark-active
    +        (exchange-point-and-mark))
    +    (setq end (line-end-position))
    +    (cons beg end)))
    +
    +(defun kill-default-buffer ()
    +  "Kill the currently active buffer -- set to C-x k so that users are not asked which buffer they want to kill."
    +  (interactive)
    +  (let (kill-buffer-query-functions) (kill-buffer)))
    +
    +(global-set-key (kbd "C-x k") 'kill-default-buffer)
    +
    +;; smart openline
    +(defun prelude-smart-open-line (arg)
    +  "Insert an empty line after the current line.
    +Position the cursor at its beginning, according to the current mode.
    +With a prefix ARG open line above the current line."
    +  (interactive "P")
    +  (if arg
    +      (prelude-smart-open-line-above)
    +    (progn
    +      (move-end-of-line nil)
    +      (newline-and-indent))))
    +
    +(defun prelude-smart-open-line-above ()
    +  "Insert an empty line above the current line.
    +Position the cursor at it's beginning, according to the current mode."
    +  (interactive)
    +  (move-beginning-of-line nil)
    +  (newline-and-indent)
    +  (forward-line -1)
    +  (indent-according-to-mode))
    +
    +(global-set-key (kbd "C-o") 'prelude-smart-open-line)
    +(global-set-key (kbd "M-o") 'open-line)
    +
    +
    + +

    +The code above is taken from this article: Smarter Navigation to the +Beginning of a Line. +

    + +
    + +
    (defadvice kill-ring-save (before slick-copy activate compile)
    +  "When called interactively with no active region, copy a single
    +line instead."
    +  (interactive
    +   (if mark-active (list (region-beginning) (region-end))
    +     (message "Copied line")
    +     (list (line-beginning-position)
    +           (line-beginning-position 2)))))
    +
    +(defadvice kill-region (before slick-cut activate compile)
    +  "When called interactively with no active region, kill a single
    +  line instead."
    +  (interactive
    +   (if mark-active (list (region-beginning) (region-end))
    +     (list (line-beginning-position)
    +           (line-beginning-position 2)))))
    +
    +;; kill a line, including whitespace characters until next non-whiepsace character
    +;; of next line
    +(defadvice kill-line (before check-position activate)
    +  (if (member major-mode
    +              '(emacs-lisp-mode scheme-mode lisp-mode
    +                                c-mode c++-mode objc-mode
    +                                latex-mode plain-tex-mode))
    +      (if (and (eolp) (not (bolp)))
    +          (progn (forward-char 1)
    +                 (just-one-space 0)
    +                 (backward-char 1)))))
    +
    +
    +
    +
    + +
    +

    4.4.2 Package: duplicate-thing

    +
    +

    +Author: ongaeshi, ongaeshi0621@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Easy duplicate line or region, with comment out. +

    + +
      +
    • Duplicate current line. +
    • +
    • Duplicate a selection when selection is active. +
    • +
    • Only C-u, replicate, comment out the range. +
    • +
    • Numerical prefix is specified as 'C-u 5': do multiple times repeatedly. +
    • +
    + +

    +Installation: +

    + +
    + +
    (require 'duplicate-thing)
    +(global-set-key (kbd "M-c") 'duplicate-thing)
    +
    +
    + +

    +Usage: +If point is on a line, the command duplicates the current line. If +region is active, duplicates region instead. +

    +
    +
    + +
    +

    4.4.3 Package: volatile-highlights

    +
    +

    +Author: Keitalo Miyazaki, Keitaro.Miyazaki@gmail.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +

    + +

    +VolatileHighlights highlights changes to the buffer caused by commands +such as ‘undo’, ‘yank’/’yank-pop’, etc. The highlight disappears at +the next command. The highlighting gives useful visual feedback for +what your operation actually changed in the buffer. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select volatile-highlights package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: volatile-highlights          ;;
    +;;                                       ;;
    +;; GROUP: Editing -> Volatile Highlights ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'volatile-highlights)
    +(volatile-highlights-mode t)
    +
    +
    + +

    +Usage: +

    + +

    +When you yank (paste) something, the yanked (pasted) region will be +highlighted. +

    +
    +
    +
    +

    4.4.4 Package: smartparens

    +
    +

    +Author: Matus Goljer, matus.goljer@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Smartparens is minor mode for Emacs that deals with parens pairs and +tries to be smart about it. It started as a unification effort to +combine functionality of several existing packages in a single, +compatible and extensible way to deal with parentheses, delimiters, +tags and the like. Some of these packages include autopair, textmate, +wrap-region, electric-pair-mode, paredit and others. With the basic +features found in other packages it also brings many improvements as +well as completely new features. Here's a highlight of some features, +for a complete list and detailed documentation look in the manual. +

    + +

    +For the complete documentation visit the documentation wiki. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select smartparens package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;; Package: smartparens
    +(require 'smartparens-config)
    +(setq sp-base-key-bindings 'paredit)
    +(setq sp-autoskip-closing-pair 'always)
    +(setq sp-hybrid-kill-entire-symbol nil)
    +(sp-use-paredit-bindings)
    +
    +
    + +

    +Usage: +

    + +

    +If smartparens sees a opening/closing of pair, either the default +supported ones or customized by users, it will complete the pair. You +can even highlight a block of text (region) and enter a pair +character, smartparens will wraps the region around the +pair. smartparens can also highlight pairs, even pairs with escape +characters. +

    +
    +
    + +
    +

    4.4.5 Package: clean-aindent-mode

    +
    +

    +Author: Peter Marinov +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +When you press RET to create a newline and got indented by +eletric-indent-mode, you have appropriate whitespace for +indenting. But, if you leave the line blank and move to the next line, +the whitespace becomes useless. This package helps clean up unused +whitespace. +

    + +

    +View this Emacswiki page for more details. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select clean-aindent-mode package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: clean-aindent-mode               ;;
    +;;                                           ;;
    +;; GROUP: Editing -> Indent -> Clean Aindent ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'clean-aindent-mode)
    +(add-hook 'prog-mode-hook 'clean-aindent-mode)
    +
    +
    + +

    +Usage: +

    + +

    +Automatically cleanup useless whitespaced on moving up/down. +

    +
    +
    + +
    +

    4.4.6 Package: undo-tree

    +
    +

    +Author: Toby Cubitt, toby-undo-tree@dr-qubit.org +

    + +

    +Homepage: www.dr-qubit.org +

    + +

    +Features: +

    + +

    +undo-tree allows you to visual the whole history of your editing in +a tree. It also provides regular undo/redo behaviours in other +editors. undo-tree can even provide a diff between two different +states. Highly recommended. +

    + + +
    +

    undo-tree.jpg +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select undo-tree package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: undo-tree                  ;;
    +;;                                     ;;
    +;; GROUP: Editing -> Undo -> Undo Tree ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'undo-tree)
    +(global-undo-tree-mode)
    +
    +
    + +

    +Usage: +

    + +

    +From now on, your undo (C-/) behaves just like normal editor. To +redo, C-_. To open the undo tree, C-x u. +

    +
    +
    + +
    +

    4.4.7 Package: yasnippet

    +
    +

    +Author: João Távora +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +YASnippet is a template system for Emacs. It allows you to type an +abbreviation and automatically expand it into function +templates. Bundled language templates include: C, C++, C#, Perl, +Python, Ruby, SQL, LaTeX, HTML, CSS and more. The snippet syntax is +inspired from TextMate's syntax, you can even import most TextMate +templates to YASnippet. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select yasnippet package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: yasnippet                 ;;
    +;;                                    ;;
    +;; GROUP: Editing -> Yasnippet        ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'yasnippet)
    +(yas-global-mode 1)
    +
    +
    + +

    +Usage: +

    + +

    +In major modes where yasnippet has snippets available, +typing a certain keyword and TAB insert a predefined snippet. For +example, in a C buffer, if you type for and TAB, it expands to: +

    + +
    + +
    for (i = 0; i < N; i++) {
    +    ...point will be here....
    +}
    +
    +
    + +

    +You can view supported snippets here. +

    +
    +
    +
    + +
    +

    4.5 setup-convenience.el

    +
    +

    +Remember to include the line (provide 'setup-convenience), otherwise +Emacs won't be able to load your module. Here is my sample +customization: +

    + +
    + +
    (provide 'setup-convenience)
    +
    +;; GROUP: Convenience -> Revert
    +
    +;; update any change made on file to the current buffer
    +(global-auto-revert-mode)
    +
    +;; GROUP: Convenience -> Hippe Expand
    +;; hippie-expand is a better version of dabbrev-expand.
    +;; While dabbrev-expand searches for words you already types, in current;; buffers and other buffers, hippie-expand includes more sources,
    +;; such as filenames, klll ring...
    +(global-set-key (kbd "M-/") 'hippie-expand) ;; replace dabbrev-expand
    +(setq
    + hippie-expand-try-functions-list
    + '(try-expand-dabbrev ;; Try to expand word "dynamically", searching the current buffer.
    +   try-expand-dabbrev-all-buffers ;; Try to expand word "dynamically", searching all other buffers.
    +   try-expand-dabbrev-from-kill ;; Try to expand word "dynamically", searching the kill ring.
    +   try-complete-file-name-partially ;; Try to complete text as a file name, as many characters as unique.
    +   try-complete-file-name ;; Try to complete text as a file name.
    +   try-expand-all-abbrevs ;; Try to expand word before point according to all abbrev tables.
    +   try-expand-list ;; Try to complete the current line to an entire line in the buffer.
    +   try-expand-line ;; Try to complete the current line to an entire line in the buffer.
    +   try-complete-lisp-symbol-partially ;; Try to complete as an Emacs Lisp symbol, as many characters as unique.
    +   try-complete-lisp-symbol) ;; Try to complete word as an Emacs Lisp symbol.
    + )
    +
    +;; GROUP: Convenience -> HL Line
    +(global-hl-line-mode)
    +
    +;; GROUP: Convenience -> Ibuffer
    +(setq ibuffer-use-other-window t) ;; always display ibuffer in another window
    +
    +;; GROUP: Convenience -> Linum
    +(add-hook 'prog-mode-hook 'linum-mode) ;; enable linum only in programming modes
    +
    +;; GROUP: Convenience -> Whitespace
    +
    +;; whenever you create useless whitespace, the whitespace is highlighted
    +(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
    +
    +;; activate whitespace-mode to view all whitespace characters
    +(global-set-key (kbd "C-c w") 'whitespace-mode)
    +
    +;; GROUP: Convenience -> Windmove
    +
    +;; easier window navigation
    +(windmove-default-keybindings)
    +
    +
    +
    + +
    +

    4.5.1 Package: company

    +
    +

    +Author: +

    + +
      +
    • Nikolaj Schumacher (original author) +
    • +
    • Dmitry Gutov (current maintainer), dgutov@yandex.ru +
    • +
    + +

    +Homepage: http://company-mode.github.io/ +

    + +

    +Features: +

    + +

    +Company is a text completion framework for Emacs. The name stands for +"complete anything". It uses pluggable back-ends and front-ends to +retrieve and display completion candidates. +

    + +

    +It comes with several back-ends such as Elisp, Clang, Semantic, Eclim, +Ropemacs, Ispell, CMake, BBDB, Yasnippet, dabbrev, etags, gtags, +files, keywords and a few others. +

    + +

    +The CAPF back-end provides a bridge to the standard +completion-at-point-functions facility, and thus works with any major +mode that defines a proper completion function. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select company package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: company              ;;
    +;;                               ;;
    +;; GROUP: Convenience -> Company ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(add-hook 'after-init-hook 'global-company-mode)
    +
    +
    + +

    +Usage: +

    + +

    +Completion will start automatically after you type a few letters. Use +M-n and M-p to select, <return> to complete or <tab> to complete the +common part. Search through the completions with C-s, C-r and +C-o. Press M-(digit) to quickly complete with one of the first 10 +candidates. +

    +
    +
    + +
    +

    4.5.2 Package: expand-region

    +
    +

    +Author: Magnar Sveen +

    + +

    +Homepage: Github +

    + +

    +Features: +expand-region allows you to select text objects incrementally. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select expand-region package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: expand-region                       ;;
    +;;                                              ;;
    +;; GROUP: Convenience -> Abbreviation -> Expand ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'expand-region)
    +(global-set-key (kbd "M-m") 'er/expand-region)
    +
    +
    + +

    +I bind er/expand-regin to M-m, because the functionality is +included from the amended beginning-of-line we did above. +

    + +

    +Usage: +

    + +

    +M-m to continue expand outward. +

    +
    +
    + +
    +

    4.5.3 Package: ibuffer-vc

    +
    +

    +Author: Steve Purcell +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +
      +
    • Group your buffers by their parent vc root directory +
    • +
    • See the VC status of the associated files +
    • +
    • Sort buffers by their VC status +
    • +
    + + +
    +

    ibuffer-vc.png +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select ibuffer-vc package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    (add-hook 'ibuffer-hook
    +          (lambda ()
    +            (ibuffer-vc-set-filter-groups-by-vc-root)
    +            (unless (eq ibuffer-sorting-mode 'alphabetic)
    +              (ibuffer-do-sort-by-alphabetic))))
    +
    +(setq ibuffer-formats
    +      '((mark modified read-only vc-status-mini " "
    +              (name 18 18 :left :elide)
    +              " "
    +              (size 9 -1 :right)
    +              " "
    +              (mode 16 16 :left :elide)
    +              " "
    +              (vc-status 16 16 :left)
    +              " "
    +              filename-and-process)))
    +
    +
    + +

    +Usage: +

    + +

    +When you use ibuffer, it will automatically group buffers by version +control system. +

    +
    +
    + +
    +

    4.5.4 Package: projectile

    +
    +

    +Author: Bozhidar Batsov, bozhidar@batsov.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Projectile is a project interaction library for Emacs. Its goal is to +provide a nice set of features operating on a project level without +introducing external dependencies(when feasible). For instance - +finding project files has a portable implementation written in pure +Emacs Lisp without the use of GNU find (but for performance sake an +indexing mechanism backed by external commands exists as well). +

    + +

    +Projectile tries to be practical - portability is great, but if some +external tools could speed up some task substantially and the tools +are available, Projectile will leverage them. +

    + +

    +This library provides easy project management and navigation. The +concept of a project is pretty basic - just a folder containing +special file. Currently git, mercurial, darcs and bazaar repos are +considered projects by default. So are lein, maven, sbt, rebar and +bundler projects. If you want to mark a folder manually as a project +just create an empty .projectile file in it. Some of Projectile's +features: +

    + +
      +
    • jump to a file in project +
    • +
    • jump to a directory in project +
    • +
    • jump to a file in a directory +
    • +
    • jump to a project buffer +
    • +
    • jump to a test in project +
    • +
    • toggle between code and its test +
    • +
    • jump to recently visited files in the project +
    • +
    • switch between projects you have worked on +
    • +
    • kill all project buffers +
    • +
    • replace in project +
    • +
    • multi-occur in project buffers +
    • +
    • grep in project +
    • +
    • regenerate project etags or gtags (requires gtags). +
    • +
    • visit project in dired +
    • +
    • run make in a project with a single key chord +
    • +
    + +

    +Here's a glimpse of Projectile in action: +

    + + +
    +

    projectile.png +

    +
    + +

    +Installation: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGES: projectile             ;;
    +;;                                  ;;
    +;; GROUP: Convenience -> Projectile ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(projectile-global-mode)
    +
    +
    +

    +Usage: +

    + +

    +Please refer to the usage on the homepage. +

    +
    +
    +
    + +
    +

    4.6 Package in a league of its own: helm

    +
    +

    +Helm is an awesome package. Please refer to the whole guide. You +should give Helm its own file: setup-helm.el. +

    +
    +
    + +
    +

    4.7 Alternative to Helm: ido + ido-ubiquitous + flx-ido + smex

    +
    +

    +If you want to use Ido, at replace Helm configuration with this sample +configuration that you can place in setup-environment.el: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Development -> Extensions -> Ido ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'ido)
    +
    +(setq ido-enable-prefix nil
    +      ido-enable-flex-matching t
    +      ido-create-new-buffer 'always
    +      ido-use-filename-at-point 'guess
    +      ido-max-prospects 10
    +      ido-default-file-method 'selected-window
    +      ido-auto-merge-work-directories-length -1)
    +
    +(ido-mode +1)
    +
    +
    +
    + +
    +

    4.7.1 Package: ido-ubiquitous

    +
    +

    +Author: Ryan C. Thompson, rct+github@thompsonclan.org +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Gimme some ido… everywhere! +

    + +

    +Does what you were really hoping for when you did (setq ido-everywhere +t). Replaces stock emacs completion with ido completion wherever it is +possible to do so without breaking things. +

    + +

    +Note that ido-ubiquitous is not enabled for org mode or magit mode, +because those modes have their own support for ido. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select ido-ubiquitous package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: ido-ubiquitous                                   ;;
    +;;                                                           ;;
    +;; GROUP: Development -> Extensions -> Ido -> Ido Ubiquitous ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(ido-ubiquitous-mode +1)
    +
    +
    + +

    +Usage: +

    + +

    +Once you activated Ido, it is available where you expect to select +and narrow down candidates. +

    +
    +
    + +
    +

    4.7.2 Package: flx-ido

    +
    +

    +Author: Le Wang +

    + +

    +Homepage: Github +

    + +

    +Features: +M-x list-packages and select flx-ido package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: flx-ido                                          ;;
    +;;                                                           ;;
    +;; GROUP: Development -> Extensions -> Ido                   ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;;; smarter fuzzy matching for ido
    +(flx-ido-mode +1)
    +;; disable ido faces to see flx highlights
    +(setq ido-use-faces nil)
    +
    +
    + +

    +Usage: +

    + +

    +flx-ido provides fuzzy completion to select completion +candidates. For example, if you want to select a file +src/foo/bar.txt, you only need to type in Ido prompt "sfb", short +for (s)rc/(f)oo/(b)ar. +

    +
    +
    + +
    +

    4.7.3 Package: smex

    +
    +

    +Author: Cornelius Mika, cornelius.mika@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Smex is a M-x enhancement for Emacs. Built on top of Ido, it provides +a convenient interface to your recently and most frequently used +commands. And to all the other commands, too. +

    + + +
    +

    smex.png +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select flx-ido package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: smex                                             ;;
    +;;                                                           ;;
    +;; GROUP: Convenience -> Extensions -> Smex                  ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'smex)
    +(smex-initialize)
    +(global-set-key (kbd "M-x") 'smex)
    +(global-set-key (kbd "M-X") 'smex-major-mode-commands)
    +
    +
    + +

    +Usage: +

    + +

    +smex is an improved M-x command. After you setup, M-x to run +smex and M-X to select only commands in the current major mode. +

    +
    +
    +
    +
    +

    4.8 setup-files.el

    +
    +

    +Remember to include the line (provide 'setup-files), otherwise Emacs +won't be able to load your module. My sample customization: +

    + +
    + +
    (provide 'setup-files)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; group: Files                      ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(setq large-file-warning-threshold 100000000) ;; size in bytes
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Files -> Back up            ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(defvar backup-directory "~/.backups")
    +(if (not (file-exists-p backup-directory))
    +    (make-directory backup-directory t))
    +(setq
    + make-backup-files t        ; backup a file the first time it is saved
    + backup-directory-alist `((".*" . ,backup-directory)) ; save backup files in ~/.backups
    + backup-by-copying t     ; copy the current file into backup directory
    + version-control t   ; version numbers for backup files
    + delete-old-versions t   ; delete unnecessary versions
    + kept-old-versions 6     ; oldest versions to keep when a new numbered backup is made (default: 2)
    + kept-new-versions 9 ; newest versions to keep when a new numbered backup is made (default: 2)
    + auto-save-default t ; auto-save every buffer that visits a file
    + auto-save-timeout 20 ; number of seconds idle time before auto-save (default: 30)
    + auto-save-interval 200 ; number of keystrokes between auto-saves (default: 300)
    + )
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Files -> Dired              ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(setq
    + dired-dwim-target t            ; if another Dired buffer is visible in another window, use that directory as target for Rename/Copy
    + dired-recursive-copies 'always         ; "always" means no asking
    + dired-recursive-deletes 'top           ; "top" means ask once for top level directory
    + dired-listing-switches "-lha"          ; human-readable listing
    + )
    +
    +;; automatically refresh dired buffer on changes
    +(add-hook 'dired-mode-hook 'auto-revert-mode)
    +
    +;; if it is not Windows, use the following listing switches
    +(when (not (eq system-type 'windows-nt))
    +  (setq dired-listing-switches "-lha --group-directories-first"))
    +
    +;;; KEY BINDINGS.
    +;; (define-key ctl-x-map "\C-j" 'dired-jump)
    +;; (define-key ctl-x-4-map "\C-j" 'dired-jump-other-window))
    +;; (define-key dired-mode-map "\C-x\M-o" 'dired-omit-mode)
    +;; (define-key dired-mode-map "*O" 'dired-mark-omitted)
    +;; (define-key dired-mode-map "\M-(" 'dired-mark-sexp)
    +;; (define-key dired-mode-map "*(" 'dired-mark-sexp)
    +;; (define-key dired-mode-map "*." 'dired-mark-extension)
    +;; (define-key dired-mode-map "\M-!" 'dired-smart-shell-command)
    +;; (define-key dired-mode-map "\M-G" 'dired-goto-subdir)
    +;; (define-key dired-mode-map "F" 'dired-do-find-marked-files)
    +;; (define-key dired-mode-map "Y"  'dired-do-relsymlink)
    +;; (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)
    +;; (define-key dired-mode-map "V" 'dired-do-run-mail)
    +(require 'dired-x) ; provide extra commands for Dired
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Files -> Dired -> Wdired    ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; wdired allows you to edit a Dired buffer and write changes to disk
    +;; - Switch to Wdired by C-x C-q
    +;; - Edit the Dired buffer, i.e. change filenames
    +;; - Commit by C-c C-c, abort by C-c C-k
    +(require 'wdired)
    +(setq
    + wdired-allow-to-change-permissions t   ; allow to edit permission bits
    + wdired-allow-to-redirect-links t       ; allow to edit symlinks
    + )
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Files -> Recentf            ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(recentf-mode)
    +(setq
    + recentf-max-menu-items 30
    + recentf-max-saved-items 5000
    + )
    +
    +
    +
    + +
    +

    4.8.1 Package: dired+

    +
    +

    +Author: Drew Adams, drew.adams@oracle.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +Dired+ (library dired+.el), which extends functionalities provided by +standard GNU Emacs libraries dired.el, dired-aux.el, and +dired-x.el. The standard functions are all available, plus many +more. +

    + + +
    +

    dired-plus.jpg +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select dired+ package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: dired+                     ;;
    +;;                                     ;;
    +;; GROUP: Files -> Dired -> Dired Plus ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'dired+)
    +
    +
    + +

    +Usage: +

    + +

    +Please refer to Emacswiki usage. Note that Dired+ has A LOT of +features, but you don't have to learn to use all of them at once. Even +the extra faces are useful enough. +

    +
    +
    + +
    +

    4.8.2 Package: recentf-ext

    +
    +

    +Features: +

    + +

    +Extension of `recentf' package. +

    + +
      +
    • `dired' buffers can be handled. +
    • +
    • Switching to file buffer considers it as most recent file. +
    • +
    + +

    +Installation: +

    + +

    +M-x list-packages and select recentf-ext package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: recentf-ext    ;;
    +;;                         ;;
    +;; GROUP: Files -> Recentf ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'recentf-ext)
    +
    +
    + +

    +Usage: +

    + +

    +When you visit a directory, that directory is saved by recentf as well. +

    +
    +
    + +
    +

    4.8.3 Package: ztree

    +
    +

    +Author: Alexey Veretennikov, alexey.veretennikov@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Ztree is a project dedicated to implementation of several text-tree +applications inside Emacs. It consists of 2 sub-projects: ztree-diff +and ztree-dir(the basis of ztree-diff). +

    + +
      +
    • ztree-diff: Perform diff on two directories. Really handy when you +want to create a big patch between two directories. +
    • +
    + + +
    +

    ztree-diff.png +

    +
    + +
      +
    • ztree-dir: a simple tree explorer. +
    • +
    + + +
    +

    ztree-dir.png +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select ztree package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: ztree  ;;
    +;;                 ;;
    +;; GROUP: No group ;;
    +;;;;;;;;;;;;;;;;;;;;;
    +;; since ztree works with files and directories, let's consider it in
    +;; group Files
    +(require 'ztree-diff)
    +(require 'ztree-dir)
    +
    +
    + +

    +Usage: +

    + +

    +M-x ztree-diff, then select the left and right directories to +compare. +

    + +

    +M-x ztree-dir to explorer filesystem: +

    + +
      +
    • Open/close directories with double-click, RET or Space keys. +
    • +
    • To jump to the parent directory, hit the Backspace key. +
    • +
    • To toggle open/closed state of the subtree of the current directory, +hit the x key. +
    • +
    +
    +
    + +
    +

    4.8.4 Package: vlf

    +
    +

    +Author: Andrey Kotlarski, m00naticus@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Emacs minor mode that allows viewing, editing, searching and comparing +large files in batches. Batch size can be adjusted on the fly and +bounds the memory that is to be used for operations on the file. This +way multiple large files (like terabytes or whatever) can be instantly +and simultaneously accessed without swapping and degraded +performance. +

    + +

    +This is development version of the GNU ELPA VLF package. Here’s what +it offers in a nutshell: +

    + +
      +
    • regular expression search on whole file (in constant memory +determined by current batch size) +
    • +
    • chunk editing (if size has changed, saving is done in constant +memory determined by current batch size) +
    • +
    • Occur like indexing +
    • +
    • options to jump to beginning, end or arbitrary file chunk +
    • +
    • ability to jump/insert given number of batches at once +
    • +
    • newly added content is acknowledged if file has changed size +meanwhile +
    • +
    • automatic scrolling of batches +
    • +
    • as a minor mode, font locking and functionality of the respective +major mode is also present +
    • +
    • by batch Ediff comparison +
    • +
    • can be added as option to automatically open large files +
    • +
    • smooth integration with hexl-mode +
    • +
    • works with TRAMP so accessing network files is fine +
    • +
    + +

    +GNU Emacs 23 and 24 are supported. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select ** package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: vlf        ;;
    +;;                     ;;
    +;; GROUP: Files -> Vlf ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'vlf-integrate)
    +(setq vlf-application 'dont-ask) ;; automatically use vlf on large file,
    +                                 ;; when the file exceed large-file-warning-threshold
    +
    +
    + +

    +Usage: +

    + +

    +Please refer to Detail Usage section. +

    +
    +
    +
    + +
    +

    4.9 setup-text.el

    +
    +

    +I only use default configuration for "Text" group. You can customize +it if you want or leave this file blank, so you can add customizations +when needed. This group is useful if you edit text frequently and need +bibliography, or you want to write Latex. +

    + +
    + +
    (provide 'setup-text)
    +
    +
    +
    +
    + +
    +

    4.10 setup-data.el

    +
    +

    +Remember to include the line (provide 'setup-data), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-data)
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Data -> Saveplace ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +
    +;; saveplace remembers your location in a file when saving files
    +(require 'saveplace)
    +(setq-default save-place t)
    +;; use (toggle-save-place-globally 1) in Emacs above 24.4
    +
    +
    +
    +
    + +
    +

    4.11 setup-external.el

    +
    +

    +Remember to include the line (provide 'setup-external), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-external)
    +
    +;; GROUP: Processes -> Flyspell
    +(if (executable-find "aspell")
    +    (progn
    +      (setq ispell-program-name "aspell")
    +      (setq ispell-extra-args '("--sug-mode=ultra")))
    +  (setq ispell-program-name "ispell"))
    +
    +(add-hook 'text-mode-hook 'flyspell-mode)
    +(add-hook 'org-mode-hook 'flyspell-mode)
    +(add-hook 'prog-mode-hook 'flyspell-prog-mode)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Processes -> Gud            ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(setq gud-chdir-before-run nil)
    +
    +;; term-mode, used in M-x term
    +(defun my-term-setup ()
    +  (interactive)
    +  (define-key term-raw-map (kbd "C-y") 'term-send-raw)
    +  (define-key term-raw-map (kbd "C-p") 'term-send-raw)
    +  (define-key term-raw-map (kbd "C-n") 'term-send-raw)
    +  (define-key term-raw-map (kbd "C-s") 'term-send-raw)
    +  (define-key term-raw-map (kbd "C-r") 'term-send-raw)
    +  (define-key term-raw-map (kbd "M-w") 'kill-ring-save)
    +  (define-key term-raw-map (kbd "M-y") 'helm-show-kill-ring)
    +  (define-key term-raw-map (kbd "M-d") (lambda () (interactive) (term-send-raw-string "\ed")))
    +  (define-key term-raw-map (kbd "<C-backspace>") (lambda () (interactive) (term-send-raw-string "\e\C-?")))
    +  (define-key term-raw-map (kbd "M-p") (lambda () (interactive) (term-send-raw-string "\ep")))
    +  (define-key term-raw-map (kbd "M-n") (lambda () (interactive) (term-send-raw-string "\en")))
    +  (define-key term-raw-map (kbd "M-,") 'term-send-input)
    +  (define-key term-raw-map (kbd "C-c y") 'term-paste)
    +  (define-key term-raw-map (kbd "C-S-y") 'term-paste)
    +  (define-key term-raw-map (kbd "C-h") nil) ; unbind C-h
    +  (define-key term-raw-map (kbd "M-x") nil) ; unbind M-x
    +  (define-key term-raw-map (kbd "C-c C-b") 'helm-mini)
    +  (define-key term-raw-map (kbd "C-1") 'zygospore-toggle-delete-other-windows)
    +  (define-key term-raw-map (kbd "C-2") 'split-window-below)
    +  (define-key term-raw-map (kbd "C-3") 'split-window-right)
    +  (define-key term-mode-map (kbd "C-0") 'delete-window))
    +(add-hook 'term-mode-hook 'my-term-setup t)
    +(setq term-buffer-maximum-size 0)
    +
    +(require 'term)
    +
    +;; taken from here: http://www.enigmacurry.com/2008/12/26/emacs-ansi-term-tricks/
    +(defun visit-ansi-term ()
    +  "If the current buffer is:
    +     1) a running ansi-term named *ansi-term*, rename it.
    +     2) a stopped ansi-term, kill it and create a new one.
    +     3) a non ansi-term, go to an already running ansi-term
    +        or start a new one while killing a defunt one"
    +  (interactive)
    +  (let ((is-term (string= "term-mode" major-mode))
    +        (is-running (term-check-proc (buffer-name)))
    +        (term-cmd "/bin/zsh")
    +        (anon-term (get-buffer "*ansi-term*")))
    +    (if is-term
    +        (if is-running
    +            (if (string= "*ansi-term*" (buffer-name))
    +                ;; (call-interactively 'rename-buffer)
    +                (ansi-term term-cmd)
    +              (if anon-term
    +                  (switch-to-buffer "*ansi-term*")
    +                (ansi-term term-cmd)))
    +          (kill-buffer (buffer-name))
    +          (ansi-term term-cmd))
    +      (if anon-term
    +          (if (term-check-proc "*ansi-term*")
    +              (switch-to-buffer "*ansi-term*")
    +            (kill-buffer "*ansi-term*")
    +            (ansi-term term-cmd))
    +        (ansi-term term-cmd)))))
    +
    +(global-set-key (kbd "<f2>") 'visit-ansi-term)
    +
    +;; PACKAGE: shell-pop
    +;; GROUP: Processes -> Shell -> Shell Pop
    +(require 'shell-pop)
    +(global-set-key (kbd "C-c t") 'shell-pop)
    +
    +
    +
    +
    +
    +

    4.12 setup-communication.el

    +
    +

    +This group allows to customize communications, networking, and remote +access to files. For example, ftp, ldap, dig, whois, netstat… I only +enable goto-address-mode to enable URL highlighting and able to +click on it in an buffer. Very useful. Sample configuration: +

    + +
    + +
    (provide 'setup-communication)
    +
    +;; go-to-address-mode
    +(add-hook 'prog-mode-hook 'goto-address-mode)
    +(add-hook 'text-mode-hook 'goto-address-mode)
    +
    +
    +
    +
    + +
    +

    4.13 setup-programming.el

    +
    +

    +Remember to include the line (provide 'setup-programming), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-programming)
    +;; GROUP: Programming -> Languages -> C
    +
    +;; Available C style:
    +;; “gnu”: The default style for GNU projects
    +;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book
    +;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
    +;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
    +;; “stroustrup”: What Stroustrup, the author of C++ used in his book
    +;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
    +;; “linux”: What the Linux developers use for kernel development
    +;; “python”: What Python developers use for extension modules
    +;; “java”: The default style for java-mode (see below)
    +;; “user”: When you want to define your own style
    +(setq c-default-style "linux" ; set style to "linux"
    +      c-basic-offset 4)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Programming -> Tools -> Gdb ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(setq gdb-many-windows t        ; use gdb-many-windows by default
    +      gdb-show-main t)          ; Non-nil means display source file containing the main routine at startup
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Programming -> Tools -> Compilation ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Compilation from Emacs
    +(defun prelude-colorize-compilation-buffer ()
    +  "Colorize a compilation mode buffer."
    +  (interactive)
    +  ;; we don't want to mess with child modes such as grep-mode, ack, ag, etc
    +  (when (eq major-mode 'compilation-mode)
    +    (let ((inhibit-read-only t))
    +      (ansi-color-apply-on-region (point-min) (point-max)))))
    +
    +;; setup compilation-mode used by `compile' command
    +(require 'compile)
    +(setq compilation-ask-about-save nil          ; Just save before compiling
    +      compilation-always-kill t               ; Just kill old compile processes before starting the new one
    +      compilation-scroll-output 'first-error) ; Automatically scroll to first
    +(global-set-key (kbd "<f5>") 'compile)
    +
    +;; GROUP: Programming -> Tools -> Makefile
    +;; takenn from prelude-c.el:48: https://github.com/bbatsov/prelude/blob/master/modules/prelude-c.el
    +(defun prelude-makefile-mode-defaults ()
    +  (whitespace-toggle-options '(tabs))
    +  (setq indent-tabs-mode t))
    +
    +(setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
    +
    +(add-hook 'makefile-mode-hook (lambda ()
    +                                (run-hooks 'prelude-makefile-mode-hook)))
    +
    +;; GROUP: Programming -> Tools -> Ediff
    +(setq ediff-diff-options "-w"
    +      ediff-split-window-function 'split-window-horizontally
    +      ediff-window-setup-function 'ediff-setup-windows-plain)
    +
    +
    +
    + +
    +

    4.13.1 Package: diff-hl

    +
    +

    +Author: Dmitry Gutov, dgutov@yandex.ru +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +diff-hl-mode highlights uncommitted changes on the left side of the +window, allows you to jump between and revert them selectively. +

    + + +
    +

    diff-hl-buffer.png +

    +
    + +

    +For the usage instructions and the list of commands, see the +Commentary section inside the file. +

    + +

    +Tested with Git, Mercurial, Bazaar and SVN. May work with other VC +backends, too. +

    + +

    +The package also contains auxiliary modes: +

    + +
      +
    • diff-hl-dired-mode provides similar functionality in Dired. + + +
      +

      diff-hl-dired.png +

      +
      +
    • + +
    • diff-hl-margin-mode changes the highlighting function to use the +margin instead of the fringe. + + +
      +

      diff-hl-margin.png +

      +
      +
    • + +
    • diff-hl-amend-mode shifts the reference revision back by one. +
    • +
    + +

    +Installation: +

    + +

    +M-x list-packages and select diff-hl package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: diff-hl                             ;;
    +;;                                              ;;
    +;; GROUP: Programming -> Tools -> Vc -> Diff Hl ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(global-diff-hl-mode)
    +(add-hook 'dired-mode-hook 'diff-hl-dired-mode)
    +
    +
    + +

    +Usage: +

    + +

    +To see diff-hl in action, open a buffer under a version control and +type something and save. You will see highlighted changes in the +fringe on the left. +

    + +

    +It is also similar with diff-hl-dired-mode. +

    +
    +
    + +
    +

    4.13.2 Package: magit

    +
    +

    +Author: +

    + +

    +Original Author: Marius Vollmer marius.vollmer@gmail.com +

    + +

    +Maintainer: Jonas Bernoulli, jonas@bernoul.li +

    + +

    +Former-Maintainers: +

    +
      +
    • Nicolas Dudebout, nicolas.dudebout@gatech.edu +
    • +
    • Peter J. Weisberg, pj@irregularexpressions.net +
    • +
    • Phil Jackson, phil@shellarchive.co.uk +
    • +
    • Rémi Vanicat, vanicat@debian.org +
    • +
    • Yann Hodique, yann.hodique@gmail.com +
    • +
    + +

    +Homepage: http://magit.github.io +

    + +

    +Features: +Magit is an interface to the version control system Git, implemented +as an Emacs extension. +

    + +

    +Unlike Emacs' native Version Control package which strives to provide +a unified interface to various version control systems, Magit only +supports Git and can therefore better take advantage of its native +features. +

    + +

    +Magit supports GNU Emacs 23.2 or later; 24.1 or later is +recommended. Magit supports Git 1.7.2.5 or later; 1.8.2 or later is +recommended. The minimal versions are those available in Debian +oldstable. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select magit package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: magit                       ;;
    +;;                                      ;;
    +;; GROUP: Programming -> Tools -> Magit ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'magit)
    +(set-default 'magit-stage-all-confirm nil)
    +(add-hook 'magit-mode-hook 'magit-load-config-extensions)
    +
    +;; full screen magit-status
    +(defadvice magit-status (around magit-fullscreen activate)
    +  (window-configuration-to-register :magit-fullscreen)
    +  ad-do-it
    +  (delete-other-windows))
    +
    +(global-unset-key (kbd "C-x g"))
    +(global-set-key (kbd "C-x g h") 'magit-log)
    +(global-set-key (kbd "C-x g f") 'magit-file-log)
    +(global-set-key (kbd "C-x g b") 'magit-blame-mode)
    +(global-set-key (kbd "C-x g m") 'magit-branch-manager)
    +(global-set-key (kbd "C-x g c") 'magit-branch)
    +(global-set-key (kbd "C-x g s") 'magit-status)
    +(global-set-key (kbd "C-x g r") 'magit-reflog)
    +(global-set-key (kbd "C-x g t") 'magit-tag)
    +
    +
    + +

    +Usage: +

    + +

    +Getting started with Magit is really easy: +

    + +
      +
    • M-x magit-status to see git status, and in the status buffer: +
    • +
    • s to stage files +
    • +
    • c c to commit, type in your commit message then C-c C-c to save +the message and commit, C-c C-k to abort current commit message +and go back magit-status. +
    • +
    • b b to switch to a branch. +
    • +
    + +

    +Other handy keys: +

    + +
      +
    • P P to do a git push +
    • +
    • F F to do a git pull +
    • +
    • try to press TAB on entries. +
    • +
    + +

    +If you want to view the raw git commands, i.e. you want to know how +git push is doing, press $. +

    + +

    +For more usage, please refer to the official manual. +

    +
    +
    + +
    +

    4.13.3 Package: flycheck

    +
    +

    +Author: Sebastian Wiesner, swiesner@lunaryorn.com +

    + +

    +Homepage: http://flycheck.readthedocs.org/ +

    + +

    +Features: +

    + +
      +
    • Supports over 30 programming and markup languages with more than 60 different syntax checking tools +
    • +
    • Fully automatic, fail-safe, on-the-fly syntax checking in background +
    • +
    • Nice error indication and highlighting +
    • +
    • Optional error list popup +
    • +
    • Many customization options +
    • +
    • A comprehensive manual +
    • +
    • A simple interface to define new syntax checkers +
    • +
    • A “doesn't get in your way” guarantee +
    • +
    • Many 3rd party extensions +
    • +
    + +

    +Installation; +

    + +

    +M-x list-packages and select flycheck package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: flycheck                       ;;
    +;;                                         ;;
    +;; GROUP: Programming -> Tools -> Flycheck ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'flycheck)
    +(add-hook 'after-init-hook #'global-flycheck-mode)
    +
    +
    + +

    +Usage: +

    + +

    +After you installed and activated flycheck, your supported buffers +are automatically checked against errors as you typed and the errors +are displayed in echo area. +

    +
    +
    + +
    +

    4.13.4 Package: flycheck-tip

    +
    +

    +Author: Yuta Yamada, cokesboy@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Show flycheck error by popupo. +

    + +

    +Installation: +M-x list-packages and select flycheck-tip package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: flycheck-tip                                      ;;
    +;;                                                            ;;
    +;; GROUP: Flycheck Tip, but just consider it part of Flycheck ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'flycheck-tip)
    +(flycheck-tip-use-timer 'verbose)
    +
    +
    + +

    +Usage: +

    + +

    +The errors are now displayed by popup, instead of printing into the +echo area. Echo area should be preserved for other things like +eldoc-mode. +

    +
    +
    +
    + +
    +

    4.14 setup-applications.el

    +
    +

    +Remember to include the line (provide 'setup-applications), otherwise +Emacs won't be able to load your module.Sample configuration: +

    + +
    + +
    (provide 'setup-applications)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Applications-> Eshell       ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'eshell)
    +(require 'em-alias)
    +(require 'cl)
    +
    +;; Advise find-file-other-window to accept more than one file
    +(defadvice find-file-other-window (around find-files activate)
    +  "Also find all files within a list of files. This even works recursively."
    +  (if (listp filename)
    +      (loop for f in filename do (find-file-other-window f wildcards))
    +    ad-do-it))
    +
    +;; In Eshell, you can run the commands in M-x
    +;; Here are the aliases to the commands.
    +;; $* means accepts all arguments.
    +(eshell/alias "o" "")
    +(eshell/alias "o" "find-file-other-window $*")
    +(eshell/alias "vi" "find-file-other-window $*")
    +(eshell/alias "vim" "find-file-other-window $*")
    +(eshell/alias "emacs" "find-file-other-windpow $*")
    +(eshell/alias "em" "find-file-other-window $*")
    +
    +(add-hook
    + 'eshell-mode-hook
    + (lambda ()
    +   (setq pcomplete-cycle-completions nil)))
    +
    +;; change listing switches based on OS
    +(when (not (eq system-type 'windows-nt))
    +  (eshell/alias "ls" "ls --color -h --group-directories-first $*"))
    +
    +
    +
    +
    + +
    +

    4.15 setup-development.el

    +
    +

    +Remember to include the line (provide 'setup-development), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-development)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Development -> Extensions -> Eldoc  ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
    +(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
    +(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Development -> Internal     ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Start garbage collection every 100MB to improve Emacs performance
    +(setq gc-cons-threshold 100000000)
    +
    +
    +
    +
    + +
    +

    4.16 setup-environment.el

    +
    +

    +Remember to include the line (provide 'setup-environment), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-environment)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Environment -> Initialization ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(setq
    + inhibit-startup-screen t
    + )
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Environment -> Minibuffer   ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; (icomplete-mode)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Environment -> Minibuffer -> Savehist ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; savehist saves minibuffer history by defaults
    +(setq savehist-additional-variables '(search ring regexp-search-ring) ; also save your regexp search queries
    +      savehist-autosave-interval 60     ; save every minute
    +      )
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Environment -> Windows -> Winner ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(winner-mode 1)
    +
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Environment -> Mode Line    ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(column-number-mode 1)
    +
    +
    +
    + +
    +

    4.16.1 Package: nyan-mode

    +
    + +

    +Author: Jacek "TeMPOraL" Zlydach, temporal.pl@gmail.com +

    + +

    +Homepage: http://nyan-mode.buildsomethingamazing.com/ +

    + +

    +Features: +

    + +

    +Nyan Mode is an analog indicator of your position in the buffer. The +Cat should go from left to right in your mode-line, as you move your +point from 0% to 100%. +

    + + +
    +

    nyan-mode.png +

    +
    + + +
      +
    • Mind dumbing content included, +
    • +
    • Experimental animation (M-x nyan-start-animation, M-x +nyan-stop-animation), +
    • +
    • Wavy rainbow (M-x set-variable <ret> nyan-wavy-trail <ret> t), +
    • +
    • Customizable properties. +
    • +
    + +

    +NOT INCLUDED: music. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select nyan-mode package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: nyan-mode                    ;;
    +;;                                       ;;
    +;; GROUOP: Environment -> Frames -> Nyan ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; only turn on if a window system is available
    +;; this prevents error under terminal that does not support X
    +(case window-system
    +  ((x w32) (nyan-mode)))
    +
    +
    + +

    +Usage: +

    + +

    +As you scroll through a buffer, the cat moves to indicate the position +in buffer. +

    +
    +
    + +
    +

    4.16.2 Package: golden-ratio

    +
    +

    +Author: Roman Gonzalez, romanandreg@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Automatic resizing of Emacs windows to the golden ratio +

    + +

    +When working with many windows at the same time, each window has a size that is not convenient for editing. +

    + +

    +golden-ratio helps on this issue by resizing automatically the windows +you are working on to the size specified in the "Golden Ratio". The +window that has the main focus will have the perfect size for editing, +while the ones that are not being actively edited will be re-sized to +a smaller size that doesn't get in the way, but at the same time will +be readable enough to know it's content. +

    + + +
    +

    golden-ratio.gif +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select golden-ratio package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: golden-ratio                         ;;
    +;;                                               ;;
    +;; GROUP: Environment -> Windows -> Golden Ratio ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'golden-ratio)
    +
    +(add-to-list 'golden-ratio-exclude-modes "ediff-mode")
    +(add-to-list 'golden-ratio-exclude-modes "helm-mode")
    +(add-to-list 'golden-ratio-exclude-modes "dired-mode")
    +(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)
    +
    +(defun pl/helm-alive-p ()
    +  (if (boundp 'helm-alive-p)
    +      (symbol-value 'helm-alive-p)))
    +
    +;; do not enable golden-raio in thses modes
    +(setq golden-ratio-exclude-modes '("ediff-mode"
    +                                   "gud-mode"
    +                                   "gdb-locals-mode"
    +                                   "gdb-registers-mode"
    +                                   "gdb-breakpoints-mode"
    +                                   "gdb-threads-mode"
    +                                   "gdb-frames-mode"
    +                                   "gdb-inferior-io-mode"
    +                                   "gud-mode"
    +                                   "gdb-inferior-io-mode"
    +                                   "gdb-disassembly-mode"
    +                                   "gdb-memory-mode"
    +                                   "magit-log-mode"
    +                                   "magit-reflog-mode"
    +                                   "magit-status-mode"
    +                                   "IELM"
    +                                   "eshell-mode" "dired-mode"))
    +
    +(golden-ratio-mode)
    +
    +
    + +

    +Usage: +

    + +

    +C-x o and see your windows being resized. +

    +
    +
    +
    + +
    +

    4.17 setup-faces-and-ui.el

    +
    +

    +Remember to include the line (provide 'setup-faces-and-ui), otherwise +Emacs won't be able to load your module. Sample configuration: +

    + +
    + +
    (provide 'setup-faces-and-ui)
    +
    +;; you won't need any of the bar thingies
    +;; turn it off to save screen estate
    +(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
    +(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
    +(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
    +
    +;; the blinking cursor is nothing, but an annoyance
    +(blink-cursor-mode -1)
    +
    +(setq scroll-margin 0
    +      scroll-conservatively 100000
    +      scroll-preserve-screen-position 1)
    +
    +(size-indication-mode t)
    +
    +;; more useful frame title, that show either a file or a
    +;; buffer name (if the buffer isn't visiting a file)
    +;; taken from prelude-ui.el
    +(setq frame-title-format
    +      '("" invocation-name " - " (:eval (if (buffer-file-name)
    +                                                    (abbreviate-file-name (buffer-file-name))
    +                                                  "%b"))))
    +
    +;; change font to Inconsolata for better looking text
    +;; remember to install the font Inconsolata first
    +(setq default-frame-alist '((font . "Inconsolata-11")))
    +;; set italic font for italic face, since Emacs does not set italic
    +;; face automatically
    +(set-face-attribute 'italic nil
    +                    :family "Inconsolata-Italic")
    +
    +
    +
    + +
    +

    4.17.1 Package: highlight-numbers

    +
    +

    +Author: Fanael Linithien, fanael4@gmail.com +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +highlight-numbers is an Emacs minor mode that highlights numeric +literals in source code. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select highlight-numbers package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: highlight-numbers         ;;
    +;;                                    ;;
    +;; GROUP: Faces -> Number Font Lock   ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(add-hook 'prog-mode-hook 'highlight-numbers-mode)
    +
    +
    + +

    +Usage: +

    + +

    +Numbers automatically have distinct colors in buffer. +

    +
    +
    + +
    +

    4.17.2 Package: highlight-symbol

    +
    +

    +Author: Nikolaj Schumacher, me@nschum.de +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Automatic and manual symbol highlighting for Emacs. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select highlight-symbol package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    (require 'highlight-symbol)
    +
    +(highlight-symbol-nav-mode)
    +
    +(add-hook 'prog-mode-hook (lambda () (highlight-symbol-mode)))
    +(add-hook 'org-mode-hook (lambda () (highlight-symbol-mode)))
    +
    +(setq highlight-symbol-idle-delay 0.2
    +      highlight-symbol-on-navigation-p t)
    +
    +(global-set-key [(control shift mouse-1)]
    +                (lambda (event)
    +                  (interactive "e")
    +                  (goto-char (posn-point (event-start event)))
    +                  (highlight-symbol-at-point)))
    +
    +(global-set-key (kbd "M-n") 'highlight-symbol-next)
    +(global-set-key (kbd "M-p") 'highlight-symbol-prev)
    +
    +
    + +

    +Usage: +

    + +

    +If you move point on a symbol, it automatically highlights all the +symbols in the current screen. From now on, pressing M-n and M-p +will immediately jump to the next/previous symbols in a buffer. +

    +
    +
    +
    +

    4.17.3 Change Emacs appearance by using color theme

    +
    +

    +Emacs has many color themes available for you to use. My personal one +is color-theme-sanityinc-tomorrow or grandshell-theme or +monokai-theme. Some popular themes are emacs-color-theme-solarized and +zenburn. You can select themes of your choice from MELPA. +

    +
    +
    +
    + +
    +

    4.18 setup-help.el

    +
    +

    +Remember to include the line (provide 'setup-help), otherwise Emacs +won't be able to load your module. +

    + +
    + +
    (provide 'setup-help)
    +
    +
    +
    + +
    +

    4.18.1 Package: info+

    +
    +

    +Author: Drew Adams, drew.adams@oracle.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +Info+ helps you read Info documents more enjoyable with extra +highlighting it provides. +

    + +

    +Installation: +

    + +

    +M-x list-packages and select info+ package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; GROUP: Help -> Info+               ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'info+)
    +
    +
    +
    +
    + +
    +

    4.18.2 Package: discover-my-major

    +
    +

    +Author: steckerhalter +

    + +

    +Homepage: Github +

    + +

    +Features: +

    + +

    +Discover key bindings and their meaning for the current Emacs major mode. +

    + + +
    +

    discover-my-major.png +

    +
    + +

    +Installation: +

    + +

    +M-x list-packages and select discover-my-major package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;; A quick major mode help with discover-my-major
    +(global-unset-key (kbd "C-h h"))        ; original "C-h h" displays "hello world" in different languages
    +(define-key 'help-command (kbd "h m") 'discover-my-major)
    +
    +
    + +

    +Usage: +

    + +

    +The above setup binds C-h h m to discover-my-major. In a buffer, +C-h h m and you will see key bindings of that major mode and its +description, as opposed to usual C-h m which gives mappings between +keys and commands. +

    +
    +
    + +
    +

    4.18.3 Package: rainbow-mode

    +
    +

    +Author: Julien Danjou, julien@danjou.info +

    + +

    +Homepage: GNU ELPA +

    + +

    +Features: +

    + +

    +This minor mode sets background color to strings that match color +names, e.g. #0000ff is displayed in white with a blue background. +

    + + +
    +

    rainbow-mode.png +

    +
    + +

    +Installation: +M-x list-packages and select rainbow-mode package, then install +it. After finish installing, add this code snippet to activate the +package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: rainbow-mode              ;;
    +;;                                    ;;
    +;; GROUP: Help -> Rainbow             ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(add-hook 'html-mode-hook 'rainbow-mode)
    +(add-hook 'css-mode-hook 'rainbow-mode)
    +
    +
    + +

    +It is useful to always activate rainbow-mode in those two major +modes. For other modes, it is situational, so I don't use +prog-mode-hook. +

    + +

    +Usage: +

    + +

    +As you type a hex number or a color string in a buffer with +rainbow-mode activated, the hex number or color string is +colourized. +

    +
    +
    +
    +

    4.18.4 Package: help+

    +
    +

    +Author: Drew Adams, drew.adams@oracle.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +

    + +

    +Extensions to `help.el' for Emacs +

    + +

    +Installation: +

    + +

    +M-x list-packages and select help+ package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: help+                     ;;
    +;;                                    ;;
    +;; GROUP: Help                        ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'help+)
    +
    +
    + +

    +Usage: +

    + +

    +The following bindings are made: +

    + +

    +`C-h u' `manual-entry' +`C-h C-a' `apropos' +`C-h C-l' `locate-library' +`C-h RET' `help-on-click/key' +`C-h M-a' `apropos-documentation' +`C-h M-o' `pop-to-help-toggle' +`C-h C-M-a' `tags-apropos' +[mouse-1] `mouse-help-on-click' (non-mode-line) +[mouse-1] `mouse-help-on-mode-line-click' (mode-line) +

    +
    +
    + +
    +

    4.18.5 Package: help-fns+

    +
    +

    +Author: Drew Adams, drew.adams@oracle.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +

    + +

    +Extensions to `help-fns.el' +

    + +

    +Installation: +

    + +

    +M-x list-packages and select help-fns+ package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: help-fns+                 ;;
    +;;                                    ;;
    +;; GROUP: Help                        ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'help-fns+)
    +
    +
    + +

    +Usage: +

    + +

    +Keys bound here: +

    + + + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeysBindings
    C-h Bdescribe-buffer
    C-h cdescribe-command (replaces describe-key-briefly)
    C-h odescribe-option
    C-h C-cdescribe-key-briefly (replaces C-h c)
    C-h C-odescribe-option-of-type
    C-h M-cdescribe-copying (replaces C-h C-c)
    C-h M-fdescribe-file
    C-h M-kdescribe-keymap
    C-h M-lfind-function-on-key
    +
    +
    + +
    +

    4.18.6 Package: help-mode+

    +
    +

    +Author: Drew Adams, drew.adams@oracle.com +

    + +

    +Homepage: Emacswiki +

    + +

    +Features: +

    + +

    +Extensions to `help-mode.el' +

    + +

    +Links to libraries are provided whenever library names appear in +buffer ‘*Help*’. After loading help-mode+.el, library names in buffer +Help have mouse-over links to the corresponding library code. +

    + +

    +For example, ‘C-h v features’ describes the variable ‘features’; this +description lists all of the libraries currently loaded in Emacs. +

    + +
      +
    • In vanilla Emacs (without help-mode+.el loaded), the library names +are not linked, unless a library (such as ‘grep’) happens to have +the same name as an Emacs function or variable, in which case +clicking the name displays the function or variable description in +buffer Help. +
    • + +
    • With help-mode+.el loaded, each library name in the ‘C-h v features’ +list is linked to the library (code) itself. Click a name to +edit/view the library file. +
    • +
    + +

    +Installation: +

    + +

    +M-x list-packages and select help-mode+ package, then +install it. After finish installing, add this code snippet to activate +the package: +

    + +
    + +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; Package: help-mode+                ;;
    +;;                                    ;;
    +;; GROUP: Help                        ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'help-mode+)
    +
    +
    + +

    +Usage: +

    + +

    +If a *Help* buffer contains other library names, the names +automatically becomes links to jump to. +

    +
    +
    +
    + +
    +

    4.19 setup-local.el

    +
    +

    +If you define your own Customization Group locally to your +computer, your Customization Group should be added under Local +parent and customize it here. The only sub-group in Local group is +holiday, and I do not use it, so I leave this file blank. +

    +
    +
    +
    + +
    +

    5 More Emacs Lisp resources

    +
    +

    +If you want to learn more about Emacs Lisp programming, GNU Emacs Lisp +Manual is great to start real Lisp programming. +

    +
    +
    +
    +
    +

    Created: 2016-12-06 Tue 01:42

    +

    Emacs 24.5.1 (Org mode 8.2.10)

    +

    Validate

    +
    + + diff --git a/helm-intro.html b/docs/helm-intro.html similarity index 60% rename from helm-intro.html rename to docs/helm-intro.html index bcebbb9..9bd3fed 100644 --- a/helm-intro.html +++ b/docs/helm-intro.html @@ -3,30 +3,22 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - A Package in a league of its own: <code>Helm</code> + + - - + -
    - - - - -

    Back to Table of Contents

    -

    A Package in a league of its own: Helm

    Table of Contents

    @@ -209,12 +185,15 @@

    Table of Contents

    • Tamas Patrovic (original author), from 2007. At this time, Helm was -named Anything.
    • +named Anything. +
    • rubikitch rubikitch@ruby-lang.org, from 2008-2011. Helm was still -named Anything
    • +named Anything +
    • Thierry Volpiatto (current maintainer). thierry.volpiatto@gmail.com, from 2011-present. Anything was -renamed to Helm during this period.
    • +renamed to Helm during this period. +

    @@ -262,8 +241,8 @@

    Table of Contents

    -
    (require 'helm-config)
    -(helm-mode 1)
    +
    (require 'helm-config)
    +(helm-mode 1)
     
    @@ -273,54 +252,55 @@

    Table of Contents

    -
    (require 'helm)
    -(require 'helm-config)
    +
    (require 'helm)
    +(require 'helm-config)
     
    -;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
    -;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
    -;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
    -(global-set-key (kbd "C-c h") 'helm-command-prefix)
    -(global-unset-key (kbd "C-x c"))
    +;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
    +;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
    +;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
    +(global-set-key (kbd "C-c h") 'helm-command-prefix)
    +(global-unset-key (kbd "C-x c"))
     
    -(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
    -(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
    -(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
    +(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
    +(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
    +(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
     
    -(when (executable-find "curl")
    -  (setq helm-google-suggest-use-curl-p t))
    +(when (executable-find "curl")
    +  (setq helm-google-suggest-use-curl-p t))
     
    -(setq helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
    -      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
    -      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
    -      helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
    +(setq helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
    +      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
    +      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
    +      helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
           helm-ff-file-name-history-use-recentf t
    -      helm-echo-input-in-header-line t)
    +      helm-echo-input-in-header-line t)
     
    -(defun spacemacs//helm-hide-minibuffer-maybe ()
    -  "Hide minibuffer in Helm session if we use the header line as input field."
    -  (when (with-helm-buffer helm-echo-input-in-header-line)
    -    (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
    -      (overlay-put ov 'window (selected-window))
    -      (overlay-put ov 'face
    -                   (let ((bg-color (face-background 'default nil)))
    -                     `(:background ,bg-color :foreground ,bg-color)))
    -      (setq-local cursor-type nil))))
    +(defun spacemacs//helm-hide-minibuffer-maybe ()
    +  "Hide minibuffer in Helm session if we use the header line as input field."
    +  (when (with-helm-buffer helm-echo-input-in-header-line)
    +    (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
    +      (overlay-put ov 'window (selected-window))
    +      (overlay-put ov 'face
    +                   (let ((bg-color (face-background 'default nil)))
    +                     `(:background ,bg-color :foreground ,bg-color)))
    +      (setq-local cursor-type nil))))
     
     
    -(add-hook 'helm-minibuffer-set-up-hook
    -          'spacemacs//helm-hide-minibuffer-maybe)
    +(add-hook 'helm-minibuffer-set-up-hook
    +          'spacemacs//helm-hide-minibuffer-maybe)
     
    -(setq helm-autoresize-max-height 0)
    -(setq helm-autoresize-min-height 20)
    -(helm-autoresize-mode 1)
    +(setq helm-autoresize-max-height 0)
    +(setq helm-autoresize-min-height 20)
    +(helm-autoresize-mode 1)
     
    -(helm-mode 1)
    +(helm-mode 1)
     
    -
    -

    Usage:

    -
    +
    +

    1 Usage:

    +
    +

    After using Helm, you are going to have a big change in the way you use Emacs. After you get used to the Helm way, you won't want to leave @@ -335,33 +315,40 @@

    Usage:

      -
    • You type something.
    • +
    • You type something. +
    • Instead of TAB to expand the common part until you find your candidates, in Helm, you type parts of the candidate you want to search for, separated by spaces. In Helm, these strings are called -patterns. Patterns can also be regexps.
    • +patterns. Patterns can also be regexps. +
    • Helm will try to search and sort according to highest match, from top to bottom. The best match is at the top, so you can press RET -and select it.
    • +and select it. +
    • You can navigate the buffer with C-n and C-p or <up> and <down> to move up/down, C-v and M-v to move to next/previous pages, and M-< and M-> to move to the top and bottom of the Helm -buffer.
    • +buffer. +
    • You can mark candidates with C-SPC; this is useful when you need to perform an action on many candidates of your choice. M-a to -select all.
    • +select all. +
    • You can insert marked candidates into the current buffer with C-c C-i. This is useful when you have narrowed to a list of candidates, -i.e. files, and then you want to save such candidates.
    • +i.e. files, and then you want to save such candidates. +
    • If you find the current horizontal Helm window is small, you can always switch it to a vertical window with C-t. Running C-t again -returns the Helm window back to horizontal and so on.
    • +returns the Helm window back to horizontal and so on. +

    @@ -397,15 +384,18 @@

    Usage: marked candidates (one or more) and quits the current Helm session; an action menu is a text-based menu that lists actions you can take. For example, Find File (open file), Find File in Dired, -Grep File… +Grep File… +
  • C-z executes helm-execute-persistent-action; a persistent action is an action that you use in a Helm session that does not quit the -session.
  • +session. +
  • In some Helm sessions, such as helm-find-files or helm-mini, you can select more than one candidates and execute actions on them, -such as grep or open.
  • +such as grep or open. +

    @@ -417,9 +407,9 @@

    Usage:
    -
    (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to do persistent action
    -(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
    -(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
    +
    (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to do persistent action
    +(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
    +(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
     
    @@ -431,20 +421,22 @@

    Usage:

    -
    -

    Why is Helm powerful?

    -
    +
    +

    2 Why is Helm powerful?

    +
    • Simple and Consistent interface: Every Helm session starts with the same, simple interface: a prompt for entering search patterns and a Helm buffer for displying results as the user types. Because of the -consistent and simple interface, new people use Helm with ease.
    • +consistent and simple interface, new people use Helm with ease. +
    • Interactivity: By nature, Helm is very interactive: as a user types, results get updated immediately in the Helm buffer. Because of this feature, Helm provides a unique interactive version of many commmands that do not exist outside of Helm. For example, -helm-ff-run-grep, which updates grep results as you type.
    • +helm-ff-run-grep, which updates grep results as you type. +
    • Focus on finding what you want first, decide what to do with it later: With Helm, you don't have to think about what you are going to @@ -460,10 +452,10 @@

      Why is have a second thought that opening the file in another window is better. Then you press C-g to cancel the command and re-execute the C-x 4 C-f version and have to start your navigating session all over -again!

    • +again! + -
    • -Matching mechanism: This is a powerful feature in Helm that I +

    • Matching mechanism: This is a powerful feature in Helm that I haven't seen in other packages: out of order matching, with regular expression. That's right, you can enter every search pattern as a regexp!. A really powerful concept: it enhances explanatory power @@ -477,7 +469,6 @@

      Why is tried it in Helm Projectile (a package that makes use of Helm framework, which does not come with stock Helm. You can read more about it in my Helm Projectile guide): -

      @@ -518,17 +509,19 @@

      Why is

      Starting from Helm 1.6.5, Helm includes fuzzy matching for many commands and a way for a package writer to activate fuzzy matching. -

    • +

      +
    • Performance: Helm can work with over 30000 candidates or more with no -problems.
    • +problems. +
    -
    -

    Operate on text at point:

    -
    +
    +

    3 Operate on text at point:

    +

    If you are already in a Helm session, you can still get input from the current editing buffer by the following key bindings: @@ -536,8 +529,10 @@

    Operat
    • C-w yanks word at point, starting from point to the end of the -word, into the Helm prompt (the minibuffer).
    • -
    • M-n yanks symbol at point
    • +word, into the Helm prompt (the minibuffer). + +
    • M-n yanks symbol at point +

    @@ -548,13 +543,17 @@

    Operat
    • C-h f, which runs describe-function, automatically takes the -symbol at point as the default for searching function.
    • +symbol at point as the default for searching function. +
    • C-h v, which runs describe-variable, automatically takes the -symbol at point as the default for searching variable.
    • +symbol at point as the default for searching variable. +
    • C-h w, which runs where-is, automatically takes the symbol at point as the default for showing the key binding for a -command.
    • -
    • … and so on… (C-h C-h to view all commands)
    • +command. + +
    • … and so on… (C-h C-h to view all commands) +

    @@ -563,9 +562,9 @@

    Operat

    -
    -

    Autoresize

    -
    +
    +

    4 Autoresize

    +

    Helm can resize its buffer automatically to fit the number of candidates if you enable helm-autoresize-mode: @@ -573,18 +572,20 @@

    Autoresize

    -
    (helm-autoresize-mode t)
    +
    (helm-autoresize-mode t)
     

    You can customize the minimum and maximum height that Helm can resize -with these two variable: +with these two variable:

      -
    • helm-autoresize-max-height
    • -
    • helm-autoresize-min-height
    • +
    • helm-autoresize-max-height +
    • +
    • helm-autoresize-min-height +

    @@ -607,11 +608,11 @@

    Autoresize

    -
    (defun pl/helm-alive-p ()
    -  (if (boundp 'helm-alive-p)
    -      (symbol-value 'helm-alive-p)))
    +
    (defun pl/helm-alive-p ()
    +  (if (boundp 'helm-alive-p)
    +      (symbol-value 'helm-alive-p)))
     
    -(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)
    +(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)
     
    @@ -641,9 +642,9 @@

    Autoresize

    -
    -

    Command: helm-M-x

    -
    +
    +

    5 Command: helm-M-x

    +

    Key binding:

    @@ -654,7 +655,7 @@

    Comman
    -
    (global-set-key (kbd "M-x") 'helm-M-x)
    +
    (global-set-key (kbd "M-x") 'helm-M-x)
     
    @@ -690,7 +691,7 @@

    Comman
    -
    (setq helm-M-x-fuzzy-match t) ;; optional fuzzy matching for helm-M-x
    +
    (setq helm-M-x-fuzzy-match t) ;; optional fuzzy matching for helm-M-x
     
    @@ -717,9 +718,9 @@

    Comman

    -
    -

    Command: helm-show-kill-ring

    -
    +
    +

    6 Command: helm-show-kill-ring

    +

    Key binding:

    @@ -730,7 +731,7 @@

    Comman
    -
    (global-set-key (kbd "M-y") 'helm-show-kill-ring)
    +
    (global-set-key (kbd "M-y") 'helm-show-kill-ring)
     
    @@ -775,9 +776,9 @@

    Comman

    -
    -

    Command: helm-mini

    -
    +
    +

    7 Command: helm-mini

    +

    Key binding:

    @@ -788,7 +789,7 @@

    Comman
    -
    (global-set-key (kbd "C-x b") 'helm-mini)
    +
    (global-set-key (kbd "C-x b") 'helm-mini)
     
    @@ -798,8 +799,8 @@

    Comman
    -
    (setq helm-buffers-fuzzy-matching t
    -      helm-recentf-fuzzy-match    t)
    +
    (setq helm-buffers-fuzzy-matching t
    +      helm-recentf-fuzzy-match    t)
     
    @@ -808,10 +809,13 @@

    Comman

      -
    • Current open buffers, under the header Buffers.
    • -
    • Recently opened files, under the header Recentf.
    • +
    • Current open buffers, under the header Buffers. +
    • +
    • Recently opened files, under the header Recentf. +
    • Allows you to create a new buffer by pressing RET, under the header -Create Buffer.
    • +Create Buffer. +

    @@ -856,12 +860,17 @@

    Comman

      -
    • Remote buffers are prefixed with '@'.
    • +
    • Remote buffers are prefixed with '@'. +
    • Red => Buffer has had its file modified on disk by an external -process.
    • -
    • Indianred2 => Buffer exists but its file has been deleted.
    • -
    • Orange => Buffer is modified and its file has not been saved to disk.
    • -
    • Italic => A non-file buffer.
    • +process. + +
    • Indianred2 => Buffer exists but its file has been deleted. +
    • +
    • Orange => Buffer is modified and its file has not been saved to disk. +
    • +
    • Italic => A non-file buffer. +

    @@ -876,27 +885,30 @@

    Comman
    • If I enter the pattern: *lisp ^helm @moc, Helm will narrow down the list by selecting only buffers that are in lisp mode, start -by helm and match "moc" in their contents.
    • +by helm and match "moc" in their contents. +
    • If I want to specify more than one major-mode, separate them with -,, e.g *!lisp,!sh,!fun will list all buffers but the ones in -lisp-mode, sh-mode and fundamental-mode.
    • +=,=, e.g *!lisp,!sh,!fun will list all buffers but the ones in +lisp-mode, sh-mode and fundamental-mode. +
    • If I enter the pattern: *lisp ^helm moc. Notice there is no @ this time helm will look for lisp mode buffers starting by -"helm" and have "moc" in their name.
    • +"helm" and have "moc" in their name. +
    • If I enter the pattern: *!lisp !helm Helm will narrow down -to buffers that are not in "lisp" mode and that do not match "helm".
    • +to buffers that are not in "lisp" mode and that do not match "helm". + -
    • -If I enter the pattern: /helm/ w3 Helm will narrow down +

    • If I enter the pattern: /helm/ w3 Helm will narrow down buffers that are in any "helm" sub-directory and matching w3. -

      helm-mini is like an interactive version of ibuffer. -

    • +

      +

    @@ -919,8 +931,9 @@

    Comman
    • All the C buffers are selected using the pattern *C. In the demo, -I also select Tcl buffers with *Tcl and then switched back to C -buffers with *C.
    • +I also select Tcl buffers with *Tcl and then switched back to C +buffers with *C. +
    • I only want to have buffers that contain only the string crash. To do that, I add a space, then add the pattern @@ -930,12 +943,14 @@

      Comman patterns, e.g., I added memory to filter down to buffers that contain the string "memory" among the buffers that contain crash. You can also mark multiple with C-SPC or mark all buffers -with M-a to search all buffers listed in helm-mini.

    • +with M-a to search all buffers listed in helm-mini. +
    • As you can see, as I filtered, the number of candidates decreased, as displayed in the modeline. At the end, there were 12 buffers remained as the result of filtering, down from the total 253 -buffers.
    • +buffers. +

    @@ -947,12 +962,10 @@

    Comman

      -
    • -helm-multi-files: this command lists buffers and recent files and +

    • helm-multi-files: this command lists buffers and recent files and files in current directory. However, when no match is found, helm-mini asks if you want to create a new buffer by highlighting the only entry, which look like this: -

      @@ -965,7 +978,8 @@

      Comman start a helm-locate session to search the whole file system for the desired file by pressing C-c p. By default, helm-for-files is bound to <prefix> f (current prefix is C-c h). -

    • +

      +
    • helm-buffer-list: similar to helm-mini, but instead of listing recent files from recentf, it uses ido-virtual-buffers, which is @@ -973,14 +987,15 @@

      Comman buffers do not contain paths. Depending on your preference, you can use this command in place of helm-mini. To enable fuzzy matching ido-virtual-buffers, if you set helm-buffers-fuzzy-matching to -t already, you also get fuzzy matching for ido-virtual-buffers.

    • +t already, you also get fuzzy matching for ido-virtual-buffers. +

    -
    -

    Command: helm-find-files

    -
    +
    +

    8 Command: helm-find-files

    +

    Key binding:

    @@ -993,7 +1008,7 @@

    Comman
    -
    (global-set-key (kbd "C-x C-f") 'helm-find-files)
    +
    (global-set-key (kbd "C-x C-f") 'helm-find-files)
     
    @@ -1007,44 +1022,55 @@

    Comman
    • helm-find-files can fuzzy match candidates in the current -directory. e.g "fob" or "fbr" will complete "foobar".
    • +directory. e.g "fob" or "fbr" will complete "foobar". +
    • You can also execute a persistent action, which is bound to C-z (by default) or TAB if you use my configuration, to narrow the current highlighting candidate; C-z or TAB again to view the contents of the buffer. You can scroll the other buffer up/down with M-<next> and -M-<prior>.
    • +M-<prior>. +
    • Alternatively, you can hit C-j to narrow to the highlighting candidate and C-j again to view the content of the other buffer. C-l goes -back.
    • +back. +
    • You can also go up one directory level with C-l. NOTE: if you use C-l, Helm goes up one level and places the cursor on the directory you've just exited. If you want to go up and have the cursor on -the parent directory, in Helm prompt, enter ../.
    • +the parent directory, in Helm prompt, enter ../. +
    • After you go up with C-l, you can go back to the exact visited -directories with C-r.
    • +directories with C-r. +
    • To create a directory, enter a new name that does not exist in the current directory and append / at the end. After you create a -directory, Helm continues in that directory.
    • +directory, Helm continues in that directory. +
    • To create a new file, enter a name and select the top row that has the symbol [?] next to it. By default, Helm always selects the -first match in the directory.
    • +first match in the directory. +
    • You can invoke grep on the currently highlighted entry with -C-s. C-u C-s performs a recursive grep.
    • +C-s. C-u C-s performs a recursive grep. + -
    • Enter ~/ at the end of the pattern to quickly reach home directory.
    • +
    • Enter ~/ at the end of the pattern to quickly reach home directory. +
    • -
    • Enter / at the end of the pattern to quickly reach root of your file system.
    • +
    • Enter / at the end of the pattern to quickly reach root of your file system. +
    • Enter ./ at the end of the pattern to quickly reach `default-directory' (initial start of session). If you are in `default-directory' move -cursor on top.
    • +cursor on top. +

    @@ -1059,7 +1085,7 @@

    Comman

    -Demo: +Demo:

    @@ -1075,7 +1101,8 @@

    Comman

    -
    • Find file at point:
      +
      1. Find file at point:
        +

        Did you know the command ffap? It was introduced in part 1, but here is the demo: @@ -1094,9 +1121,11 @@

        Comman separate command to open the file at point, but using the same C-x C-f. It's really convenient.

        -

      2. +
      +
    • + +
    • File and directory histories:
      -
    • File and directory histories:

      With a prefix argument, helm-find-files displays a list of visited directories. If one is selected at point, @@ -1115,14 +1144,16 @@

      Comman You can use M-p and M-n to move back and forth between previously visited directory.

      -

    +
    +
    -
    -

    Command: helm-ff-do-grep, live grep in Helm

    -
    +
    +

    9 Command: helm-ff-do-grep, live grep in Helm

    +
    +

    -Key binding: +Key binding:

    @@ -1152,9 +1183,9 @@

    Comma
    -
    (when (executable-find "ack-grep")
    -  (setq helm-grep-default-command "ack-grep -Hn --no-group --no-color %e %p %f"
    -        helm-grep-default-recurse-command "ack-grep -H --no-group --no-color %e %p %f"))
    +
    (when (executable-find "ack-grep")
    +  (setq helm-grep-default-command "ack-grep -Hn --no-group --no-color %e %p %f"
    +        helm-grep-default-recurse-command "ack-grep -H --no-group --no-color %e %p %f"))
     
    @@ -1170,9 +1201,9 @@

    Comma

    -
    -

    Command: helm-semantic-or-imenu

    -
    +
    +

    10 Command: helm-semantic-or-imenu

    +

    Key binding:

    @@ -1220,8 +1251,8 @@

    Comma
    -
    (setq helm-semantic-fuzzy-match t
    -      helm-imenu-fuzzy-match    t)
    +
    (setq helm-semantic-fuzzy-match t
    +      helm-imenu-fuzzy-match    t)
     
    @@ -1230,18 +1261,21 @@

    Comma

      -
    • Invoke the command (by default, C-c h i).
    • +
    • Invoke the command (by default, C-c h i). +
    • You can use the arrow keys or C-p/C-n to move up and down between candidates. You can also use C-<down> and C-<up>; as you move the selection between tags inside the Helm Semantic buffer, the point moves -between tag locations as well.
    • +between tag locations as well. +
    • A nice feature of helm-semantic-or-imenu is that whenever you activate the command, if point is inside a Semantic tag (such as a function definition), the selection is positioned at the tag in the Helm buffer. This works nicely in combination with -C-<down> and C-<up> to move between definitions in your buffer.
    • +C-<down> and C-<up> to move between definitions in your buffer. +

    @@ -1259,7 +1293,7 @@

    Comma

    -helm-semantic-or-imenu provides these types of Semantic tags: +helm-semantic-or-imenu provides these types of Semantic tags:

      @@ -1267,12 +1301,16 @@

      Comma the current major mode. For example, Dependencies in C/C++ include header files. When you execute a persistent action on a dependency, the point moves to the location of that dependency in the current -window. +window. + -
    • Variables: variables defined in current buffer.
    • -
    • Functions: function defined in current buffer
    • +
    • Variables: variables defined in current buffer. +
    • +
    • Functions: function defined in current buffer +
    • Provides: modules that this buffer provides; for example, (provide - ...) expression in Emacs Lisp.
    • + ...) expression in Emacs Lisp. +

    @@ -1292,25 +1330,26 @@

    Comma
    • First, I use helm-semantic-or-imenu to move to the function -helm-define-key-with-subkeys and move point there.
    • +helm-define-key-with-subkeys and move point there. +
    • Then, I start helm-semantic-or-imenu again and -helm-define-key-with-subkeys is pre-selected.
    • +helm-define-key-with-subkeys is pre-selected. + -
    • -Then, I move point to the variable helm-map and execute +

    • Then, I move point to the variable helm-map and execute helm-semantic-or-imenu again on two function: helm-next-source and helm-previous-source. This time, instead of showing the current semantic tag I'm operating in (which is helm-map), it shows the other two tags in Helm Semantic buffer. This is because I supplied a prefix argument before running the command. -

      helm-semantic-or-imenu-2.gif

      -
    • +

    +

    @@ -1324,27 +1363,29 @@

    Comma
    • At first, I narrow to candidates that are functions with this -pattern in the prompt: Functi.
    • +pattern in the prompt: Functi. +
    • Then, I narrow to candidates that are functions and contain void in them with this pattern: functi void, effectively -selecting functions that have type void or accept void arguments.
    • +selecting functions that have type void or accept void arguments. +
    • Then, I narrow to candidates that are functions and contain int in them with this pattern: functi int, effectively selecting functions -that have type int or accept int arguments.
    • +that have type int or accept int arguments. + -
    • -Then, I narrow to candidates that are variables and contain u16 +

    • Then, I narrow to candidates that are variables and contain u16 in them, effectively selecting only variables that have type u16; the same for u32 in the demo. -

      helm-semantic-or-imenu.gif

      -
    • +

    +

    @@ -1362,9 +1403,9 @@

    Comma

    -
    -

    Command: helm-man-woman

    -
    +
    +

    11 Command: helm-man-woman

    +

    Key binding:

    @@ -1386,7 +1427,7 @@

    Comma
    -
    (add-to-list 'helm-sources-using-default-as-input 'helm-source-man-pages)
    +
    (add-to-list 'helm-sources-using-default-as-input 'helm-source-man-pages)
     
    @@ -1402,9 +1443,9 @@

    Comma

    -
    -

    Command: helm-find

    -
    +
    +

    12 Command: helm-find

    +

    Key binding:

    @@ -1459,9 +1500,9 @@

    Comma

    -
    -

    Command: helm-locate

    -
    +
    +

    13 Command: helm-locate

    +

    Key binding:

    @@ -1501,7 +1542,7 @@

    Comma
    -
    (setq helm-locate-fuzzy-match t)
    +
    (setq helm-locate-fuzzy-match t)
     
    @@ -1522,9 +1563,9 @@

    Comma

    -
    -

    Command: helm-occur

    -
    +
    +

    14 Command: helm-occur

    +

    Key binding:

    @@ -1537,7 +1578,7 @@

    Comma
    -
    (global-set-key (kbd "C-c h o") 'helm-occur)
    +
    (global-set-key (kbd "C-c h o") 'helm-occur)
     
    @@ -1572,9 +1613,9 @@

    Comma

    -
    -

    Command: helm-apropos

    -
    +
    +

    15 Command: helm-apropos

    +

    Key binding:

    @@ -1595,16 +1636,23 @@

    Comma

      -
    • Commands: Lists all available commands.
    • -
    • Fucntion: Lists all available functions.
    • +
    • Commands: Lists all available commands. +
    • +
    • Fucntion: Lists all available functions. +
    • Classes: Lists all classes created by defclass. See Building -Classes.
    • +Classes. +
    • Generic Functions: Lists all functions created by defmethod. See -Writing Methods
    • -
    • Variables: Lists all available variables.
    • -
    • Faces: Lists all available faces.
    • +Writing Methods + +
    • Variables: Lists all available variables. +
    • +
    • Faces: Lists all available faces. +
    • Helm attributes: Lists all attributes that you can use to build a -Helm source. Useful if you want to write extension with Helm.
    • +Helm source. Useful if you want to write extension with Helm. +

    @@ -1613,15 +1661,15 @@

    Comma
    -
    (setq helm-apropos-fuzzy-match t)
    +
    (setq helm-apropos-fuzzy-match t)
     

    -
    -

    Command: helm-info-*

    -
    +
    +

    16 Command: helm-info-*

    +

    Key binding:

    @@ -1635,30 +1683,30 @@

    Comma - + - + -Key -Binding +Key +Binding -<prefix> h g -Command: helm-info-gnus +<prefix> h g +Command: helm-info-gnus -<prefix> h i -Command: helm-info-at-point +<prefix> h i +Command: helm-info-at-point -<prefix> h r -Command: helm-info-emacs +<prefix> h r +Command: helm-info-emacs @@ -1686,9 +1734,12 @@

    Comma

      -
    • helm-info-gdb.
    • -
    • helm-info-find.
    • -
    • helm-info-elisp.
    • +
    • helm-info-gdb. +
    • +
    • helm-info-find. +
    • +
    • helm-info-elisp. +

    …. @@ -1701,9 +1752,9 @@

    Comma

    -
    -

    Command: helm-lisp-completion-at-point

    -
    +
    +

    17 Command: helm-lisp-completion-at-point

    +

    Key binding:

    @@ -1726,15 +1777,15 @@

    Command: helm-lisp-completion-at-point

    -
    (setq helm-lisp-fuzzy-completion t)
    +
    (setq helm-lisp-fuzzy-completion t)
     
    -
    -

    Command: helm-resume

    -
    +
    +

    18 Command: helm-resume

    +

    Key binding:

    @@ -1775,9 +1826,9 @@

    Comma

    -
    -

    Command: helm-all-mark-rings

    -
    +
    +

    19 Command: helm-all-mark-rings

    +

    Key binding:

    @@ -1790,7 +1841,7 @@

    Comma
    -
    (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
    +
    (global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
     
    @@ -1825,9 +1876,9 @@

    Comma

    -
    -

    Command: helm-regexp

    -
    +
    +

    20 Command: helm-regexp

    +

    Key binding: <prefix> r (prefix is C-x c by default, or C-c h if set). @@ -1847,47 +1898,47 @@

    Comma - + - + -Key -Action +Key +Action -[f1] -Kill regexp as sexp +[f1] +Kill regexp as sexp -  -Saves the regexp as a string in kill-ring +  +Saves the regexp as a string in kill-ring -[f2] -Query Replace Regexp +[f2] +Query Replace Regexp -  -Invoke query-replace with current regexp to be replaced +  +Invoke query-replace with current regexp to be replaced -[f3] -Kill regexp +[f3] +Kill regexp -  -Saves the regexp as is in the current Helm prompt +  +Saves the regexp as is in the current Helm prompt @@ -1904,9 +1955,9 @@

    Comma

    -
    -

    Command: helm-register

    -
    +
    +

    21 Command: helm-register

    +

    Key binding:

    @@ -1918,7 +1969,7 @@

    Comma
    -
    (global-set-key (kbd "C-c h x") 'helm-register)
    +
    (global-set-key (kbd "C-c h x") 'helm-register)
     
    @@ -1932,57 +1983,57 @@

    Comma - + - + -Key -Action +Key +Action -[f1] -Insert Register +[f1] +Insert Register -  -Insert register content into buffer +  +Insert register content into buffer -[f2] -Append Region to Register +[f2] +Append Region to Register -  -Append an active region to current content +  +Append an active region to current content -  -in selected register +  +in selected register -[f3] -Prepend Region to Register +[f3] +Prepend Region to Register -  -Prepend an active region to current content +  +Prepend an active region to current content -  -in selected register +  +in selected register @@ -1999,9 +2050,9 @@

    Comma

    -
    -

    Command: helm-top

    -
    +
    +

    22 Command: helm-top

    +

    Key binding:

    @@ -2023,38 +2074,38 @@

    Comma - + - + -Key -Binding +Key +Binding -[f1] -kill (SIGTERM) +[f1] +kill (SIGTERM) -[f2] -kill (SIGKILL) +[f2] +kill (SIGKILL) -[f3] -kill (SIGINT) +[f3] +kill (SIGINT) -[f4] -kill (Choose signal) +[f4] +kill (Choose signal) @@ -2067,44 +2118,44 @@

    Comma - + - + -Key -Binding +Key +Binding -C-c C-u -Refresh helm-top +C-c C-u +Refresh helm-top -M-C -Sort by shell commands +M-C +Sort by shell commands -M-P -Sort by CPU usage +M-P +Sort by CPU usage -M-U -Sort by user +M-U +Sort by user -M-M -Sort by memory +M-M +Sort by memory @@ -2125,9 +2176,9 @@

    Comma

    -
    -

    Command: helm-surfraw

    -
    +
    +

    23 Command: helm-surfraw

    +

    Key binding:

    @@ -2166,11 +2217,11 @@

    Comma

    -
    -

    Command: helm-google-suggest

    -
    +
    +

    24 Command: helm-google-suggest

    +

    -Key binding: +Key binding:

    @@ -2180,7 +2231,7 @@

    Comma
    -
    (global-set-key (kbd "C-c h g") 'helm-google-suggest)
    +
    (global-set-key (kbd "C-c h g") 'helm-google-suggest)
     
    @@ -2209,9 +2260,9 @@

    Comma

    -
    -

    Command: helm-color

    -
    +
    +

    25 Command: helm-color

    +

    Key binding:

    @@ -2240,107 +2291,109 @@

    Comma

      -
    • Colors:
    • +
    • Colors: +
    -+-+ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
    KeyActionKeyAction
    [f1] or C-c NCopy Name[f1] or C-c NCopy Name
     Copy color name into kill-ring Copy color name into kill-ring
    [f2] or C-c RCopy RGB[f2] or C-c RCopy RGB
     Copy hex value into kill-ring Copy hex value into kill-ring
    [f3] or C-c nInsert Name[f3] or C-c nInsert Name
     Insert color name into current buffer Insert color name into current buffer
    [f4] or C-c rInsert RGB[f4] or C-c rInsert RGB
     Insert hex value into current buffer Insert hex value into current buffer
      -
    • Customize Face:
    • +
    • Customize Face: +
    -+-+ - - + + - - + + - - + + - - + + - - + +
    KeyActionKeyAction
    [f1]Customize[f1]Customize
     Open Customization window Open Customization window
    [f2]Copy Name[f2]Copy Name
     Copy face name Copy face name
    @@ -2357,9 +2410,9 @@

    Comma

    -
    -

    Command: helm-eval-expression-with-eldoc

    -
    +
    +

    26 Command: helm-eval-expression-with-eldoc

    +

    Key binding:

    @@ -2371,7 +2424,7 @@

    Comma
    -
    (global-set-key (kbd "C-c h M-:") 'helm-eval-expression-with-eldoc)
    +
    (global-set-key (kbd "C-c h M-:") 'helm-eval-expression-with-eldoc)
     
    @@ -2402,15 +2455,15 @@

    Comma

    -
    -

    Command: helm-calcul-expression

    -
    +
    +

    27 Command: helm-calcul-expression

    +

    Key binding:

    -<prefix> C-, (prefix is C-x c by default, or C-c h if set). +<prefix> C-,* (prefix is *C-x c by default, or C-c h if set).

    @@ -2430,21 +2483,33 @@

    Comma

      -
    • Choice of algebraic or RPN (stack-based) entry of calculations.
    • -
    • Arbitrary precision integers and floating-point numbers.
    • +
    • Choice of algebraic or RPN (stack-based) entry of calculations. +
    • +
    • Arbitrary precision integers and floating-point numbers. +
    • Arithmetic on rational numbers, complex numbers (rectangular and polar), error forms with standard deviations, open and closed intervals, vectors and matrices, dates and times, infinities, sets, -quantities with units, and algebraic formulas.
    • -
    • Mathematical operations such as logarithms and trigonometric functions.
    • -
    • Programmer's features (bitwise operations, non-decimal numbers).
    • -
    • Financial functions such as future value and internal rate of return.
    • -
    • Number theoretical features such as prime factorization and arithmetic modulo m for any m.
    • -
    • Algebraic manipulation features, including symbolic calculus.
    • -
    • Moving data to and from regular editing buffers.
    • -
    • Embedded mode for manipulating Calc formulas and data directly inside any editing buffer.
    • -
    • Graphics using GNUPLOT, a versatile (and free) plotting program.
    • -
    • Easy programming using keyboard macros, algebraic formulas, algebraic rewrite rules, or extended Emacs Lisp.
    • +quantities with units, and algebraic formulas. + +
    • Mathematical operations such as logarithms and trigonometric functions. +
    • +
    • Programmer's features (bitwise operations, non-decimal numbers). +
    • +
    • Financial functions such as future value and internal rate of return. +
    • +
    • Number theoretical features such as prime factorization and arithmetic modulo m for any m. +
    • +
    • Algebraic manipulation features, including symbolic calculus. +
    • +
    • Moving data to and from regular editing buffers. +
    • +
    • Embedded mode for manipulating Calc formulas and data directly inside any editing buffer. +
    • +
    • Graphics using GNUPLOT, a versatile (and free) plotting program. +
    • +
    • Easy programming using keyboard macros, algebraic formulas, algebraic rewrite rules, or extended Emacs Lisp. +
    @@ -2466,9 +2531,10 @@

    Comma

    -
    -

    Command: helm-eshell-history

    -
    +
    +

    28 Command: helm-eshell-history

    +
    +

    Key binding:

    @@ -2479,11 +2545,11 @@

    Comma
    -
    (require 'helm-eshell)
    +
    (require 'helm-eshell)
     
    -(add-hook 'eshell-mode-hook
    -          #'(lambda ()
    -              (define-key eshell-mode-map (kbd "C-c C-l")  'helm-eshell-history)))
    +(add-hook 'eshell-mode-hook
    +          #'(lambda ()
    +              (define-key eshell-mode-map (kbd "C-c C-l")  'helm-eshell-history)))
     
    @@ -2514,24 +2580,24 @@

    Comma

    -
    -

    Command: helm-comint-input-ring

    -
    +
    +

    29 Command: helm-comint-input-ring

    +

    Similar to helm-eshell-history, but used for M-x shell.

    -
    (define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
    +
    (define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)
     
    -
    -

    Command: helm-mini-buffer-history

    -
    +
    +

    30 Command: helm-mini-buffer-history

    +

    Do you ever feel uneasy operating on the minibuffer history when it's getting large (say, hundreds of history items)? If so, Helm can @@ -2541,15 +2607,15 @@

    Comma
    -
    (define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
    +
    (define-key minibuffer-local-map (kbd "C-c C-l") 'helm-minibuffer-history)
     

    -
    -

    Package: helm-projectile

    -
    +
    +

    31 Package: helm-projectile

    +

    Author: Bozhidar Batsov, bozhidar@batsov.com

    @@ -2594,17 +2660,20 @@

    Packa

    -
    -

    Package: helm-descbinds

    -
    +
    +

    32 Package: helm-descbinds

    +

    Author

      -
    • 2008-2010: Taiki SUGAWARA, buzz.taiki@gmail.com
    • -
    • 2012-2013 Michael Markert, markert.michael@googlemail.com
    • -
    • 2013-present: Daniel Hackney dan@haxney.org
    • +
    • 2008-2010: Taiki SUGAWARA, buzz.taiki@gmail.com +
    • +
    • 2012-2013 Michael Markert, markert.michael@googlemail.com +
    • +
    • 2013-present: Daniel Hackney dan@haxney.org +

    @@ -2623,9 +2692,12 @@

    Packa

      -
    • Execute the command
    • -
    • Describe the command
    • -
    • Find the command
    • +
    • Execute the command +
    • +
    • Describe the command +
    • +
    • Find the command +

    @@ -2640,13 +2712,13 @@

    Packa
    -
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -;; PACKAGE: helm-descbinds                      ;;
    -;;                                              ;;
    -;; GROUP: Convenience -> Helm -> Helm Descbinds ;;
    -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -(require 'helm-descbinds)
    -(helm-descbinds-mode)
    +
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +;; PACKAGE: helm-descbinds                      ;;
    +;;                                              ;;
    +;; GROUP: Convenience -> Helm -> Helm Descbinds ;;
    +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    +(require 'helm-descbinds)
    +(helm-descbinds-mode)
     
    @@ -2661,9 +2733,10 @@

    Packa

    -
    -

    Summary of Keybindings

    -
    +
    +

    33 Summary of Keybindings

    +
    +

    This chapter summarizes the key bindings introduced in the above chapters.

    @@ -2672,186 +2745,186 @@

    Summa - + - + - + -Key Binding -Command -Description +Key Binding +Command +Description -M-x -helm-M-x -List commands +M-x +helm-M-x +List commands -M-y -helm-show-kill-ring -Shows the content of the kill ring +M-y +helm-show-kill-ring +Shows the content of the kill ring -C-x b -helm-mini -Shows open buffers, recently opened files +C-x b +helm-mini +Shows open buffers, recently opened files -C-x C-f -helm-find-files -The helm version of find-file +C-x C-f +helm-find-files +The helm version of find-file -C-s -helm-ff-run-grep -Run grep from within helm-find-files +C-s +helm-ff-run-grep +Run grep from within helm-find-files -C-c h i -helm-semantic-or-imenu -Helm interface to semantic/imenu +C-c h i +helm-semantic-or-imenu +Helm interface to semantic/imenu -C-c h m -helm-man-woman -Jump to any man entry +C-c h m +helm-man-woman +Jump to any man entry -C-c h / -helm-find -Helm interface to find +C-c h / +helm-find +Helm interface to find -C-c h l -helm-locate -Helm interface to locate +C-c h l +helm-locate +Helm interface to locate -C-c h o -helm-occur -Helm interface for occur +C-c h o +helm-occur +Helm interface for occur -C-c h a -helm-apropos -Describes commands, functions, variables, … +C-c h a +helm-apropos +Describes commands, functions, variables, … -C-c h h g -helm-info-gnus -  +C-c h h g +helm-info-gnus +  -C-c h h i -helm-info-at-point -  +C-c h h i +helm-info-at-point +  -C-c h h r -helm-info-emacs -  +C-c h h r +helm-info-emacs +  -C-c h <tab> -helm-lisp-completion-at-point -Provides a list of available functions +C-c h <tab> +helm-lisp-completion-at-point +Provides a list of available functions -C-c h b -helm-resume -Resumes a previous helm session +C-c h b +helm-resume +Resumes a previous helm session -C-h SPC -helm-all-mark-rings -Views contents of local and global mark rings +C-h SPC +helm-all-mark-rings +Views contents of local and global mark rings -C-c h r -helm-regex -Visualizes regex matches +C-c h r +helm-regex +Visualizes regex matches -C-c h x -helm-register -Shows content of registers +C-c h x +helm-register +Shows content of registers -C-c h t -helm-top -Helm interface to top +C-c h t +helm-top +Helm interface to top -C-c h s -helm-surfraw -Command line interface to many web search engines +C-c h s +helm-surfraw +Command line interface to many web search engines -C-c h g -helm-google-suggest -Interactively enter search terms and get results from Google in helm buffer +C-c h g +helm-google-suggest +Interactively enter search terms and get results from Google in helm buffer -C-c h c -helm-color -Lists all available faces +C-c h c +helm-color +Lists all available faces -C-c h M-: -helm-eval-expression-with-eldoc -Get instant results for Emacs lisp expressions in the helm buffer +C-c h M-: +helm-eval-expression-with-eldoc +Get instant results for Emacs lisp expressions in the helm buffer -C-c h C-, -helm-calcul-expression -Helm interface to calc +=C-c h C-,= +helm-calcul-expression +Helm interface to calc -C-c C-l -helm-eshell-history -Interface to eshell history +C-c C-l +helm-eshell-history +Interface to eshell history -C-c C-l -helm-comint-input-ring -Interface to shell history +C-c C-l +helm-comint-input-ring +Interface to shell history -C-c C-l -helm-mini-buffer-history -Interface to mini-buffer history +C-c C-l +helm-mini-buffer-history +Interface to mini-buffer history @@ -2859,21 +2932,9 @@

    Summa

    - -
    - - - comments powered by Disqus +

    Created: 2016-12-06 Tue 01:42

    +

    Emacs 24.5.1 (Org mode 8.2.10)

    +

    Validate

    - \ No newline at end of file + diff --git a/helm-projectile.html b/docs/helm-projectile.html similarity index 78% rename from helm-projectile.html rename to docs/helm-projectile.html index 20862c5..eb36301 100644 --- a/helm-projectile.html +++ b/docs/helm-projectile.html @@ -4,10 +4,9 @@ Exploring large projects with Projectile and Helm Projectile - + - - + -
    - - - - -

    Back to Table of Contents

    -

    Exploring large projects with Projectile and Helm Projectile

    Table of Contents

    @@ -226,11 +161,11 @@

    Table of Contents

    -

    Demos

    +

    1 Demos

    -

    Select and open multiple files

    +

    1.1 Select and open multiple files

    Demo (begins when START DEMO appears in minibuffer): @@ -250,7 +185,7 @@

    -

    Open file at point anywhere

    +

    1.2 Open file at point anywhere

    @@ -283,7 +218,7 @@

    -

    Copy files anywhere

    +

    1.3 Copy files anywhere

    Demo (begins when START DEMO appears in minibuffer): @@ -308,7 +243,7 @@

    -

    Delete files anywhere

    +

    1.4 Delete files anywhere

    Demo (begins when START DEMO appears in minibuffer): @@ -328,7 +263,7 @@

    -

    Switch between current file and other files with same names but different extensions

    +

    1.5 Switch between current file and other files with same names but different extensions

    @@ -370,7 +305,7 @@

    -

    What is Projectile?

    +

    2 What is Projectile?

    @@ -481,7 +416,7 @@

    -

    All-in-one command: helm-projectile, C-c p h

    +

    4 All-in-one command: helm-projectile, C-c p h

    @@ -619,14 +554,14 @@

    -

    File management

    +

    6 File management

    -

    Command: helm-projectile-find-file, C-c p f

    +

    6.1 Command: helm-projectile-find-file, C-c p f

    -Usage: This command lists all files in a project for users to narrow +Usage: This command lists all files in a project for users to narrow down to wanted files. Some frequently used actions that cover open, rename, copy, delete,search and other miscelaneous operations. Once you mastered the actions of helm-projectile-find-file, you master @@ -647,7 +582,7 @@

    -

    Open

    +

    6.1.1 Open

    • Find File (default action bound to RET): open files; if multiple @@ -690,7 +625,7 @@

      Tramp syntax to open file as root. Just browse file to anywhere, and when needed, open it as root -instantly. +instantly.

      Demo (begins when START DEMO appears in minibuffer): @@ -730,7 +665,7 @@

      -

      Move and Rename

      +

      6.1.2 Move and Rename

      • Rename file(s) (M-R): Rename marked files. To mark files, press @@ -784,7 +719,7 @@

        -

        Copy and Delete

        +

        6.1.3 Copy and Delete

        • Copy file(s) (M-C): similar to Rename File(s) action but copy @@ -804,7 +739,7 @@

          -

          Search and Replace

          +

          6.1.4 Search and Replace

            @@ -827,7 +762,7 @@

            -

            Miscelaneous

            +

            6.1.5 Miscelaneous

            • Insert as org link (C-c @): Insert the current file that @@ -911,7 +846,7 @@

              -

              Command: helm-projectile-find-file-in-known-projects, C-c p F

              +

              6.2 Command: helm-projectile-find-file-in-known-projects, C-c p F

              This command is another one that can be used outside of any @@ -933,7 +868,7 @@

              -

              Command: helm-projectile-find-file-dwim, C-c p g

              +

              6.3 Command: helm-projectile-find-file-dwim, C-c p g

              Usage: Find file based on context at point (do what you mean): @@ -973,10 +908,10 @@

              -

              Command: helm-projectile-find-dir, C-c p d

              +

              6.4 Command: helm-projectile-find-dir, C-c p d

              -Usage: List available directories in the current project. +Usage: List available directories in the current project.

              @@ -997,7 +932,7 @@

              -

              Command: helm-projectile-recentf, C-c p e

              +

              6.5 Command: helm-projectile-recentf, C-c p e

              @@ -1076,7 +1011,7 @@

              -

              Caching

              +

              6.7 Caching

              Usage: In large projects, caching can significantly speedup file and @@ -1086,7 +1021,7 @@

              -
              (setq projectile-enable-caching t)
              +
              (setq projectile-enable-caching t)
               

              @@ -1104,7 +1039,7 @@

              -

              Command: projectile-invalidate-cache, C-c p i

              +

              6.7.1 Command: projectile-invalidate-cache, C-c p i

              Usage: As the command name suggests, it invalidates the current cache and @@ -1114,7 +1049,7 @@

              -

              Command: projectile-cache-current-file, C-c p z

              +

              6.7.2 Command: projectile-cache-current-file, C-c p z

              Usage: Add the file of current selected buffer to cache. @@ -1123,7 +1058,7 @@

              -

              Command: projectile-purge-file-from-cache

              +

              6.7.3 Command: projectile-purge-file-from-cache

              Usage: Remove a file from the cache. Once removed, you won't see it @@ -1134,7 +1069,7 @@

              -

              Command: projectile-purge-dir-from-cache

              +

              6.7.4 Command: projectile-purge-dir-from-cache

              Usage: Remove a directory from the cache. @@ -1144,7 +1079,7 @@

              -

              Virtual directory manager

              +

              7 Virtual directory manager

              Now that you know how to manage your project files with Helm and @@ -1236,14 +1171,14 @@

              -

              Store virtual directories with Bookmark (or Bookmark+)

              +

              7.1 Store virtual directories with Bookmark (or Bookmark+)

              Using Bookmark (or Bookmark+), you can actually save your virtual Dired buffers and preserve this knowledge for future reference, when you want to quickly review related files to improve or fix bug. You won't have to reconnect related files again, and often it takes quite some -time since you could forget many things. +time since you could forget many things.

              @@ -1260,11 +1195,11 @@

              -

              Buffer management

              +

              8 Buffer management

              -

              Command: helm-projectile-switch-to-buffer, C-c p b

              +

              8.1 Command: helm-projectile-switch-to-buffer, C-c p b

              Usage: List all opened buffers in current project. The command has a @@ -1276,11 +1211,11 @@

              -

              Search in project

              +

              9 Search in project

              -

              Command: helm-projectile-grep, C-c p s g

              +

              9.1 Command: helm-projectile-grep, C-c p s g

              @@ -1363,7 +1298,7 @@

              -

              Command: helm-projectile-ack, C-c p s a

              +

              9.2 Command: helm-projectile-ack, C-c p s a

              This is a replacement command for projectile-ack. Similar to @@ -1403,7 +1338,7 @@

              -

              Command: helm-projectile-ag, C-c p s s

              +

              9.3 Command: helm-projectile-ag, C-c p s s

              This is a replacement command for projectile-ag. Similar to @@ -1441,7 +1376,7 @@

              -

              Summary of Keybindings

              +

              10 Summary of Keybindings

              diff --git a/archive.html b/docs/index.html similarity index 77% rename from archive.html rename to docs/index.html index 831bd5d..8d5f3d3 100644 --- a/archive.html +++ b/docs/index.html @@ -3,11 +3,10 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -Archive - +Emacs Mini Manual + - - + -
              - +

              Created: 2016-12-06 Tue 01:42

              +

              Emacs 24.5.1 (Org mode 8.2.10)

              +

              Validate

              diff --git a/setup-emacs-windows.html b/docs/setup-emacs-windows.html similarity index 60% rename from setup-emacs-windows.html rename to docs/setup-emacs-windows.html index cbb36ce..40f8dd8 100644 --- a/setup-emacs-windows.html +++ b/docs/setup-emacs-windows.html @@ -3,30 +3,22 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - - Setup Emacs with PDF Tools and Xwidgets web browser on Windows + + - - + -
              - - - - -

              Back to Table of Contents

              -

              Setup Emacs with PDF Tools and Xwidgets web browser on Windows

              @@ -177,22 +153,24 @@

              Table of Contents

              Installation instructions:

              -
              -

              Prerequisite

              -
              +
              +

              1 Prerequisite

              +
                -
              • Download Cywing setup from Cygwin's Install page.
              • +
              • Download Cywing setup from Cygwin's Install page. +
              • If you want only the PDF reader, you can install the Emacs shipped by Cygwin. However, if you also want the web browser, then you need to compile your own -Emacs 25 from source.
              • +Emacs 25 from source. +
              -
              -

              With PDF reader

              -
              +
              +

              2 With PDF reader

              +

              DEMO (Notice how I press some text in PDF file and Latex buffer jumps to corresponding automatically). @@ -209,7 +187,8 @@

              With PDF reader

                -
              • emacs-w32 (Editors category)
              • +
              • emacs-w32 (Editors category) +

              @@ -217,12 +196,18 @@

              With PDF reader

                -
              • make (Devel category)
              • -
              • gcc-core (Devel category)
              • -
              • gcc-g++ (Devel category)
              • -
              • autoconf (Devel category)
              • -
              • automake (Devel category)
              • -
              • perl (Perl category)
              • +
              • make (Devel category) +
              • +
              • gcc-core (Devel category) +
              • +
              • gcc-g++ (Devel category) +
              • +
              • autoconf (Devel category) +
              • +
              • automake (Devel category) +
              • +
              • perl (Perl category) +

              @@ -230,8 +215,10 @@

              With PDF reader

                -
              • libpoppler-devel (Lib category)
              • -
              • libpoppler-glib-devel (Lib category)
              • +
              • libpoppler-devel (Lib category) +
              • +
              • libpoppler-glib-devel (Lib category) +

              @@ -276,9 +263,12 @@

              With PDF reader

                -
              • M-x package-install-file
              • -
              • Press RET
              • -
              • Select pdf-tools-${VERSION}.tar RET (the tar file is in your repository).
              • +
              • M-x package-install-file +
              • +
              • Press RET +
              • +
              • Select pdf-tools-${VERSION}.tar RET (the tar file is in your repository). +

              @@ -288,16 +278,16 @@

              With PDF reader

              -
              (pdf-tools-install)
              -(setq pdf-info-epdfinfo-program "/usr/bin/epdfinfo.exe")
              +
              (pdf-tools-install)
              +(setq pdf-info-epdfinfo-program "/usr/bin/epdfinfo.exe")
               
              -
              -

              With Xwidgets browser

              -
              +
              +

              3 With Xwidgets browser

              +

              DEMO

              @@ -307,15 +297,24 @@

              With Xwidgets browser

                -
              • libgif-devel (Graphics category)
              • -
              • libtiff-devel (Lib category)
              • -
              • libjpeg-devel (Devel category)
              • -
              • libxpm-devel (Devel category)
              • -
              • libgnutls-devel (Devel category)
              • -
              • libpng-devel (Devel category)
              • -
              • libncurses-devel (Lib category)
              • -
              • libgtk3-drivel (Lib category)
              • -
              • libwebkitgtk3.0-devel (Lib category)
              • +
              • libgif-devel (Graphics category) +
              • +
              • libtiff-devel (Lib category) +
              • +
              • libjpeg-devel (Devel category) +
              • +
              • libxpm-devel (Devel category) +
              • +
              • libgnutls-devel (Devel category) +
              • +
              • libpng-devel (Devel category) +
              • +
              • libncurses-devel (Lib category) +
              • +
              • libgtk3-drivel (Lib category) +
              • +
              • libwebkitgtk3.0-devel (Lib category) +

              @@ -323,8 +322,10 @@

              With Xwidgets browser

                -
              • xorg-server (X11 category)
              • -
              • xinit (X11 category)
              • +
              • xorg-server (X11 category) +
              • +
              • xinit (X11 category) +

              @@ -345,7 +346,7 @@

              With Xwidgets browser

              -
              echo "export DISPLAY=:0.0" >> .bash_profile
              +
              echo "export DISPLAY=:0.0" >> .bash_profile
               
              @@ -372,21 +373,9 @@

              With Xwidgets browser

              - -
              - - - comments powered by Disqus +

              Created: 2016-12-06 Tue 01:42

              +

              Emacs 24.5.1 (Org mode 8.2.10)

              +

              Validate

              - \ No newline at end of file + diff --git a/emacs-tutor/static/auto_complete.gif b/docs/static/auto_complete.gif similarity index 100% rename from emacs-tutor/static/auto_complete.gif rename to docs/static/auto_complete.gif diff --git a/emacs-tutor/static/c-ide/backward-func.gif b/docs/static/c-ide/backward-func.gif similarity index 100% rename from emacs-tutor/static/c-ide/backward-func.gif rename to docs/static/c-ide/backward-func.gif diff --git a/emacs-tutor/static/c-ide/beginning-of-defun.gif b/docs/static/c-ide/beginning-of-defun.gif similarity index 100% rename from emacs-tutor/static/c-ide/beginning-of-defun.gif rename to docs/static/c-ide/beginning-of-defun.gif diff --git a/emacs-tutor/static/c-ide/company-c-header.png b/docs/static/c-ide/company-c-header.png similarity index 100% rename from emacs-tutor/static/c-ide/company-c-header.png rename to docs/static/c-ide/company-c-header.png diff --git a/emacs-tutor/static/c-ide/company-clang-company-gtags.gif b/docs/static/c-ide/company-clang-company-gtags.gif similarity index 100% rename from emacs-tutor/static/c-ide/company-clang-company-gtags.gif rename to docs/static/c-ide/company-clang-company-gtags.gif diff --git a/emacs-tutor/static/c-ide/company-clang-project-completion.gif b/docs/static/c-ide/company-clang-project-completion.gif similarity index 100% rename from emacs-tutor/static/c-ide/company-clang-project-completion.gif rename to docs/static/c-ide/company-clang-project-completion.gif diff --git a/emacs-tutor/static/c-ide/compilation-compile.gif b/docs/static/c-ide/compilation-compile.gif similarity index 100% rename from emacs-tutor/static/c-ide/compilation-compile.gif rename to docs/static/c-ide/compilation-compile.gif diff --git a/emacs-tutor/static/c-ide/compilation-mode.gif b/docs/static/c-ide/compilation-mode.gif similarity index 100% rename from emacs-tutor/static/c-ide/compilation-mode.gif rename to docs/static/c-ide/compilation-mode.gif diff --git a/emacs-tutor/static/c-ide/ede-project.gif b/docs/static/c-ide/ede-project.gif similarity index 100% rename from emacs-tutor/static/c-ide/ede-project.gif rename to docs/static/c-ide/ede-project.gif diff --git a/emacs-tutor/static/c-ide/ede-rearrange-project-dir.gif b/docs/static/c-ide/ede-rearrange-project-dir.gif similarity index 100% rename from emacs-tutor/static/c-ide/ede-rearrange-project-dir.gif rename to docs/static/c-ide/ede-rearrange-project-dir.gif diff --git a/emacs-tutor/static/c-ide/ede-same-dir-completion.gif b/docs/static/c-ide/ede-same-dir-completion.gif similarity index 100% rename from emacs-tutor/static/c-ide/ede-same-dir-completion.gif rename to docs/static/c-ide/ede-same-dir-completion.gif diff --git a/emacs-tutor/static/c-ide/end-of-defun.gif b/docs/static/c-ide/end-of-defun.gif similarity index 100% rename from emacs-tutor/static/c-ide/end-of-defun.gif rename to docs/static/c-ide/end-of-defun.gif diff --git a/emacs-tutor/static/c-ide/forward-func.gif b/docs/static/c-ide/forward-func.gif similarity index 100% rename from emacs-tutor/static/c-ide/forward-func.gif rename to docs/static/c-ide/forward-func.gif diff --git a/emacs-tutor/static/c-ide/function-args-demo.gif b/docs/static/c-ide/function-args-demo.gif similarity index 100% rename from emacs-tutor/static/c-ide/function-args-demo.gif rename to docs/static/c-ide/function-args-demo.gif diff --git a/emacs-tutor/static/c-ide/function-args-jump.gif b/docs/static/c-ide/function-args-jump.gif similarity index 100% rename from emacs-tutor/static/c-ide/function-args-jump.gif rename to docs/static/c-ide/function-args-jump.gif diff --git a/emacs-tutor/static/c-ide/gdb-many-windows.gif b/docs/static/c-ide/gdb-many-windows.gif similarity index 100% rename from emacs-tutor/static/c-ide/gdb-many-windows.gif rename to docs/static/c-ide/gdb-many-windows.gif diff --git a/emacs-tutor/static/c-ide/gdb-prompt.gif b/docs/static/c-ide/gdb-prompt.gif similarity index 100% rename from emacs-tutor/static/c-ide/gdb-prompt.gif rename to docs/static/c-ide/gdb-prompt.gif diff --git a/emacs-tutor/static/c-ide/ggtags-definitions.png b/docs/static/c-ide/ggtags-definitions.png similarity index 100% rename from emacs-tutor/static/c-ide/ggtags-definitions.png rename to docs/static/c-ide/ggtags-definitions.png diff --git a/emacs-tutor/static/c-ide/gud.gif b/docs/static/c-ide/gud.gif similarity index 100% rename from emacs-tutor/static/c-ide/gud.gif rename to docs/static/c-ide/gud.gif diff --git a/emacs-tutor/static/c-ide/helm-files-insertion.gif b/docs/static/c-ide/helm-files-insertion.gif similarity index 100% rename from emacs-tutor/static/c-ide/helm-files-insertion.gif rename to docs/static/c-ide/helm-files-insertion.gif diff --git a/emacs-tutor/static/c-ide/helm-gtags-definitions.png b/docs/static/c-ide/helm-gtags-definitions.png similarity index 100% rename from emacs-tutor/static/c-ide/helm-gtags-definitions.png rename to docs/static/c-ide/helm-gtags-definitions.png diff --git a/emacs-tutor/static/c-ide/helm-gtags-jump-dwim.gif b/docs/static/c-ide/helm-gtags-jump-dwim.gif similarity index 100% rename from emacs-tutor/static/c-ide/helm-gtags-jump-dwim.gif rename to docs/static/c-ide/helm-gtags-jump-dwim.gif diff --git a/emacs-tutor/static/c-ide/helm-gtags-select.gif b/docs/static/c-ide/helm-gtags-select.gif similarity index 100% rename from emacs-tutor/static/c-ide/helm-gtags-select.gif rename to docs/static/c-ide/helm-gtags-select.gif diff --git a/emacs-tutor/static/c-ide/helm-semantic-or-imenu-with-struct.gif b/docs/static/c-ide/helm-semantic-or-imenu-with-struct.gif similarity index 100% rename from emacs-tutor/static/c-ide/helm-semantic-or-imenu-with-struct.gif rename to docs/static/c-ide/helm-semantic-or-imenu-with-struct.gif diff --git a/emacs-tutor/static/c-ide/hs-toggle-hiding.gif b/docs/static/c-ide/hs-toggle-hiding.gif similarity index 100% rename from emacs-tutor/static/c-ide/hs-toggle-hiding.gif rename to docs/static/c-ide/hs-toggle-hiding.gif diff --git a/emacs-tutor/static/c-ide/kill-func-body.gif b/docs/static/c-ide/kill-func-body.gif similarity index 100% rename from emacs-tutor/static/c-ide/kill-func-body.gif rename to docs/static/c-ide/kill-func-body.gif diff --git a/emacs-tutor/static/c-ide/mark-defun.gif b/docs/static/c-ide/mark-defun.gif similarity index 100% rename from emacs-tutor/static/c-ide/mark-defun.gif rename to docs/static/c-ide/mark-defun.gif diff --git a/emacs-tutor/static/c-ide/mark-func-body.gif b/docs/static/c-ide/mark-func-body.gif similarity index 100% rename from emacs-tutor/static/c-ide/mark-func-body.gif rename to docs/static/c-ide/mark-func-body.gif diff --git a/emacs-tutor/static/c-ide/moo-complete.png b/docs/static/c-ide/moo-complete.png similarity index 100% rename from emacs-tutor/static/c-ide/moo-complete.png rename to docs/static/c-ide/moo-complete.png diff --git a/emacs-tutor/static/c-ide/moo-jump-local.gif b/docs/static/c-ide/moo-jump-local.gif similarity index 100% rename from emacs-tutor/static/c-ide/moo-jump-local.gif rename to docs/static/c-ide/moo-jump-local.gif diff --git a/emacs-tutor/static/c-ide/projectile-find-other-file.gif b/docs/static/c-ide/projectile-find-other-file.gif similarity index 100% rename from emacs-tutor/static/c-ide/projectile-find-other-file.gif rename to docs/static/c-ide/projectile-find-other-file.gif diff --git a/emacs-tutor/static/c-ide/semantic-boost-demo.gif b/docs/static/c-ide/semantic-boost-demo.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-boost-demo.gif rename to docs/static/c-ide/semantic-boost-demo.gif diff --git a/emacs-tutor/static/c-ide/semantic-idle-summary-lambda.gif b/docs/static/c-ide/semantic-idle-summary-lambda.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-idle-summary-lambda.gif rename to docs/static/c-ide/semantic-idle-summary-lambda.gif diff --git a/emacs-tutor/static/c-ide/semantic-idle-summary-variable.gif b/docs/static/c-ide/semantic-idle-summary-variable.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-idle-summary-variable.gif rename to docs/static/c-ide/semantic-idle-summary-variable.gif diff --git a/emacs-tutor/static/c-ide/semantic-parsing.gif b/docs/static/c-ide/semantic-parsing.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-parsing.gif rename to docs/static/c-ide/semantic-parsing.gif diff --git a/emacs-tutor/static/c-ide/semantic-sticky-func.gif b/docs/static/c-ide/semantic-sticky-func.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-sticky-func.gif rename to docs/static/c-ide/semantic-sticky-func.gif diff --git a/emacs-tutor/static/c-ide/semantic-symref.gif b/docs/static/c-ide/semantic-symref.gif similarity index 100% rename from emacs-tutor/static/c-ide/semantic-symref.gif rename to docs/static/c-ide/semantic-symref.gif diff --git a/emacs-tutor/static/c-ide/senator-go-to-up-reference.gif b/docs/static/c-ide/senator-go-to-up-reference.gif similarity index 100% rename from emacs-tutor/static/c-ide/senator-go-to-up-reference.gif rename to docs/static/c-ide/senator-go-to-up-reference.gif diff --git a/emacs-tutor/static/c-ide/senator-jump.gif b/docs/static/c-ide/senator-jump.gif similarity index 100% rename from emacs-tutor/static/c-ide/senator-jump.gif rename to docs/static/c-ide/senator-jump.gif diff --git a/emacs-tutor/static/c-ide/senator-kill-yank-tag.gif b/docs/static/c-ide/senator-kill-yank-tag.gif similarity index 100% rename from emacs-tutor/static/c-ide/senator-kill-yank-tag.gif rename to docs/static/c-ide/senator-kill-yank-tag.gif diff --git a/emacs-tutor/static/c-ide/senator-next-previous-tag.gif b/docs/static/c-ide/senator-next-previous-tag.gif similarity index 100% rename from emacs-tutor/static/c-ide/senator-next-previous-tag.gif rename to docs/static/c-ide/senator-next-previous-tag.gif diff --git a/emacs-tutor/static/c-ide/senator-yank-tag.gif b/docs/static/c-ide/senator-yank-tag.gif similarity index 100% rename from emacs-tutor/static/c-ide/senator-yank-tag.gif rename to docs/static/c-ide/senator-yank-tag.gif diff --git a/emacs-tutor/static/c-ide/sr-speedbar.gif b/docs/static/c-ide/sr-speedbar.gif similarity index 100% rename from emacs-tutor/static/c-ide/sr-speedbar.gif rename to docs/static/c-ide/sr-speedbar.gif diff --git a/emacs-tutor/static/c-x-3.gif b/docs/static/c-x-3.gif similarity index 100% rename from emacs-tutor/static/c-x-3.gif rename to docs/static/c-x-3.gif diff --git a/emacs-tutor/static/c-x-c-x.gif b/docs/static/c-x-c-x.gif similarity index 100% rename from emacs-tutor/static/c-x-c-x.gif rename to docs/static/c-x-c-x.gif diff --git a/emacs-tutor/static/candidates.jpg b/docs/static/candidates.jpg similarity index 100% rename from emacs-tutor/static/candidates.jpg rename to docs/static/candidates.jpg diff --git a/emacs-tutor/static/comment.gif b/docs/static/comment.gif similarity index 100% rename from emacs-tutor/static/comment.gif rename to docs/static/comment.gif diff --git a/emacs-tutor/static/dired-subdir.gif b/docs/static/dired-subdir.gif similarity index 100% rename from emacs-tutor/static/dired-subdir.gif rename to docs/static/dired-subdir.gif diff --git a/emacs-tutor/static/emacs-manual-toc.gif b/docs/static/emacs-manual-toc.gif similarity index 100% rename from emacs-tutor/static/emacs-manual-toc.gif rename to docs/static/emacs-manual-toc.gif diff --git a/emacs-tutor/static/emacs-read-pdf.gif b/docs/static/emacs-read-pdf.gif similarity index 100% rename from emacs-tutor/static/emacs-read-pdf.gif rename to docs/static/emacs-read-pdf.gif diff --git a/emacs-tutor/static/ffap.gif b/docs/static/ffap.gif similarity index 100% rename from emacs-tutor/static/ffap.gif rename to docs/static/ffap.gif diff --git a/emacs-tutor/static/find-file-ido.gif b/docs/static/find-file-ido.gif similarity index 100% rename from emacs-tutor/static/find-file-ido.gif rename to docs/static/find-file-ido.gif diff --git a/emacs-tutor/static/find-file-normal.gif b/docs/static/find-file-normal.gif similarity index 100% rename from emacs-tutor/static/find-file-normal.gif rename to docs/static/find-file-normal.gif diff --git a/emacs-tutor/static/frames-gui.gif b/docs/static/frames-gui.gif similarity index 100% rename from emacs-tutor/static/frames-gui.gif rename to docs/static/frames-gui.gif diff --git a/emacs-tutor/static/frames-term.gif b/docs/static/frames-term.gif similarity index 100% rename from emacs-tutor/static/frames-term.gif rename to docs/static/frames-term.gif diff --git a/emacs-tutor/static/func_args.jpg b/docs/static/func_args.jpg similarity index 100% rename from emacs-tutor/static/func_args.jpg rename to docs/static/func_args.jpg diff --git a/emacs-tutor/static/gdb-many-windows1.png b/docs/static/gdb-many-windows1.png similarity index 100% rename from emacs-tutor/static/gdb-many-windows1.png rename to docs/static/gdb-many-windows1.png diff --git a/emacs-tutor/static/gdb-many-windows2.png b/docs/static/gdb-many-windows2.png similarity index 100% rename from emacs-tutor/static/gdb-many-windows2.png rename to docs/static/gdb-many-windows2.png diff --git a/emacs-tutor/static/ggtags-create-tags.gif b/docs/static/ggtags-create-tags.gif similarity index 100% rename from emacs-tutor/static/ggtags-create-tags.gif rename to docs/static/ggtags-create-tags.gif diff --git a/emacs-tutor/static/ggtags-find-file-bug.gif b/docs/static/ggtags-find-file-bug.gif similarity index 100% rename from emacs-tutor/static/ggtags-find-file-bug.gif rename to docs/static/ggtags-find-file-bug.gif diff --git a/emacs-tutor/static/ggtags-find-file.gif b/docs/static/ggtags-find-file.gif similarity index 100% rename from emacs-tutor/static/ggtags-find-file.gif rename to docs/static/ggtags-find-file.gif diff --git a/emacs-tutor/static/ggtags-rerun.gif b/docs/static/ggtags-rerun.gif similarity index 100% rename from emacs-tutor/static/ggtags-rerun.gif rename to docs/static/ggtags-rerun.gif diff --git a/emacs-tutor/static/ggtags-view-tag-history.gif b/docs/static/ggtags-view-tag-history.gif similarity index 100% rename from emacs-tutor/static/ggtags-view-tag-history.gif rename to docs/static/ggtags-view-tag-history.gif diff --git a/emacs-tutor/static/gnu-global-dir-struct.jpg b/docs/static/gnu-global-dir-struct.jpg similarity index 100% rename from emacs-tutor/static/gnu-global-dir-struct.jpg rename to docs/static/gnu-global-dir-struct.jpg diff --git a/emacs-tutor/static/grep.gif b/docs/static/grep.gif similarity index 100% rename from emacs-tutor/static/grep.gif rename to docs/static/grep.gif diff --git a/emacs-tutor/static/helm-buffer-list.gif b/docs/static/helm-buffer-list.gif similarity index 100% rename from emacs-tutor/static/helm-buffer-list.gif rename to docs/static/helm-buffer-list.gif diff --git a/emacs-tutor/static/helm-new-file-buffer.gif b/docs/static/helm-new-file-buffer.gif similarity index 100% rename from emacs-tutor/static/helm-new-file-buffer.gif rename to docs/static/helm-new-file-buffer.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-1.gif b/docs/static/helm-projectile/helm-projectile-1.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-1.gif rename to docs/static/helm-projectile/helm-projectile-1.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif b/docs/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif rename to docs/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-complete-at-point.gif b/docs/static/helm-projectile/helm-projectile-complete-at-point.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-complete-at-point.gif rename to docs/static/helm-projectile/helm-projectile-complete-at-point.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif b/docs/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif rename to docs/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-etags.gif b/docs/static/helm-projectile/helm-projectile-etags.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-etags.gif rename to docs/static/helm-projectile/helm-projectile-etags.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-file-as-root.gif b/docs/static/helm-projectile/helm-projectile-find-file-as-root.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-file-as-root.gif rename to docs/static/helm-projectile/helm-projectile-find-file-as-root.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-file-copy.gif b/docs/static/helm-projectile/helm-projectile-find-file-copy.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-file-copy.gif rename to docs/static/helm-projectile/helm-projectile-find-file-copy.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-file-delete.gif b/docs/static/helm-projectile/helm-projectile-find-file-delete.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-file-delete.gif rename to docs/static/helm-projectile/helm-projectile-find-file-delete.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-file-ediff.gif b/docs/static/helm-projectile/helm-projectile-find-file-ediff.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-file-ediff.gif rename to docs/static/helm-projectile/helm-projectile-find-file-ediff.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-file-other-window.gif b/docs/static/helm-projectile/helm-projectile-find-file-other-window.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-file-other-window.gif rename to docs/static/helm-projectile/helm-projectile-find-file-other-window.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-files-1.gif b/docs/static/helm-projectile/helm-projectile-find-files-1.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-files-1.gif rename to docs/static/helm-projectile/helm-projectile-find-files-1.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-files-dwim-1.gif b/docs/static/helm-projectile/helm-projectile-find-files-dwim-1.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-files-dwim-1.gif rename to docs/static/helm-projectile/helm-projectile-find-files-dwim-1.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-find-other-file.gif b/docs/static/helm-projectile/helm-projectile-find-other-file.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-find-other-file.gif rename to docs/static/helm-projectile/helm-projectile-find-other-file.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-grep.gif b/docs/static/helm-projectile/helm-projectile-grep.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-grep.gif rename to docs/static/helm-projectile/helm-projectile-grep.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-new-virtual-dir.gif b/docs/static/helm-projectile/helm-projectile-new-virtual-dir.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-new-virtual-dir.gif rename to docs/static/helm-projectile/helm-projectile-new-virtual-dir.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-remove-project.gif b/docs/static/helm-projectile/helm-projectile-remove-project.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-remove-project.gif rename to docs/static/helm-projectile/helm-projectile-remove-project.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-rename-file.gif b/docs/static/helm-projectile/helm-projectile-rename-file.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-rename-file.gif rename to docs/static/helm-projectile/helm-projectile-rename-file.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-serial-rename-file.gif b/docs/static/helm-projectile/helm-projectile-serial-rename-file.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-serial-rename-file.gif rename to docs/static/helm-projectile/helm-projectile-serial-rename-file.gif diff --git a/emacs-tutor/static/helm-projectile/helm-projectile-switch-project.gif b/docs/static/helm-projectile/helm-projectile-switch-project.gif similarity index 100% rename from emacs-tutor/static/helm-projectile/helm-projectile-switch-project.gif rename to docs/static/helm-projectile/helm-projectile-switch-project.gif diff --git a/emacs-tutor/static/helm_projectile.gif b/docs/static/helm_projectile.gif similarity index 100% rename from emacs-tutor/static/helm_projectile.gif rename to docs/static/helm_projectile.gif diff --git a/emacs-tutor/static/ibuffer-dired-group.gif b/docs/static/ibuffer-dired-group.gif similarity index 100% rename from emacs-tutor/static/ibuffer-dired-group.gif rename to docs/static/ibuffer-dired-group.gif diff --git a/emacs-tutor/static/ibuffer-filter-major.gif b/docs/static/ibuffer-filter-major.gif similarity index 100% rename from emacs-tutor/static/ibuffer-filter-major.gif rename to docs/static/ibuffer-filter-major.gif diff --git a/emacs-tutor/static/insert_buf2_macro.gif b/docs/static/insert_buf2_macro.gif similarity index 100% rename from emacs-tutor/static/insert_buf2_macro.gif rename to docs/static/insert_buf2_macro.gif diff --git a/emacs-tutor/static/jump_headers.gif b/docs/static/jump_headers.gif similarity index 100% rename from emacs-tutor/static/jump_headers.gif rename to docs/static/jump_headers.gif diff --git a/emacs-tutor/static/linux-dir.gif b/docs/static/linux-dir.gif similarity index 100% rename from emacs-tutor/static/linux-dir.gif rename to docs/static/linux-dir.gif diff --git a/emacs-tutor/static/live_grep.gif b/docs/static/live_grep.gif similarity index 100% rename from emacs-tutor/static/live_grep.gif rename to docs/static/live_grep.gif diff --git a/emacs-tutor/static/macro.gif b/docs/static/macro.gif similarity index 100% rename from emacs-tutor/static/macro.gif rename to docs/static/macro.gif diff --git a/emacs-tutor/static/macro2_full.gif b/docs/static/macro2_full.gif similarity index 100% rename from emacs-tutor/static/macro2_full.gif rename to docs/static/macro2_full.gif diff --git a/emacs-tutor/static/magit.gif b/docs/static/magit.gif similarity index 100% rename from emacs-tutor/static/magit.gif rename to docs/static/magit.gif diff --git a/emacs-tutor/static/modeline.jpg b/docs/static/modeline.jpg similarity index 100% rename from emacs-tutor/static/modeline.jpg rename to docs/static/modeline.jpg diff --git a/emacs-tutor/static/multiple-windows.gif b/docs/static/multiple-windows.gif similarity index 100% rename from emacs-tutor/static/multiple-windows.gif rename to docs/static/multiple-windows.gif diff --git a/emacs-tutor/static/occur-edit.gif b/docs/static/occur-edit.gif similarity index 100% rename from emacs-tutor/static/occur-edit.gif rename to docs/static/occur-edit.gif diff --git a/emacs-tutor/static/occur.gif b/docs/static/occur.gif similarity index 100% rename from emacs-tutor/static/occur.gif rename to docs/static/occur.gif diff --git a/emacs-tutor/static/part3/backward-sexp.gif b/docs/static/part3/backward-sexp.gif similarity index 100% rename from emacs-tutor/static/part3/backward-sexp.gif rename to docs/static/part3/backward-sexp.gif diff --git a/emacs-tutor/static/part3/customize.jpg b/docs/static/part3/customize.jpg similarity index 100% rename from emacs-tutor/static/part3/customize.jpg rename to docs/static/part3/customize.jpg diff --git a/emacs-tutor/static/part3/diff-hl-buffer.png b/docs/static/part3/diff-hl-buffer.png similarity index 100% rename from emacs-tutor/static/part3/diff-hl-buffer.png rename to docs/static/part3/diff-hl-buffer.png diff --git a/emacs-tutor/static/part3/diff-hl-dired.png b/docs/static/part3/diff-hl-dired.png similarity index 100% rename from emacs-tutor/static/part3/diff-hl-dired.png rename to docs/static/part3/diff-hl-dired.png diff --git a/emacs-tutor/static/part3/diff-hl-margin.png b/docs/static/part3/diff-hl-margin.png similarity index 100% rename from emacs-tutor/static/part3/diff-hl-margin.png rename to docs/static/part3/diff-hl-margin.png diff --git a/emacs-tutor/static/part3/dired-plus.jpg b/docs/static/part3/dired-plus.jpg similarity index 100% rename from emacs-tutor/static/part3/dired-plus.jpg rename to docs/static/part3/dired-plus.jpg diff --git a/emacs-tutor/static/part3/discover-my-major.png b/docs/static/part3/discover-my-major.png similarity index 100% rename from emacs-tutor/static/part3/discover-my-major.png rename to docs/static/part3/discover-my-major.png diff --git a/emacs-tutor/static/part3/forward-sexp.gif b/docs/static/part3/forward-sexp.gif similarity index 100% rename from emacs-tutor/static/part3/forward-sexp.gif rename to docs/static/part3/forward-sexp.gif diff --git a/emacs-tutor/static/part3/golden-ratio.gif b/docs/static/part3/golden-ratio.gif similarity index 100% rename from emacs-tutor/static/part3/golden-ratio.gif rename to docs/static/part3/golden-ratio.gif diff --git a/emacs-tutor/static/part3/helm-all-mark-rings.gif b/docs/static/part3/helm-all-mark-rings.gif similarity index 100% rename from emacs-tutor/static/part3/helm-all-mark-rings.gif rename to docs/static/part3/helm-all-mark-rings.gif diff --git a/emacs-tutor/static/part3/helm-autoresize-fix.gif b/docs/static/part3/helm-autoresize-fix.gif similarity index 100% rename from emacs-tutor/static/part3/helm-autoresize-fix.gif rename to docs/static/part3/helm-autoresize-fix.gif diff --git a/emacs-tutor/static/part3/helm-autoresize-mode.gif b/docs/static/part3/helm-autoresize-mode.gif similarity index 100% rename from emacs-tutor/static/part3/helm-autoresize-mode.gif rename to docs/static/part3/helm-autoresize-mode.gif diff --git a/emacs-tutor/static/part3/helm-calc.gif b/docs/static/part3/helm-calc.gif similarity index 100% rename from emacs-tutor/static/part3/helm-calc.gif rename to docs/static/part3/helm-calc.gif diff --git a/emacs-tutor/static/part3/helm-color.gif b/docs/static/part3/helm-color.gif similarity index 100% rename from emacs-tutor/static/part3/helm-color.gif rename to docs/static/part3/helm-color.gif diff --git a/emacs-tutor/static/part3/helm-eshell-history.gif b/docs/static/part3/helm-eshell-history.gif similarity index 100% rename from emacs-tutor/static/part3/helm-eshell-history.gif rename to docs/static/part3/helm-eshell-history.gif diff --git a/emacs-tutor/static/part3/helm-eval-expression.gif b/docs/static/part3/helm-eval-expression.gif similarity index 100% rename from emacs-tutor/static/part3/helm-eval-expression.gif rename to docs/static/part3/helm-eval-expression.gif diff --git a/emacs-tutor/static/part3/helm-find-files.gif b/docs/static/part3/helm-find-files.gif similarity index 100% rename from emacs-tutor/static/part3/helm-find-files.gif rename to docs/static/part3/helm-find-files.gif diff --git a/emacs-tutor/static/part3/helm-find.gif b/docs/static/part3/helm-find.gif similarity index 100% rename from emacs-tutor/static/part3/helm-find.gif rename to docs/static/part3/helm-find.gif diff --git a/emacs-tutor/static/part3/helm-google-suggest.gif b/docs/static/part3/helm-google-suggest.gif similarity index 100% rename from emacs-tutor/static/part3/helm-google-suggest.gif rename to docs/static/part3/helm-google-suggest.gif diff --git a/emacs-tutor/static/part3/helm-kill-ring.gif b/docs/static/part3/helm-kill-ring.gif similarity index 100% rename from emacs-tutor/static/part3/helm-kill-ring.gif rename to docs/static/part3/helm-kill-ring.gif diff --git a/emacs-tutor/static/part3/helm-locate.gif b/docs/static/part3/helm-locate.gif similarity index 100% rename from emacs-tutor/static/part3/helm-locate.gif rename to docs/static/part3/helm-locate.gif diff --git a/emacs-tutor/static/part3/helm-m-x.gif b/docs/static/part3/helm-m-x.gif similarity index 100% rename from emacs-tutor/static/part3/helm-m-x.gif rename to docs/static/part3/helm-m-x.gif diff --git a/emacs-tutor/static/part3/helm-man-woman.gif b/docs/static/part3/helm-man-woman.gif similarity index 100% rename from emacs-tutor/static/part3/helm-man-woman.gif rename to docs/static/part3/helm-man-woman.gif diff --git a/emacs-tutor/static/part3/helm-mini.gif b/docs/static/part3/helm-mini.gif similarity index 100% rename from emacs-tutor/static/part3/helm-mini.gif rename to docs/static/part3/helm-mini.gif diff --git a/emacs-tutor/static/part3/helm-occur.gif b/docs/static/part3/helm-occur.gif similarity index 100% rename from emacs-tutor/static/part3/helm-occur.gif rename to docs/static/part3/helm-occur.gif diff --git a/emacs-tutor/static/part3/helm-regexp.gif b/docs/static/part3/helm-regexp.gif similarity index 100% rename from emacs-tutor/static/part3/helm-regexp.gif rename to docs/static/part3/helm-regexp.gif diff --git a/emacs-tutor/static/part3/helm-registers.gif b/docs/static/part3/helm-registers.gif similarity index 100% rename from emacs-tutor/static/part3/helm-registers.gif rename to docs/static/part3/helm-registers.gif diff --git a/emacs-tutor/static/part3/helm-semantic-or-imenu-2.gif b/docs/static/part3/helm-semantic-or-imenu-2.gif similarity index 100% rename from emacs-tutor/static/part3/helm-semantic-or-imenu-2.gif rename to docs/static/part3/helm-semantic-or-imenu-2.gif diff --git a/emacs-tutor/static/part3/helm-semantic-or-imenu.gif b/docs/static/part3/helm-semantic-or-imenu.gif similarity index 100% rename from emacs-tutor/static/part3/helm-semantic-or-imenu.gif rename to docs/static/part3/helm-semantic-or-imenu.gif diff --git a/emacs-tutor/static/part3/helm-surfraw.gif b/docs/static/part3/helm-surfraw.gif similarity index 100% rename from emacs-tutor/static/part3/helm-surfraw.gif rename to docs/static/part3/helm-surfraw.gif diff --git a/emacs-tutor/static/part3/helm-top.gif b/docs/static/part3/helm-top.gif similarity index 100% rename from emacs-tutor/static/part3/helm-top.gif rename to docs/static/part3/helm-top.gif diff --git a/emacs-tutor/static/part3/ibuffer-vc.png b/docs/static/part3/ibuffer-vc.png similarity index 100% rename from emacs-tutor/static/part3/ibuffer-vc.png rename to docs/static/part3/ibuffer-vc.png diff --git a/emacs-tutor/static/part3/kill-sexp.gif b/docs/static/part3/kill-sexp.gif similarity index 100% rename from emacs-tutor/static/part3/kill-sexp.gif rename to docs/static/part3/kill-sexp.gif diff --git a/emacs-tutor/static/part3/mark-sexp.gif b/docs/static/part3/mark-sexp.gif similarity index 100% rename from emacs-tutor/static/part3/mark-sexp.gif rename to docs/static/part3/mark-sexp.gif diff --git a/emacs-tutor/static/part3/nyan-mode.png b/docs/static/part3/nyan-mode.png similarity index 100% rename from emacs-tutor/static/part3/nyan-mode.png rename to docs/static/part3/nyan-mode.png diff --git a/emacs-tutor/static/part3/projectile.png b/docs/static/part3/projectile.png similarity index 100% rename from emacs-tutor/static/part3/projectile.png rename to docs/static/part3/projectile.png diff --git a/emacs-tutor/static/part3/rainbow-mode.png b/docs/static/part3/rainbow-mode.png similarity index 100% rename from emacs-tutor/static/part3/rainbow-mode.png rename to docs/static/part3/rainbow-mode.png diff --git a/emacs-tutor/static/part3/smex.png b/docs/static/part3/smex.png similarity index 100% rename from emacs-tutor/static/part3/smex.png rename to docs/static/part3/smex.png diff --git a/emacs-tutor/static/part3/transpose-sexp.gif b/docs/static/part3/transpose-sexp.gif similarity index 100% rename from emacs-tutor/static/part3/transpose-sexp.gif rename to docs/static/part3/transpose-sexp.gif diff --git a/emacs-tutor/static/part3/undo-tree.jpg b/docs/static/part3/undo-tree.jpg similarity index 100% rename from emacs-tutor/static/part3/undo-tree.jpg rename to docs/static/part3/undo-tree.jpg diff --git a/emacs-tutor/static/part3/ztree-diff.png b/docs/static/part3/ztree-diff.png similarity index 100% rename from emacs-tutor/static/part3/ztree-diff.png rename to docs/static/part3/ztree-diff.png diff --git a/emacs-tutor/static/part3/ztree-dir.png b/docs/static/part3/ztree-dir.png similarity index 100% rename from emacs-tutor/static/part3/ztree-dir.png rename to docs/static/part3/ztree-dir.png diff --git a/emacs-tutor/static/path-variable-windows.jpg b/docs/static/path-variable-windows.jpg similarity index 100% rename from emacs-tutor/static/path-variable-windows.jpg rename to docs/static/path-variable-windows.jpg diff --git a/emacs-tutor/static/performance.gif b/docs/static/performance.gif similarity index 100% rename from emacs-tutor/static/performance.gif rename to docs/static/performance.gif diff --git a/emacs-tutor/static/prepare_macro.gif b/docs/static/prepare_macro.gif similarity index 100% rename from emacs-tutor/static/prepare_macro.gif rename to docs/static/prepare_macro.gif diff --git a/emacs-tutor/static/proglang/aggressive-indent.gif b/docs/static/proglang/aggressive-indent.gif similarity index 100% rename from emacs-tutor/static/proglang/aggressive-indent.gif rename to docs/static/proglang/aggressive-indent.gif diff --git a/emacs-tutor/static/proglang/emacs_home.png b/docs/static/proglang/emacs_home.png similarity index 100% rename from emacs-tutor/static/proglang/emacs_home.png rename to docs/static/proglang/emacs_home.png diff --git a/emacs-tutor/static/proglang/emacs_path.png b/docs/static/proglang/emacs_path.png similarity index 100% rename from emacs-tutor/static/proglang/emacs_path.png rename to docs/static/proglang/emacs_path.png diff --git a/emacs-tutor/static/proglang/forward-backward-parens.gif b/docs/static/proglang/forward-backward-parens.gif similarity index 100% rename from emacs-tutor/static/proglang/forward-backward-parens.gif rename to docs/static/proglang/forward-backward-parens.gif diff --git a/emacs-tutor/static/proglang/geiser-demo.gif b/docs/static/proglang/geiser-demo.gif similarity index 100% rename from emacs-tutor/static/proglang/geiser-demo.gif rename to docs/static/proglang/geiser-demo.gif diff --git a/emacs-tutor/static/proglang/monokai.png b/docs/static/proglang/monokai.png similarity index 100% rename from emacs-tutor/static/proglang/monokai.png rename to docs/static/proglang/monokai.png diff --git a/emacs-tutor/static/proglang/repl-autodoc.png b/docs/static/proglang/repl-autodoc.png similarity index 100% rename from emacs-tutor/static/proglang/repl-autodoc.png rename to docs/static/proglang/repl-autodoc.png diff --git a/emacs-tutor/static/proglang/repl-mod.png b/docs/static/proglang/repl-mod.png similarity index 100% rename from emacs-tutor/static/proglang/repl-mod.png rename to docs/static/proglang/repl-mod.png diff --git a/emacs-tutor/static/proglang/sml-completion.gif b/docs/static/proglang/sml-completion.gif similarity index 100% rename from emacs-tutor/static/proglang/sml-completion.gif rename to docs/static/proglang/sml-completion.gif diff --git a/emacs-tutor/static/proglang/sml-helm-imenu.gif b/docs/static/proglang/sml-helm-imenu.gif similarity index 100% rename from emacs-tutor/static/proglang/sml-helm-imenu.gif rename to docs/static/proglang/sml-helm-imenu.gif diff --git a/emacs-tutor/static/proglang/sml-send-buffer.gif b/docs/static/proglang/sml-send-buffer.gif similarity index 100% rename from emacs-tutor/static/proglang/sml-send-buffer.gif rename to docs/static/proglang/sml-send-buffer.gif diff --git a/emacs-tutor/static/proglang/sml-send-region.gif b/docs/static/proglang/sml-send-region.gif similarity index 100% rename from emacs-tutor/static/proglang/sml-send-region.gif rename to docs/static/proglang/sml-send-region.gif diff --git a/emacs-tutor/static/proglang/sml-start-proc.gif b/docs/static/proglang/sml-start-proc.gif similarity index 100% rename from emacs-tutor/static/proglang/sml-start-proc.gif rename to docs/static/proglang/sml-start-proc.gif diff --git a/emacs-tutor/static/proglang/zenburn.png b/docs/static/proglang/zenburn.png similarity index 100% rename from emacs-tutor/static/proglang/zenburn.png rename to docs/static/proglang/zenburn.png diff --git a/emacs-tutor/static/reg_a.gif b/docs/static/reg_a.gif similarity index 100% rename from emacs-tutor/static/reg_a.gif rename to docs/static/reg_a.gif diff --git a/emacs-tutor/static/reg_b.gif b/docs/static/reg_b.gif similarity index 100% rename from emacs-tutor/static/reg_b.gif rename to docs/static/reg_b.gif diff --git a/emacs-tutor/static/reg_c.gif b/docs/static/reg_c.gif similarity index 100% rename from emacs-tutor/static/reg_c.gif rename to docs/static/reg_c.gif diff --git a/emacs-tutor/static/reg_d.gif b/docs/static/reg_d.gif similarity index 100% rename from emacs-tutor/static/reg_d.gif rename to docs/static/reg_d.gif diff --git a/emacs-tutor/static/register-windows.gif b/docs/static/register-windows.gif similarity index 100% rename from emacs-tutor/static/register-windows.gif rename to docs/static/register-windows.gif diff --git a/emacs-tutor/static/setup-emacs-windows/emacs_xwidgets_windows.png b/docs/static/setup-emacs-windows/emacs_xwidgets_windows.png similarity index 100% rename from emacs-tutor/static/setup-emacs-windows/emacs_xwidgets_windows.png rename to docs/static/setup-emacs-windows/emacs_xwidgets_windows.png diff --git a/emacs-tutor/static/setup-emacs-windows/pdf_tools_windows_latex.gif b/docs/static/setup-emacs-windows/pdf_tools_windows_latex.gif similarity index 100% rename from emacs-tutor/static/setup-emacs-windows/pdf_tools_windows_latex.gif rename to docs/static/setup-emacs-windows/pdf_tools_windows_latex.gif diff --git a/emacs-tutor/static/setup-emacs-windows/xserver_example.png b/docs/static/setup-emacs-windows/xserver_example.png similarity index 100% rename from emacs-tutor/static/setup-emacs-windows/xserver_example.png rename to docs/static/setup-emacs-windows/xserver_example.png diff --git a/emacs-tutor/static/vc-diff.jpg b/docs/static/vc-diff.jpg similarity index 100% rename from emacs-tutor/static/vc-diff.jpg rename to docs/static/vc-diff.jpg diff --git a/emacs-tutor/static/worg.css b/docs/static/worg.css similarity index 100% rename from emacs-tutor/static/worg.css rename to docs/static/worg.css diff --git a/emacs-tutor/cedet.org b/emacs-tutor/cedet.org deleted file mode 100644 index 0a5662a..0000000 --- a/emacs-tutor/cedet.org +++ /dev/null @@ -1,315 +0,0 @@ -#+TITLE: C/C++ development with =CEDET= -* What is CEDET? -:PROPERTIES: -:ID: 5e06a903-4853-4093-a5b0-b5b28b3a6eaa -:END: -CEDET is a (C)ollection of (E)macs (D)evelopment (E)nvironment (T)ools written -with the end goal of creating an advanced development environment in -Emacs. CEDET includes common features such as intelligent completion, -source code navigation, project management, code generation with -templates . CEDET also provides a framework for working with -programming languages; support for new programming languages can be -added and use CEDET to provide IDE-like features. - -This tutorial only helps you use CEDET to get IDE features for C/C++, -not adding support for a new programming language using CEDET. - -* Why use CEDET? -:PROPERTIES: -:ID: b8922b61-b52a-4690-8626-4ca463dd2f85 -:END: -CEDET is simple to setup and portable (right winthin Emacs and written -entirely with Emacs Lisp). Without CEDET, you have to use external -tools and third party Emacs packages. The downside of external tools -is that they are not specifically designed for Emacs. They have -similar use cases, but not always satisfying. For example, source code -indexing tools such as GNU Global and Exuberant Ctags are really good -at working static source code, but they do not keep track changes in -real time; CEDET does: - -...[screenshot]... - -As you can see, CEDET recognizes when =printk.h= is included and -provides appropriate completion candidates. In constrast, non-context -sentisve completion is like this: - -...[screenshot]... - -In this case, the completion system gets all candidates straight from -GNU Global generated database without considering current context. - -The disadvantage is that CEDET is written in Emacs Lisp, and it is -bound to the performance limitations of Emacs. Even though, CEDET is -still really fast for moderate-size source files. CEDET also makes use -of external tools like GNU Global or Cscope or Exuberant Ctags for -finding symbol references/definition in a project to reduce its -workload. - -* Installation -:PROPERTIES: -:ID: fd13a740-7ffe-4924-8a57-d627bc1401f4 -:END: -CEDET was merged into Emacs since 23.2. You do not need to install -CEDET manually. However, you can also use the development repository -that contains latest bug fixes and more features. Nevertheless, the -built-in Emacs is still adequate for daily usage and convenient for -trying out before actually cloning and use the development version. - -If you really want to use the development version with latest feature, -checkout this branch: - -#+begin_src sh - bzr checkout bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/ede-ldf cedet -#+end_src - -Then compile it: - -#+begin_src sh - cd cedet - make # wait for it to complete - cd contrib - make -#+end_src - -Finally, assume that you placed your newly cloned CEDET in -=~/.emacs.d=, load it into your Emacs: - -#+begin_src emacs-lisp - (load-file (concat user-emacs-directory "/cedet/cedet-devel-load.el")) - (load-file (concat user-emacs-directory "cedet/contrib/cedet-contrib-load.el")) -#+end_src - -* Semantic minor modes -:PROPERTIES: -:ID: e57ff2d7-623a-4feb-91ac-c69487996527 -:END: -=Semantic= is a package that provides language-aware editing commands -based on source code parsers. Parsing is a process of analyzing source -code based on programming language syntax. Emacs understands your -source code through this process to provides features such as -contextual code completion, code navigation. - -** Command: =semantic-mode= -:PROPERTIES: -:ID: 8f24eec1-81f5-445b-bdc7-1b7e27943ce5 -:END: -This command activates =semantic-mode=. In Semantic mode, Emacs parses -the buffers you visit for their semantic content. The parsing looks -like this: - -...[screenshot]... - -Notice that at the bottom, Emacs prints messages like this: =Parsing - (LL)...=. This is common behavior of -=Semantic=: when you perform a jump to a symbol or perform a -completion, =Semantic= tries to be accurate by parsing all the -included files and all the included files in the included files and so -on, until it reaches the end. - -You may worry that this process would take a long time. Indeed, it -does. However, this is just a one time process. Once it is parsed, -Semantic will cache the parsing result for future use. The next time -you perform some action on the parsed code, you will get your desired -output instantly. - -** Command: =global-semanticdb-minor-mode= -:PROPERTIES: -:ID: 668b4f56-2977-4783-b7cb-b5d84a0dd769 -:END: -As mentioned above, Semantic caches parsing output for future -use. To do that, =semanticdb-minor-mode= must be activated. In -Semantic DB mode, Semantic parsers store results in a database, which -can be saved for future Emacs sessions. The cache is saved in -directory specified by =semanticdb-default-save-directory= -variable. The default directory is =~/.emacs.d/semanticdb=. - -** Command: =global-semantic-idle-scheduler-mode= -:PROPERTIES: -:ID: fb0dd2f4-78c0-4e9c-b9d7-0ec4caa3fde3 -:END: -When =semantic-idle-scheduler-mode= is enabled, Emacs periodically -checks to see if the buffer is out of date, and reparses while the -user is idle (not typing). When this mode is off, a buffer is only -reparsed when user explicitly issue some command. - -With =semantic-idle-scheduler-mode=, Emacs keeps track live changes of -your source code. - -** Command: =global-semantic-idle-summary-mode= -:PROPERTIES: -:ID: 3988c0b5-5cd2-409f-9825-54ac476bca7a -:END: -...[screenshot]... -When this minor mode is enabled, the echo area displays a summary of -the symbol at point whenever Emacs is idle. For example, in the above -picture, the function interface is displayed because the symbol at -point is a function name. - -** Command: =global-semantic-decoration-mode= -:PROPERTIES: -:ID: fd13b113-2460-4dea-8bae-aadc7bcf8d1d -:END: -...screenshot]... - -This mode "decorates" certain type of tags, i.e. included header, -function name, class... This can be defined by users. - -** Command: =global-semantic-idle-completions-mode= -:PROPERTIES: -:ID: b6630c63-04b2-4ddc-a209-273384b1f8f9 -:END: -When enabled, Emacs displays a list of possible completions at idle -time. - -While a completion is displayed, RET accepts the completion; M-n and -M-p cycle through completion alternatives; TAB attempts to complete as -far as possible, and cycles if no additional completion is possible; -and any other command cancels the completion: - -...[screenshot]... - -** Command: =global-semantic-highlight-func-mode= -:PROPERTIES: -:ID: 42e31b85-90de-4bf8-99fb-8778d312178d -:END: -...[screenshot]... -** Command: =global-semantic-stickyfunc-mode= -:PROPERTIES: -:ID: d5bd8f70-92c2-4143-8be1-2d5be650ea28 -:END: -...[screenshot]... -** Command: =global-semantic-mru-bookmark-mode= -:PROPERTIES: -:ID: fe4d8d37-0455-4a7d-8a18-6ddb1226a046 -:END: -...[screenshot]... - -** Command: =global-cedet-m3-minor-mode= -:PROPERTIES: -:ID: e6ccdc02-c5ca-45a3-9114-bdc6bcc8ac7d -:END: -...[screenshot]... - -** Command: =global-semantic-idle-local-symbol-highlight-mode= -:PROPERTIES: -:ID: 67b03c99-46dc-4c30-940e-de842949447f -:END: -...[screenshot]... - -** Command: =global-semantic-highlight-edits-mode= -:PROPERTIES: -:ID: 4f2ee6d4-e10d-40c6-b5fd-78712946b312 -:END: -...[screenshot]... - -** Command: =global-semantic-show-unmatched-syntax-mode= -:PROPERTIES: -:ID: 84a2c5de-45ca-4788-988e-3ad3739725b5 -:END: -...[screenshot]... - -** Command: =global-semantic-show-parser-state-mode= -:PROPERTIES: -:ID: 06bd6895-c58c-460a-ac10-465acd03a6fd -:END: -...[screenshot]... - -* Setup and manage project with EDE -:PROPERTIES: -:ID: 243bfa47-475a-41fb-8f2f-78af150c95eb -:END: -* Source code navigation -:PROPERTIES: -:ID: 2b850804-a33b-4f37-96fd-5bb4e422dbee -:END: -** System include path -:PROPERTIES: -:ID: 754d6360-f8ee-4985-8a0b-794b59435123 -:END: - -** Project include path -:PROPERTIES: -:ID: ca17991f-1d1f-4767-b8fc-e9c06c44c25a -:END: - -** Find definitions in current buffer -:PROPERTIES: -:ID: d146d5d0-092c-4e62-a362-9dcb02a64a39 -:END: - -** Find definitions in project -:PROPERTIES: -:ID: 0331265b-7c3f-457e-ba1d-ef6c3cd24208 -:END: -** Find references in project -:PROPERTIES: -:ID: 410cfad4-a08d-4139-8c37-cb1bff5bd44e -:END: -* Source code completion -:PROPERTIES: -:ID: 419c04f5-95b6-4457-83fe-9288361e7bcf -:END: -* Source code manipulation -:PROPERTIES: -:ID: 0fa2afe0-728c-49f6-86f1-7769cebc5de0 -:END: -** Folding -:PROPERTIES: -:ID: 48b6ad5f-24e2-41c3-9a44-c1decdde6910 -:END: -** Narrowing -:PROPERTIES: -:ID: 000644fa-84e8-42a2-b780-6ff1b0c84a5a -:END: -** Semantically kill/copy/yank (copy/cut/paste) -:PROPERTIES: -:ID: 21edcf89-82dc-476c-ae5d-714cdce1c7b4 -:END: -* Integration with other tools -:PROPERTIES: -:ID: 4b5a5bfe-4589-4c7e-9f0d-4e24ad37153b -:END: -** GNU Global -:PROPERTIES: -:ID: 21ea863a-a4be-4f96-b83c-1d1cf1417621 -:END: -** Exuberant Ctags -:PROPERTIES: -:ID: 846ea88b-da99-4102-b909-136b9a6aefcd -:END: - -* Senator -:PROPERTIES: -:ID: 1b5ad129-a77f-4dd5-b9de-97a16f0126d3 -:END: -** Copy/Paste -:PROPERTIES: -:ID: a7861142-010c-4640-9ec7-d201dc918f92 -:END: - -- =C-c , M-w= runs =senator-copy-tag=, take the current tag, and place - it in the tag ring. - -- =C-c , C-w= runs =senator-kill-tag=, take the current tag, place it - in the tag ring, and kill it. Killing the tag removes the text for - that tag, and places it into the kill ring. Retrieve that text with - *C-y*. - - The above commands are basically like normal =M-w= and =C-w=, but are - used for tags. For example, run =C-c , C-w= with point inside a - function definition kills the whole function body and its - interface, and can be yanked back with *C-y*: - - - -- =C-c , C-y= runs =senator-yank-tag=, yank a tag from the tag - ring. The form the tag takes is different depending on where it is - being yanked to. - -- =C-c , r= runs =senator-copy-tag-to-register=, copy the current tag - into a register. - - - - with prefix argument will delete the text of the tag to the kill - ring. diff --git a/emacs-tutor/index.org b/emacs-tutor/index.org deleted file mode 100644 index 13f8f80..0000000 --- a/emacs-tutor/index.org +++ /dev/null @@ -1,11 +0,0 @@ -#+TITLE: Table of Contents - - + [[file:emacs-tutor.org][Emacs Mini Manual (PART 1) - THE BASICS]] - + [[file:emacs-tutor2.org][Emacs Mini Manual (PART 2) - LISP PRIMER: WHY PARENTHESES MATTER]] - + [[file:emacs-tutor3.org][Emacs Mini Manual (PART 3) - CUSTOMIZING AND EXTENDING EMACS]] - + [[file:c-ide.org][Setup C/C++ Development Environment for Emacs]] - + [[file:helm-intro.org][A Package in a league of its own: =Helm=]] - + [[file:helm-projectile.org][Exploring large projects with Projectile and Helm Projectile]] - + [[file:emacs-for-proglang.org][Emacs for Programming Languages course on Coursera]] - + [[file:setup-emacs-windows.org][Setup Emacs with PDF Tools and Xwidgets web browser on Windows]] - diff --git a/emacs-tutor3.html b/emacs-tutor3.html deleted file mode 100644 index 6f120e3..0000000 --- a/emacs-tutor3.html +++ /dev/null @@ -1,4811 +0,0 @@ - - - - - - - -Emacs Mini Manual (PART 3) - CUSTOMIZING AND EXTENDING EMACS - - - - - - - -
              - - - - -

              Back to Table of Contents

              -
              -
              -

              Emacs Mini Manual (PART 3) - CUSTOMIZING AND EXTENDING EMACS

              -
              -

              Table of Contents

              -
              - -
              -
              -
              -

              Why customize and extend Emacs?

              -
              -

              -Emacs comes with default settings. Some interesting features are -disabled and hidden, i.e. ibuffer, Semantic, electric -modes… Probably, to make it more user friendly to new users and -make it behave more like "normal" editors, i.e. Normal users do not -expect automatic pairing of punctuation marks like parentheses, -brackets, curly brackets… -

              - -

              -Because the nature of Emacs is an extensible system, people write -extensions to improve Emacs and share with others. The extensions -improve various aspects of Emacs: Improve existing and add new editing -features, integrate 3rd party tools, add programming languages -supports, change Emacs appearance… Without the ability to extend, -Emacs will just be another obscure editor with some useful features -but cannot meet the demands of people, because different people have -different needs, and Emacs maintainers cannot provide them all and -integrate all into Emacs. With the ability to extend, people can bend -Emacs the way they want, much like Lisp. -

              - -

              -Unlike other editors which encourage users to stay with the default as -much as they can, Emacs encourages users to customize and extend Emacs -as much as they can. -

              - -

              -In the old days, when Emacs did not have a package manager and did -not have many learning resources, it's really uneasy to customize -Emacs, because to customize Emacs properly you have to read a decent -chunk of the Emacs Lisp manual. Many of us, including me, do not have -that luxury of time. The way I learned to customize Emacs was copying -little code snippets that solve specific problems - when I encountered -them - and paste everything in my ~/.emacs file. I also had to -download Emacs packages manually and load it manually in ~/.emacs. I -hope that this guide helps you to be at least as good as me in -customizing Emacs without having to spend a long time in collecting -configurations, or reading the whole Emacs Lisp manual. After you -finish this chapter, you can dive in the Emacs Lisp manually if you -want, and easier. -

              -
              -
              - -
              -

              Just enough Emacs Lisp

              -
              -

              -In this section, you only need to read and understand. I will list the -commonly used function used for customizing Emacs that we will use in -later sections. It's important that you understand the core -ideas. After you finish the sub-sections of this section, we will play -with Emacs Lisp code for customizing Emacs, and it's really fun to see -your Emacs "evolves" gradually. -

              - -

              -It's worth to review again. To read most of Lisp code, it is easy. You -only need to these rules: -

              - -
                -
              • Code that get executed is a pair of parentheses, with things in it: -(...). The first element always gets evaluated; your Lisp -environment (in our case, Emacs) determines which of the following 3 -forms the symbol in the first slot is, then acts accordingly:
              • - -
              • -Function form: if the first element points to a function definition, -then the following elements get evaluated from left to right and -finally passed into the function as arguments. -

                - -

                -For example: -

                - -
                - -
                (message "Hello word %d" (+ 10 10))
                -
                -
                - -

                -message is a function that prints to echo area and *Message* -buffer (can be opened with C-h e). Emacs detects that message is a -function, then it evaluates the string "Hello world %d" and another -nested form (+ 10 10) sequentially. When Emacs gets to (+ 10 - 10), it evaluates the form and return 20. Then the string "Hello -world %d" and the number 20 are passed into message, and finally -output "Hello world 20" in the echo area and *Message* buffer. -

              • - -
              • -Special form: if the first element is one of predefined functions in -Emacs Lisp that need special rules and/or syntax, then the remaining -elements are evaluated depend on the rule of the predefined -functions. Special form is just function form, but handle the -remaining in its own way rather than using the default in function -form. That's why we call it special. -

                - -

                -For example, if is a special form as we learned in previous part: -

                - -
                - -
                (if condition
                -    true-case
                -  false-case)
                -
                -
                - -

                -condition is a valid Lisp form; if it is evaluated to true (which -is anything not NIL, or the empty list ()), then the true case - -also a valid Lisp form - gets evaluated; otherwise the false case - -also a valid Lisp form - gets evaluated. -

                - -

                -Another special form is and. After Emacs determines the first -element is and special form, then it keeps evaluating the -remaining elements from left to right until one of the element -return false. If all elements get evaluated, and returns true. -

              • - -
              • Macro form: if the first element is created by the function -defmacro (which you do not need to know at this stage), then Emacs -do not evaluate any remaining elements, but passes them in as -data. Macro is a way for programmers to create their own -mini-language that do not follow the evaluation rules predefined in -Emacs (function form and special form). If you read a form that is -not a function form or any predefined special form, don't panic! -It's a macro form. Programmers always provide documentations on how -to use their mini-languages.
              • -
              - -

              -After all, those different forms are just under one category: -function. Function form is a regular function; special form is a -function with its own rule; macro form is a function that generate -code. -

              - -
                -
              • Data: has two types:
              • - -
              • Atom: primitives such as number, string, symbol and NIL.
              • - -
              • -Non-atom: if you put a just before a form, it becomes -a list. Emacs treats these quoted forms as data. -

                - -

                -Emacs also has other data types like array, hash-table… but list -is the most popular, used when performance is not needed. -

              • -
              - -

              -In this section, I only explained the frequently used functions. In -the later sections, there are more functions used. I can't explain -them all. You should really work it out on your own gradually with -C-h f and C-h v. -

              -
              - -
              -

              Function: (setq [ SYM VAL ]…)

              -
              -

              -Comment: A really fundamental function for customizing Emacs -settings. An Emacs setting is really just a variable. Emacs has GUI -for changing setting, but setq a variable is also equivalent. -

              - -

              -Example: -

              - -
              - -
              (setq global-mark-ring-max 50000)
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -Set each SYM to the value of its VAL. -The symbols SYM are variables; they are literal (not evaluated). -The values VAL are expressions; they are evaluated. -Thus, (setq x (1+ y)) sets `x' to the value of `(1+ y)'. -The second VAL is not computed until after the first SYM is set, and so on; -each VAL can use the new value of variables set earlier in the `setq_'. -The return value of the `setq_' form is the value of the last VAL. -

              -
              -
              -
              - -
              -

              Function: (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)

              -
              -

              -Comment: This function allows you to load a file. FILE is the -a filename that is looked up in the variable load-path. Do you -notice &optional keyword? When you see this keyword, it means -everything after &optional is, optional. The parameters NOERROR, -NOMESSAGE, NOSUFFIX, MUST-SUFFIX are not required to be passed -into the function if you don't need. However, if you want to pass an -argument into the place of one a parameter, you must also pass -arguments to all the parameters to the left of your chosen -parameter. For example, if you want to pass an argument into -NOSUFFIX, you are required to pass arguments into NOERROR, -NOMESSAGE first. You are safe to ignore everything after your -chosen parameter, and in our example, it's MUST-SUFFIX. -

              - -

              -Example: -

              - -
              - -
              (load (substitute-in-file-name "$HOME/.emacs.d/module")) ;; first try to load module.elc; if not found, try to load module.el
              -(load (substitute-in-file-name "$HOME/.emacs.d/module.el")) ;; only load module.el
              -(load (substitute-in-file-name "$HOME/.emacs.d/module.elc")) ;; only load module.elc
              -(load "module") ; search for the file module.el or module.elc in variable load-path
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -Execute a file of Lisp code named FILE. -First try FILE with `.elc' appended, then try with `.el', then try -FILE unmodified (the exact suffixes in the exact order are determined -by `load-suffixes'). Environment variable references in FILE are -replaced with their values by calling `substitute-in-file-name'. This -function searches the directories in `load-path'. -

              - -

              -….(C-h f for more information)… -

              -
              -
              -
              -
              -

              Function: (require FEATURE &optional FILENAME NOERROR)

              -
              -

              -Comment: If you install a package from M-x list-packages, to -load that package, use (require 'installed-package). -

              - -

              -Example: For example, you installed package volatile-highlights, -to load it: -

              - -
              - -
              (require 'volatile-highlights)
              -
              -
              - -

              -Later in the guide, you will create your own custom modules that uses -provide function to provide new feature to Emacs. To use a feature, -the module must be activated with require. -

              - -

              -Built-in Documentation: -

              - -
              -

              -If feature FEATURE is not loaded, load it from FILENAME. -If FEATURE is not a member of the list `features', then the feature -is not loaded; so load the file FILENAME. -If FILENAME is omitted, the printname of FEATURE is used as the file name, -and `load' will try to load this name appended with the suffix `.elc' or -`.el', in that order. The name without appended suffix will not be used. -See `get-load-suffixes' for the complete list of suffixes. -If the optional third argument NOERROR is non-nil, -then return nil if the file is not found instead of signaling an error. -Normally the return value is FEATURE. -The normal messages at start and end of loading FILENAME are suppressed. -

              -
              -
              -
              - -
              -

              Function: (provide FEATURE &optional SUBFEATURES)

              -
              -

              -Comment: You can use this function at the end of a file to turn the -file into a loadable module that is only loaded when called with -require. -

              - -

              -Example: -

              - -

              -Suppose that in a file setup-editing.el, you put this line at the -bottom: -

              - -
              - -
              (provide 'setup-editing)
              -
              -
              - -

              -Then, even if you load it with load function, it won't be -activated. To activate, you have to execute (require -'setup-editing). -

              - -

              -Built-in Documentation: -

              - -
              -

              -Announce that FEATURE is a feature of the current Emacs. The optional -argument SUBFEATURES should be a list of symbols listing particular -subfeatures supported in this version of FEATURE. -

              -
              -
              -
              -
              -

              Function: (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)

              -
              -

              -Comment: Add an element ELEMENT to a list named LIST-VAR. -

              - -

              -Example: -

              - -
              - -
              (add-to-list 'load-path "~/.emacs.d/personal") ; add personal to load-path,
              -                                               ; so "load" function can search for files in it
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -Add ELEMENT to the value of LIST-VAR if it isn't there yet. -The test for presence of ELEMENT is done with `equal', or with -COMPARE-FN if that's non-nil. -If ELEMENT is added, it is added at the beginning of the list, -unless the optional argument APPEND is non-nil, in which case -ELEMENT is added at the end. -

              - -

              -The return value is the new value of LIST-VAR. -

              - -

              -This is handy to add some elements to configuration variables, -but please do not abuse it in Elisp code, where you are usually -better off using `push' or `cl-pushnew'. -

              - -

              -If you want to use `add-to-list' on a variable that is not -defined until a certain package is loaded, you should put the -call to `add-to-list' into a hook function that will be run only -after loading the package. `eval-after-load' provides one way to -do this. In some cases other hooks, such as major mode hooks, -can do the job. -

              -
              -
              -
              - -
              -

              Function: (add-hook HOOK FUNCTION &optional APPEND LOCAL)

              -
              -

              -Comment: A hook is a Lisp variable which holds a list of -functions, to be called on some well-defined occasion. (This is called -running the hook. You can search for hook using C-h v and enter --hook suffix then TAB. Or you can find hooks in Customization Groups. -

              - -

              -Example: -

              - -
              - -
              (add-hook 'prog-mode-hook 'linum-mode)
              -
              -
              - -

              -After you add the function linum-mode - which activates line number -on the left margin of your Emacs - then every time you enter a -prog-mode, which is the root all programming major modes derive -from. A programming mode can be c-mode, asm-mode, -emacs-lisp-mode, java-mode… -

              - -

              -Built-in Documentation: -

              - -
              -

              -Add to the value of HOOK the function FUNCTION. -FUNCTION is not added if already present. -FUNCTION is added (if necessary) at the beginning of the hook list -unless the optional argument APPEND is non-nil, in which case -FUNCTION is added at the end. -

              - -

              -The optional fourth argument, LOCAL, if non-nil, says to modify -the hook's buffer-local value rather than its global value. -This makes the hook buffer-local, and it makes t a member of the -buffer-local value. That acts as a flag to run the hook -functions of the global value as well as in the local value. -

              - -

              -HOOK should be a symbol, and FUNCTION may be any valid function. If -HOOK is void, it is first set to nil. If HOOK's value is a single -function, it is changed to a list of functions. -

              -
              -
              -
              - -
              -

              Function: (global-set-key KEY COMMAND)

              -
              -

              -Comment: This function binds a command to a key, as you can see in -the function interface. -

              - -

              -Example: -

              - -

              -You can bind in one of the following ways: -

              - -
              - -
              (global-set-key (kbd "C-x C-b") 'ibuffer) ;; bind "C-x C-b" to ibuffer command
              -(global-set-key "\C-x\C-b" 'ibuffer)  ;; bind "C-x C-b to ibuffer command, but modifier 
              -                                      ;; keys must be escaped with the backslash
              -(global-set-key [?\C-x?\C-b] 'ibuffer) ;; use vector instead of a string
              -
              -
              - -

              -I recommend you to use (kbd ...) function because we can write key -bindings using our familiar key notations without adding unnecessary -characters. Vector is array in other languages. Vector was used for -mapping function keys, such as [left], [right], [up], [down], -[f1]...[f12]. But now, you can also map function keys in (kbd -...) function using angle brackets: -

              - -
              - -
              (global-set-key (kbd "<f3>") 'kmacro-start-macro-or-insert-counter)
              -
              -
              - -

              -Here are common function keys (remember to wrap them in a pair of -angle bracket): -

              - - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              KeyDescription
              left, up, right, downCursor arrow keys
              begin, end, home, next, priorOther cursor re-positioning keys
               prior means PageUp
               next means PageDOwn
              select, print, execute, backtabMiscellaneous keys
              insert, undo, redo, clearlinebacktab means S-TAB or C-iso-tab
              insertline, deleteline, insertchar, deletechar 
              f1, f2, ... F35Numbered function keys on top of your keyboard
              kp-add, kp-subtract, kp-multiply, kp-divideKeypad keys (to the right of the regular keyboard)
              kp-backtab, kp-space, kp-tab, kp-enter, with names or punctuation.
              kp-separator, kp-decimal, kp-equal 
                
              kp-0, kp-1, ... kp-9Keypad keys with digits.
                
              kp-f1, kp-f2, kp-f3, kp-f4Keypad PF keys.
              - -

              -Built-in Documentation: -

              - -
              -

              -Give KEY a global binding as COMMAND. -COMMAND is the command definition to use; usually it is -a symbol naming an interactively-callable function. -KEY is a key sequence; noninteractively, it is a string or vector -of characters or event types, and non-ASCII characters with codes -above 127 (such as ISO Latin-1) can be included if you use a vector. -

              - -

              -Note that if KEY has a local binding in the current buffer, -that local binding will continue to shadow any global binding -that you make with this function. -

              -
              -
              -
              -
              -

              Function: (define-key KEYMAP KEY DEF)

              -
              -

              -Comment: -

              - -

              -This function binds a definition DEF, usually a command, to a key -sequence KEY. A definition can be other things that you can find in -the built-in documentation. -

              - -

              -A key sequence (key, for short) is a sequence of input events that -have a meaning as a unit. Input events include characters, function -keys and mouse buttons—all the inputs that you can send to the -computer. A key sequence gets its meaning from its binding, which says -what command it runs. -

              - -

              -When a key sequence KEY is pressed, Emacs runs the associated -function. A keymap KEYMAP stores a list of bindings between KEY -and definition DEF. Major mode or minor mode uses keymap to provide -its own key bindings. A keymap usually has -mode-map suffix, -i.e. dired-mode-map; if you want to change or add a key binding in a -major mode or minor mode, you use define-key function like this: -

              - -

              -Example: -

              - -
              - -
              ;; Dired uses "e", "f" or RET to open a file
              -;; you can reuse one of these keys for different purpose
              -;; for example, you can bind it to wdired-change-to-wdired-mode
              -;; wdired-change-to-wdired-mode allows you to edit your Dired buffer
              -;; like a normal text buffer, such as edit file/directory names,
              -;; permission bits.. and then commit the changes to disk.
              -;;
              -;; "e" is short for "edit"
              -;; After finish your editing, "C-c C-c" to commit, "C-c C-k" to abort
              -(define-key dired-mode-map (kbd "e") 'wdired-change-to-wdired-mode)
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -In KEYMAP, define key sequence KEY as DEF. -KEYMAP is a keymap. -

              - -

              -KEY is a string or a vector of symbols and characters, representing a -sequence of keystrokes and events. Non-ASCII characters with codes -above 127 (such as ISO Latin-1) can be represented by vectors. -Two types of vector have special meanings: -[remap COMMAND] remaps any key binding for COMMAND. -[t] creates a default definition, which applies to any event with no -other definition in KEYMAP. -

              - -

              -DEF is anything that can be a key's definition: -nil (means key is undefined in this keymap), -a command (a Lisp function suitable for interactive calling), -a string (treated as a keyboard macro), -a keymap (to define a prefix key), -a symbol (when the key is looked up, the symbol will stand for its -function definition, which should at that time be one of the above, -or another symbol whose function definition is used, etc.), -a cons (STRING . DEFN), meaning that DEFN is the definition -(DEFN should be a valid definition in its own right), -or a cons (MAP . CHAR), meaning use definition of CHAR in keymap MAP, -or an extended menu item definition. -(See info node `(elisp)Extended Menu Items'.) -

              - -

              -If KEYMAP is a sparse keymap with a binding for KEY, the existing -binding is altered. If there is no binding for KEY, the new pair -binding KEY to DEF is added at the front of KEYMAP. -

              -
              -
              -
              -
              -

              Function: (defalias SYMBOL DEFINITION &optional DOCSTRING)

              -
              -

              -Comment: defalias allows you to rename a command. It is usually -used to abbreviate command name. -

              - -

              -Example: Put the following aliases in your init.el: -

              - -
              - -
              (defalias 'yes-or-no-p 'y-or-n-p) ; y or n is enough
              -(defalias 'list-buffers 'ibuffer) ; always use ibuffer
              -
              -                                        ; elisp
              -(defalias 'eb 'eval-buffer)
              -(defalias 'er 'eval-region)
              -(defalias 'ed 'eval-defun)
              -
              -                                        ; minor modes
              -(defalias 'wsm 'whitespace-mode)
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -Set SYMBOL's function definition to DEFINITION. -Associates the function with the current load file, if any. -The optional third argument DOCSTRING specifies the documentation string -for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string -determined by DEFINITION. -

              - -

              -Internally, this normally uses `fset', but if SYMBOL has a -`defalias-fset-function' property, the associated value is used instead. -

              - -

              -The return value is undefined. -

              -
              -
              -
              - -
              -

              Function: (mapc FUNCTION SEQUENCE)

              -
              -

              -Comment: mapc calls the function FUNCTION on each element of the -sequence SEQUENCE. -

              - -

              -Example: -

              - -
              - -
              ;; load every .el file inside ~/.emacs.d/custom/
              -(mapc 'load (directory-files "~/.emacs.d/custom" t ".*\.el"))
              -
              -
              - -

              -Built-in Documentation: -

              - -
              -

              -Apply FUNCTION to each element of SEQUENCE for side effects only. -Unlike `mapcar', don't accumulate the results. Return SEQUENCE. -SEQUENCE may be a list, a vector, a bool-vector, or a string. -

              -
              -
              -
              - -
              -

              Macro: (defun NAME ARGLIST &optional DOCSTRING DECL &rest BODY)

              -
              -

              -Comment: defun is a Lisp macro that allows you to define a -function, like any other language. A function is a collection of -Lisp forms to be executed. The return value is the last form. -

              - -

              -Example: -

              - -
                -
              • Create a normal function (Not available in M-x):
              • -
              - -
              - -
              (defun demo ()
              -  (message "Hello World" number string))
              -
              -
              - -
                -
              • Create a command (Available in M-x):
              • -
              -
              - -
              (defun demo ()
              -  (interactive)
              -  (message "Hello World"))
              -
              -
              - -

              -interactive is a special form that turns a function into a command -and allow a command to accept various types of prefix arguments, such -as a number, a string, symbol, buffer names… You can C-h f and -type interactive to find out more. -

              - -

              -Built-in Documentation: -

              - -
              -

              -Define NAME as a function. -The definition is (lambda ARGLIST [/DOCSTRING/] BODY…). -See also the function `interactive'. -DECL is a declaration, optional, of the form (declare DECLS…) where -/DECLS is a list of elements of the form (PROP . VALUES). These are -interpreted according to `defun-declarations-alist'. -The return value is undefined. -

              -
              -
              -
              -
              - -
              -

              Useful built-in key bindings for navigating pairs

              -
              -
                -
              • -C-M-f binds to forward-sexp, move forward over a balanced -expression. Demo: -

                - - -
                -

                forward-sexp.gif -

                -
              • - -
              • -C-M-b binds to backward-sexp, move backward over a balanced -expression. Demo: -

                - - -
                -

                backward-sexp.gif -

                -
              • - -
              • -C-M-k binds to kill-sexp, kill balanced expression -forward. Demo: -

                - - -
                -

                kill-sexp.gif -

                -
              • - -
              • -C-M-t binds to transpose-sexps, transpose expressions. Demo: -

                - - -
                -

                transpose-sexp.gif -

                -
              • - -
              • -C-M-<SPC> or C-M-@ binds to mark-sexp, put mark after -following expression. Demo: -

                - - -
                -

                mark-sexp.gif -

                -
              • -
              -
              -
              - -
              -

              Let's supercharge Emacs

              -
              -

              -Throughout this section I will help you to extend Emacs with packages -that improves general Emacs features, such as Info, Dired, buffer -management… I will introduce you popular packages out there, but I -cannot present you all. The purpose of this guide is to help you get -really comfortable to Emacs package system, so you can extend Emacs -with packages from other people easily to fit your need. Writing your -own Emacs extension is a differnt story, and is beyond the scope of -this guide. -

              - -

              -I will introduce packages specialized for programming in later part: how -to setup programming environment for popular languages (C/C++, Lisp, -Python, Ruby…); each programming environment will have its own -chapter. In this part of the mini manual series, I only introduce -general packages for extending Emacs in various aspects. And you are -going to need some of these packages to setup your specialized -programming envrionment, so don't skip it. -

              - -

              -Don't be intimidated if you see many packages down there. Adding -packages and see it extends your Emacs is fun and addictive, like -playing video games. -

              - -

              -To remind you, Emacs always loads one of the three of the following -files when it starts: -

              - -
                -
              • ~/.emacs
              • -
              • ~/.emacs.d/init
              • -
              • ~/.emacs.d/init.el
              • -
              - -

              -To apply a setting, move point to the end of a Lisp expression and -C-x C-e, which runs eval-last-sexp. Or, you can evaluate the whole -buffer with eval-buffer. -

              - -

              -When you want to complete function names in Emacs Lisp: C-M-i, -which runs completion-at-point. It will display a list of possible -candidates available in Emacs. As a reminder, if you want to quickly -complete some text, you can M-/, which runs dabbrev-expand. -

              - -

              -If a package uses new functions, I will introduce the functions in its -own sections just before we get to that package. I will only introduce -the basic usage of the functions. If you want to understand more, C-h -f and enter name of the function. All of the quoted function -descriptions are taken from C-h f. If you forget what a function -does and how to use it, C-h f to find out. Really, you should get -used to getting help from Emacs itself. -

              -
              - -
              -

              How to use Emacs package manager

              -
              -

              -Emacs has a package manager to make the task of installing, update and -removing easier, as well as inform users new packages created by the -community. Emacs gets a list of packages from sources, called package -archive. Package archive is the same as repository in -Linux. Currently, there are 3 package archives in Emacs: -

              - -
                -
              • built-in: limited number of packages, and not always up to date.
              • -
              • Marmalade: more packages, but mostly outdated since people moved to MELPA.
              • -
              • MELPA: the most popular and most up to date package archive, with -most number of packages.
              • -
              - -

              -Marmalade and MELPA are not activated by default; you have to add them -manually. You only need to setup MELPA and that's enough to get all -the packages described in later sections. Add this code snippet to your -~/.emacs.d/init.el: -

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

              -Then, evaluate those two expressions with C-x C-e or eval-buffer. -

              - -

              -To open the package manager, M-x list-package. You will see a list -of packages. -

              - -
                -
              • To navigate the package list down and up using n and p.
              • -
              • To view information of a package, press RET.
              • -
              • To mark a package for install, press i.
              • -
              • To mark a package for delete, press d.
              • -
              • To unmark a package, press u.
              • -
              • To execute the marked packages (either for install or delete), press x.
              • -
              • To refresh and update the latest package list, press r.
              • -
              • To update all packages, press U.
              • -
              • To filter to a group of packages, press f. Press TAB to display -possible groups.
              • -
              • To display these key bindings, press h.
              • -
              - -

              -Exercise: Let's install a few packages in advance, so you won't -have to install the packages later. Install these packages: -

              - -
                -
              • volatile-highlights
              • -
              • undo-tree
              • -
              • yasnippet
              • -
              -
              -
              - -
              -

              Customize Emacs

              -
              -
              -
              -

              Using GUI

              -
              -

              -If you want to change a specific setting, you need to change a -variable value. You wonder, there are so many variables to set. How do -you know which to which? Luckily, you don't have to manually guess -which variable to set. Emacs has a command for setting Emacs -internally, with a nice organization of settings, rather than randomly -set a variable that you randomly found. M-x customize to open a -window for customizing Emacs: -

              - - -
              -

              customize.jpg -

              -
              - -

              -You will see various categories for customizing Emacs. These -categories are called Customization Groups in Emacs. Let's try -setting something in Emacs: -

              - -
                -
              • Go to Editing -> Editing Basics -> move point to "Global
              • -
              -

              -Mark ring Max: ". -

              -
                -
              • Change the value to 5000.
              • -
              • Move point on State button. Press RET.
              • -
              • A menu appears with the following choice:
              • -
              - -

              -0 = Set for current Sesssion -This option is for trying out a new setting. If you close Emacs, the -old setting is restored. -

              - -

              -1 = Save for Future Sesssions -This option saves the new value permanently, so the next time you -start Emacs, it uses your saved setting. The new value is saved at -~/.emacs.d/init.el like this: -

              - -
              - -
              (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.
              - '(global-mark-ring-max 5000))
              -
              -
              - -

              -2 = Undo Edits: Undo to the previous value of a particular setting, if you haven't -set. -

              - -

              -3 = Revert This Sesssion's Customization: This restores the value of -the variable to the last saved value, and updates the text -accordingly. -

              - -

              -4 = Erase Customization: Reset to standard value and delete set -value in ~/emacs.d/init.el. -

              - -

              -7 = Add Comment: Sometimes you have something to say about your -customization. Write it using this option. -

              - -

              -: = Show Saved Lisp Expression: Show the actual variable -representation. If you open the menu again, the option : = Show Saved -Lisp Expression is changed to Show current value that switches back -to the nicer representation. -

              - -

              -Another way to change a setting is using C-h v, which runs -describe-variable that list all the available variables in your -Emacs and allow you to select one. You can also access the parent -group of a group or a variable. -

              - -

              -Aside from the general customize command, Emacs has many more -customization command: customize-group, customize-face… That -organize customization groups in different ways. However, in the scope -of this guide, we only use customize for customize Emacs generally -and customize-group to select a specific package for customizing, -and also find out which parent group the package belongs to, after you -finished installing from the package manager. -

              -
              -
              - -
              -

              Using Emacs Lisp

              -
              -

              -The above approach uses GUI, which makes Emacs look familiar to normal -users from other editors: using GUI to change the editors. However, it -has disadvantages: Monolithic. Although the settings are nicely -organized into groups, its underlying representation is not. After you -set and save something in whatever group, Emacs always add your -setting to the function custom-set-variables like this: -

              - -
              - -
              (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.
              - '(global-mark-ring-max 5000 nil nil "test"))
              -
              -
              - -

              -As you can read it the comment, custom-set-variables is expected to -be unique in your init file. If you have more, things go wrong. So, by -design, you cannot split the settings into logical groups of your -choice. -

              - -

              -For that reason, setq is the preferred method. But, you can use the -GUI with nice and logical grouping to guide you to the settings you -want to change. The grouping is nice, and for consistency, we should -organize our module structure based on the grouping in M-x -customize: -

              - -
                -
              • setup-editing.el for Editing group.
              • -
              • setup-convenience.el for Convenience group.
              • -
              • setup-files.el for Files group.
              • -
              • setup-text.el for Text group.
              • -
              • setup-data.el for Data group.
              • -
              • setup-external.el for External group.
              • -
              • setup-communication.el for Communication group.
              • -
              • setup-programming.el for Programming group.
              • -
              • setup-applications.el for Application group.
              • -
              • setup-development.el for Development group.
              • -
              • setup-environment.el for Environment group.
              • -
              • setup-faces.el for Faces group.
              • -
              • setup-help.el for Help group.
              • -
              • setup-multimedia.el for Multimedia group.
              • -
              • setup-local.el for Local group.
              • -
              - -

              -Please note that even though you may see some packages are inside a -group in customize GUI, I still put in another group since I feel -such packages are more appropriate. So, if you see packages in my -setup are in different groups, don't be surprise. But it's just my -personal opinion. You can move it where you want. -

              - -

              -Exercise: -

              - -
                -
              • Create a directory: ~/.emacs.d/custom/
              • -
              • Create the above setup-*.el files under it.
              • -
              • Load the files above using mapc:
              • -
              - -
              - -
              (mapc 'load (directory-files "~/.emacs.d/custom" t ".*\.el"))
              -
              -
              - -

              -You already installed the package rebox2 in How to use Emacs package -manager section. When you mark a region and M-q, you can create the -above comment box. There are many styles, you can cycle by pressing -M-q repeatedly. -

              - -

              -Now, everything is prepared. We can really dive into customizing and -extending Emacs with 3rd party packages and various code snippets that -solve many little problems. In later sections, each is dedicated to a -category. But, please note that I only provide the customizations that -I found useful, not templates that you have to follow rigidly. You can -consider my customizations as an example for your own -customizations. You can use it either way: -

              - -
                -
              • Copy the sample configurations into your files and look back later -or just don't care.
              • - -
              • Really control the customization process and make the customizations -actually yours, by reading the customization code and understand -what it does.
              • -
              -
              -
              -
              - -
              -

              init.el

              -
              -

              -Sample init.el: -

              - - -
              - -
              ;; Add and enable MELPA
              -(require 'package)
              -(add-to-list 'package-archives
              -             '("melpa" . "http://melpa.milkbox.net/packages/") t)
              -(package-initialize)
              -
              -;; add your modules path
              -(add-to-list 'load-path "~/.emacs.d/custom/")
              -
              -;; load your modules
              -(require 'setup-applications)
              -(require 'setup-communication)
              -(require 'setup-convenience)
              -(require 'setup-data)
              -(require 'setup-development)
              -(require 'setup-editing)
              -(require 'setup-environment)
              -(require 'setup-external)
              -(require 'setup-faces-and-ui)
              -(require 'setup-files)
              -(require 'setup-help)
              -(require 'setup-programming)
              -(require 'setup-text)
              -(require 'setup-local)
              -
              -
              -
              - -
              -

              Package: workgroups2

              -
              -

              -Author: -

              - -

              -Sergey Pashinin, sergey@pashinin.com -

              - -

              -Based on the original workgroups, created by tlh, thunkout@gmail.com. -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Workgroups is a session manager for Emacs. -

              - -
                -
              • It saves all your opened buffers, their location and sizes on disk -to restore later.
              • - -
              • You can create several workspaces.
              • -
              - -

              -You can also restore such buffers as: org-agenda, shell, magit-status, -help. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select workgroups2 package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: workgroups2               ;;
              -;;                                    ;;
              -;; GROUP: Convenience -> Workgroups   ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'workgroups2)
              -;; Change some settings
              -(workgroups-mode 1)
              -
              -
              - -

              -Remember to put the code at the bottom of init.el, after everything -is properly initialized. -

              - -

              -Usage: -

              - -

              -Most commands are bound to both <prefix> <key> and <prefix> C-<key>. -

              - -

              -By default prefix is: "C-c z" (To change it - see settings below) -

              - -
              -

              -<prefix> <key> -<prefix> c - create workgroup -<prefix> A - rename workgroup -<prefix> k - kill workgroup -<prefix> v - switch to workgroup -<prefix> C-s - save session -<prefix> C-f - load session -<prefix> 0..9 - switch to workgroup at index 0..9 -

              -
              - -

              -Do you remember how to use registers to store window configurations? -Registers are good, but it does not allow you to name window -configurations. It would be trouble when the number of window -configurations getting large. You will have to tediously remember -which register stores which configuration. -

              - -

              -With workgroups2, each window configuration is a workgroup, and you -can create as many workgroups and named it with <prefix> c; later, -you can switch back by <prefix> v. Because you can name your window -configurations, you don't have the burden to remember which to which -in registers. You can also save your window configurations to continue -using them in later Emacs sessions. -

              -
              -
              -
              - -
              -

              setup-editing.el

              -
              -

              -Let's use setq to change Emacs the way we want. You should type in -the snippet below and use the completion key bindings until you get -used to it. Remember to include the line (provide 'setup-editing), -otherwise Emacs won't be able to load your module. -

              - -
              - -
              (provide 'setup-editing)
              -
              -;; GROUP: Editing -> Editing Basics
              -(setq global-mark-ring-max 5000         ; increase mark ring to contains 5000 entries
              -      mark-ring-max 5000                ; increase kill ring to contains 5000 entries
              -      mode-require-final-newline t      ; add a newline to end of file
              -      )
              -
              -;; default to 4 visible spaces to display a tab
              -(setq-default tab-width 4)
              -
              -(set-terminal-coding-system 'utf-8)
              -(set-keyboard-coding-system 'utf-8)
              -(set-language-environment "UTF-8")
              -(prefer-coding-system 'utf-8)
              -
              -(setq-default indent-tabs-mode nil)
              -(delete-selection-mode)
              -(global-set-key (kbd "RET") 'newline-and-indent)
              -
              -;; GROUP: Editing -> Killing
              -(setq
              - kill-ring-max 5000 ; increase kill-ring capacity
              - kill-whole-line t  ; if NIL, kill whole line and move the next line up
              - )
              -
              -;; show important whitespace in diff-mode
              -(add-hook 'diff-mode-hook (lambda ()
              -                            (setq-local whitespace-style
              -                                        '(face
              -                                          tabs
              -                                          tab-mark
              -                                          spaces
              -                                          space-mark
              -                                          trailing
              -                                          indentation::space
              -                                          indentation::tab
              -                                          newline
              -                                          newline-mark))
              -                            (whitespace-mode 1)))
              -
              -
              -
              - -
              -

              Customize built-in functions

              -
              -

              -Sometimes, we want to adjust or improve the behaviours of some -commands in certain contexts. Consider this situation: C-a, which -runs move-beginning-of-line, always move to the beginning of -line. However, sometimes we don't always to move to the beginning of -line, but move to the first non-whitespace character of that line. -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Customized functions                ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(defun prelude-move-beginning-of-line (arg)
              -  "Move point back to indentation of beginning of line.
              -
              -Move point to the first non-whitespace character on this line.
              -If point is already there, move to the beginning of the line.
              -Effectively toggle between the first non-whitespace character and
              -the beginning of the line.
              -
              -If ARG is not nil or 1, move forward ARG - 1 lines first. If
              -point reaches the beginning or end of the buffer, stop there."
              -  (interactive "^p")
              -  (setq arg (or arg 1))
              -
              -  ;; Move lines first
              -  (when (/= arg 1)
              -    (let ((line-move-visual nil))
              -      (forward-line (1- arg))))
              -
              -  (let ((orig-point (point)))
              -    (back-to-indentation)
              -    (when (= orig-point (point))
              -      (move-beginning-of-line 1))))
              -
              -(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line)
              -
              -(defadvice kill-ring-save (before slick-copy activate compile)
              -  "When called interactively with no active region, copy a single
              -line instead."
              -  (interactive
              -   (if mark-active (list (region-beginning) (region-end))
              -     (message "Copied line")
              -     (list (line-beginning-position)
              -           (line-beginning-position 2)))))
              -
              -(defadvice kill-region (before slick-cut activate compile)
              -  "When called interactively with no active region, kill a single
              -  line instead."
              -  (interactive
              -   (if mark-active (list (region-beginning) (region-end))
              -     (list (line-beginning-position)
              -           (line-beginning-position 2)))))
              -
              -;; kill a line, including whitespace characters until next non-whiepsace character
              -;; of next line
              -(defadvice kill-line (before check-position activate)
              -  (if (member major-mode
              -              '(emacs-lisp-mode scheme-mode lisp-mode
              -                                c-mode c++-mode objc-mode
              -                                latex-mode plain-tex-mode))
              -      (if (and (eolp) (not (bolp)))
              -          (progn (forward-char 1)
              -                 (just-one-space 0)
              -                 (backward-char 1)))))
              -
              -;; taken from prelude-editor.el
              -;; automatically indenting yanked text if in programming-modes
              -(defvar yank-indent-modes
              -  '(LaTeX-mode TeX-mode)
              -  "Modes in which to indent regions that are yanked (or yank-popped).
              -Only modes that don't derive from `prog-mode' should be listed here.")
              -
              -(defvar yank-indent-blacklisted-modes
              -  '(python-mode slim-mode haml-mode)
              -  "Modes for which auto-indenting is suppressed.")
              -
              -(defvar yank-advised-indent-threshold 1000
              -  "Threshold (# chars) over which indentation does not automatically occur.")
              -
              -(defun yank-advised-indent-function (beg end)
              -  "Do indentation, as long as the region isn't too large."
              -  (if (<= (- end beg) yank-advised-indent-threshold)
              -      (indent-region beg end nil)))
              -
              -(defadvice yank (after yank-indent activate)
              -  "If current mode is one of 'yank-indent-modes,
              -indent yanked text (with prefix arg don't indent)."
              -  (if (and (not (ad-get-arg 0))
              -           (not (member major-mode yank-indent-blacklisted-modes))
              -           (or (derived-mode-p 'prog-mode)
              -               (member major-mode yank-indent-modes)))
              -      (let ((transient-mark-mode nil))
              -        (yank-advised-indent-function (region-beginning) (region-end)))))
              -
              -(defadvice yank-pop (after yank-pop-indent activate)
              -  "If current mode is one of `yank-indent-modes',
              -indent yanked text (with prefix arg don't indent)."
              -  (when (and (not (ad-get-arg 0))
              -             (not (member major-mode yank-indent-blacklisted-modes))
              -             (or (derived-mode-p 'prog-mode)
              -                 (member major-mode yank-indent-modes)))
              -    (let ((transient-mark-mode nil))
              -      (yank-advised-indent-function (region-beginning) (region-end)))))
              -
              -;; prelude-core.el
              -(defun prelude-duplicate-current-line-or-region (arg)
              -  "Duplicates the current line or region ARG times.
              -If there's no region, the current line will be duplicated. However, if
              -there's a region, all lines that region covers will be duplicated."
              -  (interactive "p")
              -  (pcase-let* ((origin (point))
              -               (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
              -               (region (buffer-substring-no-properties beg end)))
              -    (-dotimes arg
              -      (lambda (n)
              -        (goto-char end)
              -        (newline)
              -        (insert region)
              -        (setq end (point))))
              -    (goto-char (+ origin (* (length region) arg) arg))))
              -
              -;; prelude-core.el
              -(defun indent-buffer ()
              -  "Indent the currently visited buffer."
              -  (interactive)
              -  (indent-region (point-min) (point-max)))
              -
              -;; prelude-editing.el
              -(defcustom prelude-indent-sensitive-modes
              -  '(coffee-mode python-mode slim-mode haml-mode yaml-mode)
              -  "Modes for which auto-indenting is suppressed."
              -  :type 'list)
              -
              -(defun indent-region-or-buffer ()
              -  "Indent a region if selected, otherwise the whole buffer."
              -  (interactive)
              -  (unless (member major-mode prelude-indent-sensitive-modes)
              -    (save-excursion
              -      (if (region-active-p)
              -          (progn
              -            (indent-region (region-beginning) (region-end))
              -            (message "Indented selected region."))
              -        (progn
              -          (indent-buffer)
              -          (message "Indented buffer.")))
              -      (whitespace-cleanup))))
              -
              -(global-set-key (kbd "C-c i") 'indent-region-or-buffer)
              -
              -;; add duplicate line function from Prelude
              -;; taken from prelude-core.el
              -(defun prelude-get-positions-of-line-or-region ()
              -  "Return positions (beg . end) of the current line
              -or region."
              -  (let (beg end)
              -    (if (and mark-active (> (point) (mark)))
              -        (exchange-point-and-mark))
              -    (setq beg (line-beginning-position))
              -    (if mark-active
              -        (exchange-point-and-mark))
              -    (setq end (line-end-position))
              -    (cons beg end)))
              -
              -(defun kill-default-buffer ()
              -  "Kill the currently active buffer -- set to C-x k so that users are not asked which buffer they want to kill."
              -  (interactive)
              -  (let (kill-buffer-query-functions) (kill-buffer)))
              -
              -(global-set-key (kbd "C-x k") 'kill-default-buffer)
              -
              -;; smart openline
              -(defun prelude-smart-open-line (arg)
              -  "Insert an empty line after the current line.
              -Position the cursor at its beginning, according to the current mode.
              -With a prefix ARG open line above the current line."
              -  (interactive "P")
              -  (if arg
              -      (prelude-smart-open-line-above)
              -    (progn
              -      (move-end-of-line nil)
              -      (newline-and-indent))))
              -
              -(defun prelude-smart-open-line-above ()
              -  "Insert an empty line above the current line.
              -Position the cursor at it's beginning, according to the current mode."
              -  (interactive)
              -  (move-beginning-of-line nil)
              -  (newline-and-indent)
              -  (forward-line -1)
              -  (indent-according-to-mode))
              -
              -(global-set-key (kbd "C-o") 'prelude-smart-open-line)
              -(global-set-key (kbd "M-o") 'open-line)
              -
              -
              - -

              -The code above is taken from this article: Smarter Navigation to the -Beginning of a Line. -

              - -
              - -
              (defadvice kill-ring-save (before slick-copy activate compile)
              -  "When called interactively with no active region, copy a single
              -line instead."
              -  (interactive
              -   (if mark-active (list (region-beginning) (region-end))
              -     (message "Copied line")
              -     (list (line-beginning-position)
              -           (line-beginning-position 2)))))
              -
              -(defadvice kill-region (before slick-cut activate compile)
              -  "When called interactively with no active region, kill a single
              -  line instead."
              -  (interactive
              -   (if mark-active (list (region-beginning) (region-end))
              -     (list (line-beginning-position)
              -           (line-beginning-position 2)))))
              -
              -;; kill a line, including whitespace characters until next non-whiepsace character
              -;; of next line
              -(defadvice kill-line (before check-position activate)
              -  (if (member major-mode
              -              '(emacs-lisp-mode scheme-mode lisp-mode
              -                                c-mode c++-mode objc-mode
              -                                latex-mode plain-tex-mode))
              -      (if (and (eolp) (not (bolp)))
              -          (progn (forward-char 1)
              -                 (just-one-space 0)
              -                 (backward-char 1)))))
              -
              -
              -
              -
              - -
              -

              Package: duplicate-thing

              -
              -

              -Author: ongaeshi, ongaeshi0621@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Easy duplicate line or region, with comment out. -

              - -
                -
              • Duplicate current line.
              • -
              • Duplicate a selection when selection is active.
              • -
              • Only C-u, replicate, comment out the range.
              • -
              • Numerical prefix is specified as 'C-u 5': do multiple times repeatedly.
              • -
              - -

              -Installation: -

              - -
              - -
              (require 'duplicate-thing)
              -(global-set-key (kbd "M-c") 'duplicate-thing)
              -
              -
              - -

              -Usage: -If point is on a line, the command duplicates the current line. If -region is active, duplicates region instead. -

              -
              -
              - -
              -

              Package: volatile-highlights

              -
              -

              -Author: Keitalo Miyazaki, Keitaro.Miyazaki@gmail.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -

              - -

              -VolatileHighlights highlights changes to the buffer caused by commands -such as ‘undo’, ‘yank’/’yank-pop’, etc. The highlight disappears at -the next command. The highlighting gives useful visual feedback for -what your operation actually changed in the buffer. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select volatile-highlights package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: volatile-highlights          ;;
              -;;                                       ;;
              -;; GROUP: Editing -> Volatile Highlights ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'volatile-highlights)
              -(volatile-highlights-mode t)
              -
              -
              - -

              -Usage: -

              - -

              -When you yank (paste) something, the yanked (pasted) region will be -highlighted. -

              -
              -
              -
              -

              Package: smartparens

              -
              -

              -Author: Matus Goljer, matus.goljer@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Smartparens is minor mode for Emacs that deals with parens pairs and -tries to be smart about it. It started as a unification effort to -combine functionality of several existing packages in a single, -compatible and extensible way to deal with parentheses, delimiters, -tags and the like. Some of these packages include autopair, textmate, -wrap-region, electric-pair-mode, paredit and others. With the basic -features found in other packages it also brings many improvements as -well as completely new features. Here's a highlight of some features, -for a complete list and detailed documentation look in the manual. -

              - -

              -For the complete documentation visit the documentation wiki. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select smartparens package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;; Package: smartparens
              -(require 'smartparens-config)
              -(setq sp-base-key-bindings 'paredit)
              -(setq sp-autoskip-closing-pair 'always)
              -(setq sp-hybrid-kill-entire-symbol nil)
              -(sp-use-paredit-bindings)
              -
              -
              - -

              -Usage: -

              - -

              -If smartparens sees a opening/closing of pair, either the default -supported ones or customized by users, it will complete the pair. You -can even highlight a block of text (region) and enter a pair -character, smartparens will wraps the region around the -pair. smartparens can also highlight pairs, even pairs with escape -characters. -

              -
              -
              - -
              -

              Package: clean-aindent-mode

              -
              -

              -Author: Peter Marinov -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -When you press RET to create a newline and got indented by -eletric-indent-mode, you have appropriate whitespace for -indenting. But, if you leave the line blank and move to the next line, -the whitespace becomes useless. This package helps clean up unused -whitespace. -

              - -

              -View this Emacswiki page for more details. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select clean-aindent-mode package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: clean-aindent-mode               ;;
              -;;                                           ;;
              -;; GROUP: Editing -> Indent -> Clean Aindent ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'clean-aindent-mode)
              -(add-hook 'prog-mode-hook 'clean-aindent-mode)
              -
              -
              - -

              -Usage: -

              - -

              -Automatically cleanup useless whitespaced on moving up/down. -

              -
              -
              - -
              -

              Package: undo-tree

              -
              -

              -Author: Toby Cubitt, toby-undo-tree@dr-qubit.org -

              - -

              -Homepage: www.dr-qubit.org -

              - -

              -Features: -

              - -

              -undo-tree allows you to visual the whole history of your editing in -a tree. It also provides regular undo/redo behaviours in other -editors. undo-tree can even provide a diff between two different -states. Highly recommended. -

              - - -
              -

              undo-tree.jpg -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select undo-tree package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: undo-tree                  ;;
              -;;                                     ;;
              -;; GROUP: Editing -> Undo -> Undo Tree ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'undo-tree)
              -(global-undo-tree-mode)
              -
              -
              - -

              -Usage: -

              - -

              -From now on, your undo (C-/) behaves just like normal editor. To -redo, C-_. To open the undo tree, C-x u. -

              -
              -
              - -
              -

              Package: yasnippet

              -
              -

              -Author: João Távora -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -YASnippet is a template system for Emacs. It allows you to type an -abbreviation and automatically expand it into function -templates. Bundled language templates include: C, C++, C#, Perl, -Python, Ruby, SQL, LaTeX, HTML, CSS and more. The snippet syntax is -inspired from TextMate's syntax, you can even import most TextMate -templates to YASnippet. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select yasnippet package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: yasnippet                 ;;
              -;;                                    ;;
              -;; GROUP: Editing -> Yasnippet        ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'yasnippet)
              -(yas-global-mode 1)
              -
              -
              - -

              -Usage: -

              - -

              -In major modes where yasnippet has snippets available, -typing a certain keyword and TAB insert a predefined snippet. For -example, in a C buffer, if you type for and TAB, it expands to: -

              - -
              - -
              for (i = 0; i < N; i++) {
              -    ...point will be here....
              -}
              -
              -
              - -

              -You can view supported snippets here. -

              -
              -
              -
              - -
              -

              setup-convenience.el

              -
              -

              -Remember to include the line (provide 'setup-convenience), otherwise -Emacs won't be able to load your module. Here is my sample -customization: -

              - -
              - -
              (provide 'setup-convenience)
              -
              -;; GROUP: Convenience -> Revert
              -
              -;; update any change made on file to the current buffer
              -(global-auto-revert-mode)
              -
              -;; GROUP: Convenience -> Hippe Expand
              -;; hippie-expand is a better version of dabbrev-expand.
              -;; While dabbrev-expand searches for words you already types, in current;; buffers and other buffers, hippie-expand includes more sources,
              -;; such as filenames, klll ring...
              -(global-set-key (kbd "M-/") 'hippie-expand) ;; replace dabbrev-expand
              -(setq
              - hippie-expand-try-functions-list
              - '(try-expand-dabbrev ;; Try to expand word "dynamically", searching the current buffer.
              -   try-expand-dabbrev-all-buffers ;; Try to expand word "dynamically", searching all other buffers.
              -   try-expand-dabbrev-from-kill ;; Try to expand word "dynamically", searching the kill ring.
              -   try-complete-file-name-partially ;; Try to complete text as a file name, as many characters as unique.
              -   try-complete-file-name ;; Try to complete text as a file name.
              -   try-expand-all-abbrevs ;; Try to expand word before point according to all abbrev tables.
              -   try-expand-list ;; Try to complete the current line to an entire line in the buffer.
              -   try-expand-line ;; Try to complete the current line to an entire line in the buffer.
              -   try-complete-lisp-symbol-partially ;; Try to complete as an Emacs Lisp symbol, as many characters as unique.
              -   try-complete-lisp-symbol) ;; Try to complete word as an Emacs Lisp symbol.
              - )
              -
              -;; GROUP: Convenience -> HL Line
              -(global-hl-line-mode)
              -
              -;; GROUP: Convenience -> Ibuffer
              -(setq ibuffer-use-other-window t) ;; always display ibuffer in another window
              -
              -;; GROUP: Convenience -> Linum
              -(add-hook 'prog-mode-hook 'linum-mode) ;; enable linum only in programming modes
              -
              -;; GROUP: Convenience -> Whitespace
              -
              -;; whenever you create useless whitespace, the whitespace is highlighted
              -(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1)))
              -
              -;; activate whitespace-mode to view all whitespace characters
              -(global-set-key (kbd "C-c w") 'whitespace-mode)
              -
              -;; GROUP: Convenience -> Windmove
              -
              -;; easier window navigation
              -(windmove-default-keybindings)
              -
              -
              -
              - -
              -

              Package: company

              -
              -

              -Author: -

              - -
                -
              • Nikolaj Schumacher (original author)
              • -
              • Dmitry Gutov (current maintainer), dgutov@yandex.ru
              • -
              - -

              -Homepage: http://company-mode.github.io/ -

              - -

              -Features: -

              - -

              -Company is a text completion framework for Emacs. The name stands for -"complete anything". It uses pluggable back-ends and front-ends to -retrieve and display completion candidates. -

              - -

              -It comes with several back-ends such as Elisp, Clang, Semantic, Eclim, -Ropemacs, Ispell, CMake, BBDB, Yasnippet, dabbrev, etags, gtags, -files, keywords and a few others. -

              - -

              -The CAPF back-end provides a bridge to the standard -completion-at-point-functions facility, and thus works with any major -mode that defines a proper completion function. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select company package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: company              ;;
              -;;                               ;;
              -;; GROUP: Convenience -> Company ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(add-hook 'after-init-hook 'global-company-mode)
              -
              -
              - -

              -Usage: -

              - -

              -Completion will start automatically after you type a few letters. Use -M-n and M-p to select, <return> to complete or <tab> to complete the -common part. Search through the completions with C-s, C-r and -C-o. Press M-(digit) to quickly complete with one of the first 10 -candidates. -

              -
              -
              - -
              -

              Package: expand-region

              -
              -

              -Author: Magnar Sveen -

              - -

              -Homepage: Github -

              - -

              -Features: -expand-region allows you to select text objects incrementally. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select expand-region package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: expand-region                       ;;
              -;;                                              ;;
              -;; GROUP: Convenience -> Abbreviation -> Expand ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'expand-region)
              -(global-set-key (kbd "M-m") 'er/expand-region)
              -
              -
              - -

              -I bind er/expand-regin to M-m, because the functionality is -included from the amended beginning-of-line we did above. -

              - -

              -Usage: -

              - -

              -M-m to continue expand outward. -

              -
              -
              - -
              -

              Package: ibuffer-vc

              -
              -

              -Author: Steve Purcell -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -
                -
              • Group your buffers by their parent vc root directory
              • -
              • See the VC status of the associated files
              • -
              • Sort buffers by their VC status
              • -
              - - -
              -

              ibuffer-vc.png -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select ibuffer-vc package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              (add-hook 'ibuffer-hook
              -          (lambda ()
              -            (ibuffer-vc-set-filter-groups-by-vc-root)
              -            (unless (eq ibuffer-sorting-mode 'alphabetic)
              -              (ibuffer-do-sort-by-alphabetic))))
              -
              -(setq ibuffer-formats
              -      '((mark modified read-only vc-status-mini " "
              -              (name 18 18 :left :elide)
              -              " "
              -              (size 9 -1 :right)
              -              " "
              -              (mode 16 16 :left :elide)
              -              " "
              -              (vc-status 16 16 :left)
              -              " "
              -              filename-and-process)))
              -
              -
              - -

              -Usage: -

              - -

              -When you use ibuffer, it will automatically group buffers by version -control system. -

              -
              -
              - -
              -

              Package: projectile

              -
              -

              -Author: Bozhidar Batsov, bozhidar@batsov.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Projectile is a project interaction library for Emacs. Its goal is to -provide a nice set of features operating on a project level without -introducing external dependencies(when feasible). For instance - -finding project files has a portable implementation written in pure -Emacs Lisp without the use of GNU find (but for performance sake an -indexing mechanism backed by external commands exists as well). -

              - -

              -Projectile tries to be practical - portability is great, but if some -external tools could speed up some task substantially and the tools -are available, Projectile will leverage them. -

              - -

              -This library provides easy project management and navigation. The -concept of a project is pretty basic - just a folder containing -special file. Currently git, mercurial, darcs and bazaar repos are -considered projects by default. So are lein, maven, sbt, rebar and -bundler projects. If you want to mark a folder manually as a project -just create an empty .projectile file in it. Some of Projectile's -features: -

              - -
                -
              • jump to a file in project
              • -
              • jump to a directory in project
              • -
              • jump to a file in a directory
              • -
              • jump to a project buffer
              • -
              • jump to a test in project
              • -
              • toggle between code and its test
              • -
              • jump to recently visited files in the project
              • -
              • switch between projects you have worked on
              • -
              • kill all project buffers
              • -
              • replace in project
              • -
              • multi-occur in project buffers
              • -
              • grep in project
              • -
              • regenerate project etags or gtags (requires gtags).
              • -
              • visit project in dired
              • -
              • run make in a project with a single key chord
              • -
              - -

              -Here's a glimpse of Projectile in action: -

              - - -
              -

              projectile.png -

              -
              - -

              -Installation: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGES: projectile             ;;
              -;;                                  ;;
              -;; GROUP: Convenience -> Projectile ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(projectile-global-mode)
              -
              -
              -

              -Usage: -

              - -

              -Please refer to the usage on the homepage. -

              -
              -
              -
              - -
              -

              Package in a league of its own: helm

              -
              -

              -Helm is an awesome package. Please refer to the whole guide. You -should give Helm its own file: setup-helm.el. -

              -
              -
              - -
              -

              Alternative to Helm: ido + ido-ubiquitous + flx-ido + smex

              -
              -

              -If you want to use Ido, at replace Helm configuration with this sample -configuration that you can place in setup-environment.el: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Development -> Extensions -> Ido ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'ido)
              -
              -(setq ido-enable-prefix nil
              -      ido-enable-flex-matching t
              -      ido-create-new-buffer 'always
              -      ido-use-filename-at-point 'guess
              -      ido-max-prospects 10
              -      ido-default-file-method 'selected-window
              -      ido-auto-merge-work-directories-length -1)
              -
              -(ido-mode +1)
              -
              -
              -
              - -
              -

              Package: ido-ubiquitous

              -
              -

              -Author: Ryan C. Thompson, rct+github@thompsonclan.org -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Gimme some ido… everywhere! -

              - -

              -Does what you were really hoping for when you did (setq ido-everywhere -t). Replaces stock emacs completion with ido completion wherever it is -possible to do so without breaking things. -

              - -

              -Note that ido-ubiquitous is not enabled for org mode or magit mode, -because those modes have their own support for ido. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select ido-ubiquitous package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: ido-ubiquitous                                   ;;
              -;;                                                           ;;
              -;; GROUP: Development -> Extensions -> Ido -> Ido Ubiquitous ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(ido-ubiquitous-mode +1)
              -
              -
              - -

              -Usage: -

              - -

              -Once you activated Ido, it is available where you expect to select -and narrow down candidates. -

              -
              -
              - -
              -

              Package: flx-ido

              -
              -

              -Author: Le Wang -

              - -

              -Homepage: Github -

              - -

              -Features: -M-x list-packages and select flx-ido package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: flx-ido                                          ;;
              -;;                                                           ;;
              -;; GROUP: Development -> Extensions -> Ido                   ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;;; smarter fuzzy matching for ido
              -(flx-ido-mode +1)
              -;; disable ido faces to see flx highlights
              -(setq ido-use-faces nil)
              -
              -
              - -

              -Usage: -

              - -

              -flx-ido provides fuzzy completion to select completion -candidates. For example, if you want to select a file -src/foo/bar.txt, you only need to type in Ido prompt "sfb", short -for (s)rc/(f)oo/(b)ar. -

              -
              -
              - -
              -

              Package: smex

              -
              -

              -Author: Cornelius Mika, cornelius.mika@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Smex is a M-x enhancement for Emacs. Built on top of Ido, it provides -a convenient interface to your recently and most frequently used -commands. And to all the other commands, too. -

              - - -
              -

              smex.png -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select flx-ido package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: smex                                             ;;
              -;;                                                           ;;
              -;; GROUP: Convenience -> Extensions -> Smex                  ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'smex)
              -(smex-initialize)
              -(global-set-key (kbd "M-x") 'smex)
              -(global-set-key (kbd "M-X") 'smex-major-mode-commands)
              -
              -
              - -

              -Usage: -

              - -

              -smex is an improved M-x command. After you setup, M-x to run -smex and M-X to select only commands in the current major mode. -

              -
              -
              -
              -
              -

              setup-files.el

              -
              -

              -Remember to include the line (provide 'setup-files), otherwise Emacs -won't be able to load your module. My sample customization: -

              - -
              - -
              (provide 'setup-files)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; group: Files                      ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(setq large-file-warning-threshold 100000000) ;; size in bytes
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Files -> Back up            ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(defvar backup-directory "~/.backups")
              -(if (not (file-exists-p backup-directory))
              -    (make-directory backup-directory t))
              -(setq
              - make-backup-files t        ; backup a file the first time it is saved
              - backup-directory-alist `((".*" . ,backup-directory)) ; save backup files in ~/.backups
              - backup-by-copying t     ; copy the current file into backup directory
              - version-control t   ; version numbers for backup files
              - delete-old-versions t   ; delete unnecessary versions
              - kept-old-versions 6     ; oldest versions to keep when a new numbered backup is made (default: 2)
              - kept-new-versions 9 ; newest versions to keep when a new numbered backup is made (default: 2)
              - auto-save-default t ; auto-save every buffer that visits a file
              - auto-save-timeout 20 ; number of seconds idle time before auto-save (default: 30)
              - auto-save-interval 200 ; number of keystrokes between auto-saves (default: 300)
              - )
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Files -> Dired              ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(setq
              - dired-dwim-target t            ; if another Dired buffer is visible in another window, use that directory as target for Rename/Copy
              - dired-recursive-copies 'always         ; "always" means no asking
              - dired-recursive-deletes 'top           ; "top" means ask once for top level directory
              - dired-listing-switches "-lha"          ; human-readable listing
              - )
              -
              -;; automatically refresh dired buffer on changes
              -(add-hook 'dired-mode-hook 'auto-revert-mode)
              -
              -;; if it is not Windows, use the following listing switches
              -(when (not (eq system-type 'windows-nt))
              -  (setq dired-listing-switches "-lha --group-directories-first"))
              -
              -;;; KEY BINDINGS.
              -;; (define-key ctl-x-map "\C-j" 'dired-jump)
              -;; (define-key ctl-x-4-map "\C-j" 'dired-jump-other-window))
              -;; (define-key dired-mode-map "\C-x\M-o" 'dired-omit-mode)
              -;; (define-key dired-mode-map "*O" 'dired-mark-omitted)
              -;; (define-key dired-mode-map "\M-(" 'dired-mark-sexp)
              -;; (define-key dired-mode-map "*(" 'dired-mark-sexp)
              -;; (define-key dired-mode-map "*." 'dired-mark-extension)
              -;; (define-key dired-mode-map "\M-!" 'dired-smart-shell-command)
              -;; (define-key dired-mode-map "\M-G" 'dired-goto-subdir)
              -;; (define-key dired-mode-map "F" 'dired-do-find-marked-files)
              -;; (define-key dired-mode-map "Y"  'dired-do-relsymlink)
              -;; (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp)
              -;; (define-key dired-mode-map "V" 'dired-do-run-mail)
              -(require 'dired-x) ; provide extra commands for Dired
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Files -> Dired -> Wdired    ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; wdired allows you to edit a Dired buffer and write changes to disk
              -;; - Switch to Wdired by C-x C-q
              -;; - Edit the Dired buffer, i.e. change filenames
              -;; - Commit by C-c C-c, abort by C-c C-k
              -(require 'wdired)
              -(setq
              - wdired-allow-to-change-permissions t   ; allow to edit permission bits
              - wdired-allow-to-redirect-links t       ; allow to edit symlinks
              - )
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Files -> Recentf            ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(recentf-mode)
              -(setq
              - recentf-max-menu-items 30
              - recentf-max-saved-items 5000
              - )
              -
              -
              -
              - -
              -

              Package: dired+

              -
              -

              -Author: Drew Adams, drew.adams@oracle.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -Dired+ (library dired+.el), which extends functionalities provided by -standard GNU Emacs libraries dired.el, dired-aux.el, and -dired-x.el. The standard functions are all available, plus many -more. -

              - - -
              -

              dired-plus.jpg -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select dired+ package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: dired+                     ;;
              -;;                                     ;;
              -;; GROUP: Files -> Dired -> Dired Plus ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'dired+)
              -
              -
              - -

              -Usage: -

              - -

              -Please refer to Emacswiki usage. Note that Dired+ has A LOT of -features, but you don't have to learn to use all of them at once. Even -the extra faces are useful enough. -

              -
              -
              - -
              -

              Package: recentf-ext

              -
              -

              -Features: -

              - -

              -Extension of `recentf' package. -

              - -
                -
              • `dired' buffers can be handled.
              • -
              • Switching to file buffer considers it as most recent file.
              • -
              - -

              -Installation: -

              - -

              -M-x list-packages and select recentf-ext package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: recentf-ext    ;;
              -;;                         ;;
              -;; GROUP: Files -> Recentf ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'recentf-ext)
              -
              -
              - -

              -Usage: -

              - -

              -When you visit a directory, that directory is saved by recentf as well. -

              -
              -
              - -
              -

              Package: ztree

              -
              -

              -Author: Alexey Veretennikov, alexey.veretennikov@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Ztree is a project dedicated to implementation of several text-tree -applications inside Emacs. It consists of 2 sub-projects: ztree-diff -and ztree-dir(the basis of ztree-diff). -

              - -
                -
              • ztree-diff: Perform diff on two directories. Really handy when you -want to create a big patch between two directories.
              • -
              - - -
              -

              ztree-diff.png -

              -
              - -
                -
              • ztree-dir: a simple tree explorer.
              • -
              - - -
              -

              ztree-dir.png -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select ztree package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: ztree  ;;
              -;;                 ;;
              -;; GROUP: No group ;;
              -;;;;;;;;;;;;;;;;;;;;;
              -;; since ztree works with files and directories, let's consider it in
              -;; group Files
              -(require 'ztree-diff)
              -(require 'ztree-dir)
              -
              -
              - -

              -Usage: -

              - -

              -M-x ztree-diff, then select the left and right directories to -compare. -

              - -

              -M-x ztree-dir to explorer filesystem: -

              - -
                -
              • Open/close directories with double-click, RET or Space keys.
              • -
              • To jump to the parent directory, hit the Backspace key.
              • -
              • To toggle open/closed state of the subtree of the current directory, -hit the x key.
              • -
              -
              -
              - -
              -

              Package: vlf

              -
              -

              -Author: Andrey Kotlarski, m00naticus@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Emacs minor mode that allows viewing, editing, searching and comparing -large files in batches. Batch size can be adjusted on the fly and -bounds the memory that is to be used for operations on the file. This -way multiple large files (like terabytes or whatever) can be instantly -and simultaneously accessed without swapping and degraded -performance. -

              - -

              -This is development version of the GNU ELPA VLF package. Here’s what -it offers in a nutshell: -

              - -
                -
              • regular expression search on whole file (in constant memory -determined by current batch size)
              • -
              • chunk editing (if size has changed, saving is done in constant -memory determined by current batch size)
              • -
              • Occur like indexing
              • -
              • options to jump to beginning, end or arbitrary file chunk
              • -
              • ability to jump/insert given number of batches at once
              • -
              • newly added content is acknowledged if file has changed size -meanwhile
              • -
              • automatic scrolling of batches
              • -
              • as a minor mode, font locking and functionality of the respective -major mode is also present
              • -
              • by batch Ediff comparison
              • -
              • can be added as option to automatically open large files
              • -
              • smooth integration with hexl-mode
              • -
              • works with TRAMP so accessing network files is fine
              • -
              - -

              -GNU Emacs 23 and 24 are supported. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select ** package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: vlf        ;;
              -;;                     ;;
              -;; GROUP: Files -> Vlf ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'vlf-integrate)
              -(setq vlf-application 'dont-ask) ;; automatically use vlf on large file,
              -                                 ;; when the file exceed large-file-warning-threshold
              -
              -
              - -

              -Usage: -

              - -

              -Please refer to Detail Usage section. -

              -
              -
              -
              - -
              -

              setup-text.el

              -
              -

              -I only use default configuration for "Text" group. You can customize -it if you want or leave this file blank, so you can add customizations -when needed. This group is useful if you edit text frequently and need -bibliography, or you want to write Latex. -

              - -
              - -
              (provide 'setup-text)
              -
              -
              -
              -
              - -
              -

              setup-data.el

              -
              -

              -Remember to include the line (provide 'setup-data), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-data)
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Data -> Saveplace ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -
              -;; saveplace remembers your location in a file when saving files
              -(require 'saveplace)
              -(setq-default save-place t)
              -;; use (toggle-save-place-globally 1) in Emacs above 24.4
              -
              -
              -
              -
              - -
              -

              setup-external.el

              -
              -

              -Remember to include the line (provide 'setup-external), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-external)
              -
              -;; GROUP: Processes -> Flyspell
              -(if (executable-find "aspell")
              -    (progn
              -      (setq ispell-program-name "aspell")
              -      (setq ispell-extra-args '("--sug-mode=ultra")))
              -  (setq ispell-program-name "ispell"))
              -
              -(add-hook 'text-mode-hook 'flyspell-mode)
              -(add-hook 'org-mode-hook 'flyspell-mode)
              -(add-hook 'prog-mode-hook 'flyspell-prog-mode)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Processes -> Gud            ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(setq gud-chdir-before-run nil)
              -
              -;; term-mode, used in M-x term
              -(defun my-term-setup ()
              -  (interactive)
              -  (define-key term-raw-map (kbd "C-y") 'term-send-raw)
              -  (define-key term-raw-map (kbd "C-p") 'term-send-raw)
              -  (define-key term-raw-map (kbd "C-n") 'term-send-raw)
              -  (define-key term-raw-map (kbd "C-s") 'term-send-raw)
              -  (define-key term-raw-map (kbd "C-r") 'term-send-raw)
              -  (define-key term-raw-map (kbd "M-w") 'kill-ring-save)
              -  (define-key term-raw-map (kbd "M-y") 'helm-show-kill-ring)
              -  (define-key term-raw-map (kbd "M-d") (lambda () (interactive) (term-send-raw-string "\ed")))
              -  (define-key term-raw-map (kbd "<C-backspace>") (lambda () (interactive) (term-send-raw-string "\e\C-?")))
              -  (define-key term-raw-map (kbd "M-p") (lambda () (interactive) (term-send-raw-string "\ep")))
              -  (define-key term-raw-map (kbd "M-n") (lambda () (interactive) (term-send-raw-string "\en")))
              -  (define-key term-raw-map (kbd "M-,") 'term-send-input)
              -  (define-key term-raw-map (kbd "C-c y") 'term-paste)
              -  (define-key term-raw-map (kbd "C-S-y") 'term-paste)
              -  (define-key term-raw-map (kbd "C-h") nil) ; unbind C-h
              -  (define-key term-raw-map (kbd "M-x") nil) ; unbind M-x
              -  (define-key term-raw-map (kbd "C-c C-b") 'helm-mini)
              -  (define-key term-raw-map (kbd "C-1") 'zygospore-toggle-delete-other-windows)
              -  (define-key term-raw-map (kbd "C-2") 'split-window-below)
              -  (define-key term-raw-map (kbd "C-3") 'split-window-right)
              -  (define-key term-mode-map (kbd "C-0") 'delete-window))
              -(add-hook 'term-mode-hook 'my-term-setup t)
              -(setq term-buffer-maximum-size 0)
              -
              -(require 'term)
              -
              -;; taken from here: http://www.enigmacurry.com/2008/12/26/emacs-ansi-term-tricks/
              -(defun visit-ansi-term ()
              -  "If the current buffer is:
              -     1) a running ansi-term named *ansi-term*, rename it.
              -     2) a stopped ansi-term, kill it and create a new one.
              -     3) a non ansi-term, go to an already running ansi-term
              -        or start a new one while killing a defunt one"
              -  (interactive)
              -  (let ((is-term (string= "term-mode" major-mode))
              -        (is-running (term-check-proc (buffer-name)))
              -        (term-cmd "/bin/zsh")
              -        (anon-term (get-buffer "*ansi-term*")))
              -    (if is-term
              -        (if is-running
              -            (if (string= "*ansi-term*" (buffer-name))
              -                ;; (call-interactively 'rename-buffer)
              -                (ansi-term term-cmd)
              -              (if anon-term
              -                  (switch-to-buffer "*ansi-term*")
              -                (ansi-term term-cmd)))
              -          (kill-buffer (buffer-name))
              -          (ansi-term term-cmd))
              -      (if anon-term
              -          (if (term-check-proc "*ansi-term*")
              -              (switch-to-buffer "*ansi-term*")
              -            (kill-buffer "*ansi-term*")
              -            (ansi-term term-cmd))
              -        (ansi-term term-cmd)))))
              -
              -(global-set-key (kbd "<f2>") 'visit-ansi-term)
              -
              -;; PACKAGE: shell-pop
              -;; GROUP: Processes -> Shell -> Shell Pop
              -(require 'shell-pop)
              -(global-set-key (kbd "C-c t") 'shell-pop)
              -
              -
              -
              -
              -
              -

              setup-communication.el

              -
              -

              -This group allows to customize communications, networking, and remote -access to files. For example, ftp, ldap, dig, whois, netstat… I only -enable goto-address-mode to enable URL highlighting and able to -click on it in an buffer. Very useful. Sample configuration: -

              - -
              - -
              (provide 'setup-communication)
              -
              -;; go-to-address-mode
              -(add-hook 'prog-mode-hook 'goto-address-mode)
              -(add-hook 'text-mode-hook 'goto-address-mode)
              -
              -
              -
              -
              - -
              -

              setup-programming.el

              -
              -

              -Remember to include the line (provide 'setup-programming), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-programming)
              -;; GROUP: Programming -> Languages -> C
              -
              -;; Available C style:
              -;; “gnu”: The default style for GNU projects
              -;; “k&r”: What Kernighan and Ritchie, the authors of C used in their book
              -;; “bsd”: What BSD developers use, aka “Allman style” after Eric Allman.
              -;; “whitesmith”: Popularized by the examples that came with Whitesmiths C, an early commercial C compiler.
              -;; “stroustrup”: What Stroustrup, the author of C++ used in his book
              -;; “ellemtel”: Popular C++ coding standards as defined by “Programming in C++, Rules and Recommendations,” Erik Nyquist and Mats Henricson, Ellemtel
              -;; “linux”: What the Linux developers use for kernel development
              -;; “python”: What Python developers use for extension modules
              -;; “java”: The default style for java-mode (see below)
              -;; “user”: When you want to define your own style
              -(setq c-default-style "linux" ; set style to "linux"
              -      c-basic-offset 4)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Programming -> Tools -> Gdb ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(setq gdb-many-windows t        ; use gdb-many-windows by default
              -      gdb-show-main t)          ; Non-nil means display source file containing the main routine at startup
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Programming -> Tools -> Compilation ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Compilation from Emacs
              -(defun prelude-colorize-compilation-buffer ()
              -  "Colorize a compilation mode buffer."
              -  (interactive)
              -  ;; we don't want to mess with child modes such as grep-mode, ack, ag, etc
              -  (when (eq major-mode 'compilation-mode)
              -    (let ((inhibit-read-only t))
              -      (ansi-color-apply-on-region (point-min) (point-max)))))
              -
              -;; setup compilation-mode used by `compile' command
              -(require 'compile)
              -(setq compilation-ask-about-save nil          ; Just save before compiling
              -      compilation-always-kill t               ; Just kill old compile processes before starting the new one
              -      compilation-scroll-output 'first-error) ; Automatically scroll to first
              -(global-set-key (kbd "<f5>") 'compile)
              -
              -;; GROUP: Programming -> Tools -> Makefile
              -;; takenn from prelude-c.el:48: https://github.com/bbatsov/prelude/blob/master/modules/prelude-c.el
              -(defun prelude-makefile-mode-defaults ()
              -  (whitespace-toggle-options '(tabs))
              -  (setq indent-tabs-mode t))
              -
              -(setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults)
              -
              -(add-hook 'makefile-mode-hook (lambda ()
              -                                (run-hooks 'prelude-makefile-mode-hook)))
              -
              -;; GROUP: Programming -> Tools -> Ediff
              -(setq ediff-diff-options "-w"
              -      ediff-split-window-function 'split-window-horizontally
              -      ediff-window-setup-function 'ediff-setup-windows-plain)
              -
              -
              -
              - -
              -

              Package: diff-hl

              -
              -

              -Author: Dmitry Gutov, dgutov@yandex.ru -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -diff-hl-mode highlights uncommitted changes on the left side of the -window, allows you to jump between and revert them selectively. -

              - - -
              -

              diff-hl-buffer.png -

              -
              - -

              -For the usage instructions and the list of commands, see the -Commentary section inside the file. -

              - -

              -Tested with Git, Mercurial, Bazaar and SVN. May work with other VC -backends, too. -

              - -

              -The package also contains auxiliary modes: -

              - -
                -
              • -diff-hl-dired-mode provides similar functionality in Dired. -

                - - -
                -

                diff-hl-dired.png -

                -
              • - -
              • -diff-hl-margin-mode changes the highlighting function to use the -margin instead of the fringe. -

                - - -
                -

                diff-hl-margin.png -

                -
              • - -
              • diff-hl-amend-mode shifts the reference revision back by one.
              • -
              - -

              -Installation: -

              - -

              -M-x list-packages and select diff-hl package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: diff-hl                             ;;
              -;;                                              ;;
              -;; GROUP: Programming -> Tools -> Vc -> Diff Hl ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(global-diff-hl-mode)
              -(add-hook 'dired-mode-hook 'diff-hl-dired-mode)
              -
              -
              - -

              -Usage: -

              - -

              -To see diff-hl in action, open a buffer under a version control and -type something and save. You will see highlighted changes in the -fringe on the left. -

              - -

              -It is also similar with diff-hl-dired-mode. -

              -
              -
              - -
              -

              Package: magit

              -
              -

              -Author: -

              - -

              -Original Author: Marius Vollmer marius.vollmer@gmail.com -

              - -

              -Maintainer: Jonas Bernoulli, jonas@bernoul.li -

              - -

              -Former-Maintainers: -

              -
                -
              • Nicolas Dudebout, nicolas.dudebout@gatech.edu
              • -
              • Peter J. Weisberg, pj@irregularexpressions.net
              • -
              • Phil Jackson, phil@shellarchive.co.uk
              • -
              • Rémi Vanicat, vanicat@debian.org
              • -
              • Yann Hodique, yann.hodique@gmail.com
              • -
              - -

              -Homepage: http://magit.github.io -

              - -

              -Features: -Magit is an interface to the version control system Git, implemented -as an Emacs extension. -

              - -

              -Unlike Emacs' native Version Control package which strives to provide -a unified interface to various version control systems, Magit only -supports Git and can therefore better take advantage of its native -features. -

              - -

              -Magit supports GNU Emacs 23.2 or later; 24.1 or later is -recommended. Magit supports Git 1.7.2.5 or later; 1.8.2 or later is -recommended. The minimal versions are those available in Debian -oldstable. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select magit package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: magit                       ;;
              -;;                                      ;;
              -;; GROUP: Programming -> Tools -> Magit ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'magit)
              -(set-default 'magit-stage-all-confirm nil)
              -(add-hook 'magit-mode-hook 'magit-load-config-extensions)
              -
              -;; full screen magit-status
              -(defadvice magit-status (around magit-fullscreen activate)
              -  (window-configuration-to-register :magit-fullscreen)
              -  ad-do-it
              -  (delete-other-windows))
              -
              -(global-unset-key (kbd "C-x g"))
              -(global-set-key (kbd "C-x g h") 'magit-log)
              -(global-set-key (kbd "C-x g f") 'magit-file-log)
              -(global-set-key (kbd "C-x g b") 'magit-blame-mode)
              -(global-set-key (kbd "C-x g m") 'magit-branch-manager)
              -(global-set-key (kbd "C-x g c") 'magit-branch)
              -(global-set-key (kbd "C-x g s") 'magit-status)
              -(global-set-key (kbd "C-x g r") 'magit-reflog)
              -(global-set-key (kbd "C-x g t") 'magit-tag)
              -
              -
              - -

              -Usage: -

              - -

              -Getting started with Magit is really easy: -

              - -
                -
              • M-x magit-status to see git status, and in the status buffer:
              • -
              • s to stage files
              • -
              • c c to commit, type in your commit message then C-c C-c to save -the message and commit, C-c C-k to abort current commit message -and go back magit-status.
              • -
              • b b to switch to a branch.
              • -
              - -

              -Other handy keys: -

              - -
                -
              • P P to do a git push
              • -
              • F F to do a git pull
              • -
              • try to press TAB on entries.
              • -
              - -

              -If you want to view the raw git commands, i.e. you want to know how -git push is doing, press $. -

              - -

              -For more usage, please refer to the official manual. -

              -
              -
              - -
              -

              Package: flycheck

              -
              -

              -Author: Sebastian Wiesner, swiesner@lunaryorn.com -

              - -

              -Homepage: http://flycheck.readthedocs.org/ -

              - -

              -Features: -

              - -
                -
              • Supports over 30 programming and markup languages with more than 60 different syntax checking tools
              • -
              • Fully automatic, fail-safe, on-the-fly syntax checking in background
              • -
              • Nice error indication and highlighting
              • -
              • Optional error list popup
              • -
              • Many customization options
              • -
              • A comprehensive manual
              • -
              • A simple interface to define new syntax checkers
              • -
              • A “doesn't get in your way” guarantee
              • -
              • Many 3rd party extensions
              • -
              - -

              -Installation; -

              - -

              -M-x list-packages and select flycheck package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: flycheck                       ;;
              -;;                                         ;;
              -;; GROUP: Programming -> Tools -> Flycheck ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'flycheck)
              -(add-hook 'after-init-hook #'global-flycheck-mode)
              -
              -
              - -

              -Usage: -

              - -

              -After you installed and activated flycheck, your supported buffers -are automatically checked against errors as you typed and the errors -are displayed in echo area. -

              -
              -
              - -
              -

              Package: flycheck-tip

              -
              -

              -Author: Yuta Yamada, cokesboy@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Show flycheck error by popupo. -

              - -

              -Installation: -M-x list-packages and select flycheck-tip package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: flycheck-tip                                      ;;
              -;;                                                            ;;
              -;; GROUP: Flycheck Tip, but just consider it part of Flycheck ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'flycheck-tip)
              -(flycheck-tip-use-timer 'verbose)
              -
              -
              - -

              -Usage: -

              - -

              -The errors are now displayed by popup, instead of printing into the -echo area. Echo area should be preserved for other things like -eldoc-mode. -

              -
              -
              -
              - -
              -

              setup-applications.el

              -
              -

              -Remember to include the line (provide 'setup-applications), otherwise -Emacs won't be able to load your module.Sample configuration: -

              - -
              - -
              (provide 'setup-applications)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Applications-> Eshell       ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'eshell)
              -(require 'em-alias)
              -(require 'cl)
              -
              -;; Advise find-file-other-window to accept more than one file
              -(defadvice find-file-other-window (around find-files activate)
              -  "Also find all files within a list of files. This even works recursively."
              -  (if (listp filename)
              -      (loop for f in filename do (find-file-other-window f wildcards))
              -    ad-do-it))
              -
              -;; In Eshell, you can run the commands in M-x
              -;; Here are the aliases to the commands.
              -;; $* means accepts all arguments.
              -(eshell/alias "o" "")
              -(eshell/alias "o" "find-file-other-window $*")
              -(eshell/alias "vi" "find-file-other-window $*")
              -(eshell/alias "vim" "find-file-other-window $*")
              -(eshell/alias "emacs" "find-file-other-windpow $*")
              -(eshell/alias "em" "find-file-other-window $*")
              -
              -(add-hook
              - 'eshell-mode-hook
              - (lambda ()
              -   (setq pcomplete-cycle-completions nil)))
              -
              -;; change listing switches based on OS
              -(when (not (eq system-type 'windows-nt))
              -  (eshell/alias "ls" "ls --color -h --group-directories-first $*"))
              -
              -
              -
              -
              - -
              -

              setup-development.el

              -
              -

              -Remember to include the line (provide 'setup-development), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-development)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Development -> Extensions -> Eldoc  ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
              -(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
              -(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Development -> Internal     ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Start garbage collection every 100MB to improve Emacs performance
              -(setq gc-cons-threshold 100000000)
              -
              -
              -
              -
              - -
              -

              setup-environment.el

              -
              -

              -Remember to include the line (provide 'setup-environment), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-environment)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Environment -> Initialization ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(setq
              - inhibit-startup-screen t
              - )
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Environment -> Minibuffer   ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; (icomplete-mode)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Environment -> Minibuffer -> Savehist ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; savehist saves minibuffer history by defaults
              -(setq savehist-additional-variables '(search ring regexp-search-ring) ; also save your regexp search queries
              -      savehist-autosave-interval 60     ; save every minute
              -      )
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Environment -> Windows -> Winner ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(winner-mode 1)
              -
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Environment -> Mode Line    ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(column-number-mode 1)
              -
              -
              -
              - -
              -

              Package: nyan-mode

              -
              -

              -Author: Jacek "TeMPOraL" Zlydach, temporal.pl@gmail.com -

              - -

              -Homepage: http://nyan-mode.buildsomethingamazing.com/ -

              - -

              -Features: -

              - -

              -Nyan Mode is an analog indicator of your position in the buffer. The -Cat should go from left to right in your mode-line, as you move your -point from 0% to 100%. -

              - - -
              -

              nyan-mode.png -

              -
              - - -
                -
              • Mind dumbing content included,
              • -
              • Experimental animation (M-x nyan-start-animation, M-x -nyan-stop-animation),
              • -
              • Wavy rainbow (M-x set-variable <ret> nyan-wavy-trail <ret> t),
              • -
              • Customizable properties.
              • -
              - -

              -NOT INCLUDED: music. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select nyan-mode package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: nyan-mode                    ;;
              -;;                                       ;;
              -;; GROUOP: Environment -> Frames -> Nyan ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; only turn on if a window system is available
              -;; this prevents error under terminal that does not support X
              -(case window-system
              -  ((x w32) (nyan-mode)))
              -
              -
              - -

              -Usage: -

              - -

              -As you scroll through a buffer, the cat moves to indicate the position -in buffer. -

              -
              -
              - -
              -

              Package: golden-ratio

              -
              -

              -Author: Roman Gonzalez, romanandreg@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Automatic resizing of Emacs windows to the golden ratio -

              - -

              -When working with many windows at the same time, each window has a size that is not convenient for editing. -

              - -

              -golden-ratio helps on this issue by resizing automatically the windows -you are working on to the size specified in the "Golden Ratio". The -window that has the main focus will have the perfect size for editing, -while the ones that are not being actively edited will be re-sized to -a smaller size that doesn't get in the way, but at the same time will -be readable enough to know it's content. -

              - - -
              -

              golden-ratio.gif -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select golden-ratio package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: golden-ratio                         ;;
              -;;                                               ;;
              -;; GROUP: Environment -> Windows -> Golden Ratio ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'golden-ratio)
              -
              -(add-to-list 'golden-ratio-exclude-modes "ediff-mode")
              -(add-to-list 'golden-ratio-exclude-modes "helm-mode")
              -(add-to-list 'golden-ratio-exclude-modes "dired-mode")
              -(add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p)
              -
              -(defun pl/helm-alive-p ()
              -  (if (boundp 'helm-alive-p)
              -      (symbol-value 'helm-alive-p)))
              -
              -;; do not enable golden-raio in thses modes
              -(setq golden-ratio-exclude-modes '("ediff-mode"
              -                                   "gud-mode"
              -                                   "gdb-locals-mode"
              -                                   "gdb-registers-mode"
              -                                   "gdb-breakpoints-mode"
              -                                   "gdb-threads-mode"
              -                                   "gdb-frames-mode"
              -                                   "gdb-inferior-io-mode"
              -                                   "gud-mode"
              -                                   "gdb-inferior-io-mode"
              -                                   "gdb-disassembly-mode"
              -                                   "gdb-memory-mode"
              -                                   "magit-log-mode"
              -                                   "magit-reflog-mode"
              -                                   "magit-status-mode"
              -                                   "IELM"
              -                                   "eshell-mode" "dired-mode"))
              -
              -(golden-ratio-mode)
              -
              -
              - -

              -Usage: -

              - -

              -C-x o and see your windows being resized. -

              -
              -
              -
              - -
              -

              setup-faces-and-ui.el

              -
              -

              -Remember to include the line (provide 'setup-faces-and-ui), otherwise -Emacs won't be able to load your module. Sample configuration: -

              - -
              - -
              (provide 'setup-faces-and-ui)
              -
              -;; you won't need any of the bar thingies
              -;; turn it off to save screen estate
              -(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
              -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
              -(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
              -
              -;; the blinking cursor is nothing, but an annoyance
              -(blink-cursor-mode -1)
              -
              -(setq scroll-margin 0
              -      scroll-conservatively 100000
              -      scroll-preserve-screen-position 1)
              -
              -(size-indication-mode t)
              -
              -;; more useful frame title, that show either a file or a
              -;; buffer name (if the buffer isn't visiting a file)
              -;; taken from prelude-ui.el
              -(setq frame-title-format
              -      '("" invocation-name " - " (:eval (if (buffer-file-name)
              -                                                    (abbreviate-file-name (buffer-file-name))
              -                                                  "%b"))))
              -
              -;; change font to Inconsolata for better looking text
              -;; remember to install the font Inconsolata first
              -(setq default-frame-alist '((font . "Inconsolata-11")))
              -;; set italic font for italic face, since Emacs does not set italic
              -;; face automatically
              -(set-face-attribute 'italic nil
              -                    :family "Inconsolata-Italic")
              -
              -
              -
              - -
              -

              Package: highlight-numbers

              -
              -

              -Author: Fanael Linithien, fanael4@gmail.com -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -highlight-numbers is an Emacs minor mode that highlights numeric -literals in source code. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select highlight-numbers package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: highlight-numbers         ;;
              -;;                                    ;;
              -;; GROUP: Faces -> Number Font Lock   ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(add-hook 'prog-mode-hook 'highlight-numbers-mode)
              -
              -
              - -

              -Usage: -

              - -

              -Numbers automatically have distinct colors in buffer. -

              -
              -
              - -
              -

              Package: highlight-symbol

              -
              -

              -Author: Nikolaj Schumacher, me@nschum.de -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Automatic and manual symbol highlighting for Emacs. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select highlight-symbol package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              (require 'highlight-symbol)
              -
              -(highlight-symbol-nav-mode)
              -
              -(add-hook 'prog-mode-hook (lambda () (highlight-symbol-mode)))
              -(add-hook 'org-mode-hook (lambda () (highlight-symbol-mode)))
              -
              -(setq highlight-symbol-idle-delay 0.2
              -      highlight-symbol-on-navigation-p t)
              -
              -(global-set-key [(control shift mouse-1)]
              -                (lambda (event)
              -                  (interactive "e")
              -                  (goto-char (posn-point (event-start event)))
              -                  (highlight-symbol-at-point)))
              -
              -(global-set-key (kbd "M-n") 'highlight-symbol-next)
              -(global-set-key (kbd "M-p") 'highlight-symbol-prev)
              -
              -
              - -

              -Usage: -

              - -

              -If you move point on a symbol, it automatically highlights all the -symbols in the current screen. From now on, pressing M-n and M-p -will immediately jump to the next/previous symbols in a buffer. -

              -
              -
              -
              -

              Change Emacs appearance by using color theme

              -
              -

              -Emacs has many color themes available for you to use. My personal one -is color-theme-sanityinc-tomorrow or grandshell-theme or -monokai-theme. Some popular themes are emacs-color-theme-solarized and -zenburn. You can select themes of your choice from MELPA. -

              -
              -
              -
              - -
              -

              setup-help.el

              -
              -

              -Remember to include the line (provide 'setup-help), otherwise Emacs -won't be able to load your module. -

              - -
              - -
              (provide 'setup-help)
              -
              -
              -
              - -
              -

              Package: info+

              -
              -

              -Author: Drew Adams, drew.adams@oracle.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -Info+ helps you read Info documents more enjoyable with extra -highlighting it provides. -

              - -

              -Installation: -

              - -

              -M-x list-packages and select info+ package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; GROUP: Help -> Info+               ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'info+)
              -
              -
              -
              -
              - -
              -

              Package: discover-my-major

              -
              -

              -Author: steckerhalter -

              - -

              -Homepage: Github -

              - -

              -Features: -

              - -

              -Discover key bindings and their meaning for the current Emacs major mode. -

              - - -
              -

              discover-my-major.png -

              -
              - -

              -Installation: -

              - -

              -M-x list-packages and select discover-my-major package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;; A quick major mode help with discover-my-major
              -(global-unset-key (kbd "C-h h"))        ; original "C-h h" displays "hello world" in different languages
              -(define-key 'help-command (kbd "h m") 'discover-my-major)
              -
              -
              - -

              -Usage: -

              - -

              -The above setup binds C-h h m to discover-my-major. In a buffer, -C-h h m and you will see key bindings of that major mode and its -description, as opposed to usual C-h m which gives mappings between -keys and commands. -

              -
              -
              - -
              -

              Package: rainbow-mode

              -
              -

              -Author: Julien Danjou, julien@danjou.info -

              - -

              -Homepage: GNU ELPA -

              - -

              -Features: -

              - -

              -This minor mode sets background color to strings that match color -names, e.g. #0000ff is displayed in white with a blue background. -

              - - -
              -

              rainbow-mode.png -

              -
              - -

              -Installation: -M-x list-packages and select rainbow-mode package, then install -it. After finish installing, add this code snippet to activate the -package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; PACKAGE: rainbow-mode              ;;
              -;;                                    ;;
              -;; GROUP: Help -> Rainbow             ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(add-hook 'html-mode-hook 'rainbow-mode)
              -(add-hook 'css-mode-hook 'rainbow-mode)
              -
              -
              - -

              -It is useful to always activate rainbow-mode in those two major -modes. For other modes, it is situational, so I don't use -prog-mode-hook. -

              - -

              -Usage: -

              - -

              -As you type a hex number or a color string in a buffer with -rainbow-mode activated, the hex number or color string is -colourized. -

              -
              -
              -
              -

              Package: help+

              -
              -

              -Author: Drew Adams, drew.adams@oracle.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -

              - -

              -Extensions to `help.el' for Emacs -

              - -

              -Installation: -

              - -

              -M-x list-packages and select help+ package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: help+                     ;;
              -;;                                    ;;
              -;; GROUP: Help                        ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'help+)
              -
              -
              - -

              -Usage: -

              - -

              -The following bindings are made: -

              - -

              -`C-h u' `manual-entry' -`C-h C-a' `apropos' -`C-h C-l' `locate-library' -`C-h RET' `help-on-click/key' -`C-h M-a' `apropos-documentation' -`C-h M-o' `pop-to-help-toggle' -`C-h C-M-a' `tags-apropos' -[mouse-1] `mouse-help-on-click' (non-mode-line) -[mouse-1] `mouse-help-on-mode-line-click' (mode-line) -

              -
              -
              - -
              -

              Package: help-fns+

              -
              -

              -Author: Drew Adams, drew.adams@oracle.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -

              - -

              -Extensions to `help-fns.el' -

              - -

              -Installation: -

              - -

              -M-x list-packages and select help-fns+ package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: help-fns+                 ;;
              -;;                                    ;;
              -;; GROUP: Help                        ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'help-fns+)
              -
              -
              - -

              -Usage: -

              - -

              -Keys bound here: -

              - - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              KeysBindings
              C-h Bdescribe-buffer
              C-h cdescribe-command (replaces describe-key-briefly)
              C-h odescribe-option
              C-h C-cdescribe-key-briefly (replaces C-h c)
              C-h C-odescribe-option-of-type
              C-h M-cdescribe-copying (replaces C-h C-c)
              C-h M-fdescribe-file
              C-h M-kdescribe-keymap
              C-h M-lfind-function-on-key
              -
              -
              - -
              -

              Package: help-mode+

              -
              -

              -Author: Drew Adams, drew.adams@oracle.com -

              - -

              -Homepage: Emacswiki -

              - -

              -Features: -

              - -

              -Extensions to `help-mode.el' -

              - -

              -Links to libraries are provided whenever library names appear in -buffer ‘*Help*’. After loading help-mode+.el, library names in buffer -Help have mouse-over links to the corresponding library code. -

              - -

              -For example, ‘C-h v features’ describes the variable ‘features’; this -description lists all of the libraries currently loaded in Emacs. -

              - -
                -
              • In vanilla Emacs (without help-mode+.el loaded), the library names -are not linked, unless a library (such as ‘grep’) happens to have -the same name as an Emacs function or variable, in which case -clicking the name displays the function or variable description in -buffer Help.
              • - -
              • With help-mode+.el loaded, each library name in the ‘C-h v features’ -list is linked to the library (code) itself. Click a name to -edit/view the library file.
              • -
              - -

              -Installation: -

              - -

              -M-x list-packages and select help-mode+ package, then -install it. After finish installing, add this code snippet to activate -the package: -

              - -
              - -
              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -;; Package: help-mode+                ;;
              -;;                                    ;;
              -;; GROUP: Help                        ;;
              -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
              -(require 'help-mode+)
              -
              -
              - -

              -Usage: -

              - -

              -If a *Help* buffer contains other library names, the names -automatically becomes links to jump to. -

              -
              -
              -
              - -
              -

              setup-local.el

              -
              -

              -If you define your own Customization Group locally to your -computer, your Customization Group should be added under Local -parent and customize it here. The only sub-group in Local group is -holiday, and I do not use it, so I leave this file blank. -

              -
              -
              -
              - -
              -

              More Emacs Lisp resources

              -
              -

              -If you want to learn more about Emacs Lisp programming, GNU Emacs Lisp -Manual is great to start real Lisp programming. -

              -
              -
              -
              -
              - -
              - - - comments powered by Disqus -
              - - \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index cb00139..0000000 --- a/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - -Table of Contents - - - - - - - -
              - - - - -
              - - - \ No newline at end of file diff --git a/emacs-tutor/c-ide.org b/org/c-ide.org similarity index 84% rename from emacs-tutor/c-ide.org rename to org/c-ide.org index 8ec0dd1..d252fd8 100644 --- a/emacs-tutor/c-ide.org +++ b/org/c-ide.org @@ -1,3 +1,4 @@ +# c-ide.org -*- mode:org; mode:visual-line; -*- #+TITLE: C/C++ Development Environment for Emacs In this guide, I will help you to setup an efficient working C/C++ @@ -9,7 +10,16 @@ inside Emacs effortlessly, such as jump to definition/references at cursor, go back and forth between jumping points, finding any file instantly, switching between .h and .c/.cpp. -A few demos: +Please remember that there's a table of content on the top right +corner and you can use it to navigate this guide. If you feel your +internet connection is too slow for my guide, you can always clone and +read it offline: https://github.com/tuhdo/tuhdo.github.io + +* Introductory demos +:PROPERTIES: +:ID: introductory-demos +:END: +Here are some visual examples of the emacs IDE in action: - Switching between .h and .c/.cpp anywhere in the project like Linux kernel. If more than one file exists, it displays a list of @@ -18,7 +28,7 @@ A few demos: [[file:static/c-ide/projectile-find-other-file.gif][file:static/c-ide/projectile-find-other-file.gif]] -- Jump around Linux kernel source with ease using =helm-gtags=. The +- Jumping around Linux kernel source with ease using =helm-gtags=. The demo begins when "START" appears at the bottom: [[file:static/c-ide/helm-gtags-jump-dwim.gif][file:static/c-ide/helm-gtags-jump-dwim.gif]] @@ -77,192 +87,155 @@ A few demos: [[file:static/part3/helm-man-woman.gif][file:static/part3/helm-man-woman.gif]] -Please remember that there's a table of content on the top right -corner and you can use it to navigate this guide. If you feel your -internet connection is too slow for my guide, you can always clone and -read it offline: https://github.com/tuhdo/tuhdo.github.io - -I added an Emacs repository that is properly configured for -demonstration purposes. You can clone and play with it without having to -manually copy and paste all the setup Elisp code throughout the guide. When -installed and run the _first time_, the demo repository will download from -MELPA, install and compile all the packages it needs. Note that depending on -your internet connection and processor speeds, this may take a while. - -Steps to install: +* Setup +:PROPERTIES: +:ID: setup +:END: +** Quick setup +:PROPERTIES: +:ID: quick-setup +:END: -- Install [[http://www.gnu.org/software/global][GNU Global]] from your distribution's package manager (Linux / Mac) or - from the [[http://adoxa.altervista.org/global/][Win32 port]] (Windows). If none is available, download the source [[http://www.gnu.org/software/global/download.html][here]] - and manually build the package. -- Backup your ~/.emacs.d elsewhere. +I've prepared a github repository (URL below) with the configuration +files to properly install and configure the components of the emacs +IDE, and with a sample C project to play with. When installed and run +the _first time_, the demo repository will download from MELPA, +install and compile all the packages it needs. Note that depending on +your internet connection and processor speeds, this may take a while, +but that shouldn't stop you from continuing with this guide; the next +section can be followed using a second instance of emacs, and without +the IDE components. + +If you don't wish to use the github repository, you can manually +install the components, and use the =.el= files of the demo as a +reference sample configuration. + +Steps to install the 'quick setup': + +- Install [[http://www.gnu.org/software/global][GNU Global]] from your distribution's package manager (Linux / + Mac) or from the [[http://adoxa.altervista.org/global/][Win32 port]] (Windows). If none is available, + download the source [[http://www.gnu.org/software/global/download.html][here]] and manually build the package. - If emacs is not already running, start it. -- Update your melpa database: =M-x package-list-packages=. -- Clone the repository into your ~/.emacs.d folder. - -#+begin_src sh - git clone https://github.com/tuhdo/emacs-c-ide-demo.git ~/.emacs.d -#+end_src - -- You may possibly want to edit your new =~/.emacs.d/init.el= file for two - options: - - + The demo repository can use either =gtags= (the default), or =ggtags=. If - you want to use =ggtags=, comment this line in =init.el=: +- Update your MELPA database: =M-x package-list-packages=. (reference: + [[file:emacs-tutor3.org::*How%20to%20use%20Emacs%20package%20manager][How to use Emacs package manager]]). +- Get a local copy of the repository. +#+BEGIN_SRC sh +# Three ways. There are more... +wget https://github.com/Boruch-Baum/emacs-c-ide-demo/archive/master.zip && unzip master.zip +wget https://github.com/Boruch-Baum/emacs-c-ide-demo/archive/master.tar.gz && tar -xf master.tar.gz +git clone --depth=1 https://github.com/Boruch-Baum/emacs-c-ide-demo.git +#+END_SRC +- Copy the sub-folder =emacs_ide_demo_config= into your =~/.emacs.d/= + folder. +- The other sub-folder, =emacs_ide_demo_project= has a sample skeleton + project. Use it in place or copy it elsewhere as convenient. +- You may possibly want to make a change to your new + =~/.emacs.d/emacs_ide_demo_config/init.el= file. By default, the + demo uses [[https://github.com/emacs-helm/helm][helm]] ([[http://tuhdo.github.io/helm-intro.html][reference]]) and [[https://github.com/syohex/emacs-helm-gtags][helm-gtags]], but if you don't want to + use =helm=, the alternative is to use =ggtags=. Here's how to make + that change. + + + comment these lines in =init.el=: #+BEGIN_SRC emacs-lisp + (require 'setup-helm) (require 'setup-helm-gtags) #+END_SRC And uncomment this line: - + #+BEGIN_SRC emacs-lisp ;; (require 'setup-ggtags) #+END_SRC - + The demo uses Helm. If you're not already familiar with Helm, read [[http://tuhdo.github.io/helm-intro.html][my guide]]. - If you don't want to use Helm, also comment this line in =init.el=: +- =M-x load-library RET emacs_ide_init= - #+BEGIN_SRC emacs-lisp - (require 'setup-helm) - #+END_SRC - -That does it! To start using the demo, just type =M-x load-file RET init.el=. -Continue reading this guide for its operational directions, without needing to -bother to perform any more installations or elisp evaluations. +As mentioned earlier, the first time you load the library, it will +perform a series of downloads, installs and compiles, which may take a +while, but you can still continue with the next section of this guide +in a second instance of emacs, even without any of the IDE components. -* Source code navigation -:PROPERTIES: -:ID: source-navigation -:END: -** Prerequisite: +** Not-so-quick setup :PROPERTIES: -:ID: b1292347-d0ed-4421-9905-33f1050883b2 +:ID: not-so-quick-setup :END: -- Know how to use =package.el= and MELPA. If you don't know how to - use, read the guide [[file:emacs-tutor3.org::*How%20to%20use%20Emacs%20package%20manager][How to use Emacs package manager]]. - -- Install [[https://github.com/leoliu/ggtags][ggtags]]. After installing =ggtags= from MELPA, add this code - snippet to setup =ggtags= and key bindings: - -#+begin_src emacs-lisp - (require 'ggtags) - (add-hook 'c-mode-common-hook - (lambda () - (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'asm-mode) - (ggtags-mode 1)))) - - (define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol) - (define-key ggtags-mode-map (kbd "C-c g h") 'ggtags-view-tag-history) - (define-key ggtags-mode-map (kbd "C-c g r") 'ggtags-find-reference) - (define-key ggtags-mode-map (kbd "C-c g f") 'ggtags-find-file) - (define-key ggtags-mode-map (kbd "C-c g c") 'ggtags-create-tags) - (define-key ggtags-mode-map (kbd "C-c g u") 'ggtags-update-tags) - - (define-key ggtags-mode-map (kbd "M-,") 'pop-tag-mark) -#+end_src -- Or, [[https://github.com/emacs-helm/helm][helm]] + [[https://github.com/syohex/emacs-helm-gtags][helm-gtags]]. Helm is awesome and if you are going to use - Helm, please read the [[http://tuhdo.github.io/helm-intro.html][Helm guide]]. Remember to setup =Helm= before - using =helm-gtags=. You can use this [[https://github.com/tuhdo/emacs-c-ide-demo/blob/master/custom/setup-helm.el][sample configuration]]. When - includes the above file in your =~/.emacs.d=, remember to add - =(require 'setup-helm)= to your =init.el=. +If your operating system distribution has already prepared all or some of the emacs IDE components as packages, then it stands to reason that it recommends you use those instead of downloading from MELPA. -#+begin_src emacs-lisp - (setq - helm-gtags-ignore-case t - helm-gtags-auto-update t - helm-gtags-use-input-at-cursor t - helm-gtags-pulse-at-cursor t - helm-gtags-prefix-key "\C-cg" - helm-gtags-suggested-key-mapping t - ) - - (require 'helm-gtags) - ;; Enable helm-gtags-mode - (add-hook 'dired-mode-hook 'helm-gtags-mode) - (add-hook 'eshell-mode-hook 'helm-gtags-mode) - (add-hook 'c-mode-hook 'helm-gtags-mode) - (add-hook 'c++-mode-hook 'helm-gtags-mode) - (add-hook 'asm-mode-hook 'helm-gtags-mode) - - (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function) - (define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select) - (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim) - (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack) - (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history) - (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history) -#+end_src - -Before using the =ggtags= or =helm-gtags=, remember to create a GTAGS -database by running =gtags= at your project root in terminal: +You can use your distribution's package manager to install any components so prepared, and afterwards perform the 'quick setup' instructions above. -#+begin_src shell-script - $ cd /path/to/project/root - $ gtags -#+end_src +If you use your distribution's package manager to install any components AFTER performing the 'quick setup', you will need to then manually delete the initially downloaded library from your =~/.emacs.d/elpa= folder. -After this, a few files are created: +The emacs ide components are: ++ TODO -#+begin_src shell-script - $ ls G* - GPATH GRTAGS GTAGS -#+end_src +Let's use debian as an example linux distribution. At the time of this writing, debian had packaged the following components: ++ TODO -- *GTAGS*: definition database -- *GRTAGS*: reference database -- *GPATH*: path name database - -If you use =ggtags=, you have a command for creating GTAGS database, -that is =ggtags-create-tags=; this is recommended way when using -=ggtags=, to let it know where the project root is. - -** Basic movements +* Basic source code navigation :PROPERTIES: -:ID: 45f1bb42-08e5-43b9-8ea9-7b5e1124f89e +:ID: basic-navigation :END: -- *C-M-f* runs =forward-sexp=, move forward over a balanced - expression that can be a pair or a symbol. Demo: - - [[file:static/c-ide/forward-func.gif][file:static/c-ide/forward-func.gif]] - -- *C-M-b* runs =backward-sexp=, move backward over a balanced - expression that can be a pair or a symbol. Demo: - - [[file:static/c-ide/backward-func.gif][file:static/c-ide/backward-func.gif]] - -- *C-M-k* runs =kill-sexp=, kill balanced expression - forward that can be a pair or a symbol. Demo: - - [[file:static/c-ide/kill-func-body.gif][file:static/c-ide/kill-func-body.gif]] - -- *C-M-* or *C-M-@* runs =mark-sexp=, put mark after - following expression that can be a pair or a symbol. Demo: - - [[file:static/c-ide/mark-func-body.gif][file:static/c-ide/mark-func-body.gif]] - -- *C-M-a* runs =beginning-of-defun=, which moves point to beginning of - a function. Demo: +Even without any IDE components installed, emacs already has features +useful for operating on source code. + +#+ATTR_HTML: :align center +| Key | Binding Function | | +|------------------------+----------------------+---------------------------------------------------------------------------| +| *C-M-f* | =forward-sexp= | move forward over a balanced expression that can be a pair or a symbol. | +| *C-M-b* | =backward-sexp= | move backward over a balanced expression that can be a pair or a symbol. | +| *C-M-k* | =kill-sexp= | kill balanced expression forward that can be a pair or a symbol. | +| *C-M-* or *C-M-@* | =mark-sexp= | put mark after following expression that can be a pair or a symbol. | +| *C-M-a* | =beginning-of-defun= | move point to beginning of a function. | +| *C-M-e* | =end-of-defun= | move point to end of a function. | +| *C-M-h* | =mark-defun= | put a region around whole current or following function. | + +** Demos + +#+ATTR_HTML: :border 2 :rules all :frame border +| *C-M-f* runs =forward-sexp=, to move forward | | *C-M-b* runs =backward-sexp=, to move backward | +| over a balanced expression that can be a pair or a symbol. | | over a balanced expression that can be a pair or a symbol. | +| [[file:static/c-ide/forward-func.gif][file:static/c-ide/forward-func.gif]] | | [[file:static/c-ide/backward-func.gif][file:static/c-ide/backward-func.gif]] | +| | | | +| *C-M-k* runs =kill-sexp=, to kill balanced expression | | *C-M-* or *C-M-@* runs =mark-sexp=, to put mark after | +| forward that can be a pair or a symbol. | | following expression that can be a pair or a symbol. | +| [[file:static/c-ide/kill-func-body.gif][file:static/c-ide/kill-func-body.gif]] | | [[file:static/c-ide/mark-func-body.gif][file:static/c-ide/mark-func-body.gif]] | +| | | | +| *C-M-a* runs =beginning-of-defun=, to move point to beginning of | | *C-M-e* runs =end-of-defun=, to move point to end of a | +| a function. | | function. | +| [[file:static/c-ide/beginning-of-defun.gif][file:static/c-ide/beginning-of-defun.gif]] | | [[file:static/c-ide/end-of-defun.gif][file:static/c-ide/end-of-defun.gif]] | +| | | | +| *C-M-h* runs =mark-defun=, to put a region around whole current | | | +| or following function. | | | +| [[file:static/c-ide/mark-defun.gif][file:static/c-ide/mark-defun.gif]] | | | - [[file:static/c-ide/beginning-of-defun.gif][file:static/c-ide/beginning-of-defun.gif]] - -- *C-M-e* runs =end-of-defun=, which moves point to end of a - function. Demo: - - [[file:static/c-ide/end-of-defun.gif][file:static/c-ide/end-of-defun.gif]] - -- *C-M-h* runs =mark-defun=, which put a region around whole current - or following function. Demo: +* Source code navigation +:PROPERTIES: +:ID: source-navigation +:END: +At this point, we begin using components of our emacs IDE, so if +you're using the demo to perform its install, you'll need to wait for +that to finish, and to close the second instance of emacs that you +were using in the previous section. +** Package preparation +:PROPERTIES: +:ID: b1292347-d0ed-4421-9905-33f1050883b2 +:END: +If you didn't use the the demo to install the emacs IDE components, +you'll now need to install [[http://www.gnu.org/software/global][GNU Global]], and you'll need to install from +MELPA your choice of either [[https://github.com/leoliu/ggtags][ggtags]] or the pair of packages [[https://github.com/emacs-helm/helm][helm]] + +[[https://github.com/syohex/emacs-helm-gtags][helm-gtags]]. In the demo package, the elisp code used to setup those packages can be found in =setup-helm-tags.el= / =setup-ggtags.el=. - [[file:static/c-ide/mark-defun.gif][file:static/c-ide/mark-defun.gif]] -** Basic concepts of tag +** Basic concepts of tags :PROPERTIES: :ID: b4902a85-f303-4f5f-8c13-1eb3d2d2de73 :END: -A tag is a name of an entity in source code. An entity can be a -variable, a method definition, an include-operator... A tag contains -information such as name of the tag (the name of the variable, -class, method), location of this tag in source code and which file it -belongs to. As an example, GNU Global generates three tag databases: +Source code navigation done by IDEs employs a concept called =tags=, a +term for an entity in source code. An entity can be a variable, a +method definition, an include-operator... A tag contains information +such as name of the tag (the name of the variable, class, method), +location of this tag in source code and which file it belongs to. As +an example, GNU Global generates three tag databases: - *GTAGS*: definition database - *GRTAGS*: reference database @@ -276,20 +249,29 @@ specified. A reference of a tag is where a tag is used in a source tree, but not where it is defined. +** Tag database creation +:PROPERTIES: +:ID: tag-database-creation +:END: +Were you _not_ using the emacs (or some other) IDE, the way to +create a GTAGS database would be to run =gtags= at your project root in +terminal: +#+begin_src shell-script + $ cd /path/to/project/root + $ gtags +#+end_src +With the emacs IDE, configured as recommended with the snippets above, +just type =C-c g c=, which will run either the =helm-gtags-create-tags= or =ggtags-create-tags= emacs command. + +Just to be certain that the database was created, type =M-! ls G*= to have emacs run the shelll command =ls G*= and display the output in a dedicated window. You should see the three files GPATH, GRTAGS, and GTAGS. ** Find definitions in current buffer :PROPERTIES: :ID: 3a64c7a4-e8a5-42b9-9476-28dff9e5cb96 :END: -The Imenu facility offers a way to find the major definitions, such as -function definitions, variable definitions in a file by name. =ggtags= -can integrate Imenu: - -#+begin_src emacs-lisp - (setq-local imenu-create-index-function #'ggtags-build-imenu-index) -#+end_src -If you use Helm, use =moo-jump-local= from [[https://github.com/abo-abo/function-args][function-args]] package. You -can use it as an outline tree like in other IDEs. Here is a demo: +If you use Helm, use =moo-jump-local= from [[https://github.com/abo-abo/function-args][function-args]] package. (But +helm seems to have imenu integration now). You can use it as an +outline tree like in other IDEs. Here is a demo: [[file:static/c-ide/moo-jump-local.gif][file:static/c-ide/moo-jump-local.gif]] @@ -331,7 +313,7 @@ s= to invoke Isearch on candidate buffer list. =M-.= runs =helm-gtags-dwim=, which behaves the same as =ggtags-find-tag-dwim=. Similarly, you jump back to original location by using =M-,=, which runs =tags-loop-continue= (Emacs - default). + default). #+BEGIN_CENTER [[file:static/c-ide/helm-gtags-definitions.png][file:static/c-ide/helm-gtags-definitions.png]] @@ -344,10 +326,10 @@ blank space. A prompt asks you for tag pattern, which is a regexp. =helm-gtags= provides a really nice feature that uses Helm to display -all available tags in a project and incrementally filtering, and is really +all available tags in a project and incrementally filtering, and is really fast using =helm-gtags-select=, which is bound to =C-j= in my setup above. This is useful when you want to explore tags in unfamiliar -project. Demo: +project. Demo: [[file:static/c-ide/helm-gtags-select.gif][file:static/c-ide/helm-gtags-select.gif]] @@ -360,7 +342,7 @@ project. Demo: - Using =helm-gtags=: Either run =helm-gtags-dwim= or =helm-gtags-find-rtags=, bound to *C-c g r*, which only finds - references. Note that for =helm-gtags-find-rtags=: + references. Note that for =helm-gtags-find-rtags=: - if point is inside a function, the prompt will be default to the function name. @@ -429,7 +411,7 @@ the node is a directory, the children of the node are files in that directory. One important thing to remember, Speedbar only lists files that match =speedbar-file-regexp=, that contains the extensions for common programming languages. If you don't see files in your -programming languages listed, consider adding it the regexp list. +programming languages listed, consider adding it the regexp list. *Basic usage*: @@ -606,7 +588,7 @@ You have two commands for completing C/C++ code: ((nil . ((company-clang-arguments . ("-I/home//project_root/include1/" "-I/home//project_root/include2/"))))) #+end_src - + If you put a file with a special name .dir-locals.el in a directory, Emacs will read it when it visits any file in that directory or any of its subdirectories, and apply the settings it specifies to the file’s @@ -615,7 +597,7 @@ Per-Directory Local Variables]]. If you use Helm, you can easily insert absolute path by *C-c i* at the current path in =helm-find-files= (bound to *C-x C-f* by default in my demo =.emacs.d= at the beginning): -[[file:static/c-ide/helm-files-insertion.gif][file:static/c-ide/helm-files-insertion.gif]] +[[file:static/c-ide/helm-files-insertion.gif][file:static/c-ide/helm-files-insertion.gif]] In the above example, =nil= means apply the settings to any file or sub-directory visited. If =non-nil=, you have to specify a major mode @@ -648,7 +630,7 @@ Replace == with your username. - Enter any source file and start completion. You will see that =company-clang= correctly retrieves completion candidates in those directories. - + * Header file completion with =company-c-headers= package :PROPERTIES: :ID: 6e05e8a5-04a3-4279-bf99-22fd627c0e92 @@ -666,7 +648,7 @@ Company. After installing from MELPA, set it up: add its paths since by default =company-c-headers= only includes these two system include paths: =/usr/include/= and =/usr/local/include/=. To enable C++ header completion for standard -libraries, you have to add its path, for example, like this: +libraries, you have to add its path, for example, like this: #+begin_src emacs-lisp (add-to-list 'company-c-headers-path-system "/usr/include/c++/4.8/") @@ -679,23 +661,24 @@ local, use =company-c-headers-path-user= and put it in * CEDET :PROPERTIES: :ID: cedet -:END: +:END: ** What is CEDET? :PROPERTIES: :ID: what-is-cedet :END: -CEDET is a (C)ollection of (E)macs (D)evelopment (E)nvironment (T)ools written -with the end goal of creating an advanced development environment in -Emacs. CEDET includes common features such as intelligent completion, -source code navigation, project management, code generation with -templates . CEDET also provides a framework for working with -programming languages; support for new programming languages can be -added and use CEDET to provide IDE-like features. - -CEDET can give you code completion, but this process takes time and can block -your Emacs while it is doing so. If you have large project, you may not want to -use CEDET for code completion. But, you can use CEDET perfectly for utilities -that work at file scope i.e. refactoring local variables in a function in a file. +CEDET is a (C)ollection of (E)macs (D)evelopment (E)nvironment (T)ools +written with the end goal of creating an advanced development +environment in Emacs. CEDET includes common features such as +intelligent completion, source code navigation, project management, +code generation with templates . CEDET also provides a framework for +working with programming languages; support for new programming +languages can be added and use CEDET to provide IDE-like features. + +CEDET can give you code completion, but this process takes time and +can block your Emacs while it is doing so. If you have large project, +you may not want to use CEDET for code completion. But, you can use +CEDET perfectly for utilities that work at file scope i.e. refactoring +local variables in a function in a file. ** Why use CEDET? :PROPERTIES: @@ -736,9 +719,9 @@ CEDET was merged into Emacs since 23.2. You do not need to install CEDET manually. However, you can also use the development repository that contains latest bug fixes and more features. Nevertheless, the built-in Emacs is still adequate for daily usage and convenient for -trying out before actually cloning and use the development -version. Skip this section if you only want to try Emacs. Come back -later if you really like it. +trying out before actually cloning and use the development version. +Skip this section if you only want to try Emacs. Come back later if +you really like it. If you really want to use the development version with latest feature, checkout this branch: @@ -1432,29 +1415,15 @@ Setup for C/C++: #+end_src Default key bindings: - -| Key | Binding | -|---------------+--------------------------------------------| -| *C-c @ C-c* | Command: =hs-toggle-hiding= | -| | Toggle hiding/showing of a block | -|---------------+--------------------------------------------| -| *C-c @ C-h* | Command: =hs-hide-block= | -| | Select current block at point and hide it | -|---------------+--------------------------------------------| -| *C-c @ C-l* | Command: =hs-hide-level= | -| | Hide all block with indentation levels | -| | below this block | -|---------------+--------------------------------------------| -| *C-c @ C-s* | Command: =hs-show-block= | -| | Select current block at point and show it. | -|---------------+--------------------------------------------| -| *C-c @ C-M-h* | Command: =hs-hide-all= | -| | Hide all top level blocks, displaying | -| | only first and last lines. | -|---------------+--------------------------------------------| -| *C-c @ C-M-s* | Command: =hs-show-all= | -| | Show everything | -|---------------+--------------------------------------------| +#+ATTR_HTML: :align center +| Key | Binding | | +|---------------+--------------------+------------------------------------------------------------------| +| *C-c @ C-c* | =hs-toggle-hiding= | Toggle hiding/showing of a block | +| *C-c @ C-h* | =hs-hide-block= | Select current block at point and hide it | +| *C-c @ C-l* | =hs-hide-level= | Hide all block with indentation levels below this block | +| *C-c @ C-s* | =hs-show-block= | Select current block at point and show it. | +| *C-c @ C-M-h* | =hs-hide-all= | Hide all top level blocks, displaying only first and last lines. | +| *C-c @ C-M-s* | =hs-show-all= | Show everything | Demo: @@ -1476,18 +1445,12 @@ can safely remove all those =printf= and be certain that nothing else is changed accidentally. Default key bindings: - -| Key | Binding | -|-----------+--------------------------------------------| -| *C-x n d* | Command: =narrow-to-defun= | -| | Narrow buffer to current function at point | -|-----------+--------------------------------------------| -| *C-x n r* | Command: =narrow-to-region= | -| *C-x n n* | Narrow buffer to active region | -|-----------+--------------------------------------------| -| *C-x n w* | Command: =widen= | -| | Widen buffer | -|-----------+--------------------------------------------| +#+ATTR_HTML: :align center +| Key | Binding | | +|-----------+--------------------+--------------------------------------------| +| *C-x n d* | =narrow-to-defun= | Narrow buffer to current function at point | +| *C-x n n* | =narrow-to-region= | Narrow buffer to active region | +| *C-x n w* | =widen= | Widen buffer | ** Identation :PROPERTIES: @@ -1702,27 +1665,18 @@ For complete documentation, please refer to [[https://github.com/Fuco1/smartpare *RET* to jump to the location of that error. The following key bindings are available: - +#+ATTR_HTML: :align center | Key | Description | |---------+---------------------------------------------------------------------------------| | *C-o* | Display matched location, but *do not* switch point to matched buffer | -|---------+---------------------------------------------------------------------------------| | *M-n* | Move to next error message, but *do not* visit error location | -|---------+---------------------------------------------------------------------------------| | *M-p* | Move to next previous message, but *do not* visit error location | -|---------+---------------------------------------------------------------------------------| | *M-g n* | Move to next error message, visit error location | -|---------+---------------------------------------------------------------------------------| | *M-g p* | Move to previous error message, visit error location | -|---------+---------------------------------------------------------------------------------| | *RET* | Visit location of error at poiint | -|---------+---------------------------------------------------------------------------------| | *M-{* | Move point to the next error message or match occurring in a different file | -|---------+---------------------------------------------------------------------------------| | *M-}* | Move point to the previous error message or match occurring in a different file | -|---------+---------------------------------------------------------------------------------| | *q* | Quit =*compilation*= buffer | -|---------+---------------------------------------------------------------------------------| I usually execute the same compilation command many times. It's more convenient if Emacs doesn't ask us to confirm every time we re-execute @@ -1765,7 +1719,7 @@ store window configurations, read it [[file:emacs-tutor.org::*Registers][here]]. * Debugging :PROPERTIES: -:ID: debugging +:ID: debugging :END: ** With GDB Many Windows :PROPERTIES: @@ -1843,7 +1797,7 @@ Each cell coressponds to the following commands: - =gdb-display-threads-buffer= (Cell 6): Display running threads in your programs. Please refer to [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Threads-Buffer.html#Threads-Buffer][GNU Manual - Threads Buffer]] and - [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Multithreaded-Debugging.html#Multithreaded-Debugging][Multithreaded Debugging]] for usage of the buffer. + [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Multithreaded-Debugging.html#Multithreaded-Debugging][Multithreaded Debugging]] for usage of the buffer. There are two useful commands that are not visible in =gdb-many-windows=: diff --git a/emacs-tutor/c-ide-irony_bak.org b/org/c-ide_old.org similarity index 100% rename from emacs-tutor/c-ide-irony_bak.org rename to org/c-ide_old.org diff --git a/emacs-tutor/ebrowse.org b/org/ebrowse_old.org similarity index 100% rename from emacs-tutor/ebrowse.org rename to org/ebrowse_old.org diff --git a/emacs-tutor/emacs-for-proglang.org b/org/emacs-for-proglang.org similarity index 100% rename from emacs-tutor/emacs-for-proglang.org rename to org/emacs-for-proglang.org diff --git a/emacs-tutor/emacs-tutor.org b/org/emacs-tutor1.org similarity index 100% rename from emacs-tutor/emacs-tutor.org rename to org/emacs-tutor1.org diff --git a/emacs-tutor/emacs-tutor2.org b/org/emacs-tutor2.org similarity index 100% rename from emacs-tutor/emacs-tutor2.org rename to org/emacs-tutor2.org diff --git a/emacs-tutor/emacs-tutor3.org b/org/emacs-tutor3.org similarity index 100% rename from emacs-tutor/emacs-tutor3.org rename to org/emacs-tutor3.org diff --git a/emacs-tutor/helm-intro.org b/org/helm-intro.org similarity index 100% rename from emacs-tutor/helm-intro.org rename to org/helm-intro.org diff --git a/emacs-tutor/helm-projectile.org b/org/helm-projectile.org similarity index 100% rename from emacs-tutor/helm-projectile.org rename to org/helm-projectile.org diff --git a/org/index.org b/org/index.org new file mode 100644 index 0000000..6a75403 --- /dev/null +++ b/org/index.org @@ -0,0 +1,13 @@ +#+TITLE: Emacs Mini Manual + ++ Pages + + [[file:emacs-tutor.org][Emacs Mini Manual (PART 1) - The Basics]] + + [[file:emacs-tutor2.org][Emacs Mini Manual (PART 2) - Lisp Primer: Why Parentheses Matter]] + + [[file:emacs-tutor3.org][Emacs Mini Manual (PART 3) - Customizing And Extending Emacs]] + + [[file:c-ide.org][Setup C/C++ Development Environment for Emacs]] + + [[file:helm-intro.org][A Package in a league of its own: =Helm=]] + + [[file:helm-projectile.org][Exploring large projects with Projectile and Helm Projectile]] + + [[file:emacs-for-proglang.org][Emacs for Programming Languages course on Coursera]] + + [[file:setup-emacs-windows.org][Setup Emacs with PDF Tools and Xwidgets web browser on Windows]] + +(source: https://boruch-baum.github.io/emacs_mini_manual/) diff --git a/emacs-tutor/planet.css b/org/planet.css similarity index 100% rename from emacs-tutor/planet.css rename to org/planet.css diff --git a/org/publish.el b/org/publish.el new file mode 100644 index 0000000..80dbe83 --- /dev/null +++ b/org/publish.el @@ -0,0 +1,35 @@ +; publish.el - org-publish definition +; in support of `tuhdo.github.io' "Emacs Mini Manual" +; +; Warning: Performing the publication will overwrite any targets +; already existing in the parent folder. +; +; Instructions: +; M-x load-file path/to/publish.el (or otherwise evaluate this buffer) +; Navigate to a buffer of the project +; C-u M-x org-publish emacs_mini_manual +; +(setq + org-publish-project-alist + '(("orgfiles" + :base-directory "./" + :base-extension "org" + :exclude "_old.org" + :publishing-directory "../docs/" + :publishing-function org-html-publish-to-html + :headline-levels 3 + :section-numbers t + :with-toc 1 + :html-head "" + :html-preamble t) + ("images+css" + :base-directory "./" + :recursive t + :base-extension "jpg\\|gif\\|png" + :include ("static/worg.css") + :publishing-directory "../docs/" + :publishing-function org-publish-attachment) + ("emacs_mini_manual" :components ("orgfiles" "images+css"))) +; org-html-table-default-attributes + ) diff --git a/emacs-tutor/setup-emacs-windows.org b/org/setup-emacs-windows.org similarity index 100% rename from emacs-tutor/setup-emacs-windows.org rename to org/setup-emacs-windows.org diff --git a/static/auto_complete.gif b/org/static/auto_complete.gif similarity index 100% rename from static/auto_complete.gif rename to org/static/auto_complete.gif diff --git a/static/c-ide/backward-func.gif b/org/static/c-ide/backward-func.gif similarity index 100% rename from static/c-ide/backward-func.gif rename to org/static/c-ide/backward-func.gif diff --git a/static/c-ide/beginning-of-defun.gif b/org/static/c-ide/beginning-of-defun.gif similarity index 100% rename from static/c-ide/beginning-of-defun.gif rename to org/static/c-ide/beginning-of-defun.gif diff --git a/static/c-ide/company-c-header.png b/org/static/c-ide/company-c-header.png similarity index 100% rename from static/c-ide/company-c-header.png rename to org/static/c-ide/company-c-header.png diff --git a/static/c-ide/company-clang-company-gtags.gif b/org/static/c-ide/company-clang-company-gtags.gif similarity index 100% rename from static/c-ide/company-clang-company-gtags.gif rename to org/static/c-ide/company-clang-company-gtags.gif diff --git a/static/c-ide/company-clang-project-completion.gif b/org/static/c-ide/company-clang-project-completion.gif similarity index 100% rename from static/c-ide/company-clang-project-completion.gif rename to org/static/c-ide/company-clang-project-completion.gif diff --git a/static/c-ide/compilation-compile.gif b/org/static/c-ide/compilation-compile.gif similarity index 100% rename from static/c-ide/compilation-compile.gif rename to org/static/c-ide/compilation-compile.gif diff --git a/static/c-ide/compilation-mode.gif b/org/static/c-ide/compilation-mode.gif similarity index 100% rename from static/c-ide/compilation-mode.gif rename to org/static/c-ide/compilation-mode.gif diff --git a/static/c-ide/ede-project.gif b/org/static/c-ide/ede-project.gif similarity index 100% rename from static/c-ide/ede-project.gif rename to org/static/c-ide/ede-project.gif diff --git a/static/c-ide/ede-rearrange-project-dir.gif b/org/static/c-ide/ede-rearrange-project-dir.gif similarity index 100% rename from static/c-ide/ede-rearrange-project-dir.gif rename to org/static/c-ide/ede-rearrange-project-dir.gif diff --git a/static/c-ide/ede-same-dir-completion.gif b/org/static/c-ide/ede-same-dir-completion.gif similarity index 100% rename from static/c-ide/ede-same-dir-completion.gif rename to org/static/c-ide/ede-same-dir-completion.gif diff --git a/static/c-ide/end-of-defun.gif b/org/static/c-ide/end-of-defun.gif similarity index 100% rename from static/c-ide/end-of-defun.gif rename to org/static/c-ide/end-of-defun.gif diff --git a/emacs-tutor/static/c-ide/fa-show b/org/static/c-ide/fa-show similarity index 100% rename from emacs-tutor/static/c-ide/fa-show rename to org/static/c-ide/fa-show diff --git a/static/c-ide/forward-func.gif b/org/static/c-ide/forward-func.gif similarity index 100% rename from static/c-ide/forward-func.gif rename to org/static/c-ide/forward-func.gif diff --git a/static/c-ide/function-args-demo.gif b/org/static/c-ide/function-args-demo.gif similarity index 100% rename from static/c-ide/function-args-demo.gif rename to org/static/c-ide/function-args-demo.gif diff --git a/static/c-ide/function-args-jump.gif b/org/static/c-ide/function-args-jump.gif similarity index 100% rename from static/c-ide/function-args-jump.gif rename to org/static/c-ide/function-args-jump.gif diff --git a/static/c-ide/gdb-many-windows.gif b/org/static/c-ide/gdb-many-windows.gif similarity index 100% rename from static/c-ide/gdb-many-windows.gif rename to org/static/c-ide/gdb-many-windows.gif diff --git a/static/c-ide/gdb-prompt.gif b/org/static/c-ide/gdb-prompt.gif similarity index 100% rename from static/c-ide/gdb-prompt.gif rename to org/static/c-ide/gdb-prompt.gif diff --git a/static/c-ide/ggtags-definitions.png b/org/static/c-ide/ggtags-definitions.png similarity index 100% rename from static/c-ide/ggtags-definitions.png rename to org/static/c-ide/ggtags-definitions.png diff --git a/static/c-ide/gud.gif b/org/static/c-ide/gud.gif similarity index 100% rename from static/c-ide/gud.gif rename to org/static/c-ide/gud.gif diff --git a/static/c-ide/helm-files-insertion.gif b/org/static/c-ide/helm-files-insertion.gif similarity index 100% rename from static/c-ide/helm-files-insertion.gif rename to org/static/c-ide/helm-files-insertion.gif diff --git a/static/c-ide/helm-gtags-definitions.png b/org/static/c-ide/helm-gtags-definitions.png similarity index 100% rename from static/c-ide/helm-gtags-definitions.png rename to org/static/c-ide/helm-gtags-definitions.png diff --git a/static/c-ide/helm-gtags-jump-dwim.gif b/org/static/c-ide/helm-gtags-jump-dwim.gif similarity index 100% rename from static/c-ide/helm-gtags-jump-dwim.gif rename to org/static/c-ide/helm-gtags-jump-dwim.gif diff --git a/static/c-ide/helm-gtags-select.gif b/org/static/c-ide/helm-gtags-select.gif similarity index 100% rename from static/c-ide/helm-gtags-select.gif rename to org/static/c-ide/helm-gtags-select.gif diff --git a/static/c-ide/helm-semantic-or-imenu-with-struct.gif b/org/static/c-ide/helm-semantic-or-imenu-with-struct.gif similarity index 100% rename from static/c-ide/helm-semantic-or-imenu-with-struct.gif rename to org/static/c-ide/helm-semantic-or-imenu-with-struct.gif diff --git a/static/c-ide/hs-toggle-hiding.gif b/org/static/c-ide/hs-toggle-hiding.gif similarity index 100% rename from static/c-ide/hs-toggle-hiding.gif rename to org/static/c-ide/hs-toggle-hiding.gif diff --git a/static/c-ide/kill-func-body.gif b/org/static/c-ide/kill-func-body.gif similarity index 100% rename from static/c-ide/kill-func-body.gif rename to org/static/c-ide/kill-func-body.gif diff --git a/static/c-ide/mark-defun.gif b/org/static/c-ide/mark-defun.gif similarity index 100% rename from static/c-ide/mark-defun.gif rename to org/static/c-ide/mark-defun.gif diff --git a/static/c-ide/mark-func-body.gif b/org/static/c-ide/mark-func-body.gif similarity index 100% rename from static/c-ide/mark-func-body.gif rename to org/static/c-ide/mark-func-body.gif diff --git a/static/c-ide/moo-complete.png b/org/static/c-ide/moo-complete.png similarity index 100% rename from static/c-ide/moo-complete.png rename to org/static/c-ide/moo-complete.png diff --git a/static/c-ide/moo-jump-local.gif b/org/static/c-ide/moo-jump-local.gif similarity index 100% rename from static/c-ide/moo-jump-local.gif rename to org/static/c-ide/moo-jump-local.gif diff --git a/static/c-ide/projectile-find-other-file.gif b/org/static/c-ide/projectile-find-other-file.gif similarity index 100% rename from static/c-ide/projectile-find-other-file.gif rename to org/static/c-ide/projectile-find-other-file.gif diff --git a/static/c-ide/semantic-boost-demo.gif b/org/static/c-ide/semantic-boost-demo.gif similarity index 100% rename from static/c-ide/semantic-boost-demo.gif rename to org/static/c-ide/semantic-boost-demo.gif diff --git a/static/c-ide/semantic-idle-summary-lambda.gif b/org/static/c-ide/semantic-idle-summary-lambda.gif similarity index 100% rename from static/c-ide/semantic-idle-summary-lambda.gif rename to org/static/c-ide/semantic-idle-summary-lambda.gif diff --git a/static/c-ide/semantic-idle-summary-variable.gif b/org/static/c-ide/semantic-idle-summary-variable.gif similarity index 100% rename from static/c-ide/semantic-idle-summary-variable.gif rename to org/static/c-ide/semantic-idle-summary-variable.gif diff --git a/static/c-ide/semantic-parsing.gif b/org/static/c-ide/semantic-parsing.gif similarity index 100% rename from static/c-ide/semantic-parsing.gif rename to org/static/c-ide/semantic-parsing.gif diff --git a/static/c-ide/semantic-sticky-func.gif b/org/static/c-ide/semantic-sticky-func.gif similarity index 100% rename from static/c-ide/semantic-sticky-func.gif rename to org/static/c-ide/semantic-sticky-func.gif diff --git a/static/c-ide/semantic-symref.gif b/org/static/c-ide/semantic-symref.gif similarity index 100% rename from static/c-ide/semantic-symref.gif rename to org/static/c-ide/semantic-symref.gif diff --git a/static/c-ide/senator-go-to-up-reference.gif b/org/static/c-ide/senator-go-to-up-reference.gif similarity index 100% rename from static/c-ide/senator-go-to-up-reference.gif rename to org/static/c-ide/senator-go-to-up-reference.gif diff --git a/static/c-ide/senator-jump.gif b/org/static/c-ide/senator-jump.gif similarity index 100% rename from static/c-ide/senator-jump.gif rename to org/static/c-ide/senator-jump.gif diff --git a/static/c-ide/senator-kill-yank-tag.gif b/org/static/c-ide/senator-kill-yank-tag.gif similarity index 100% rename from static/c-ide/senator-kill-yank-tag.gif rename to org/static/c-ide/senator-kill-yank-tag.gif diff --git a/static/c-ide/senator-next-previous-tag.gif b/org/static/c-ide/senator-next-previous-tag.gif similarity index 100% rename from static/c-ide/senator-next-previous-tag.gif rename to org/static/c-ide/senator-next-previous-tag.gif diff --git a/static/c-ide/senator-yank-tag.gif b/org/static/c-ide/senator-yank-tag.gif similarity index 100% rename from static/c-ide/senator-yank-tag.gif rename to org/static/c-ide/senator-yank-tag.gif diff --git a/static/c-ide/sr-speedbar.gif b/org/static/c-ide/sr-speedbar.gif similarity index 100% rename from static/c-ide/sr-speedbar.gif rename to org/static/c-ide/sr-speedbar.gif diff --git a/static/c-x-3.gif b/org/static/c-x-3.gif similarity index 100% rename from static/c-x-3.gif rename to org/static/c-x-3.gif diff --git a/static/c-x-c-x.gif b/org/static/c-x-c-x.gif similarity index 100% rename from static/c-x-c-x.gif rename to org/static/c-x-c-x.gif diff --git a/static/candidates.jpg b/org/static/candidates.jpg similarity index 100% rename from static/candidates.jpg rename to org/static/candidates.jpg diff --git a/static/comment.gif b/org/static/comment.gif similarity index 100% rename from static/comment.gif rename to org/static/comment.gif diff --git a/static/dired-subdir.gif b/org/static/dired-subdir.gif similarity index 100% rename from static/dired-subdir.gif rename to org/static/dired-subdir.gif diff --git a/static/emacs-manual-toc.gif b/org/static/emacs-manual-toc.gif similarity index 100% rename from static/emacs-manual-toc.gif rename to org/static/emacs-manual-toc.gif diff --git a/static/emacs-read-pdf.gif b/org/static/emacs-read-pdf.gif similarity index 100% rename from static/emacs-read-pdf.gif rename to org/static/emacs-read-pdf.gif diff --git a/static/ffap.gif b/org/static/ffap.gif similarity index 100% rename from static/ffap.gif rename to org/static/ffap.gif diff --git a/static/find-file-ido.gif b/org/static/find-file-ido.gif similarity index 100% rename from static/find-file-ido.gif rename to org/static/find-file-ido.gif diff --git a/static/find-file-normal.gif b/org/static/find-file-normal.gif similarity index 100% rename from static/find-file-normal.gif rename to org/static/find-file-normal.gif diff --git a/static/frames-gui.gif b/org/static/frames-gui.gif similarity index 100% rename from static/frames-gui.gif rename to org/static/frames-gui.gif diff --git a/static/frames-term.gif b/org/static/frames-term.gif similarity index 100% rename from static/frames-term.gif rename to org/static/frames-term.gif diff --git a/static/func_args.jpg b/org/static/func_args.jpg similarity index 100% rename from static/func_args.jpg rename to org/static/func_args.jpg diff --git a/static/gdb-many-windows1.png b/org/static/gdb-many-windows1.png similarity index 100% rename from static/gdb-many-windows1.png rename to org/static/gdb-many-windows1.png diff --git a/static/gdb-many-windows2.png b/org/static/gdb-many-windows2.png similarity index 100% rename from static/gdb-many-windows2.png rename to org/static/gdb-many-windows2.png diff --git a/static/ggtags-create-tags.gif b/org/static/ggtags-create-tags.gif similarity index 100% rename from static/ggtags-create-tags.gif rename to org/static/ggtags-create-tags.gif diff --git a/static/ggtags-find-file-bug.gif b/org/static/ggtags-find-file-bug.gif similarity index 100% rename from static/ggtags-find-file-bug.gif rename to org/static/ggtags-find-file-bug.gif diff --git a/static/ggtags-find-file.gif b/org/static/ggtags-find-file.gif similarity index 100% rename from static/ggtags-find-file.gif rename to org/static/ggtags-find-file.gif diff --git a/static/ggtags-rerun.gif b/org/static/ggtags-rerun.gif similarity index 100% rename from static/ggtags-rerun.gif rename to org/static/ggtags-rerun.gif diff --git a/static/ggtags-view-tag-history.gif b/org/static/ggtags-view-tag-history.gif similarity index 100% rename from static/ggtags-view-tag-history.gif rename to org/static/ggtags-view-tag-history.gif diff --git a/static/gnu-global-dir-struct.jpg b/org/static/gnu-global-dir-struct.jpg similarity index 100% rename from static/gnu-global-dir-struct.jpg rename to org/static/gnu-global-dir-struct.jpg diff --git a/static/grep.gif b/org/static/grep.gif similarity index 100% rename from static/grep.gif rename to org/static/grep.gif diff --git a/static/helm-buffer-list.gif b/org/static/helm-buffer-list.gif similarity index 100% rename from static/helm-buffer-list.gif rename to org/static/helm-buffer-list.gif diff --git a/static/helm-new-file-buffer.gif b/org/static/helm-new-file-buffer.gif similarity index 100% rename from static/helm-new-file-buffer.gif rename to org/static/helm-new-file-buffer.gif diff --git a/static/helm-projectile/helm-projectile-1.gif b/org/static/helm-projectile/helm-projectile-1.gif similarity index 100% rename from static/helm-projectile/helm-projectile-1.gif rename to org/static/helm-projectile/helm-projectile-1.gif diff --git a/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif b/org/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif similarity index 100% rename from static/helm-projectile/helm-projectile-add-files-virtual-dir.gif rename to org/static/helm-projectile/helm-projectile-add-files-virtual-dir.gif diff --git a/static/helm-projectile/helm-projectile-complete-at-point.gif b/org/static/helm-projectile/helm-projectile-complete-at-point.gif similarity index 100% rename from static/helm-projectile/helm-projectile-complete-at-point.gif rename to org/static/helm-projectile/helm-projectile-complete-at-point.gif diff --git a/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif b/org/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif similarity index 100% rename from static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif rename to org/static/helm-projectile/helm-projectile-delete-files-virtual-dir.gif diff --git a/static/helm-projectile/helm-projectile-etags.gif b/org/static/helm-projectile/helm-projectile-etags.gif similarity index 100% rename from static/helm-projectile/helm-projectile-etags.gif rename to org/static/helm-projectile/helm-projectile-etags.gif diff --git a/static/helm-projectile/helm-projectile-find-file-as-root.gif b/org/static/helm-projectile/helm-projectile-find-file-as-root.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-file-as-root.gif rename to org/static/helm-projectile/helm-projectile-find-file-as-root.gif diff --git a/static/helm-projectile/helm-projectile-find-file-copy.gif b/org/static/helm-projectile/helm-projectile-find-file-copy.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-file-copy.gif rename to org/static/helm-projectile/helm-projectile-find-file-copy.gif diff --git a/static/helm-projectile/helm-projectile-find-file-delete.gif b/org/static/helm-projectile/helm-projectile-find-file-delete.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-file-delete.gif rename to org/static/helm-projectile/helm-projectile-find-file-delete.gif diff --git a/static/helm-projectile/helm-projectile-find-file-ediff.gif b/org/static/helm-projectile/helm-projectile-find-file-ediff.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-file-ediff.gif rename to org/static/helm-projectile/helm-projectile-find-file-ediff.gif diff --git a/static/helm-projectile/helm-projectile-find-file-other-window.gif b/org/static/helm-projectile/helm-projectile-find-file-other-window.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-file-other-window.gif rename to org/static/helm-projectile/helm-projectile-find-file-other-window.gif diff --git a/static/helm-projectile/helm-projectile-find-files-1.gif b/org/static/helm-projectile/helm-projectile-find-files-1.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-files-1.gif rename to org/static/helm-projectile/helm-projectile-find-files-1.gif diff --git a/static/helm-projectile/helm-projectile-find-files-dwim-1.gif b/org/static/helm-projectile/helm-projectile-find-files-dwim-1.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-files-dwim-1.gif rename to org/static/helm-projectile/helm-projectile-find-files-dwim-1.gif diff --git a/static/helm-projectile/helm-projectile-find-other-file.gif b/org/static/helm-projectile/helm-projectile-find-other-file.gif similarity index 100% rename from static/helm-projectile/helm-projectile-find-other-file.gif rename to org/static/helm-projectile/helm-projectile-find-other-file.gif diff --git a/static/helm-projectile/helm-projectile-grep.gif b/org/static/helm-projectile/helm-projectile-grep.gif similarity index 100% rename from static/helm-projectile/helm-projectile-grep.gif rename to org/static/helm-projectile/helm-projectile-grep.gif diff --git a/static/helm-projectile/helm-projectile-new-virtual-dir.gif b/org/static/helm-projectile/helm-projectile-new-virtual-dir.gif similarity index 100% rename from static/helm-projectile/helm-projectile-new-virtual-dir.gif rename to org/static/helm-projectile/helm-projectile-new-virtual-dir.gif diff --git a/static/helm-projectile/helm-projectile-remove-project.gif b/org/static/helm-projectile/helm-projectile-remove-project.gif similarity index 100% rename from static/helm-projectile/helm-projectile-remove-project.gif rename to org/static/helm-projectile/helm-projectile-remove-project.gif diff --git a/static/helm-projectile/helm-projectile-rename-file.gif b/org/static/helm-projectile/helm-projectile-rename-file.gif similarity index 100% rename from static/helm-projectile/helm-projectile-rename-file.gif rename to org/static/helm-projectile/helm-projectile-rename-file.gif diff --git a/static/helm-projectile/helm-projectile-serial-rename-file.gif b/org/static/helm-projectile/helm-projectile-serial-rename-file.gif similarity index 100% rename from static/helm-projectile/helm-projectile-serial-rename-file.gif rename to org/static/helm-projectile/helm-projectile-serial-rename-file.gif diff --git a/static/helm-projectile/helm-projectile-switch-project.gif b/org/static/helm-projectile/helm-projectile-switch-project.gif similarity index 100% rename from static/helm-projectile/helm-projectile-switch-project.gif rename to org/static/helm-projectile/helm-projectile-switch-project.gif diff --git a/static/helm_projectile.gif b/org/static/helm_projectile.gif similarity index 100% rename from static/helm_projectile.gif rename to org/static/helm_projectile.gif diff --git a/static/ibuffer-dired-group.gif b/org/static/ibuffer-dired-group.gif similarity index 100% rename from static/ibuffer-dired-group.gif rename to org/static/ibuffer-dired-group.gif diff --git a/static/ibuffer-filter-major.gif b/org/static/ibuffer-filter-major.gif similarity index 100% rename from static/ibuffer-filter-major.gif rename to org/static/ibuffer-filter-major.gif diff --git a/static/insert_buf2_macro.gif b/org/static/insert_buf2_macro.gif similarity index 100% rename from static/insert_buf2_macro.gif rename to org/static/insert_buf2_macro.gif diff --git a/static/jump_headers.gif b/org/static/jump_headers.gif similarity index 100% rename from static/jump_headers.gif rename to org/static/jump_headers.gif diff --git a/static/linux-dir.gif b/org/static/linux-dir.gif similarity index 100% rename from static/linux-dir.gif rename to org/static/linux-dir.gif diff --git a/static/live_grep.gif b/org/static/live_grep.gif similarity index 100% rename from static/live_grep.gif rename to org/static/live_grep.gif diff --git a/static/macro.gif b/org/static/macro.gif similarity index 100% rename from static/macro.gif rename to org/static/macro.gif diff --git a/static/macro2_full.gif b/org/static/macro2_full.gif similarity index 100% rename from static/macro2_full.gif rename to org/static/macro2_full.gif diff --git a/static/magit.gif b/org/static/magit.gif similarity index 100% rename from static/magit.gif rename to org/static/magit.gif diff --git a/static/modeline.jpg b/org/static/modeline.jpg similarity index 100% rename from static/modeline.jpg rename to org/static/modeline.jpg diff --git a/static/multiple-windows.gif b/org/static/multiple-windows.gif similarity index 100% rename from static/multiple-windows.gif rename to org/static/multiple-windows.gif diff --git a/static/occur-edit.gif b/org/static/occur-edit.gif similarity index 100% rename from static/occur-edit.gif rename to org/static/occur-edit.gif diff --git a/static/occur.gif b/org/static/occur.gif similarity index 100% rename from static/occur.gif rename to org/static/occur.gif diff --git a/static/part3/backward-sexp.gif b/org/static/part3/backward-sexp.gif similarity index 100% rename from static/part3/backward-sexp.gif rename to org/static/part3/backward-sexp.gif diff --git a/static/part3/customize.jpg b/org/static/part3/customize.jpg similarity index 100% rename from static/part3/customize.jpg rename to org/static/part3/customize.jpg diff --git a/static/part3/diff-hl-buffer.png b/org/static/part3/diff-hl-buffer.png similarity index 100% rename from static/part3/diff-hl-buffer.png rename to org/static/part3/diff-hl-buffer.png diff --git a/static/part3/diff-hl-dired.png b/org/static/part3/diff-hl-dired.png similarity index 100% rename from static/part3/diff-hl-dired.png rename to org/static/part3/diff-hl-dired.png diff --git a/static/part3/diff-hl-margin.png b/org/static/part3/diff-hl-margin.png similarity index 100% rename from static/part3/diff-hl-margin.png rename to org/static/part3/diff-hl-margin.png diff --git a/static/part3/dired-plus.jpg b/org/static/part3/dired-plus.jpg similarity index 100% rename from static/part3/dired-plus.jpg rename to org/static/part3/dired-plus.jpg diff --git a/static/part3/discover-my-major.png b/org/static/part3/discover-my-major.png similarity index 100% rename from static/part3/discover-my-major.png rename to org/static/part3/discover-my-major.png diff --git a/static/part3/forward-sexp.gif b/org/static/part3/forward-sexp.gif similarity index 100% rename from static/part3/forward-sexp.gif rename to org/static/part3/forward-sexp.gif diff --git a/static/part3/golden-ratio.gif b/org/static/part3/golden-ratio.gif similarity index 100% rename from static/part3/golden-ratio.gif rename to org/static/part3/golden-ratio.gif diff --git a/static/part3/helm-all-mark-rings.gif b/org/static/part3/helm-all-mark-rings.gif similarity index 100% rename from static/part3/helm-all-mark-rings.gif rename to org/static/part3/helm-all-mark-rings.gif diff --git a/static/part3/helm-autoresize-fix.gif b/org/static/part3/helm-autoresize-fix.gif similarity index 100% rename from static/part3/helm-autoresize-fix.gif rename to org/static/part3/helm-autoresize-fix.gif diff --git a/static/part3/helm-autoresize-mode.gif b/org/static/part3/helm-autoresize-mode.gif similarity index 100% rename from static/part3/helm-autoresize-mode.gif rename to org/static/part3/helm-autoresize-mode.gif diff --git a/static/part3/helm-calc.gif b/org/static/part3/helm-calc.gif similarity index 100% rename from static/part3/helm-calc.gif rename to org/static/part3/helm-calc.gif diff --git a/static/part3/helm-color.gif b/org/static/part3/helm-color.gif similarity index 100% rename from static/part3/helm-color.gif rename to org/static/part3/helm-color.gif diff --git a/helm-eshell-history.gif b/org/static/part3/helm-eshell-history.gif similarity index 100% rename from helm-eshell-history.gif rename to org/static/part3/helm-eshell-history.gif diff --git a/static/part3/helm-eval-expression.gif b/org/static/part3/helm-eval-expression.gif similarity index 100% rename from static/part3/helm-eval-expression.gif rename to org/static/part3/helm-eval-expression.gif diff --git a/static/part3/helm-find-files.gif b/org/static/part3/helm-find-files.gif similarity index 100% rename from static/part3/helm-find-files.gif rename to org/static/part3/helm-find-files.gif diff --git a/static/part3/helm-find.gif b/org/static/part3/helm-find.gif similarity index 100% rename from static/part3/helm-find.gif rename to org/static/part3/helm-find.gif diff --git a/static/part3/helm-google-suggest.gif b/org/static/part3/helm-google-suggest.gif similarity index 100% rename from static/part3/helm-google-suggest.gif rename to org/static/part3/helm-google-suggest.gif diff --git a/static/part3/helm-kill-ring.gif b/org/static/part3/helm-kill-ring.gif similarity index 100% rename from static/part3/helm-kill-ring.gif rename to org/static/part3/helm-kill-ring.gif diff --git a/static/part3/helm-locate.gif b/org/static/part3/helm-locate.gif similarity index 100% rename from static/part3/helm-locate.gif rename to org/static/part3/helm-locate.gif diff --git a/static/part3/helm-m-x.gif b/org/static/part3/helm-m-x.gif similarity index 100% rename from static/part3/helm-m-x.gif rename to org/static/part3/helm-m-x.gif diff --git a/static/part3/helm-man-woman.gif b/org/static/part3/helm-man-woman.gif similarity index 100% rename from static/part3/helm-man-woman.gif rename to org/static/part3/helm-man-woman.gif diff --git a/static/part3/helm-mini.gif b/org/static/part3/helm-mini.gif similarity index 100% rename from static/part3/helm-mini.gif rename to org/static/part3/helm-mini.gif diff --git a/static/part3/helm-occur.gif b/org/static/part3/helm-occur.gif similarity index 100% rename from static/part3/helm-occur.gif rename to org/static/part3/helm-occur.gif diff --git a/static/part3/helm-regexp.gif b/org/static/part3/helm-regexp.gif similarity index 100% rename from static/part3/helm-regexp.gif rename to org/static/part3/helm-regexp.gif diff --git a/static/part3/helm-registers.gif b/org/static/part3/helm-registers.gif similarity index 100% rename from static/part3/helm-registers.gif rename to org/static/part3/helm-registers.gif diff --git a/static/part3/helm-semantic-or-imenu-2.gif b/org/static/part3/helm-semantic-or-imenu-2.gif similarity index 100% rename from static/part3/helm-semantic-or-imenu-2.gif rename to org/static/part3/helm-semantic-or-imenu-2.gif diff --git a/static/part3/helm-semantic-or-imenu.gif b/org/static/part3/helm-semantic-or-imenu.gif similarity index 100% rename from static/part3/helm-semantic-or-imenu.gif rename to org/static/part3/helm-semantic-or-imenu.gif diff --git a/static/part3/helm-surfraw.gif b/org/static/part3/helm-surfraw.gif similarity index 100% rename from static/part3/helm-surfraw.gif rename to org/static/part3/helm-surfraw.gif diff --git a/static/part3/helm-top.gif b/org/static/part3/helm-top.gif similarity index 100% rename from static/part3/helm-top.gif rename to org/static/part3/helm-top.gif diff --git a/static/part3/ibuffer-vc.png b/org/static/part3/ibuffer-vc.png similarity index 100% rename from static/part3/ibuffer-vc.png rename to org/static/part3/ibuffer-vc.png diff --git a/static/part3/kill-sexp.gif b/org/static/part3/kill-sexp.gif similarity index 100% rename from static/part3/kill-sexp.gif rename to org/static/part3/kill-sexp.gif diff --git a/static/part3/mark-sexp.gif b/org/static/part3/mark-sexp.gif similarity index 100% rename from static/part3/mark-sexp.gif rename to org/static/part3/mark-sexp.gif diff --git a/static/part3/nyan-mode.png b/org/static/part3/nyan-mode.png similarity index 100% rename from static/part3/nyan-mode.png rename to org/static/part3/nyan-mode.png diff --git a/static/part3/projectile.png b/org/static/part3/projectile.png similarity index 100% rename from static/part3/projectile.png rename to org/static/part3/projectile.png diff --git a/static/part3/rainbow-mode.png b/org/static/part3/rainbow-mode.png similarity index 100% rename from static/part3/rainbow-mode.png rename to org/static/part3/rainbow-mode.png diff --git a/static/part3/smex.png b/org/static/part3/smex.png similarity index 100% rename from static/part3/smex.png rename to org/static/part3/smex.png diff --git a/static/part3/transpose-sexp.gif b/org/static/part3/transpose-sexp.gif similarity index 100% rename from static/part3/transpose-sexp.gif rename to org/static/part3/transpose-sexp.gif diff --git a/static/part3/undo-tree.jpg b/org/static/part3/undo-tree.jpg similarity index 100% rename from static/part3/undo-tree.jpg rename to org/static/part3/undo-tree.jpg diff --git a/static/part3/ztree-diff.png b/org/static/part3/ztree-diff.png similarity index 100% rename from static/part3/ztree-diff.png rename to org/static/part3/ztree-diff.png diff --git a/static/part3/ztree-dir.png b/org/static/part3/ztree-dir.png similarity index 100% rename from static/part3/ztree-dir.png rename to org/static/part3/ztree-dir.png diff --git a/static/path-variable-windows.jpg b/org/static/path-variable-windows.jpg similarity index 100% rename from static/path-variable-windows.jpg rename to org/static/path-variable-windows.jpg diff --git a/static/performance.gif b/org/static/performance.gif similarity index 100% rename from static/performance.gif rename to org/static/performance.gif diff --git a/static/prepare_macro.gif b/org/static/prepare_macro.gif similarity index 100% rename from static/prepare_macro.gif rename to org/static/prepare_macro.gif diff --git a/static/proglang/aggressive-indent.gif b/org/static/proglang/aggressive-indent.gif similarity index 100% rename from static/proglang/aggressive-indent.gif rename to org/static/proglang/aggressive-indent.gif diff --git a/static/proglang/emacs_home.png b/org/static/proglang/emacs_home.png similarity index 100% rename from static/proglang/emacs_home.png rename to org/static/proglang/emacs_home.png diff --git a/static/proglang/emacs_path.png b/org/static/proglang/emacs_path.png similarity index 100% rename from static/proglang/emacs_path.png rename to org/static/proglang/emacs_path.png diff --git a/static/proglang/forward-backward-parens.gif b/org/static/proglang/forward-backward-parens.gif similarity index 100% rename from static/proglang/forward-backward-parens.gif rename to org/static/proglang/forward-backward-parens.gif diff --git a/static/proglang/geiser-demo.gif b/org/static/proglang/geiser-demo.gif similarity index 100% rename from static/proglang/geiser-demo.gif rename to org/static/proglang/geiser-demo.gif diff --git a/static/proglang/monokai.png b/org/static/proglang/monokai.png similarity index 100% rename from static/proglang/monokai.png rename to org/static/proglang/monokai.png diff --git a/static/proglang/repl-autodoc.png b/org/static/proglang/repl-autodoc.png similarity index 100% rename from static/proglang/repl-autodoc.png rename to org/static/proglang/repl-autodoc.png diff --git a/static/proglang/repl-mod.png b/org/static/proglang/repl-mod.png similarity index 100% rename from static/proglang/repl-mod.png rename to org/static/proglang/repl-mod.png diff --git a/static/proglang/sml-completion.gif b/org/static/proglang/sml-completion.gif similarity index 100% rename from static/proglang/sml-completion.gif rename to org/static/proglang/sml-completion.gif diff --git a/static/proglang/sml-helm-imenu.gif b/org/static/proglang/sml-helm-imenu.gif similarity index 100% rename from static/proglang/sml-helm-imenu.gif rename to org/static/proglang/sml-helm-imenu.gif diff --git a/static/proglang/sml-send-buffer.gif b/org/static/proglang/sml-send-buffer.gif similarity index 100% rename from static/proglang/sml-send-buffer.gif rename to org/static/proglang/sml-send-buffer.gif diff --git a/static/proglang/sml-send-region.gif b/org/static/proglang/sml-send-region.gif similarity index 100% rename from static/proglang/sml-send-region.gif rename to org/static/proglang/sml-send-region.gif diff --git a/static/proglang/sml-start-proc.gif b/org/static/proglang/sml-start-proc.gif similarity index 100% rename from static/proglang/sml-start-proc.gif rename to org/static/proglang/sml-start-proc.gif diff --git a/static/proglang/zenburn.png b/org/static/proglang/zenburn.png similarity index 100% rename from static/proglang/zenburn.png rename to org/static/proglang/zenburn.png diff --git a/static/reg_a.gif b/org/static/reg_a.gif similarity index 100% rename from static/reg_a.gif rename to org/static/reg_a.gif diff --git a/static/reg_b.gif b/org/static/reg_b.gif similarity index 100% rename from static/reg_b.gif rename to org/static/reg_b.gif diff --git a/static/reg_c.gif b/org/static/reg_c.gif similarity index 100% rename from static/reg_c.gif rename to org/static/reg_c.gif diff --git a/static/reg_d.gif b/org/static/reg_d.gif similarity index 100% rename from static/reg_d.gif rename to org/static/reg_d.gif diff --git a/static/register-windows.gif b/org/static/register-windows.gif similarity index 100% rename from static/register-windows.gif rename to org/static/register-windows.gif diff --git a/static/setup-emacs-windows/emacs_xwidgets_windows.png b/org/static/setup-emacs-windows/emacs_xwidgets_windows.png similarity index 100% rename from static/setup-emacs-windows/emacs_xwidgets_windows.png rename to org/static/setup-emacs-windows/emacs_xwidgets_windows.png diff --git a/static/setup-emacs-windows/pdf_tools_windows_latex.gif b/org/static/setup-emacs-windows/pdf_tools_windows_latex.gif similarity index 100% rename from static/setup-emacs-windows/pdf_tools_windows_latex.gif rename to org/static/setup-emacs-windows/pdf_tools_windows_latex.gif diff --git a/static/setup-emacs-windows/xserver_example.png b/org/static/setup-emacs-windows/xserver_example.png similarity index 100% rename from static/setup-emacs-windows/xserver_example.png rename to org/static/setup-emacs-windows/xserver_example.png diff --git a/static/vc-diff.jpg b/org/static/vc-diff.jpg similarity index 100% rename from static/vc-diff.jpg rename to org/static/vc-diff.jpg diff --git a/static/worg.css b/org/static/worg.css similarity index 100% rename from static/worg.css rename to org/static/worg.css diff --git a/static/part3/helm-eshell-history.gif b/static/part3/helm-eshell-history.gif deleted file mode 100644 index 2b9957c..0000000 Binary files a/static/part3/helm-eshell-history.gif and /dev/null differ diff --git a/static/setup-emacs-windows/cygwin_example_install.png b/static/setup-emacs-windows/cygwin_example_install.png deleted file mode 100755 index 482a7ae..0000000 Binary files a/static/setup-emacs-windows/cygwin_example_install.png and /dev/null differ diff --git a/theindex.html b/theindex.html deleted file mode 100644 index df3b342..0000000 --- a/theindex.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - -Index - - - - - - - - - - -
              -

              Index

              - -
              -
              - -
              - - - comments powered by Disqus -
              - -