* FR: Yank rectangle, not as a rectangle but as a string.
@ 2014-03-05 16:22 Jambunathan K
2014-03-06 1:59 ` Eric Abrahamsen
2014-03-06 7:26 ` Teemu Likonen
0 siblings, 2 replies; 4+ messages in thread
From: Jambunathan K @ 2014-03-05 16:22 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]
FR: Yank rectangle, not as a rectangle but as a string.
----------------------------------------------------------------
Use Case:
I was trying to Org-tablize a two-column glossary. Glossary runs to 22
printed pages and after being Org-tablized has (I believe) 3000 entries
or so.
The glosssary.txt is created with
pdftotext -layout -nopgbrk glossary.pdf
See the attached files and screenshots.
----------------------------------------------------------------
Long story short:
1. C-x C-f kbd-macro.el. Install that macro.
2. C-x C-f glossary.txt
3. M-x fixup-glossary
4. You will end up with glossary-final.txt.
----------------------------------------------------------------
Crux of the matter:
The interesting portion in the macro is this sequence
?\C-x ?r ?k
?\C-x ?b ?t ?e ?m ?p ?- ?1 return
?\C-x ?r ?y
?\C-x ?h
?\C-w
?\C-x ?b return
down ?\C-y
where I rely on a temporary buffer to "string-ize" a rectangle.
----------------------------------------------------------------
So, my question is this: Is there a way to do yank a rectangle as a
string?
----------------------------------------------------------------
Interesting Titbit:
This is the "inverse" operation of what the Info node says
| (info "(emacs) Rectangles")
|
| For example, you can convert two single-column lists into a
| double-column list by killing one of the single-column lists as a
| rectangle, and then yanking it beside the other list.
[-- Attachment #2: french-english-glossary.png --]
[-- Type: image/png, Size: 63480 bytes --]
[-- Attachment #3: glossary.txt --]
[-- Type: text/plain, Size: 1142 bytes --]
mettre à jour: to update, 13 neveu: m. nephew, 2
mettre à la porte / être mis(e) à la porte: to fire / to nez: m. nose, 4, 10
be fired, 12 nièce: f. niece, 2
mettre de côté: to put aside, to save, 13 noces: f pl, wedding, 7
meuble / meubles: m. piece of furniture / furniture, 8
COERLL - French Department Page 329 of 347 CC 2011 University of Texas at Austin
Noël, le 25 décembre / Joyeux Noël!: m. Christmas / Pâques / Joyeuses Pâques!: m, f pl, Easter / Happy
Merry Christmas! , 7 Easter!, 7
noir(e): black, 4 parc: m. park, 3, 6
noix: f. walnut, 5 parce que: because, 2
nom (de famille): m. last name, 2 parents: m pl, parents, relatives , 2
[-- Attachment #4: kbd-macro.el --]
[-- Type: application/emacs-lisp, Size: 617 bytes --]
[-- Attachment #5: glossary-final.txt --]
[-- Type: text/plain, Size: 1065 bytes --]
| mettre à jour: to update, 13 |
| mettre à la porte / être mis(e) à la porte: to fire / to |
| be fired, 12 |
| mettre de côté: to put aside, to save, 13 |
| meuble / meubles: m. piece of furniture / furniture, 8 |
| neveu: m. nephew, 2 |
| nez: m. nose, 4, 10 |
| nièce: f. niece, 2 |
| noces: f pl, wedding, 7 |
| |
Noël, le 25 décembre / Joyeux Noël!: m. Christmas / Pâques / Joyeuses Pâques!: m, f pl, Easter / Happy
Merry Christmas! , 7 Easter!, 7
noir(e): black, 4 parc: m. park, 3, 6
noix: f. walnut, 5 parce que: because, 2
nom (de famille): m. last name, 2 parents: m pl, parents, relatives , 2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FR: Yank rectangle, not as a rectangle but as a string.
2014-03-05 16:22 FR: Yank rectangle, not as a rectangle but as a string Jambunathan K
@ 2014-03-06 1:59 ` Eric Abrahamsen
2014-03-06 7:26 ` Teemu Likonen
1 sibling, 0 replies; 4+ messages in thread
From: Eric Abrahamsen @ 2014-03-06 1:59 UTC (permalink / raw)
To: help-gnu-emacs
Jambunathan K <kjambunathan@gmail.com> writes:
> FR: Yank rectangle, not as a rectangle but as a string.
+1, I've often wanted to be able to do this...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FR: Yank rectangle, not as a rectangle but as a string.
2014-03-05 16:22 FR: Yank rectangle, not as a rectangle but as a string Jambunathan K
2014-03-06 1:59 ` Eric Abrahamsen
@ 2014-03-06 7:26 ` Teemu Likonen
2014-03-06 10:22 ` Teemu Likonen
1 sibling, 1 reply; 4+ messages in thread
From: Teemu Likonen @ 2014-03-06 7:26 UTC (permalink / raw)
To: Jambunathan K.; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 792 bytes --]
Jambunathan K. [2014-03-05 21:52:15 +05:30] wrote:
> FR: Yank rectangle, not as a rectangle but as a string.
I didn't read all your examples so I might not understand this
correctly. Anyway, I've written a command which sounds like what you
need. With prefix argument the command requests a separator string to be
inserted between rectangle rows. The default is space (" ").
(defun tl-yank-rectangle-sequentially (beg end char)
;; Variable "select-active-regions" must not be t.
(interactive (list (region-beginning) (region-end)
(if current-prefix-arg
(read-string "Separator string: ")
" ")))
(save-match-data
(kill-new (mapconcat 'identity (extract-rectangle beg end) char))
(setq deactivate-mark t)))
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-06 10:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 16:22 FR: Yank rectangle, not as a rectangle but as a string Jambunathan K
2014-03-06 1:59 ` Eric Abrahamsen
2014-03-06 7:26 ` Teemu Likonen
2014-03-06 10:22 ` Teemu Likonen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.