From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Steve Newsgroups: gmane.emacs.help Subject: Re: first steps in elisp Date: Wed, 12 Apr 2017 02:26:23 -0400 Organization:  Message-ID: <87lgr6xhtc.fsf@centurylink.net> References: <271a22de-593b-479d-a3d7-4aecbce934fb@googlegroups.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491978630 8146 195.159.176.226 (12 Apr 2017 06:30:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Apr 2017 06:30:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 12 08:30:23 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyBnL-0001xo-Bd for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Apr 2017 08:30:23 +0200 Original-Received: from localhost ([::1]:42420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyBnP-0006ee-LG for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Apr 2017 02:30:27 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 12 Apr 2017 01:26:00 -0500 Original-Newsgroups: gnu.emacs.help Cancel-Lock: sha1:z6aCXagf4/IU9ijog9ufNUjnLEA= Original-Lines: 72 X-Usenet-Provider: http://www.giganews.com Original-X-Trace: sv3-PmbWh2G8TRK0ohp232v5+HmS1ZWzZsTggUg54lIZmPZGEbm7+NUtgBZfPgqcbDHbveJO5TkEwHLumKj!mo/ZPwu4I7mSMGR+DNy4sKLTOPUZ14v0fCn5wYGym6etmCzrQKk0 Original-X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3754 Original-Xref: usenet.stanford.edu gnu.emacs.help:219082 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:112750 Archived-At: Mark Piffer writes: < I am trying to write some helper functions which should ease < documentation of C as per the method which my customers require < (mostly repetition of parameters as Doxygen-enabled comments - I don't < think that that's a good idea, but the customer wants it). I coudn't < find a package that was primitive enough to help me with the parsing - < the code is embedded C and quite non-standard with respect to compiler < extensions. I have some terrible ideas, but you might find them useful or interesting. using grep as a shell command process. I would try looking at `grep-process-startup' or `shell-command on region'. You don't need to use an external program (shell script). also, emacs has the `combine-and-quote-strings' function which is very nice. Also `looking-at-p' is a newer one, does not load match-data. I'm sure the doxygen docstrings are parsable with emacs - they are font locked when I check some C buffers; doxygen is not something I know much about. check in site-lisp/progmodes/cc-mode.el - has some functions to determine if your inside a string or comment. < Which things are especially bad or unusual concerning both, Lisp and < emacs? Concerning lisp, I often hear that lisp programmers are considered a tad bit goofy :) they seem to like to write everything from scratch until it becomes a command interpreter; the course of just a few bytecodes... They used to say emacs and vi are religions; these days they are starting to seem like latin. < [ ... ] > < (defun ignore-line-comments (nlines) < "return the text starting at point as a list, < going nlines lines down, stripped of < all C comments (except pathological cases w/ string literals)" < (if (zerop nlines) < nil < (setq ml-e (if (looking-at "\\(.*?\\)/\\*") ;; test on /* comment < (match-end 1) < nil)) using setq will bind the variable with dynamic scope. to get lexical scope youe use a lambda function (lambda function usually means `let'. (defun ignore-line-comments (nlines) "return [ ... ] " ;; new (let ((ml-e nil)) ;; now setq will bind ml-e lexically for the function (if (zerop nlines) nil (setq ml-e (if (looking-at "\\(.*?\\)/\\*") ;; test on /* comment (match-end 1) nil)) Hops this helps. P.S. in another article about the `serial-term' ; Emacs serial term is woring great with a parallax propeller. The trick is to use pst#NL (that is insert newline and then form feed. Arg... just had to get that off my chest.