bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17854: The patch #3 of 3 for hideif.el, a lot of bug fixes and enhan


From: Glenn Morris
Subject: bug#17854: The patch #3 of 3 for hideif.el, a lot of bug fixes and enhancements
Date: Tue, 01 Jul 2014 02:44:31 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Luke Lee wrote:

> Sure, I will. However, my hideif modification was splitted into 3
> patches  and I already submitted 2 so I'll keep those white
> space changes that should went to the earlier 2 patches. I
> learnt this rule "no white space change alone" too late. For
> thosecodes that I did not touch I will keep the white spaces.
> Sorry about that.

That's fine, no problem.

>>> +  :version "24.4")
>>
>>Why is the :version changing?

I'm still confused as to why the :version is changing.
Did you change it in a previous patch and forget to add :version?
If so, you can just fix that now. No need to wait and put everything in
one big patch.

> IMHO usually don't, but I don't know if there will be cases that
> some header files are written as:
>
> #if XXXXXXXXXXX
> ...
> #elif YYYYYYYYY
> ...
> #elif ZZZZZZZZZZ
> ...
> #endif
>
> And each part is very long, maybe someone would like only one
> portion to be visible?

Ah, ok, makes sense.

> If so, maybe making this variable a buffer local would make more
> sense? What do you think?

Yes, perhaps. (I don't use hideif so I can't really comment...)

>>>    (interactive)
>>> -  (message "Hiding...")
>>> +  (let ((hide-ifdef-lines current-prefix-arg))
>>
>>I think this should take an explicit prefix argument.
>
> Originally, I followed, adding optional argument "arg" added
> and applied `interactive "P"'. Change all the callers to include
> one more argument.
> However, I need to keep the `current-prefix-arg' since locally I bind
> "C-c @ C-h" (compare with the default hide-ifdefs shortcut key
> "C-c @ h") for "strong-hide-ifdefs" to invoke hide-ifdefs with a prefix
> command automatically:
>
> (defun strong-hide-ifdefs ()
>   "Perform hideif-defs including the #ifdef themselves."
>   (interactive)
>   (let ((current-prefix-arg t))
>     (hide-ifdefs)))
>
> Thus, "C-u C-c @ h" or the shorter "C-c @ C-h" both works.
> If I use use ARG in the let binding of `hide-ifdefs', strong-hide-ifdefs
> won't work so I kept the `current-prefix-arg'. Therefore, 'arg' become
> an unused argument so I roll my code back. If you got better idea
> about how to implement things like `strong-hide-ifdefs', please tell
> me. Others might meet the same problem.

I don't really follow.
It sounds like you want to call function A, which calls functions B,
which calls function C; and you want to change some aspect of how C
behaves? IMO yes, just giving A, B, and C explicit arguments would be better.
But you've thought about it more than I have.

>>> +(defun hide-ifdef-block (&optional start end)
>>> +  "Hide the ifdef block (true or false part) enclosing or before the
> cursor.
>>> +If prefixed, it will also hide #ifdefs themselves."
>>
>>Suggestion:
>>"With optional prefix agument ARG, also hide the #ifdefs themselves."
>
> It's nice but I can make it work with either `interactive "Pr"' or
> `interactive "rP" so I keep it unchanged.

I don't follow. Why not just pick one?

> +(defcustom hide-ifdef-expand-reinclusion-protection t
> +  "Non-nil means don't hide an entire header file enclused by
> #ifndef...#endif.

s/enclused/enclosed

> +undefined, and so nothing is hidden. The next time we visit it, everything

Two spaces between sentences (various places).

> +(defcustom hide-ifdef-header-regexp
> +  "\\.h\\(h\\|xx\\|pp\\)?"

I think you want to anchor this with \\' at the end.

> +(defun hide-ifdef-define (var &optional val)
> +  "Define a VAR to VAL (DEFAULT 1) in `hide-ifdef-env'.

s/DEFAULT/default





reply via email to

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