]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/hideif.el
Merge multi-tty branch
[gnu-emacs] / lisp / progmodes / hideif.el
index 23031c5bcda24f7f3075813656261013671052ac..bb791b18c1b7410c19654efb266a2d82f3a5415a 100644 (file)
@@ -1,6 +1,7 @@
 ;;; hideif.el --- hides selected code within ifdef
 
-;; Copyright (C) 1988, 1994, 2001, 2002, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;; Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
 ;; Maintainer: FSF
@@ -10,7 +11,7 @@
 
 ;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -20,8 +21,8 @@
 
 ;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -927,15 +928,17 @@ Return as (TOP . BOTTOM) the extent of ifdef block."
     (setq hide-ifdef-hiding t))
   (setq buffer-read-only (or hide-ifdef-read-only hif-outside-read-only)))
 
-
 (defun show-ifdef-block ()
   "Show the ifdef block (true or false part) enclosing or before the cursor."
   (interactive)
-  (if hide-ifdef-lines
-      (save-excursion
-       (beginning-of-line)
-       (hif-show-ifdef-region (1- (point)) (progn (end-of-line) (point))))
-    (let ((top-bottom (hif-find-ifdef-block)))
+  (let ((top-bottom (hif-find-ifdef-block)))
+    (if hide-ifdef-lines
+       (hif-show-ifdef-region
+        (save-excursion
+          (goto-char (car top-bottom)) (line-beginning-position))
+        (save-excursion
+          (goto-char (1+ (cdr top-bottom)))
+          (hif-end-of-line) (point)))
       (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom)))))
 
 
@@ -960,7 +963,9 @@ Return as (TOP . BOTTOM) the extent of ifdef block."
   "Set `hide-ifdef-env' to the define list specified by NAME."
   (interactive
    (list (completing-read "Use define list: "
-                         hide-ifdef-define-alist nil t)))
+                         (mapcar (lambda (x) (symbol-name (car x)))
+                                  hide-ifdef-define-alist)
+                          nil t)))
   (if (stringp name) (setq name (intern name)))
   (let ((define-list (assoc name hide-ifdef-define-alist)))
     (if define-list
@@ -972,5 +977,5 @@ Return as (TOP . BOTTOM) the extent of ifdef block."
 
 (provide 'hideif)
 
-;;; arch-tag: c6381d17-a59a-483a-b945-658f22277981
+;; arch-tag: c6381d17-a59a-483a-b945-658f22277981
 ;;; hideif.el ends here