emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: show-ifdef-block does not work when hide-ifdef-lines


From: martin rudalics
Subject: Re: address@hidden: show-ifdef-block does not work when hide-ifdef-lines is t]
Date: Sat, 13 May 2006 12:11:17 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> 1. load a C file with an ifdef block
> 2. turn on hide-ifdef-mode
> 3. hide-ifdef-block and show-ifdef-block work fine
> 4. set hide-ifdef-lines to t
> 5. hide-ifdef-block works, but show-ifdef-block only brings back one line
>    of this block each time it is called

Attached find two patches.  The first patches just `show-ifdef-block'.
The second uses one invisibility overlay only to cover the ifdef lines
and the enclosed block.  Without any warranty.
*** hideif.el   Sat Nov  5 19:46:04 2005
--- hideif.el   Sat May 13 11:57:14 2006
***************
*** 928,942 ****
      (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)))
        (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom)))))


--- 928,943 ----
      (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)
!   (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)))
        (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom)))))


*** hideif.el   Sat Nov  5 19:46:04 2005
--- hideif.el   Sat May 13 11:38:20 2006
***************
*** 921,945 ****
    (interactive)
    (unless hide-ifdef-mode (hide-ifdef-mode 1))
    (let ((top-bottom (hif-find-ifdef-block)))
!     (hide-ifdef-region (car top-bottom) (cdr top-bottom))
!     (when hide-ifdef-lines
!       (hif-hide-line (car top-bottom))
!       (hif-hide-line (1+ (cdr top-bottom))))
      (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)))
        (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom)))))

- 
  ;;;  definition alist support

  (defvar hide-ifdef-define-alist nil
--- 921,948 ----
    (interactive)
    (unless hide-ifdef-mode (hide-ifdef-mode 1))
    (let ((top-bottom (hif-find-ifdef-block)))
!     (if hide-ifdef-lines
!       (hide-ifdef-region-internal
!        (save-excursion
!          (goto-char (car top-bottom)) (line-beginning-position))
!        (save-excursion
!          (goto-char (cdr top-bottom)) (line-end-position 2)))
!       (hide-ifdef-region (car top-bottom) (cdr top-bottom)))
      (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)
!   (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 (cdr top-bottom)) (line-end-position 2)))
        (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom)))))

  ;;;  definition alist support

  (defvar hide-ifdef-define-alist nil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]