From 3a29998b7e3ad57cf1b34ac4ac9babae26cb77ce Mon Sep 17 00:00:00 2001 From: Detlef Groth <75636+mittelmark@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:38:52 +0100 Subject: [PATCH] adding R documentation --- microemacs/doc/m9typ033.9 | 4 +- microemacs/doc/m9typ048.9 | 104 ++++++++++++++++++++++++++++++++++++++ microemacs/macros/r.eaf | 2 +- 3 files changed, 107 insertions(+), 3 deletions(-) create mode 100755 microemacs/doc/m9typ048.9 diff --git a/microemacs/doc/m9typ033.9 b/microemacs/doc/m9typ033.9 index 4daf0e4b8..f97f8d8e1 100755 --- a/microemacs/doc/m9typ033.9 +++ b/microemacs/doc/m9typ033.9 @@ -6,7 +6,7 @@ .\" Created By : Jon Green .\" Created : Thu Jun 24 22:02:47 1999 .\" -.Id $Id: m9typ033.9,v 2.6 2024/12/04 07:17:24 jon Exp $ +.Id $Id: m9typ033.9,v 2.6 2024/12/04 08:27:19 jon Exp $ .Im MicroEmacs filetype .so me.tni .TH python 9 @@ -20,7 +20,7 @@ python \- Python Language File. \- Python Language file hook definition .br .B python.eaf -\- UNIX shell abbreviation file +\- Python abbreviation file .ad .SH EXTENSIONS .na diff --git a/microemacs/doc/m9typ048.9 b/microemacs/doc/m9typ048.9 new file mode 100755 index 000000000..4337abd84 --- /dev/null +++ b/microemacs/doc/m9typ048.9 @@ -0,0 +1,104 @@ +.\" -*- nroff -*- +.\" This is part of the JASSPA MicroEmacs documentation files. +.\" Copyright (c) 1999-2009 JASSPA (www.jasspa.com) +.\" See the file "me.nrs" for copying and conditions. +.\" +.\" Created By : Jon Green +.\" Created : Thu Jun 24 22:02:47 1999 +.\" +.Id $Id: m9typ033.9,v 2.6 2024/12/04 08:37:35 jon Exp $ +.Im MicroEmacs filetype +.so me.tni +.TH r 9 +.XI R - "R Language File" +.XI r - "R Language File" +.SH SYNOPSIS +r \- R Language File. +.SH FILES +.na +.B hkr.emf +\- R Language file hook definition +.br +.B r.eaf +\- R language abbreviation file +.ad +.SH EXTENSIONS +.na +\fB.r\fR \- R file +.ad +.SH "MAGIC STRINGS" +.TP +\fB^#![ \\t]*/.*env[ \\t]+Rscript\fR +.\" +\*(mE recognizes the magic string on the first line of the file used to locate +the executable. The Rscript files may be extension-less and are still +recognized. +.SH DESCRIPTION +The \fBR\fR file type template provides simple hilighting of Python +files, the template provides minimal hilighting. +.PP +File recognition is performed using the standard file extension \fB.r\fR, +\fB.R\fR or by the magic string. +.PP +It offers as well folding and support for displaying an outline of the +functions of the R script for easy navigation using the +.Ht item-list 3 +command. Further is is possible to expand abbreviations either via short +strings using the +.Ht expand-abbrev-handle 3 +command and visual inserting abbreviations using the mouse by the +.Ht abbrev-list 3 +macro. +.IP "\fBFolding and Information Hiding\fR" +Generic folding is enabled within the R files. The folds occur about +the \fBfunction\fR keywords located on the left-hand margin at the beginning +of the line if the smaller-minus assignment operator is used. +The following commands are supported to show and hide the function bodies. +.Ht collapse-all 3 +(un)folds all regions in the file, +.Ht collapse-current 3 +(un)folds the current region. +.IP "\fBList Items\fR" +Item listing is available and the key constructs of the file may be listed in +the \fIitem-list\fR. +.IP "\fBAbbreviations\fR" +The installation comes with a default abbreviation file for R code editing +which can be used by writing short abbreviations like "\fBmain\fR" +for a default Rscript application outline,"\fBfor\fR", +"\fBif\fR" or "\fBfun\fR" - for a R function - and then pressing the +key-binding for the +.Ht expand-abbrev-handle 3 +command. The list of abbreviations can be used interactively in the GUI +version of \*(mE using the +.Ht abbrev-list 3 +command. +.IP "\fBShort Cuts\fR" +The short cut keys used within the buffer are:- +.IP +\fB\*cc \*cc\fR \- Comment out the current line. +.br +\fB\*cc \*cd\fR \- Uncomment the current line. +.br +\fB\*cc \*ce\fR \- Comment to the end of the line with stars (*). +.br +\fB\*a\*ci\fR \- Restyle the current region. +.br +\fBf2\fR \- (un)fold the current region +.br +\fBf3\fR \- (un)fold all regions +.br +\fBf6\fR \- list items +.br +\fB\*e f6\fR \- close list items +.SH BUGS +Functions with using the equal operator for assignments are not shown in the +function outline, this should be seen as a feature which allow you to write +hidden internal functions within other functions. +.SH "SEE ALSO" +.na +.Ht py 9 . +.Ht sh 9 . +.Hl "Supported File Types" FileTypes - +.ad +.FH + diff --git a/microemacs/macros/r.eaf b/microemacs/macros/r.eaf index 6fd9a1a87..d49c6a7ab 100644 --- a/microemacs/macros/r.eaf +++ b/microemacs/macros/r.eaf @@ -4,7 +4,7 @@ if "if (\p) {\r\r}\P" " if" elif "elseif (\p) {\r\r}\P" " elif" else "else {\r\p}\r\P" " else" while "while (\p) {\r\r}\P" " while" -func "\p <- function (...) {\r\r}\P" " func" +fun "\p <- function (...) {\r\r}\P" " fun" main "main <- function (argv) {\r\r}\rif (sys.nframe() == 0L && !interactive()) {\r main(commandArgs(trailingOnly=TRUE))\r}" " main" openw "fout = file(\"\pfilename\",'w')\rcat(\"hello line\\n\",file=fout)\rclose(fout)\r\P" " openw" openr "fin = file(\"\pfilename\", \"r\")\rwhile(length((line = readLines(fin,n=1)))>0) {\r print(line)\r}\rclose(fin)" " openr"