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 [2016/01/18 19:31] anthonyresources:emacs_resources [2019/05/22 16:08] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== Emacs Resources ======
 +
 +\\
 +
 ====== Regular expressions ====== ====== Regular expressions ======
  
 ("regexps," "regexp," "regex") ("regexps," "regexp," "regex")
-====== Links to helpful pages ======+===== Links to helpful pages =====
  
 http://www.emacswiki.org/emacs/RegularExpression http://www.emacswiki.org/emacs/RegularExpression
Line 10: Line 14:
 ---- ----
  
-====== Recipes ======+===== Recipes =====
  
 \\ \\
 \\ \\
  
-===== Replace single spaces after end of sentence with two spaces in Emacs =====+==== Replace single spaces after end of sentence with two spaces in Emacs ====
  
 <2015.6.24> <2015.6.24>
Line 30: Line 34:
 ---- ----
  
-===== Emacs replacement trick ADC used when writing SPM table report tool =====+==== Emacs replacement trick ADC used when writing SPM table report tool ====
  
 (from [[internal:mathwonc_spm_tables#emacs_regexp_trick|here]]) (from [[internal:mathwonc_spm_tables#emacs_regexp_trick|here]])
Line 45: Line 49:
 ---- ----
  
-===== Emacs regexp for removing newline characters from text copied from Adobe PDF file =====+==== 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] [Originally from Anthony's ''science.txt'' file, entry dated 2015-09-03]
Line 68: Line 72:
 ---- ----
  
 +==== Add line break (RETURN) to end of all lines ====
  
-===== Sort article lists by year using awk and sed =====+[Put another way: insert spaces, insert empty line in between every line.]
  
-[Originally from Anthony's ''science.txt'' file, entry dated 2015-07-18.] +<code> 
- +M-x replace-regexp  
-Exported bibliography to clipboard in Zotero, pasted into Emacs to write new file:  +.$[RET
- +\&[C-q][C-j][RET]
-''.../VNLab/studies/ipsNumMeta/sources_number.txt'' +
- +
- +
-Try using awk to print column with year before whole rest of line +
- +
-<code bash> +
-gawk '{match($0,"\\([0-9]*[a-z]?\\)",a)} {print a[0], $0}' sources_number.txt > sources_number_yearCol.txt+
 </code> </code>
  
-Remove parens from FIRST (year) on a line:+"\&" is the emacs pattern that stands for "the entire matched pattern"
  
-<code bash> +C-q indicates something like "insert the following input literally" (I remember it by thinking of this as "quoting" something).
-sed -r 's/[(]([0-9]*[a-z]?)[)]/\1/' sources_number_yearCol.txt > sources_number_yearCol_noParens.txt +
-</code>+
  
-Used rectangle register copy trick in Emacs to copy only first five chars (catches both 2012 and 2012band pasted ultimately to Excel column.+C-j inserts a line break (a RETURN keypress, but this might not be the most precise description).
  
 \\ \\
 ---- ----
- 
resources/emacs_resources.1453163506.txt.gz · Last modified: (external edit)