NB: Some of the below tips are outdated and I don't follow them any more.
Refer to my .emacs file for the best practices I am now using.
  1. 2019, November: how I installed Emacs 25 on Ubuntu 16.04
  2. Following the instructions from here I did the following:

    sudo add-apt-repository ppa:kelleyk/emacs
    sudo apt install emacs25
    $ emacs --version | head -1
    GNU Emacs 24.5.1
    $ emacs25 --version | head -1
    GNU Emacs 25.3.2

    Subsequently, I configured alternatives for emacs:

    $ sudo update-alternatives --config emacs
    [sudo] password for mperdikeas:
    There are 2 choices for the alternative emacs (providing /usr/bin/emacs).
    
      Selection    Path                Priority   Status
    ------------------------------------------------------------
    * 0            /usr/bin/emacs24-x   27        auto mode
      1            /usr/bin/emacs24-x   27        manual mode
      2            /usr/bin/emacs25     27        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 2
                update-alternatives: using /usr/bin/emacs25 to provide /usr/bin/emacs (emacs) in manual mode
    $
    $
    $ emacs --version | head -1
    GNU Emacs 25.3.2
    

  3. how to rebuild ELPA packages
  4. source

    I have encountered cases where an emacs installation would behave erratically with certain key-bindings not working as expected given the packages I've installed. This could be due to an Emacs upgrade and the ELPA packages requiring rebuilding.

    Based on the source link above (and given that my package-user-dir variable was apparently not set), I've used the following:

    M-: (byte-recompile-directory package-user-dir nil 'force)

    … to rebuild the packages. When I re-launced Emacs things seemed to be working more smoothly.

    If, for some weird reason the package-user-dir variable is not set (use C-h v to inspect it) you can also provide the directory as a string literal:
    M-: (byte-recompile-directory package-user-dir "/home/mperdikeas/.emacs.d/elpa" nil 'force)

    BTW, M-: can be used to evaluate any expression in the minibuffer.

  5. key information
  6. C-h k

    … followed by an arbitrary key sequence shows which command is mapped to that key sequence.
  7. mode information
  8. C-h m
    to get information about major and minor modes
    C-h f json-mode
    to get information about a particular mode

    and a link to the file that defines.
  9. solve the dreaded C-SPACE sequence key not working in emacs
  10. I was beset by this problem when I installed Emacs24 on Ubuntu 14.04.5 on the Dell Precision laptop (August '16)

    Basically what happens is that the C-SPACE combo is hijacked by the ibus program and not recognized as a sequence in Emacs. When you ssh to the computer from another machine that doesn't suffer from this problem the combo works as expected (this proves that the problem is not in Emacs but rather in the desktop environment).

    Follow these instructions.

    Core of the solution:

    In 14.04, you can edit the settings directly is dconf-editor.

    If it is not installed:

    sudo apt install dconf-editor

    Then browse to Desktop >> ibus >> general >> hotkey. The trigger and triggers setting will still show 'control+space'. Edit these settings out, being careful to leave empty brackets [] in triggers.

  11. solve the dreaded M- problem in Org-mode on tty
  12. Use these alternative key bindings as suggested in this answer.
  13. how to disable ALT key hijacking in Unity when working with Emacs
  14. Follow these instructions.

    Basically install ccsm (CompizConfig Settings Manager):

    sudo apt-get install CompizConfig-Settings-Manager.
                
    … then run ccsm and select Desktop / Ubuntu Unity Plugin and disable the "Key to show the menu bar while pressed" and possibly "Key to show the HUD when tapped" too.

    Basically disable everything bound to the ALT key to be on the safe side.

  15. how to load a module in Emacs and associate it with a file extension
  16. It is a three-step process:
    1. extend the load-path to include the directory where the *.el file for the mode lives
    2. load the module
    3. associate the module with the file extension
    This is nicely shown in the below excrept from my .emacs file:
    (progn
        (add-to-list 'load-path "~/.emacs.d/web-mode/")
        (load "web-mode")
        (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
    )
              
    It is advisable that that the el file lives in a git submodule.
  17. how to view the value of a variable in Emacs
  18. Use the function describe-variable (usually bound to C-h v)
  19. replace tabs / spaces in Emacs
  20. The way to do it is via M-x tabify or M-x untabify. These functions work on the current selection, so to apply them to the whole buffer do a C-x h beforehand.
  21. how to install Emacs24 on Ubuntu
  22. I followed the instructions found here:

    https://launchpad.net/~cassou/+archive/emacs

    (I got there from:

    http://askubuntu.com/questions/149562/how-to-upgrade-to-emacs-24-1

    )

    Be sure to also read the instructions in the link of the "Signing key". After the "sudo apt-get update" I then did a "sudo apt-get install emacs24" and had Emacs 24 installed.

    ================================================================

    Before succeeding I tried following these instructions instead:

    http://batsov.com/articles/2011/10/09/getting-started-with-emacs-24/

    (which points you to: http://emacs.naquadah.org/ )

    but it didn't work. The reason was that I was being silly because the link at http:emacs.naquadah.org ALSO points to Damien Cassou's page (it says: "If you are looking for the Ubuntu packages, Damien Cassou now maintains an emacs-snapshot PPA.") but I was tired and my eyes were sore and didn't notice it.