From: Steve <loft@centurylink.net>
To: help-gnu-emacs@gnu.org
Subject: Re: first steps in elisp
Date: Wed, 12 Apr 2017 02:26:23 -0400 [thread overview]
Message-ID: <87lgr6xhtc.fsf@centurylink.net> (raw)
In-Reply-To: 271a22de-593b-479d-a3d7-4aecbce934fb@googlegroups.com
Mark Piffer <mark.piffer@gmail.com> 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.
prev parent reply other threads:[~2017-04-12 6:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 23:00 first steps in elisp Mark Piffer
2016-11-25 5:39 ` Marcin Borkowski
2016-11-25 8:00 ` Joost Kremers
2016-12-21 17:57 ` Thien-Thi Nguyen
2017-04-12 6:26 ` Steve [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lgr6xhtc.fsf@centurylink.net \
--to=loft@centurylink.net \
--cc=help-gnu-emacs@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.