User Tools

Site Tools


resources:emacs_resources

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:emacs_resources [2015/06/24 10:49] anthonyresources:emacs_resources [2019/05/22 16:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Emacs Resources ======
  
- +\\
- +
- +
-<2015.6.24>+
  
 ====== Regular expressions ====== ====== Regular expressions ======
Line 18: Line 16:
 ===== Recipes ===== ===== Recipes =====
  
 +\\
 +\\
  
-==== Replace single spaces after end of sentence with two spaces====+==== Replace single spaces after end of sentence with two spaces in Emacs ==== 
 + 
 +<2015.6.24>
  
 Type the following: Type the following:
Line 29: Line 31:
 </code> </code>
  
-==== ADC used when writing SPM table report tool ====+\\ 
 +----
  
-(see here: [[internal:mathwonc_spm_tables#emacs_regexp_trick|Made full SPM table for manuscript]])+==== Emacs replacement trick ADC used when writing SPM table report tool ==== 
 + 
 +(from [[internal:mathwonc_spm_tables#emacs_regexp_trick|here]])
  
 In output file (“taldaemon_i_plus.td.txt” e.g.), AC used emacs regexp (regular expression) to reformat BA's, and just copied a rectangle to get region descriptions: In output file (“taldaemon_i_plus.td.txt” e.g.), AC used emacs regexp (regular expression) to reformat BA's, and just copied a rectangle to get region descriptions:
  
-Replace regexp (default Brodmann area.\([0-9]+\) → BA\1):+<code emacs> 
 +[M-x] replace-regexp [RET] 
 +^.*Brodmann area.\([0-9]+\).* [RET] 
 +BA\1 [RET] 
 +</code>
  
-and then+\\ 
 +----
  
-Replace regexp (default ^.*BA\([0-9]?\).* → BA\1):+==== Emacs regexp for removing newline characters from text copied from Adobe PDF file ====
  
 +[Originally from Anthony's ''science.txt'' file, entry dated 2015-09-03]
  
 +To remove all Windows newlines:
  
 +<code>
 +M-x replace-regexp 
 +C-q C-j RET
 +RET
 +</code>
 +
 +To add a newline before heading names, e.g. "I." or "A."
 +
 +<code>
 +M-x replace-regexp 
 +.\. RET
 +C-q C-j \& RET
 +</code>
 +
 +\\
 +----
 +
 +==== Add line break (RETURN) to end of all lines ====
 +
 +[Put another way: insert spaces, insert empty line in between every line.]
 +
 +<code>
 +M-x replace-regexp 
 +.$[RET]
 +\&[C-q][C-j][RET]
 +</code>
 +
 +"\&" is the emacs pattern that stands for "the entire matched pattern"
 +
 +C-q indicates something like "insert the following input literally" (I remember it by thinking of this as "quoting" something).
 +
 +C-j inserts a line break (a RETURN keypress, but this might not be the most precise description).
 +
 +\\
 +----
resources/emacs_resources.1435157354.txt.gz · Last modified: (external edit)