unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Luke Lee <luke.yx.lee@gmail.com>
Cc: 17854@debbugs.gnu.org
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	[thread overview]
Message-ID: <82lhsdtw6o.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <CAA=xLRMBMnu0eaor7uxHEVRLugKqqG5rcgcbUQwn9shr2nG2RQ@mail.gmail.com>

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





  parent reply	other threads:[~2014-07-01  6:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 13:51 bug#17854: The patch #3 of 3 for hideif.el, a lot of bug fixes and enhancements Luke Lee
2014-06-26 16:56 ` Glenn Morris
2014-06-26 16:59   ` Glenn Morris
2014-06-27  9:08     ` Luke Lee
2014-06-27  9:26   ` Luke Lee
2014-06-27  9:37 ` Luke Lee
2014-06-28  1:53   ` Glenn Morris
2014-06-28  3:22     ` Glenn Morris
2014-06-30 14:42     ` Luke Lee
2014-06-30 21:47       ` Stefan Monnier
2014-07-01  1:55         ` Luke Lee
2014-07-01  6:44       ` Glenn Morris [this message]
2014-07-03  2:37         ` Luke Lee
2014-07-07  0:02           ` Glenn Morris
2014-07-07  1:00             ` Glenn Morris
2014-07-07  9:05               ` Luke Lee
2014-07-07  9:04             ` Luke Lee
2014-07-07 16:10               ` Glenn Morris
2014-07-08  2:10                 ` Luke Lee
2014-07-07  9:04 ` bug#17854: Completed Luke Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82lhsdtw6o.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=17854@debbugs.gnu.org \
    --cc=luke.yx.lee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).