From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: .emacs poser Date: Thu, 19 Dec 2013 08:13:43 +0700 Message-ID: References: <87wqj4p720.fsf@nl106-137-194.student.uu.se> <87fvpsp3oy.fsf@nl106-137-194.student.uu.se> <8761qo56we.fsf@ID-264037.user.dfncis.de> <878uvjsa1k.fsf@nl106-137-194.student.uu.se> <87sitp7szm.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1387415630 12552 80.91.229.3 (19 Dec 2013 01:13:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Dec 2013 01:13:50 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 19 02:13:57 2013 Return-path: Envelope-to: geh-help-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 1VtSBY-0000yC-Vb for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Dec 2013 02:13:57 +0100 Original-Received: from localhost ([::1]:41508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtSBY-0000rp-Do for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Dec 2013 20:13:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtSBN-0000r2-Ad for help-gnu-emacs@gnu.org; Wed, 18 Dec 2013 20:13:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtSBM-0004kH-68 for help-gnu-emacs@gnu.org; Wed, 18 Dec 2013 20:13:45 -0500 Original-Received: from mail-qe0-x232.google.com ([2607:f8b0:400d:c02::232]:42580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtSBM-0004kD-27 for help-gnu-emacs@gnu.org; Wed, 18 Dec 2013 20:13:44 -0500 Original-Received: by mail-qe0-f50.google.com with SMTP id 1so438284qec.9 for ; Wed, 18 Dec 2013 17:13:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=pW0MhSjNUFtreWwn45RMGT2Mhs3y2B2dwPoPMO3qXSE=; b=C+bTuJpdgFbMKCkwlGZsBTCTVPkv46b939q7RHGmp0q0cVNtJccJkOqOByNPwOprES xALLHW9b/HUoOEBaueI8iEp8ZKwZmS7kszLz/JyMJ3YDwxDnoyjVK5TcQrZVha6lN5Ih oVcM4NCKyoH56ckwixtGLcQ3RT2GTYqhzXmVO5OFNlxIBFqd35TWaay3NqUnWYezEGY5 bl8nU6YKZj/n1veR3QdDZ2j/OZ0L9qMHX07C4lqX/WsEr/O+5PshJRIaBZhNvnLj9UbJ 3idn9A62Z5lLopr1KSg6WZjEnqcyePBJYQAmEe3olOXVWmQU6vvEBwNGDBDZA0sD2c6q huoA== X-Received: by 10.49.106.37 with SMTP id gr5mr59193686qeb.75.1387415623502; Wed, 18 Dec 2013 17:13:43 -0800 (PST) Original-Received: by 10.96.42.106 with HTTP; Wed, 18 Dec 2013 17:13:43 -0800 (PST) In-Reply-To: <87sitp7szm.fsf@nl106-137-194.student.uu.se> X-Google-Sender-Auth: PegqltIQ5Lu04WKfYb4RZ3qOD_Q X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::232 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95089 Archived-At: On Thu, Dec 19, 2013 at 4:23 AM, Emanuel Berg wrot= e: >> Writing keywords in all caps used to be popular in >> case-insensitive languages until syntax highlighting >> editors became the norm. Nowadays, it=E2=80=99s not quite as >> frequent. > > Is the preprocessor in C case-*in*sensitive? Because C > isn't. The preprocessor is case-sensitive, as is C. But, contrary to language keywords, we the developers get to pick our macro names. Because macro names are not namespaced and because they are known to cause surprising effects when used carelessly, we pick them so that they be highly visible and less likely to clash with other identifiers. To the latter end, ALL CAPS provides a mini-namespace, if we agree never to name non-macros in all caps. >> If/when there comes a day when most editors (IDEs?) >> can reliably detect preprocessor macros and highlight >> them with a dangerous-looking shade of red, the >> all-caps convention for #defines can also be dropped. > > This sounds like something that would be possible to do > with Emacs today. As for the definitions, that would be > a regular expression (very easy). But how to make it > consistent in the rest of the buffer (i.e., where the > constant is used), I don't know. The highlight at definition time is not important; there we have the # character to alert us that something shady is going on. What=E2=80=99s important is the highlight at each use. Syntactically, macro= s do not differ from ordinary identifiers, and their set is not constant as in the case of language keywords. So the IDE must do some parsing and remembering. Also, macro definitions may be placed under conditional compilation. So, depending on which branch is taken, different macros may be in effect after definition. So the IDE must also understand conditional compilation directives and be able to evaluate conditions. Additionally, sometimes preprocessor macros are defined in the compiler invocation command (-D switch for most compilers). But sorry for off-topic; we are digressing here from the problem of the rogue macron into the land of semantic parsers.