unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Luke Lee <luke.yx.lee@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Fwd: Update earlier posted hideif.el enhancements
Date: Fri, 29 Nov 2013 16:59:55 -0500	[thread overview]
Message-ID: <jwv1u1yanma.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAA=xLROf3AyGQ=P7j+qTp8-cPXQeUUm-nYV24sgHeuc9WjQCcg@mail.gmail.com> (Luke Lee's message of "Mon, 25 Nov 2013 14:35:27 +0800")

> Sure, no problem. Attached is the patch against Emacs trunk.

Thanks.  Came through unadulterated ;-)

> I'm using git://git.savannah.gnu.org/emacs.git as my Emacs remote
> source.  I've checked the trunk, master and emacs-24 and they seems to
> have the identical hideif.el version so I think it should be okay to
> patch it.

Indeed, there's been no real development on it in recently.  See my
comments below.  Overall, I think it looks good and could be included in
hideif.el, but I'd appreciate if you could clean up a few things first
and split the change into a few chunks (this is a bit large to review as
one single chunk).  IIUC one chunk would focus on extend the current
parser & evaluator to handle the full CPP syntax.


        Stefan


>    (if hide-ifdef-mode
>        (progn
>  	;; inherit global values
> -	(set (make-local-variable 'hide-ifdef-env)
> -	     (default-value 'hide-ifdef-env))
> +;;	(set (make-local-variable 'hide-ifdef-env) ;; [2012-09-27 11:05:26 +0800] Luke rem 2 ins 2
> +;;	     (default-value 'hide-ifdef-env))
> +	(set 'hide-ifdef-env (default-value 'hide-ifdef-env))
>  	(set (make-local-variable 'hide-ifdef-hiding)
>  	     (default-value 'hide-ifdef-hiding))
>  	(set (make-local-variable 'hif-outside-read-only) buffer-read-only)

I don't undertand this change.  "(set '<foo> ...)" is just a bad form of
(setq <foo> ...) so use `setq' instead.

> +(defun merge-ifdef-region (start end)

This lacks the "hif-" or "hide-ifdef-" prefix.

>  ;;;-----------------------------------------------------------------
>  ;;; Translate C preprocessor #if expressions using recursive descent.
>  ;;; This parser is limited to the operators &&, ||, !, and "defined".
>  ;;; Added ==, !=, +, and -.  Gary Oberbrunner, garyo@avs.com, 8/9/94
> +;;;
> +;;; Implement the C language operator precedence table. Add all those
> +;;; missing operators that could be used in macros. Luke Lee 2013-09-04

";;;" should be limited to headers.  The pre-existing code is already at
fault, but we should fix the pre-existing code rather than repeating
its mistake.

> +;;;  | Unary Operators      | * & + - ! ~ ++expr --expr (typecast) sizeof | right-to-left |

Try really hard to stay within 80 columns, please.

> +(defun hif-expand-token-list (tokens &optional macroname reflist) ;; reference list to prevent self-referencing

Same here.  Also, we like to capitalize our comments and terminate them
with full-stops.

BTW, maybe we could/should add some code to smie.el so as to not only
skip a expression but return a parse tree.  Then we could use maybe it here.

> +(defun shiftleft (a b)
> +(defun shiftright (a b)
> +(defun flatten (l)
> +(defun delimit (l a)

Lack the "hif-" prefix.



  reply	other threads:[~2013-11-29 21:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08  1:59 Update earlier posted hideif.el enhancements Luke Lee
2013-11-08  2:54 ` Stefan Monnier
2013-11-08  4:07   ` Luke Lee
2013-11-24 17:50     ` Stefan Monnier
     [not found]       ` <CAA=xLROospEnRM_Es0bBkQUpC_RmrS-vQDxprD2it+fVDbVKog@mail.gmail.com>
2013-11-25  6:35         ` Fwd: " Luke Lee
2013-11-29 21:59           ` Stefan Monnier [this message]
2013-12-03  4:33             ` Luke Lee
2013-12-03 13:45               ` Stefan Monnier
2013-12-04  2:06                 ` Luke Lee
2013-12-04 15:28                   ` Luke Lee
2013-12-04 17:33                     ` Stefan Monnier

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=jwv1u1yanma.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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).