unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Comment conventions.
@ 2004-02-10  2:35 Luc Teirlinck
  0 siblings, 0 replies; only message in thread
From: Luc Teirlinck @ 2004-02-10  2:35 UTC (permalink / raw)


In mid-October, we reached consensus to change the current conventions
for commenting out code, as documented in (elisp)Comment Tips, to
better adapt them to outline-minor-mode.  This was discussed (as a
side issue) in a thread titled "Undocumented hyperlinks in doc strings".

The new conventions were to use two semicolons to comment out entire
functions and three semicolons to comment out part of functions,
indenting any introductory comment by at least two spaces to allow
outline-minor-mode to distinguish.  We then apparently forgot about it
and, in as far as I know, nothing was done to document or implement
this.

What about the following changes to lisp-mode.el and tips.texi?

===File ~/lisp-mode-diff====================================
*** lisp-mode.el.~1.152.~	Tue Sep  2 07:41:50 2003
--- lisp-mode.el	Mon Feb  9 18:50:51 2004
***************
*** 182,188 ****
    (make-local-variable 'parse-sexp-ignore-comments)
    (setq parse-sexp-ignore-comments t)
    (make-local-variable 'outline-regexp)
!   (setq outline-regexp ";;;;* \\|(")
    (make-local-variable 'outline-level)
    (setq outline-level 'lisp-outline-level)
    (make-local-variable 'comment-start)
--- 182,188 ----
    (make-local-variable 'parse-sexp-ignore-comments)
    (setq parse-sexp-ignore-comments t)
    (make-local-variable 'outline-regexp)
!   (setq outline-regexp ";;;;* [^ \t\n]\\|(")
    (make-local-variable 'outline-level)
    (setq outline-level 'lisp-outline-level)
    (make-local-variable 'comment-start)
============================================================

===File ~/tips-diff=========================================
*** tips.texi.~1.55.~	Tue Dec 30 17:39:18 2003
--- tips.texi	Mon Feb  9 19:54:33 2004
***************
*** 802,816 ****
  the left margin.  These are used, occasionally, for comments within
  functions that should start at the margin.  We also use them sometimes
  for comments that are between functions---whether to use two or three
! semicolons there is a matter of style.
  
  Another use for triple-semicolon comments is for commenting out lines
  within a function.  We use three semicolons for this precisely so that
! they remain at the left margin.
  
  @smallexample
  (defun foo (a)
! ;;; This is no longer necessary.
  ;;;  (force-mode-line-update)
    (message "Finished with %s" a))
  @end smallexample
--- 802,826 ----
  the left margin.  These are used, occasionally, for comments within
  functions that should start at the margin.  We also use them sometimes
  for comments that are between functions---whether to use two or three
! semicolons depends on whether the comment should be considered a
! ``heading'' by @code{outline-minor-mode}.  By default, comments
! starting with at least three semicolons are considered headings,
! comments starting with two or less are not.
  
  Another use for triple-semicolon comments is for commenting out lines
  within a function.  We use three semicolons for this precisely so that
! they remain at the left margin.  @code{outline-minor-mode} does not
! consider a comment to be a heading (even if it starts with at least
! three semicolons) if the semicolons are followed by at least two
! spaces.  Thus, if you add an introductory comment to the commented out
! code, make sure to indent it by at least two spaces after the three
! semicolons.
! 
! When commenting out entire functions, use two semicolons.
  
  @smallexample
  (defun foo (a)
! ;;;  This is no longer necessary.
  ;;;  (force-mode-line-update)
    (message "Finished with %s" a))
  @end smallexample
============================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-02-10  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-10  2:35 Comment conventions Luc Teirlinck

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).