Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / lisp / progmodes / hideif.el
index 9f83d89..76a91c4 100644 (file)
@@ -1,18 +1,18 @@
 ;;; hideif.el --- hides selected code within ifdef
 
-;; Copyright (C) 1988, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008  Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001-2011  Free Software Foundation, Inc.
 
-;; Author: Daniel LaLiberte <liberte@holonexus.org>
+;; Author: Brian Marick
+;;     Daniel LaLiberte <liberte@holonexus.org>
 ;; Maintainer: FSF
 ;; Keywords: c, outlines
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 (easy-menu-define hide-ifdef-mode-menu hide-ifdef-mode-map
   "Menu for `hide-ifdef-mode'."
   '("Hide-Ifdef"
-    ["Hide some ifdefs" hide-ifdefs t]
-    ["Show all ifdefs" show-ifdefs t]
-    ["Hide ifdef block" hide-ifdef-block t]
-    ["Show ifdef block" show-ifdef-block t]
-    ["Define a variable" hide-ifdef-define t]
-    ["Define an alist" hide-ifdef-set-define-alist t]
-    ["Use an alist" hide-ifdef-use-define-alist t]
-    ["Undefine a variable" hide-ifdef-undef t]
+    ["Hide some ifdefs" hide-ifdefs
+     :help "Hide the contents of some #ifdefs"]
+    ["Show all ifdefs" show-ifdefs
+     :help "Cancel the effects of `hide-ifdef': show the contents of all #ifdefs"]
+    ["Hide ifdef block" hide-ifdef-block
+     :help "Hide the ifdef block (true or false part) enclosing or before the cursor"]
+    ["Show ifdef block" show-ifdef-block
+     :help "Show the ifdef block (true or false part) enclosing or before the cursor"]
+    ["Define a variable..." hide-ifdef-define
+     :help "Define a VAR so that #ifdef VAR would be included"]
+    ["Undefine a variable..." hide-ifdef-undef
+     :help "Undefine a VAR so that #ifdef VAR would not be included"]
+    ["Define an alist..." hide-ifdef-set-define-alist
+     :help "Set the association for NAME to `hide-ifdef-env'"]
+    ["Use an alist..." hide-ifdef-use-define-alist
+     :help "Set `hide-ifdef-env' to the define list specified by NAME"]
     ["Toggle read only" hide-ifdef-toggle-read-only
-     :style toggle :selected hide-ifdef-read-only]
+     :style toggle :selected hide-ifdef-read-only
+     :help "Buffer should be read-only while hiding text"]
     ["Toggle shadowing" hide-ifdef-toggle-shadowing
-     :style toggle :selected hide-ifdef-shadow]))
+     :style toggle :selected hide-ifdef-shadow
+     :help "Text should be shadowed instead of hidden"]))
 
 (defvar hide-ifdef-hiding nil
   "Non-nil when text may be hidden.")
@@ -257,8 +265,8 @@ how the hiding is done:
     ;; else end hide-ifdef-mode
     (kill-local-variable 'line-move-ignore-invisible)
     (remove-from-invisibility-spec '(hide-ifdef . t))
-    (if hide-ifdef-hiding
-       (show-ifdefs))))
+    (when hide-ifdef-hiding
+      (show-ifdefs))))
 
 
 (defun hif-show-all ()
@@ -751,7 +759,7 @@ Point is left unchanged."
       (cond ((hif-looking-at-else)
             (setq else (point)))
            (t
-            (setq end (point)))) ; (save-excursion (end-of-line) (point))
+            (setq end (point)))) ; (line-end-position)
       ;; If found #else, look for #endif.
       (when else
        (while (progn
@@ -760,7 +768,7 @@ Point is left unchanged."
          (hif-ifdef-to-endif))
        (if (hif-looking-at-else)
            (error "Found two elses in a row?  Broken!"))
-       (setq end (point)))            ; (save-excursion (end-of-line) (point))
+       (setq end (point)))            ; (line-end-position)
       (hif-make-range start end else))))
 
 
@@ -1016,5 +1024,4 @@ Return as (TOP . BOTTOM) the extent of ifdef block."
 
 (provide 'hideif)
 
-;; arch-tag: c6381d17-a59a-483a-b945-658f22277981
 ;;; hideif.el ends here