* Re: Font lock for #if 0 ... #endif
[not found] <mailman.828.1179524023.32220.help-gnu-emacs@gnu.org>
@ 2007-05-24 23:49 ` gamename
2007-05-25 5:54 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: gamename @ 2007-05-24 23:49 UTC (permalink / raw)
To: help-gnu-emacs
Excellent!
Thanks for the help. :)
-T
martin rudalics wrote:
> > Ok. I guess it really isn't possible to do what I wanted to anyway.
>
> Add the following lines to your .emacs:
>
> (require 'hideif)
>
> (defun hide-ifdef-region-internal (start end)
> (remove-overlays start end 'face 'font-lock-warning-face)
> (let ((o (make-overlay start end)))
> (overlay-put o 'face 'font-lock-warning-face)))
>
> (defun hif-show-ifdef-region (start end)
> "Everything between START and END is made visible."
> (remove-overlays start end 'face 'font-lock-warning-face))
>
> Save and (evaluate .emacs or) restart Emacs, open the file of
> your choice, and do
>
> M-x hide-ifdefs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Font lock for #if 0 ... #endif
2007-05-24 23:49 ` Font lock for #if 0 ... #endif gamename
@ 2007-05-25 5:54 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2007-05-25 5:54 UTC (permalink / raw)
To: help-gnu-emacs
> From: gamename <namesagame-usenet@yahoo.com>
> Date: 24 May 2007 16:49:56 -0700
>
> Excellent!
>
> Thanks for the help. :)
>
> -T
> martin rudalics wrote:
> > > Ok. I guess it really isn't possible to do what I wanted to anyway.
> >
> > Add the following lines to your .emacs:
> >
> > (require 'hideif)
> >
> > (defun hide-ifdef-region-internal (start end)
> > (remove-overlays start end 'face 'font-lock-warning-face)
> > (let ((o (make-overlay start end)))
> > (overlay-put o 'face 'font-lock-warning-face)))
> >
> > (defun hif-show-ifdef-region (start end)
> > "Everything between START and END is made visible."
> > (remove-overlays start end 'face 'font-lock-warning-face))
> >
> > Save and (evaluate .emacs or) restart Emacs, open the file of
> > your choice, and do
> >
> > M-x hide-ifdefs
Martin, how about extending hideif to allow this as an option? It
sounds like a good feature.
TIA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Font lock for #if 0 ... #endif
@ 2007-05-29 12:29 martin rudalics
0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2007-05-29 12:29 UTC (permalink / raw)
To: eliz; +Cc: help-gnu-emacs, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 144 bytes --]
> Martin, how about extending hideif to allow this as an option? It
> sounds like a good feature.
Please have a look at the attached patch.
[-- Attachment #2: hideif.patch --]
[-- Type: text/plain, Size: 3611 bytes --]
*** progmodes/hideif.el Tue Jan 23 06:41:08 2007
--- progmodes/hideif.el Tue May 29 14:13:08 2007
***************
*** 242,250 ****
(end-of-line 2)))
(defun hide-ifdef-region-internal (start end)
! (remove-overlays start end 'invisible 'hide-ifdef)
(let ((o (make-overlay start end)))
! (overlay-put o 'invisible 'hide-ifdef)))
(defun hide-ifdef-region (start end)
"START is the start of a #if or #else form. END is the ending part.
--- 242,253 ----
(end-of-line 2)))
(defun hide-ifdef-region-internal (start end)
! (remove-overlays start end 'hide-ifdef t)
(let ((o (make-overlay start end)))
! (overlay-put o 'hide-ifdef t)
! (if hide-ifdef-shadow
! (overlay-put o 'face 'hide-ifdef-shadow)
! (overlay-put o 'invisible 'hide-ifdef))))
(defun hide-ifdef-region (start end)
"START is the start of a #if or #else form. END is the ending part.
***************
*** 256,262 ****
(defun hif-show-ifdef-region (start end)
"Everything between START and END is made visible."
! (remove-overlays start end 'invisible 'hide-ifdef))
;;===%%SF%% evaluation (Start) ===
--- 259,265 ----
(defun hif-show-ifdef-region (start end)
"Everything between START and END is made visible."
! (remove-overlays start end 'hide-ifdef t))
;;===%%SF%% evaluation (Start) ===
***************
*** 726,736 ****
(defun hif-hide-line (point)
"Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil."
! (if hide-ifdef-lines
! (save-excursion
! (goto-char point)
! (hide-ifdef-region-internal (line-beginning-position)
! (progn (hif-end-of-line) (point))))))
;;; Hif-Possibly-Hide
--- 729,739 ----
(defun hif-hide-line (point)
"Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil."
! (when hide-ifdef-lines
! (save-excursion
! (goto-char point)
! (hide-ifdef-region-internal
! (line-beginning-position) (progn (hif-end-of-line) (point))))))
;;; Hif-Possibly-Hide
***************
*** 815,836 ****
;;;###autoload
(defcustom hide-ifdef-initially nil
! "*Non-nil means call `hide-ifdefs' when Hide-Ifdef mode is first activated."
:type 'boolean
:group 'hide-ifdef)
;;;###autoload
(defcustom hide-ifdef-read-only nil
! "*Set to non-nil if you want buffer to be read-only while hiding text."
:type 'boolean
:group 'hide-ifdef)
;;;###autoload
(defcustom hide-ifdef-lines nil
! "*Non-nil means hide the #ifX, #else, and #endif lines."
:type 'boolean
:group 'hide-ifdef)
(defun hide-ifdef-toggle-read-only ()
"Toggle `hide-ifdef-read-only'."
(interactive)
--- 818,849 ----
;;;###autoload
(defcustom hide-ifdef-initially nil
! "Non-nil means call `hide-ifdefs' when Hide-Ifdef mode is first activated."
:type 'boolean
:group 'hide-ifdef)
;;;###autoload
(defcustom hide-ifdef-read-only nil
! "Set to non-nil if you want buffer to be read-only while hiding text."
:type 'boolean
:group 'hide-ifdef)
;;;###autoload
(defcustom hide-ifdef-lines nil
! "Non-nil means hide the #ifX, #else, and #endif lines."
:type 'boolean
:group 'hide-ifdef)
+ ;;;###autoload
+ (defcustom hide-ifdef-shadow nil
+ "Non-nil means shadow text instead of hiding it."
+ :type 'boolean
+ :group 'hide-ifdef)
+
+ (defface hide-ifdef-shadow '((t (:inherit shadow)))
+ "Face for shadowing ifdef blocks."
+ :group 'hide-ifdef)
+
(defun hide-ifdef-toggle-read-only ()
"Toggle `hide-ifdef-read-only'."
(interactive)
[-- Attachment #3: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Font lock for #if 0 ... #endif
@ 2007-05-18 21:29 martin rudalics
0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2007-05-18 21:29 UTC (permalink / raw)
To: namesagame-usenet; +Cc: help-gnu-emacs
> Ok. I guess it really isn't possible to do what I wanted to anyway.
Add the following lines to your .emacs:
(require 'hideif)
(defun hide-ifdef-region-internal (start end)
(remove-overlays start end 'face 'font-lock-warning-face)
(let ((o (make-overlay start end)))
(overlay-put o 'face 'font-lock-warning-face)))
(defun hif-show-ifdef-region (start end)
"Everything between START and END is made visible."
(remove-overlays start end 'face 'font-lock-warning-face))
Save and (evaluate .emacs or) restart Emacs, open the file of
your choice, and do
M-x hide-ifdefs
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.726.1179297177.32220.help-gnu-emacs@gnu.org>]
* Re: Font lock for #if 0 ... #endif
[not found] <mailman.726.1179297177.32220.help-gnu-emacs@gnu.org>
@ 2007-05-18 15:11 ` gamename
2007-06-09 22:24 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: gamename @ 2007-05-18 15:11 UTC (permalink / raw)
To: help-gnu-emacs
On May 15, 11:13 pm, martin rudalics <rudal...@gmx.at> wrote:
> > Sometimes in my C routines, I do
> >
> > #if 0
> > <code>
> > #endif
> >
> > to temporarily skip compilation of code (mostly for debugging
> > purposes).
> >
> > How can I change fontlock to recolor the region to something obvious?
>
> I won't recommend doing that in font-lock - the region could be too
> large to be handled efficiently. Try hide ifdef (hideif.el): If you
> don't like the ellipses you could use overlays to "recolor the region."
Ok. I guess it really isn't possible to do what I wanted to anyway.
-T
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Font lock for #if 0 ... #endif
[not found] <mailman.726.1179297177.32220.help-gnu-emacs@gnu.org>
2007-05-18 15:11 ` gamename
@ 2007-06-09 22:24 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2007-06-09 22:24 UTC (permalink / raw)
To: help-gnu-emacs
>> Sometimes in my C routines, I do
>>
>> #if 0
>> <code>
>> #endif
>>
>> to temporarily skip compilation of code (mostly for debugging
>> purposes).
>>
>> How can I change fontlock to recolor the region to something obvious?
> I won't recommend doing that in font-lock - the region could be too
> large to be handled efficiently.
Actually, you may be able to get something efficient by placing
a "comment-fence" syntax on those two elements from
c-font-lock-syntactic-keywords. But this can be tricky.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Font lock for #if 0 ... #endif
@ 2007-05-16 6:13 martin rudalics
0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2007-05-16 6:13 UTC (permalink / raw)
To: namesagame-usenet; +Cc: help-gnu-emacs
> Sometimes in my C routines, I do
>
> #if 0
> <code>
> #endif
>
> to temporarily skip compilation of code (mostly for debugging
> purposes).
>
> How can I change fontlock to recolor the region to something obvious?
I won't recommend doing that in font-lock - the region could be too
large to be handled efficiently. Try hide ifdef (hideif.el): If you
don't like the ellipses you could use overlays to "recolor the region."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Font lock for #if 0 ... #endif
@ 2007-05-15 1:50 gamename
0 siblings, 0 replies; 8+ messages in thread
From: gamename @ 2007-05-15 1:50 UTC (permalink / raw)
To: help-gnu-emacs
Hi Everyone,
Sometimes in my C routines, I do
#if 0
<code>
#endif
to temporarily skip compilation of code (mostly for debugging
purposes).
How can I change fontlock to recolor the region to something obvious?
Thanks,
-T
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-06-09 22:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.828.1179524023.32220.help-gnu-emacs@gnu.org>
2007-05-24 23:49 ` Font lock for #if 0 ... #endif gamename
2007-05-25 5:54 ` Eli Zaretskii
2007-05-29 12:29 martin rudalics
-- strict thread matches above, loose matches on Subject: below --
2007-05-18 21:29 martin rudalics
[not found] <mailman.726.1179297177.32220.help-gnu-emacs@gnu.org>
2007-05-18 15:11 ` gamename
2007-06-09 22:24 ` Stefan Monnier
2007-05-16 6:13 martin rudalics
2007-05-15 1:50 gamename
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).