Skip to content

Commit

Permalink
adding r-format, r-link macros and renamed rdoc to r-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Detlef Groth committed Dec 12, 2024
1 parent d18a596 commit 09a0b2a
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 46 deletions.
66 changes: 49 additions & 17 deletions doc/me.smd
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@
[list-buffers(2)](list-buffers(2)) (C-x C-b) List all buffers and show their status
[osd-help(3)](osd-help(3)) GUI based on-line help
[pydoc(3)](pydoc(3)) Display Python module manual pages
[rdoc(3)](rdoc(3)) Display R function and package manual pages
[r-doc(3)](r-doc(3)) Display R function and package manual pages

!! me-id: amicr021
! Operating Modes
Expand Down Expand Up @@ -2099,7 +2099,9 @@
[quote-char(2)](quote-char(2)) (C-q) Insert literal character
[rcs-file(2)](rcs-file(2)) (C-x C-q) Handle Revision Control System (RCS) files
[rdiff(3)](rdiff(3)) Recursively compare files or directories
[rdoc(3)](rdoc(3)) Display R function and package manual pages
[r-doc(3)](r-doc(3)) Display R function and package manual pages
[r-format(3)](r-format(3)) Format the currently edited R script file
[r-lint(3)](r-lint(3)) Source code check of the currently edited R script file
[read-file(2)](read-file(2)) (C-x C-r) Find and load file replacing current buffer
[read-registry(2)](read-registry(2)) Read in a registry definition file
[read-session(3)](read-session(3)) Read in session information
Expand Down Expand Up @@ -2626,7 +2628,9 @@
[query-replace-all-string(3)](query-replace-all-string(3)) Query replace string in a list of files
[query-replace-string-in-files(3)](query-replace-string-in-files(3)) Conditionally search and replace strings across files
[rdiff(3)](rdiff(3)) Recursively compare files or directories
[rdoc(3)](rdoc(3)) Display R function and package manual pages
[r-doc(3)](r-doc(3)) Display R function and package manual pages
[r-format(3)](r-format(3)) Format the currently edited R script file
[r-lint(3)](r-lint(3)) Source code check of the currently edited R script file
[read-session(3)](read-session(3)) Read in session information
[replace-all-pairs(3)](replace-all-pairs(3)) Replace string pairs in a list of files
[replace-all-string(3)](replace-all-string(3)) Replace string with new string in a list of files
Expand Down Expand Up @@ -3781,7 +3785,9 @@
[rc(9)](rc(9)) Microsoft Developer resource file
[rcs-file(2)](rcs-file(2)) (C-x C-q) Handle Revision Control System (RCS) files
[rdiff(3)](rdiff(3)) Recursively compare files or directories
[rdoc(3)](rdoc(3)) Display R function and package manual pages
[r-doc(3)](r-doc(3)) Display R function and package manual pages
[r-format(3)](r-format(3)) Format the currently edited R script file
[r-lint(3)](r-lint(3)) Source code check of the currently edited R script file
[read-file(2)](read-file(2)) (C-x C-r) Find and load file replacing current buffer
[read-registry(2)](read-registry(2)) Read in a registry definition file
[read-session(3)](read-session(3)) Read in session information
Expand Down Expand Up @@ -4992,6 +4998,7 @@

## Development History


- [241120]
- fixing Find osd type for wrong key shortcut
- improved abbreviation handling for R and Python Esc Esc now expands
Expand Down Expand Up @@ -43424,22 +43431,30 @@ $a

[scheme-editor(3)](scheme-editor(3))
!! me-id: m3mac099
! 3 rdoc
! 3 r-doc
! 3 r-format
! 3 r-lint
## NAME


|rdoc
rdoc - display documentation for R functions and packages
|r-doc
r-doc - display documentation for R functions and packages
|r-format
r-format - format a R script using the formatR library
|r-lint
r-lint - R source code linter using the lintr library
$a

## SYNOPSIS

__rdoc__ ["package::function|function"]
__r-doc__ ["package::function|function"]
__r-format__
__r-lint__


## DESCRIPTION

Displays in a hypertext browser with R syntax hilighting the manual pages
for R packages or R functions.
The __r-doc__ macro displays in a hypertext browser with R syntax hilighting
the manual pages for R packages or R functions.

You can fold or unfold the section and use the [item-list(3)](item-list(3))
command to navigate the documentation sections. If no argment is given
Expand All @@ -43449,19 +43464,36 @@ $a
using the syntax "pkgname::funcname". Links to other functions and to the
main package overview are shown with hilights in the normal text. Usage and
Examples sections use R highlighting.


The __r-format__ macro formats the currently edited R script file using the
formats the currently edited file using the R library `formatR` which must
be installed by the user for instance using the usual
`install.packages('formatR')` syntax from within a R console.

The __r-lint__ macro checks the currently edited file using the R package
`lintr` which must be installed by the user for instance using the usual
`install.packages('lintr)` syntax from within a R console.

After executing the macro a popup-window (`*lintr*`) displays the warning
messages of the linter package, the user can click on the hilighted lines
showing warnings and jump directly to the problematic line. The same can
be achieved by pressing the ENTER key on the hilighted line.

## EXAMPLE

```{.emf}
rdoc ; requests a help page from the user
rdoc "plot" ; function documentation
rdoc "cluster::pam" ; function pam in package cluster
rdoc "package::cluster" ; package overview with functions
r-doc ; requests a help page from the user
r-doc "plot" ; plot function documentation
r-doc "cluster::pam" ; function pam in package cluster docu
r-doc "package::cluster" ; package overview with functions
r-format ; formats and reloads the currently edited R script
r-lint ; gives code advise for the currently edited R script
```

## NOTES

__rdoc__ macro is defined in file `hkrdoc.emf`.
__r-doc__ macro is defined in file `hkrdoc.emf`. The macros __r-format__
and __r-lint__ are implemented in the file `rtools.emf`.

## SEE ALSO

Expand Down
2 changes: 1 addition & 1 deletion jasspa/macros/hkr.emf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ define-macro fhook-r
@# buffer-init "r"
buffer-init-hooks
!emacro

define-macro-file rtools r-lint r-format
; buffer-init variables
set-variable .fhook-r.name "R/S-Plus"
set-variable .fhook-r.setup &reg "/history/fhook/r" "bdfghopx"
Expand Down
4 changes: 1 addition & 3 deletions jasspa/macros/hkrdoc.emf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; Author : $Author$
; Created By : Detlef Groth
; Created : Thu Sep 26 14:43:10 2024
; Last Modified : <240926.1936>
; Last Modified : <241212.1427>
;
; Description
;
Expand Down Expand Up @@ -56,5 +56,3 @@ set-variable .fhook-rdoc.setup-mask "acfhmw"
set-variable .fhook-rdoc.item-list-s1 "^\ecE\\([A-Z].+\\)\ecA"
set-variable .fhook-rdoc.item-list-r1 "SECT \ecB\\1\ecA"


1000 ml-write "load new hkrdoc"
66 changes: 49 additions & 17 deletions jasspa/macros/me.ehf
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ Miscellaneous Information
lslist-buffers(2)lmlist-buffers(2)le (C-x C-b) List all buffers and show their status
lsosd-help(3)lmosd-help(3)le GUI based on-line help
lspydoc(3)lmpydoc(3)le Display Python module manual pages
lsrdoc(3)lmrdoc(3)le Display R function and package manual pages
lsr-doc(3)lmr-doc(3)le Display R function and package manual pages

! Operating Modes
cEcEOPERATING MODES cEcA
Expand Down Expand Up @@ -2182,7 +2182,9 @@ Miscellaneous Information
lsquote-char(2)lmquote-char(2)le (C-q) Insert literal character
lsrcs-file(2)lmrcs-file(2)le (C-x C-q) Handle Revision Control System (RCS) files
lsrdiff(3)lmrdiff(3)le Recursively compare files or directories
lsrdoc(3)lmrdoc(3)le Display R function and package manual pages
lsr-doc(3)lmr-doc(3)le Display R function and package manual pages
lsr-format(3)lmr-format(3)le Format the currently edited R script file
lsr-lint(3)lmr-lint(3)le Source code check of the currently edited R script file
lsread-file(2)lmread-file(2)le (C-x C-r) Find and load file replacing current buffer
lsread-registry(2)lmread-registry(2)le Read in a registry definition file
lsread-session(3)lmread-session(3)le Read in session information
Expand Down Expand Up @@ -2708,7 +2710,9 @@ Miscellaneous Information
lsquery-replace-all-string(3)lmquery-replace-all-string(3)le Query replace string in a list of files
lsquery-replace-string-in-files(3)lmquery-replace-string-in-files(3)le Conditionally search and replace strings across files
lsrdiff(3)lmrdiff(3)le Recursively compare files or directories
lsrdoc(3)lmrdoc(3)le Display R function and package manual pages
lsr-doc(3)lmr-doc(3)le Display R function and package manual pages
lsr-format(3)lmr-format(3)le Format the currently edited R script file
lsr-lint(3)lmr-lint(3)le Source code check of the currently edited R script file
lsread-session(3)lmread-session(3)le Read in session information
lsreplace-all-pairs(3)lmreplace-all-pairs(3)le Replace string pairs in a list of files
lsreplace-all-string(3)lmreplace-all-string(3)le Replace string with new string in a list of files
Expand Down Expand Up @@ -3860,7 +3864,9 @@ Miscellaneous Information
lsrc(9)lmrc(9)le Microsoft Developer resource file
lsrcs-file(2)lmrcs-file(2)le (C-x C-q) Handle Revision Control System (RCS) files
lsrdiff(3)lmrdiff(3)le Recursively compare files or directories
lsrdoc(3)lmrdoc(3)le Display R function and package manual pages
lsr-doc(3)lmr-doc(3)le Display R function and package manual pages
lsr-format(3)lmr-format(3)le Format the currently edited R script file
lsr-lint(3)lmr-lint(3)le Source code check of the currently edited R script file
lsread-file(2)lmread-file(2)le (C-x C-r) Find and load file replacing current buffer
lsread-registry(2)lmread-registry(2)le Read in a registry definition file
lsread-session(3)lmread-session(3)le Read in session information
Expand Down Expand Up @@ -5067,6 +5073,7 @@ Miscellaneous Information

cEDevelopment History cA


- [241120]
- fixing Find osd type for wrong key shortcut
- improved abbreviation handling for R and Python Esc Esc now expands
Expand Down Expand Up @@ -42846,22 +42853,30 @@ $a
cESEE ALSO cA

lsscheme-editor(3)lmscheme-editor(3)le
! 3 rdoc
! 3 r-doc
! 3 r-format
! 3 r-lint
cEcENAME cEcA


|rdoc
rdoc - display documentation for R functions and packages
|r-doc
r-doc - display documentation for R functions and packages
|r-format
r-format - format a R script using the formatR library
|r-lint
r-lint - R source code linter using the lintr library
$a

cESYNOPSIS cA

cDrdoccA ["package::function|function"]
cDr-doccA ["package::function|function"]
cDr-formatcA
cDr-lintcA


cEDESCRIPTION cA

Displays in a hypertext browser with R syntax hilighting the manual pages
for R packages or R functions.
The cDr-doccA macro displays in a hypertext browser with R syntax hilighting
the manual pages for R packages or R functions.

You can fold or unfold the section and use the lsitem-list(3)lmitem-list(3)le
command to navigate the documentation sections. If no argment is given
Expand All @@ -42871,18 +42886,35 @@ $a
using the syntax "pkgname::funcname". Links to other functions and to the
main package overview are shown with hilights in the normal text. Usage and
Examples sections use R highlighting.


The cDr-formatcA macro formats the currently edited R script file using the
formats the currently edited file using the R library cGformatRcA which must
be installed by the user for instance using the usual
cGinstall.packages('formatR')cA syntax from within a R console.

The cDr-lintcA macro checks the currently edited file using the R package
cGlintrcA which must be installed by the user for instance using the usual
cGinstall.packages('lintr)cA syntax from within a R console.

After executing the macro a popup-window (cG*lintr*cA) displays the warning
messages of the linter package, the user can click on the hilighted lines
showing warnings and jump directly to the problematic line. The same can
be achieved by pressing the ENTER key on the hilighted line.

cEEXAMPLE cA

sB
rdoc ; requests a help page from the user
rdoc "plot" ; function documentation
rdoc "cluster::pam" ; function pam in package cluster
rdoc "package::cluster" ; package overview with functions
r-doc ; requests a help page from the user
r-doc "plot" ; plot function documentation
r-doc "cluster::pam" ; function pam in package cluster docu
r-doc "package::cluster" ; package overview with functions
r-format ; formats and reloads the currently edited R script
r-lint ; gives code advise for the currently edited R script
sA
cENOTES cA

cDrdoccA macro is defined in file cGhkrdoc.emfcA.
cDr-doccA macro is defined in file cGhkrdoc.emfcA. The macros cDr-formatcA
and cDr-lintcA are implemented in the file cGrtools.emfcA.

cESEE ALSO cA

Expand Down
2 changes: 1 addition & 1 deletion jasspa/macros/me.emf
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define-macro-file mail mail mail-check stop-mail-check
define-macro-file fileopen osd-file-open osd-get-file
define-macro-file spellaut auto-spell auto-spell-menu
define-macro-file hkinfo info info-on info-goto-link
define-macro-file rdoc rdoc
define-macro-file rdoc r-doc
define-macro-file hkpydoc pydoc
define-macro-file zfile find-zfile zfile-setup
define-macro-file gentags generate-tags-file
Expand Down
12 changes: 5 additions & 7 deletions jasspa/macros/rdoc.emf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; Author : $Author$
; Created By : Detlef Groth
; Created : Thu Sep 26 19:12:38 2024
; Last Modified : <240928.0506>
; Last Modified : <241212.1436>
;
; Description
;
Expand All @@ -14,7 +14,7 @@
; Copyright (c) 2024 Detlef Groth.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
define-macro rdoc
define-macro r-doc
!force set-variable #l0 @1
!if &not $status
set-variable #l0 @ml00 "R help on"
Expand All @@ -36,8 +36,6 @@ define-macro rdoc
set-variable .package ""
set-variable #l1 &spr "options(useFancyQuotes = FALSE);help('%s')" #l0
!endif
r-doc-test #l1
1000 ml-write .docu
0 pipe-shell-command &spr "LANG=en_US Rscript -e \"%s\"" #l1 "*rdoc*"
set-variable :mouse-word-select r-doc-process-link
-1 buffer-mode "view"
Expand Down Expand Up @@ -152,13 +150,13 @@ define-macro r-doc-test
-1 yank
;3000 ml-write &spr "fetching %s" #l6
!if &seq .rdoc.package ""
rdoc #l6
r-doc #l6
!else
!if &equ &sin "package:" #l6 0
rdoc &spr "%s::%s" .rdoc.package #l6
r-doc &spr "%s::%s" .rdoc.package #l6
!else
; click on package:pkgname
rdoc #l6
r-doc #l6
!endif
!endif
!endif
Expand Down
Loading

0 comments on commit 09a0b2a

Please sign in to comment.