1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
[[!meta title="Parallel Text Replacement"]]
[[!meta copyright="Copyright © 2023 Lovro, Valentino Picotti"]]
[[!inline pages="internal(2023/info/parallel-nav)" raw="yes"]]
<!-- Initially generated with emacsconf-publish-talk-page and then left alone for manual editing -->
<!-- You can manually edit this file to update the abstract, add links, etc. --->
# Parallel Text Replacement
Lovro, Valentino Picotti - IRC: hokomo, <mailto:hokomo@disroot.org>
[[!inline pages="internal(2023/info/parallel-before)" raw="yes"]]
We present our Emacs package for performing parallel text
replacement.
"Parallel" in this context does not refer to improving
efficiency through parallelism, but to the concept of performing
more than one text replacement without them interfering with
each other. This is in line with the usage of the term in the
Lisp community when contrasting the behaviors of LET and LET*,
SETQ and PSETQ, etc. (e.g.
<http://www.lispworks.com/documentation/lw60/CLHS/Body/s_let_l.htm>).
We will present the package's features and its integration with
Emacs' query-replace system, a comparison with previous
solutions, and a few notes on our implementation. We will
describe some common use-cases and showcase how the package is
used.
The package is currently not yet published in a package archive,
but the code is already publicly available at
<https://github.com/hokomo/query-replace-parallel>. The name
"query-replace-parallel" is not yet final and we are thinking of
alternatives. Our current best candidate is "replace-parallel"
(similar to the built-in "replace.el"), but suggestions are
welcome.
# Discussion
## Questions and answers
- Q: This looks great, and was very well-presented. Do you have plans
to upstream this functionality into Emacs?
- A: Would require some refactoring upstream, so not suitable for
upstreaming as-is.
- Q: Did you use pair-programming while developing it, or did you work
independently, alternating and reviewing?
- A: Yes, we did! I was at the keyboard, Valentino was at the
whiteboard, and we kept bouncing ideas back and forth, trying
out prototypes, coming up with various tests, checking the edge
cases, etc.
- Q: What is your background in programming? Was it difficult to
implement following the same API and architecture as what is already
in Emacs?
- A: Both Valentino and I are PhD students in computer science,
but a PhD or similar is definitely not a requirement. It wasn't
too difficult because we could reuse the interactive
functionality from query-replace's internals. Figuring out what
and how to reuse is what took a bit of creativity, but a lot of
the necessary knowledge for that came from just reading and
poking around Emacs' replace.el. Don't be afraid to go and
read the source!
- Q: What did you learn about Emacs programming or programming in
general while working on this project?
- A: That Emacs is so flexible that you can even advise its
`message` function. Similarly, being able to prototype
functionality so quickly and immediately integrate it into the
rest of Emacs is so fun and so satisfying!
## Notes
- One usecase could be character names in a novel manuscript, if one
has named a character and want to now rename it to some other
character names or swap it with another one.
- I never saw so many talks about repls. so great!!!
- Nice, I was wondering if it utilized `rx`
- package installed, ready to use!
- excellent talk, and also such a cool package
- great talk, very clever concept
- that SRE "paper" you linked to is interesting
- just saw the "Parallel Text Replacement" talk - 👏 great talk!
[[!inline pages="internal(2023/info/parallel-after)" raw="yes"]]
[[!inline pages="internal(2023/info/parallel-nav)" raw="yes"]]
|