From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "hans nieuwenhuizen" Newsgroups: gmane.emacs.help Subject: elisp problem! Date: Tue, 3 Feb 2004 22:00:28 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <000401c3ea98$f0481410$93d19b83@campus.tue.nl> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1152815713==" X-Trace: sea.gmane.org 1075842328 27095 80.91.224.253 (3 Feb 2004 21:05:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 3 Feb 2004 21:05:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 03 22:05:12 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ao7jL-0006fB-00 for ; Tue, 03 Feb 2004 22:05:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ao7iY-0003DU-RD for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Feb 2004 16:04:22 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Ao7g3-0002cv-NY for help-gnu-emacs@gnu.org; Tue, 03 Feb 2004 16:01:47 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Ao7fW-0002Vl-BG for help-gnu-emacs@gnu.org; Tue, 03 Feb 2004 16:01:45 -0500 Original-Received: from [131.155.2.7] (helo=mailhost.tue.nl) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ao7ew-0002Mi-6w for help-gnu-emacs@gnu.org; Tue, 03 Feb 2004 16:00:38 -0500 Original-Received: by mailhost.tue.nl (Postfix, from userid 40) id A9B2214BD00; Tue, 3 Feb 2004 22:00:27 +0100 (CET) Original-Received: from jnieuwen (n148.dial.tue.nl [131.155.209.147]) by mailhost.tue.nl (Postfix) with SMTP id 12A4514BD70 for ; Tue, 3 Feb 2004 22:00:16 +0100 (CET) Original-To: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 X-Spam-DCC: COLLEGEOFNEWCALEDONIA: mailhost.tue.nl 1189; Body=1 Fuz1=1 Fuz2=1 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:16622 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16622 This is a multi-part message in MIME format. --===============1152815713== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0018_01C3EAA1.22AF3D90" This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C3EAA1.22AF3D90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear Sirs,=20 I use emacs 21.2.1, have studied Cameron and Glickstein, and read most = of elisp-manual-21-2-7, emacs-lisp-intro-2.04, elisp-20.2.5, as well as = the underlying .texi files for searching subjects, but did not find even = a suggestion how to solve my problems. I have asked for a quotation for = the printed version but not yet received it and I would very much = appreciate to receive a hint from you how to solve this, or --- better = --- hear what books may contain what I need.=20 The problem:=20 I have a program that builds any sourcefile ( .txt, .texi, .tex, .ltx, = .pl, .dh, .c, .cc, ...., 22 in total, see below ) with standard header = including date of last update like this: ;;=20 ;; Category 1 : 53482=20 ;; ID :=20 ;; Category 2 :=20 ;; Filename : UpdateDate.el ;; Lastedit : 2004-01-31 ;; Version : 1.0.0 ;; =20 ;; System : Emacs lisp ;; Date of 1st issue : 2004-01-31 ;; Directory : = /home/hans/5.Interesses/3.Computers/4.Developments/8.Utilities/2.Diskutil= s/UpdateDate.el ;; Changelog :=20 ;; Status :=20 ;; Purpose :=20 ;; =20 ;; Usage :=20 ;;=20 ;; =20 ;; = +---------------------------------------------------------------+ ;; | Copyright: = | ;; | = |=20 ;; | Ir. J.K. Nieuwenhuizen B.V. = | ;; | dom Paul Bellotweg 8, 5624 KZ Eindhoven, The Netherlands = | ;; | = | ;; | Telephone [ {..31|0} 40 ] 2442226 = | ;; | email nhzbv@nieuwenhuizen-jk.nl = | ;; | Registration KvK Eindhoven 170370770000 = | ;; = +---------------------------------------------------------------+ ;; =20 ;;=20 ;;=20 ;;=20 ;; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = B E G I N O F F I L E = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ;;=20 After an update I want emacs to change the 'Lastedit" date and write the = old date with a leading "Intermediate comment" lined up wth the others = under 'Changelog". =20 I thereto need a 21 * 6 S(string)matrix like: =20 (setq Filetypes=20 ;;; =3D=3D=3D No, Title, postfix, Single, Opening, Closing, Intermediate = =3D=3D=3D ;;; Filetypes, array[0-21] of array[0-5] ( vconcat=20 [ "Pure Text" "txt" "### " "### " "### " "### " ]=20 [ "Texinfo" "texi" "### " "### " "### " "### " ]=20 [ "Plain TeX" "tex" "%%% " "%%% " "%%% " "%%% " ] [ "LaTeX" "ltx" "%%% " "%%% " "%%% " "%%% " ] [ "HTML" "html" " " " " " " ] [ "Assembler" "asm" ";;; " ";;; " ";;; " ";;; " ] [ "GNU Assembler" "S" ";;; " ";;; " ";;; " ";;; " ] [ "Emacs lisp" "el" ";;; " ";;; " ";;; " ";;; " ] ( <--- = this file ) [ "Acad lisp" "lsp" ";;; " ";;; " ";;; " ";;; " ] [ "Perl script" "pl" "### " "### " "### " "### " ] [ "Bash script" "sh" "### " "### " "### " "### " ] [ "C definitions" "h" " " "/* " " */ " " * " ] [ "C main" "c" " " "/* " " */ " " * " ] [ "C procedures" "c" " " "/* " " */ " " * " ] [ "C++ definitions" "hpp" " " "/* " " */ " " * " ] [ "C++ implementation" "cc" " // " "/* " " */ " " * " ] [ "C++ main program" "cc" " // " "/* " " */ " " * " ] [ "C++ procedures" "cc" " // " "/* " " */ " " * " ] [ "C Makefile" "mak" "### " "### " "### " "### " ] [ "C++ Makefile" "mak" "### " "### " "### " "### " ] [ "Prof. Nhz. letter" "ltx" "%%% " "%%% " "%%% " "%%% " ] [ "NhzBV letter" "ltx" "%%% " "%%% " "%%% " "%%% " ] ) ) ### (setq Filetypes=20 but the best I an do is build ( as shown ) a 126 items Vector and = extract element [row][column] as [ 6 * row + column].=20 (** `(aref (( aref Filetypes [row] )) [column] )` is flagged as error = **)=20 (defun update-date ( ) "Update Fileheader::LastEdit with Today and Fileheader::Changelog = with present LastEdit." (interactive) (goto-char (point-min)) ;;; Find type of file (search-forward "Filename") (re-search-forward "\\.\\(\\w*\\)$") ;;; (setq postfix "\\1") = THIS DOES NOT WORK. Copy One after the other? (setq end (point)) (search-backward ".") (forward-char) =20 (setq start (point)) ;;; region : "el\n" above. start=3D101, = end=3D103 OK (kill-ring-save start end) ;;; And now? How to copy the kill-ring = into a form to be combared with Filetypes[count][1]? =20 Now I need to compare the region ( start - end ) with column #1 of the = matrix to find what commentsymbol to use. But none of my books or = manuals tells me how to=20 copy a regexp matched ( see "\\(\\w*\\)$" above, as in perl : postfix = =3D $1; ) so that I can compare it with the items of column #1 in my = matrix. Even in your 992 pages long manual I don't see how to copy the = region into a variable ( see postfix above ) or register, nor how to = read from one of the 256 registers identified by 1 single char ( ? ).=20 Or is there a better way to do these things?=20 Where can I find the needed info? =20 =20 ;;=20 ;; = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= E N D O F F I L E = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D ;;=20 Thanks, Nieuwenhuizen 2004-02-03 -------------------------------------------------------------------------= --- Prof. Ir. j.k. nieuwenhuizen email: = hans@nieuwenhuizen-jk.nl dom Paul Bellotweg 8 5624 KZ Eindhoven - NL Tel [{++31|0}40]2442226 -------------------------------------------------------------------------= ---- ------=_NextPart_000_0018_01C3EAA1.22AF3D90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Sirs,
 
I use emacs 21.2.1, have studied = Cameron and=20 Glickstein, and read most of elisp-manual-21-2-7, emacs-lisp-intro-2.04, = elisp-20.2.5, as well as the underlying .texi files for searching = subjects, but=20 did not find even a suggestion how to solve my problems. I have asked = for a=20 quotation for the printed version but not yet received it and I = would very=20 much appreciate to receive a hint from you how to solve this, or --- = better ---=20 hear what books may contain what I need.
 
The problem:
 
I have a program that builds any = sourcefile ( .txt,=20 .texi, .tex, .ltx, .pl, .dh, .c, .cc, ...., 22 in total, see below ) = with=20 standard header including date of last update like this:
 

;;
;;   = Category=20 1        : 53482
;;  =20 ID            = ;   =20 :
;;   Category = 2        :=20
;;  =20 Filename          :=20 UpdateDate.el
;;  =20 Lastedit          :=20 2004-01-31
;;  =20 Version           :=20 1.0.0
;;  
;;  =20 System            = : Emacs=20 lisp
;;   Date of 1st issue : 2004-01-31
;;  =20 Directory         :=20 /home/hans/5.Interesses/3.Computers/4.Developments/8.Utilities/2.Diskutil= s/UpdateDate.el
;;  =20 Changelog         : =
;;  =20 Status            = :=20
;;  =20 Purpose           :=20
;;  
;;  =20 Usage           &n= bsp; :=20
;;
;;        =20
;;        =20 +---------------------------------------------------------------+
;;&n= bsp;       =20 |=20 Copyright:          &nb= sp;           &nbs= p;            = ;            =     =20 |
;;        =20 |            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p; =20 |
;;        =20 |            =  =20 Ir. J.K. Nieuwenhuizen=20 B.V.           &nb= sp;         =20 |
;;         |   = dom Paul=20 Bellotweg 8, 5624 KZ Eindhoven,  The Netherlands  =20 |
;;        =20 |            =             &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p; =20 |
;;         |   = Telephone=20 [ {..31|0} 40 ]=20 2442226           =             &= nbsp;  =20 |
;;         |  =20 email    
nhzbv@nieuwenhuizen-jk.nl
         &nbs= p;            = ;  =20 |
;;        =20 |            =         =20 Registration KvK Eindhoven 170370770000  =20 |
;;        =20 +---------------------------------------------------------------+
;;&n= bsp;       =20
;;
;;
 
;;
;; = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D&nbs= p; B E G I=20 N   O F   F I L E  = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<= BR>;;=20
 
After an update I want emacs to change = the=20 'Lastedit" date and write the old date with a leading "Intermediate = comment"=20 lined up wth the others under 'Changelog".
 
I thereto need a 21 * 6 S(string)matrix = like:    
 
(setq Filetypes
 
;;; =3D=3D=3D No, Title, = postfix, Single,=20 Opening, Closing, Intermediate =3D=3D=3D
;;; Filetypes, array[0-21] = of=20 array[0-5]
    ( vconcat
 [ "Pure=20 Text"          "txt"  = "### "=20 "### " "### "
   "###
" ]
 [=20 "Texinfo"          &nbs= p;=20 "texi" "### " "### " "### " "### " ]
 [ "Plain=20 TeX"          "tex"  = "%%% "=20 "%%% " "%%% " "%%% " ]
 [=20 "LaTeX"           =   =20 "ltx"  "%%% " "%%% " "%%% " "%%% " ]
 [=20 "HTML"           &= nbsp;  =20 "html" "    " "<!--" "--> " "    "=20 ]
 [ = "Assembler"         =20 "asm"  ";;; " ";;; " ";;; " ";;; " ]
 [ "GNU=20 Assembler"      "S"    ";;; " = ";;; "=20 ";;; " ";;; " ]
 [ "Emacs=20 lisp"         "el"   = ";;; "=20 ";;; " ";;; " ";;; " ]  ( <--- this file )
 [ "Acad=20 lisp"          "lsp"  = ";;; "=20 ";;; " ";;; " ";;; " ]
 [ "Perl=20 script"        "pl"   "### = " "### "=20 "### " "### " ]
 [ "Bash=20 script"        "sh"   "### = " "### "=20 "### " "### " ]
 [ "C definitions"      = "h"    "    " "/*  " " */ " " *  = "=20 ]
 [ "C=20 main"           &n= bsp;=20 "c"    "    " "/*  " " */ " " *  = "=20 ]
 [ "C procedures"      =20 "c"    "    " "/*  " " */ " " *  = "=20 ]
 [ "C++ definitions"    "hpp"  = "   =20 " "/*  " " */ " " *  " ]
 [ "C++ implementation"=20 "cc"   " // " "/*  " " */ " " *  " ]
 [ "C++ = main=20 program"   "cc"   " // " "/*  " " */ " " = *  "=20 ]
 [ "C++ procedures"     "cc"   " = // "=20 "/*  " " */ " " *  " ]
 [ "C=20 Makefile"         "mak"  = "### "=20 "### " "### " "### " ]
 [ "C++=20 Makefile"       "mak"  "### " "### " = "### "=20 "### " ]
 [ "Prof. Nhz. letter"  "ltx"  "%%% " "%%% " = "%%% "=20 "%%% " ]
 [ "NhzBV letter"      =20 "ltx"  "%%% " "%%% " "%%% " "%%% " ]
    )
) = ### (setq=20 Filetypes
 
but the best I an do is build ( as = shown ) a 126=20 items Vector and extract element [row][column] as [ 6 * row + column].=20
(** `(aref (( aref Filetypes [row] )) = [column] )`=20 is flagged as error **) 
 
(defun update-date ( = )
   =20 "Update Fileheader::LastEdit with Today and Fileheader::Changelog with = present=20 LastEdit."
    (interactive)
    = (goto-char=20 (point-min))
;;; Find type of file
    = (search-forward=20 "Filename")
    (re-search-forward "
\\.\\(\\w*\\)$")    ;;;    = (setq=20 postfix "\\1") THIS DOES NOT WORK. Copy One after the=20 other?
    (setq end (point))
   =20 (search-backward ".")
   =20 (forward-char)          = ;       

   =20 (setq start = (point))       ;;; region :=20 "el\n" above. start=3D101, end=3D103 OK
    = (kill-ring-save start=20 end) ;;; And now? How to copy the kill-ring into a form to be combared = with=20 Filetypes[count][1]?
 
Now I need to compare the region ( = start - end )=20 with column #1 of the matrix to find what commentsymbol to use. But none = of my=20 books or manuals tells me how to 
copy a regexp matched ( see "\\(\\w*\\)$" above, as in perl : postfix =3D = $1; )=20 so that I can compare it with the items of column #1 in my matrix. = Even in=20 your 992 pages long manual I don't see how to copy the region into=20 a variable ( see postfix above ) or register, nor how to read = from one=20 of the 256 registers identified by 1 single char ( ? = ). 
Or is there a better way to do these = things?=20
 
 
Where can I find the needed info?  =
 
 

;;
;;=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=   E N D   O F   F I L E =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
;;
 
Thanks,
 
Nieuwenhuizen
2004-02-03
 
 
 
 
----------------------------------------------------------= ------------------
Prof.=20 Ir. j.k.=20 nieuwenhuizen          =       =20 email:
hans@nieuwenhuizen-jk.nl
dom Paul=20 Bellotweg 8
5624 KZ Eindhoven - NL
 
Tel=20 [{++31|0}40]2442226
--------------------------------------------------= ---------------------------
------=_NextPart_000_0018_01C3EAA1.22AF3D90-- --===============1152815713== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnu-emacs --===============1152815713==--