Feeds:
Posts
Comments

Posts Tagged ‘Uncomment’


Usually, when writing in LaTeX, one would like to comment and/or un-comment a section of the manuscript.

There is a package which allow you to comment a portion of the file. However, I found out that one can customize Emacs for inserting/remove a percentage sign at the beginning
of each line of a selected region.

Change the .emacs file

In order to do so, one should change the .emacs file.

  • Open the file .emacs with your favourite text editor (say emacs, gedit, nano… vi?)
  • Add the following lines,
    (defun uncomment-region (beg end)
      "Uncomment a region of text"
      (interactive "r")
      (comment-region beg end -1));
    
    (global-set-key "\C-c;"      'comment-region)
    (global-set-key "\C-c:"      'uncomment-region)
  • Save changes and close the editor
  • Start using the new feature

    Next time you open Emacs, you could select a region and use C-c ; for comment the region. Or if it is commented, use C-c : for un-comment it.

    Enjoy

    Dox

    Advertisements

    Read Full Post »