From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs 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 Message-ID: <82lhsdtw6o.fsf@fencepost.gnu.org> References: <75lhsh7qb8.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1404197118 26669 80.91.229.3 (1 Jul 2014 06:45:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jul 2014 06:45:18 +0000 (UTC) Cc: 17854@debbugs.gnu.org To: Luke Lee Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 01 08:45:10 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X1roU-0006pq-2h for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 08:45:10 +0200 Original-Received: from localhost ([::1]:38804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1roT-0000RD-Ko for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 02:45:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1roP-0000Pp-6D for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 02:45:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1roN-0007xZ-UT for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 02:45:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1roN-0007x6-QS for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 02:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X1roN-0001L6-Ax for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 02:45:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Jul 2014 06:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17854 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 17854-submit@debbugs.gnu.org id=B17854.14041970775090 (code B ref 17854); Tue, 01 Jul 2014 06:45:03 +0000 Original-Received: (at 17854) by debbugs.gnu.org; 1 Jul 2014 06:44:37 +0000 Original-Received: from localhost ([127.0.0.1]:38574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X1rnw-0001K1-U3 for submit@debbugs.gnu.org; Tue, 01 Jul 2014 02:44:37 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:60707 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X1rns-0001Jp-7L for 17854@debbugs.gnu.org; Tue, 01 Jul 2014 02:44:33 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1X1rnr-00024v-BQ; Tue, 01 Jul 2014 02:44:31 -0400 X-Spook: Abbas JPL Bruxelles SWAT undercover plutonium Sundevil X-Ran: S+7&*kI}~(^lex_IM]w/d0h%v]]"{sKmq\0kf#+93V@5SvFv3#@7jW@veD(BaY!A&V3M's X-Hue: blue X-Attribution: GM User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91035 Archived-At: 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