changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / sys/lib/plumb/basic

changeset 7417: 278bf2c57889
parent: ec8e6605a508
author: Alex Musolino <alex@musolino.id.au>
date: Tue, 22 Oct 2019 08:18:20 +1030
permissions: -rw-r--r--
description: /sys/lib/plumb/basic: open nedmail windows with -noscroll

This preserves the desired behaviour of *not* scrolling to the bottom
of plumbed messages even when rio(1) is invoked with the -s flag.
1 # these are generally in order from most specific to least,
2 # since first rule that fires wins.
3 
4 include fileaddr
5 
6 # declarations of ports without rules
7 plumb to seemail
8 plumb to showmail
9 
10 # open urls with web browser
11 type is text
12 data matches 'https?://[^ ]+'
13 plumb to web
14 plumb client window $browser
15 
16 # rtf files go to wdoc2txt
17 type is text
18 data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
19 data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.rtf'
20 arg isfile $0
21 plumb to msword
22 plumb start wdoc2txt $file
23 
24 # start rule for microsoft word documents without .doc suffix
25 type is text
26 dst is msword
27 plumb to msword
28 plumb start wdoc2txt $file
29 
30 # email addresses get a new mail window
31 type is text
32 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
33 plumb to sendmail
34 plumb start window rc -c '''echo % mail '''$0'; mail '$0
35 
36 # audio
37 type is text
38 data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
39 data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(mp3|ogg|flac|m3u|pls)'
40 arg isfile $0
41 plumb to audio
42 plumb start window -scroll play $file
43 
44 # image files go to page
45 type is text
46 data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
47 data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|PPM|bit|BIT|png|PNG|pgm|PGM|bmp|BMP|yuv|YUV)'
48 arg isfile $0
49 plumb to image
50 plumb client page -wi
51 
52 # page bookmarks
53 type is text
54 data matches '(([a-zA-Z¡-￿0-9_\-.,/]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC|epub|EPUB|cb[tz]|CB[TZ]))!(.+)'
55 arg isfile $1
56 data set $file
57 attr add addr=$4
58 plumb to image
59 plumb start page -wij $file!$4 $file
60 
61 # postscript/pdf/dvi/doc go to page but not over the a plumb port
62 # the port is here for reference but is unused
63 type is text
64 data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
65 data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC|epub|EPUB|cb[tz]|CB[TZ])'
66 arg isfile $0
67 plumb to postscript
68 plumb start page -w $file
69 
70 # existing files, possibly tagged by line number, go to editor
71 type is text
72 data matches '([.a-zA-Z¡-￿0-9_/+\-]*[a-zA-Z¡-￿0-9_/+\-])('$addr')?'
73 arg isfile $1
74 data set $file
75 attr add addr=$3
76 plumb to edit
77 plumb client window $editor
78 
79 # .h files are looked up in /sys/include and passed to edit
80 type is text
81 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
82 arg isfile /sys/include/$1
83 data set $file
84 attr add addr=$3
85 plumb to edit
86 plumb client window $editor
87 
88 # .m files are looked up in /usr/inferno/module and passed to edit
89 type is text
90 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
91 arg isfile /usr/inferno/module/$1
92 data set $file
93 attr add addr=$3
94 plumb to edit
95 plumb client window $editor
96 
97 # faces -> new mail window for message
98 type is text
99 data matches '[a-zA-Z¡-￿0-9_\-./]+'
100 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
101 plumb to showmail
102 plumb start window -noscroll -r 4 120 750 600 upas/nedmail -s $0
103 
104 # man index entries are synthesized
105 type is text
106 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
107 plumb start rc -c 'man -b '$2' '$1'
108 
109 # RFC references are looked up in /lib/rfc and passed to editor
110 type is text
111 data matches 'RFC ?([0-9]+)'
112 arg isfile /lib/rfc/rfc$1
113 data set $file
114 plumb to edit
115 plumb client window $editor
116 
117 # start rule for images without known suffixes
118 dst is image
119 plumb to image
120 plumb client page -wi
121 
122 # start rule for postscript without known suffixes
123 dst is postscript
124 arg isfile $data
125 plumb start page -w $data
126 
127 type is text
128 data matches 'Local (.*)'
129 plumb to none
130 plumb start rc -c $1