comparison lisp/progmodes/hideif.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 0d8b17d428b5
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; hideif.el --- hides selected code within ifdef 1 ;;; hideif.el --- hides selected code within ifdef
2 2
3 ;; Copyright (C) 1988,1994,2001, 2002 Free Software Foundation, Inc. 3 ;; Copyright (C) 1988, 1994, 2001, 2002, 2003, 2004 2005
4 ;; Free Software Foundation, Inc.
4 5
5 ;; Author: Daniel LaLiberte <liberte@holonexus.org> 6 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
6 ;; Maintainer: FSF 7 ;; Maintainer: FSF
7 ;; Keywords: c, outlines 8 ;; Keywords: c, outlines
8 9
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details. 20 ;; GNU General Public License for more details.
20 21
21 ;; You should have received a copy of the GNU General Public License 22 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02111-1307, USA. 25 ;; Boston, MA 02110-1301, USA.
25 26
26 ;;; Commentary: 27 ;;; Commentary:
27 28
28 ;; To initialize, toggle the hide-ifdef minor mode with 29 ;; To initialize, toggle the hide-ifdef minor mode with
29 ;; 30 ;;
195 `hide-ifdef-read-only' 196 `hide-ifdef-read-only'
196 Set to non-nil if you want to make buffers read only while hiding. 197 Set to non-nil if you want to make buffers read only while hiding.
197 After `show-ifdefs', read-only status is restored to previous value. 198 After `show-ifdefs', read-only status is restored to previous value.
198 199
199 \\{hide-ifdef-mode-map}" 200 \\{hide-ifdef-mode-map}"
200 nil " Ifdef" nil 201 :group 'hide-ifdef :lighter " Ifdef"
201 (if hide-ifdef-mode 202 (if hide-ifdef-mode
202 (progn 203 (progn
203 ;; inherit global values 204 ;; inherit global values
204 (set (make-local-variable 'hide-ifdef-env) 205 (set (make-local-variable 'hide-ifdef-env)
205 (default-value 'hide-ifdef-env)) 206 (default-value 'hide-ifdef-env))
956 (push (cons name (hif-compress-define-list hide-ifdef-env)) 957 (push (cons name (hif-compress-define-list hide-ifdef-env))
957 hide-ifdef-define-alist)) 958 hide-ifdef-define-alist))
958 959
959 (defun hide-ifdef-use-define-alist (name) 960 (defun hide-ifdef-use-define-alist (name)
960 "Set `hide-ifdef-env' to the define list specified by NAME." 961 "Set `hide-ifdef-env' to the define list specified by NAME."
961 (interactive "SUse define list: ") 962 (interactive
963 (list (completing-read "Use define list: "
964 (mapcar (lambda (x) (symbol-name (car x)))
965 hide-ifdef-define-alist)
966 nil t)))
967 (if (stringp name) (setq name (intern name)))
962 (let ((define-list (assoc name hide-ifdef-define-alist))) 968 (let ((define-list (assoc name hide-ifdef-define-alist)))
963 (if define-list 969 (if define-list
964 (setq hide-ifdef-env 970 (setq hide-ifdef-env
965 (mapcar (lambda (arg) (cons arg t)) 971 (mapcar (lambda (arg) (cons arg t))
966 (cdr define-list))) 972 (cdr define-list)))
967 (error "No define list for %s" name)) 973 (error "No define list for %s" name))
968 (if hide-ifdef-hiding (hide-ifdefs)))) 974 (if hide-ifdef-hiding (hide-ifdefs))))
969 975
970 (provide 'hideif) 976 (provide 'hideif)
971 977
978 ;; arch-tag: c6381d17-a59a-483a-b945-658f22277981
972 ;;; hideif.el ends here 979 ;;; hideif.el ends here