Skip to content

Commit 788ea37

Browse files
author
Detlef Groth
committed
few fixes and docu updates for rdoc and pydoc macros
1 parent d515a27 commit 788ea37

File tree

7 files changed

+263
-154
lines changed

7 files changed

+263
-154
lines changed

ChangeLog

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
>
88
> Created By : Jon Green
99
> Created : Fri Feb 6 11:13:34 2004
10-
> Last Modified : <240922.0632>
10+
> Last Modified : <240928.0451>
1111
> Authors: : John Green, Steven Phillips, Detlef Groth
1212

1313
[240927]
1414

1515
- support for Markdown as define-help language
16+
- adding rdoc(3) command
17+
- adding r(9) documentation
18+
- adding !hm and !he abbreviations for macro help
19+
- adding pydoc(3) command
1620

1721
[240920]
1822

doc/files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ m3mac096.html git-status(3)
666666
m3mac097.html save-kbd-macro(3)
667667
m3mac098.html xrdb-scheme(3)
668668
m3mac099.html rdoc(3)
669+
m3mac100.html pydoc(3)
669670
m3osd000.html user-setup(3)
670671
m3osd001.html organizer(3)
671672
m3osd002.html find-word(3)

doc/me.smd

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,6 +4982,10 @@
49824982

49834983
- [20240927]
49844984
- support for Markdown as define-help language
4985+
- adding [rdoc(3)](rdoc(3)) command
4986+
- adding [r(9)](r(9)) documentation
4987+
- adding !hm and !he abbreviations for macro help
4988+
- adding [pydoc(3)](pydoc(3)) command
49854989

49864990
- [240920]
49874991
- documenting save-kbd-macro(3)
@@ -43383,16 +43387,27 @@ $a
4338343387
Displays in a hypertext browser with R syntax hilighting the manual pages
4338443388
for R packages or R functions.
4338543389

43390+
You can fold or unfold the section and use the [item-list(3)](item-list(3))
43391+
command to navigate the documentation sections. If no argment is given
43392+
requests a package or function name from the user via the command line.
43393+
Package overview pages should be requested using the syntax
43394+
"package::pkgname", documentation for specific functions should be requested
43395+
using the syntax "pkgname::funcname". Links to other functions and to the
43396+
main package overview are shown with hilights in the normal text. Usage and
43397+
Examples sections use R highlighting.
4338643398

4338743399
## EXAMPLE
43388-
43389-
rdoc "plot"
43390-
rdoc "cluster::pam"
43391-
rdoc "package::cluster"
43400+
43401+
```{.emf}
43402+
rdoc ; requests a help page from the user
43403+
rdoc "plot" ; function documentation
43404+
rdoc "cluster::pam" ; function pam in package cluster
43405+
rdoc "package::cluster" ; package overview with functions
43406+
```
4339243407

4339343408
## NOTES
4339443409

43395-
__rdoc__ macro is defined in file `hkrdoc.emf`.
43410+
__rdoc__ macro is defined in file `hkrdoc.emf`.
4339643411

4339743412
## SEE ALSO
4339843413

@@ -43413,14 +43428,15 @@ $a
4341343428
## DESCRIPTION
4341443429

4341543430
Displays with the manual page for a Python package module or package.
43431+
4341643432
You can fold or unfold the section and use the [item-list(3)](item-list(3))
4341743433
command to get an overview about section and classes in a module or
4341843434
package. If no argment is given requests a package or function name from
4341943435
the user via the command line.
4342043436

4342143437
## EXAMPLE
4342243438

43423-
pydoc "argparse"
43439+
pydoc "argparse"
4342443440
pydoc "sys"
4342543441

4342643442
## NOTES

jasspa/macros/hkrdoc.emf

Lines changed: 12 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
; Author : $Author$
44
; Created By : Detlef Groth
55
; Created : Thu Sep 26 14:43:10 2024
6-
; Last Modified : <240926.1642>
6+
; Last Modified : <240926.1936>
77
;
88
; Description
99
;
@@ -15,8 +15,16 @@
1515
;
1616
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1717
define-macro fhook-rdoc
18-
@# buffer-init "rdoc"
19-
buffer-init-hooks
18+
@# buffer-init "rdoc"
19+
!if &seq $buffer-bname "*rdoc*"
20+
; Hyperlink with the <RETURN> key
21+
buffer-bind-create "bio" "return" "0" r-doc-process-link
22+
; Move between links with the <TAB> key
23+
buffer-bind-create "bio" "tab" "" r-doc-forward-link
24+
buffer-bind-create "bio" "S-tab" "" r-doc-backward-link
25+
buffer-bind-create "bio" "space" "" scroll-down
26+
!endif
27+
buffer-init-hooks
2028
!emacro
2129

2230
; buffer-init variables
@@ -30,7 +38,7 @@ set-variable .fhook-rdoc.setup-mask "acfhmw"
3038
0 hilight .hilight.rdoc 0 .scheme.text
3139
!iif &not &exi ".hilight.r" !force execute-file "hkr"
3240
hilight .hilight.rdoc 0xc0 "^cEUsage:cA" "Usage:" .hilight.r .scheme.header
33-
hilight .hilight.rdoc 0xc0 "^cEExamples:cA" "Example:" .hilight.r .scheme.header
41+
hilight .hilight.rdoc 0xc0 "^cEExamples:cA" "Examples:" .hilight.r .scheme.header
3442
hilight .hilight.r 0xc0 "cE(.+)cA" "\\1" .hilight.rdoc .scheme.header
3543
hilight .hilight.r 0x44 "^cE" "" "cA" "" "" .scheme.header
3644
hilight .hilight.rdoc 0x44 "^cE" "" "cA" "" "" .scheme.header
@@ -48,140 +56,5 @@ set-variable .fhook-rdoc.setup-mask "acfhmw"
4856
set-variable .fhook-rdoc.item-list-s1 "^\ecE\\([A-Z].+\\)\ecA"
4957
set-variable .fhook-rdoc.item-list-r1 "SECT \ecB\\1\ecA"
5058

51-
add-file-hook "*rdoc*" fhook-rdoc
52-
53-
define-macro rdoc
54-
!force set-variable #l0 @1
55-
!if &not $status
56-
set-variable #l0 @ml00 "R help on"
57-
!endif
58-
!if &seq #l0 ""
59-
!return
60-
!endif
61-
set-variable #l0 &rep #l0 "::" ":"
62-
!if &xse #l0 "\\(.+\\):\\(.+\\)"
63-
!if &or &seq @s1 "library" &seq @s1 "package"
64-
set-variable #l1 &spr "options(useFancyQuotes = FALSE);library(help='%s')" @s2
65-
set-variable .package @s2
66-
!else
67-
set-variable #l1 &spr "options(useFancyQuotes = FALSE);help('%s',package='%s',help_type='text')" @s2 @s1
68-
set-variable .package @s1
69-
!endif
70-
!else
71-
; options(useFancyQuotes = FALSE);
72-
set-variable .package ""
73-
set-variable #l1 &spr "options(useFancyQuotes = FALSE);help('%s')" #l0
74-
!endif
75-
0 pipe-shell-command &spr "LANG=en_US Rscript -e \"%s\"" #l1 "*rdoc*"
76-
set-variable :mouse-word-select r-doc-process-link
77-
-1 buffer-mode "view"
78-
beginning-of-buffer
79-
;set-variable $debug 2
80-
!force search-buffer "me" "During startup - Warning messages:"
81-
!if $status
82-
beginning-of-line
83-
1 kill-line
84-
!endif
85-
!force search-buffer "me" "Setting LC_.+ failed"
86-
!while $status
87-
beginning-of-line
88-
1 kill-line
89-
!force search-buffer "me" "Setting LC_.+ failed"
90-
!done
91-
beginning-of-buffer
92-
3 kill-line
93-
replace-string "_" ""
94-
beginning-of-buffer
95-
replace-string "^See Also:" "\ecESee Also:\ecA"
96-
beginning-of-buffer
97-
replace-string "^\\(\\u\\l[^ :]+:\\)$" "\ecE\\1\ecA"
98-
beginning-of-buffer
99-
replace-string " \\(package:[^ ]+\\) " " \els\\1\ele "
100-
beginning-of-buffer
101-
!force search-buffer "me" "^\\ecESee Also:"
102-
!if $status
103-
2 forward-line
104-
;set-variable $debug 2
105-
beginning-of-line
106-
set-variable #l1 0
107-
; maximal 5 lines as &xse has problems with while
108-
!while &less #l1 6
109-
; &xse @wl "^\\S" does not work ...
110-
-1 replace-string "'\\([^']+\\)'" "\els\\1\ele"
111-
forward-line
112-
beginning-of-line
113-
set-variable #l1 &add #l1 1
114-
!done
115-
!endif
116-
beginning-of-buffer
117-
;; package documentation with Index:
118-
!force search-buffer "me" "^\\ecEIndex:"
119-
!if $status
120-
2 forward-line
121-
beginning-of-line
122-
set-variable #l1 0
123-
; maximal 5 lines
124-
!while &less #l1 100
125-
; &xse @wl "^\\S" does not work ...
126-
-1 replace-string "^\\([^\\s]+\\)" "\els\\1\ele"
127-
!force forward-line
128-
!if $status
129-
beginning-of-line
130-
!endif
131-
set-variable #l1 &add #l1 1
132-
!done
133-
beginning-of-buffer
134-
!endif
135-
;execute-file "hkrdoc"
136-
beginning-of-buffer
137-
1 buffer-mode "view"
138-
!if &band $system 0x01
139-
; some terminals might need this
140-
screen-update
141-
!endif
142-
143-
!emacro
144-
145-
0 define-macro r-doc-process-link
146-
;set-variable $debug 3
147-
set-position "\x80"
148-
set-variable #l0 $window-col
149-
set-variable #l1 $window-line
150-
;set-variable $debug 2
151-
!force -2 search-forward "\ele"
152-
!if $status
153-
set-variable #l2 $window-col
154-
set-variable #l3 $window-line
155-
3 backward-char
156-
!force -2 search-backward "\els"
157-
!if $status
158-
set-variable #l4 $window-col
159-
set-variable #l5 $window-line
160-
3 forward-char
161-
; all on same line? and
162-
!if &and &equ #l1 #l3 &equ #l3 #l5
163-
!if &and &less #l0 #l2 &great #l0 #l4
164-
set-mark
165-
search-forward "\ele"
166-
3 backward-char
167-
copy-region
168-
set-variable #l6 @y
169-
-1 yank
170-
;3000 ml-write &spr "fetching %s" #l6
171-
!if &seq .rdoc.package ""
172-
rdoc #l6
173-
!else
174-
!if &equ &sin "package:" #l6 0
175-
rdoc &spr "%s::%s" .rdoc.package #l6
176-
!else
177-
; click on package:pkgname
178-
rdoc #l6
179-
!endif
180-
!endif
181-
!endif
182-
!endif
183-
!endif
184-
!endif
185-
!emacro
18659

18760
1000 ml-write "load new hkrdoc"

jasspa/macros/me.ehf

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,10 @@ Miscellaneous Information
50575057

50585058
- [20240927]
50595059
- support for Markdown as define-help language
5060+
- adding lsrdoc(3)lmrdoc(3)le command
5061+
- adding lsr(9)lmr(9)le documentation
5062+
- adding !hm and !he abbreviations for macro help
5063+
- adding lspydoc(3)lmpydoc(3)le command
50605064

50615065
- [240920]
50625066
- documenting save-kbd-macro(3)
@@ -42805,16 +42809,26 @@ $a
4280542809
Displays in a hypertext browser with R syntax hilighting the manual pages
4280642810
for R packages or R functions.
4280742811

42812+
You can fold or unfold the section and use the lsitem-list(3)lmitem-list(3)le
42813+
command to navigate the documentation sections. If no argment is given
42814+
requests a package or function name from the user via the command line.
42815+
Package overview pages should be requested using the syntax
42816+
"package::pkgname", documentation for specific functions should be requested
42817+
using the syntax "pkgname::funcname". Links to other functions and to the
42818+
main package overview are shown with hilights in the normal text. Usage and
42819+
Examples sections use R highlighting.
4280842820

4280942821
cEEXAMPLE cA
42810-
42811-
rdoc "plot"
42812-
rdoc "cluster::pam"
42813-
rdoc "package::cluster"
42814-
42822+
42823+
sB
42824+
rdoc ; requests a help page from the user
42825+
rdoc "plot" ; function documentation
42826+
rdoc "cluster::pam" ; function pam in package cluster
42827+
rdoc "package::cluster" ; package overview with functions
42828+
sA
4281542829
cENOTES cA
4281642830

42817-
cDrdoccA macro is defined in file cGhkrdoc.emfcA.
42831+
cDrdoccA macro is defined in file cGhkrdoc.emfcA.
4281842832

4281942833
cESEE ALSO cA
4282042834

@@ -42834,14 +42848,15 @@ $a
4283442848
cEDESCRIPTION cA
4283542849

4283642850
Displays with the manual page for a Python package module or package.
42851+
4283742852
You can fold or unfold the section and use the lsitem-list(3)lmitem-list(3)le
4283842853
command to get an overview about section and classes in a module or
4283942854
package. If no argment is given requests a package or function name from
4284042855
the user via the command line.
4284142856

4284242857
cEEXAMPLE cA
4284342858

42844-
pydoc "argparse"
42859+
pydoc "argparse"
4284542860
pydoc "sys"
4284642861

4284742862
cENOTES cA

jasspa/macros/me.emf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ define-macro-file mail mail mail-check stop-mail-check
7171
define-macro-file fileopen osd-file-open osd-get-file
7272
define-macro-file spellaut auto-spell auto-spell-menu
7373
define-macro-file hkinfo info info-on info-goto-link
74-
define-macro-file hkrdoc rdoc
74+
define-macro-file rdoc rdoc
7575
define-macro-file hkpydoc pydoc
7676
define-macro-file zfile find-zfile zfile-setup
7777
define-macro-file gentags generate-tags-file

0 commit comments

Comments
 (0)