From eb3b61a9ef1e3d8e67712862c3df1d59359c9f1d Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 5 Oct 2015 18:26:06 -0400 Subject: [PATCH] Fix latex-tsv-to-table --- .emacs.d/init.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 26f6eb3..6310233 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -157,12 +157,12 @@ (defun latex-tsv-to-table () "Converts tab-seperated-values to a LaTeX table." (interactive) - (let ((beg (region-beginning)) (lines (count-lines (region-beginning) (region-end)))) + (let ((beg (region-beginning)) (end-line (line-number-at-pos (region-end)))) (save-excursion - (goto-char beg) - (indent-region beg (point)) - (replace-regexp "\t" " & " nil beg (point)) - (replace-regexp "$" " \\\\\\\\" nil beg (point)) + (goto-line end-line) + (indent-region beg (point-at-eol)) + (replace-regexp "\t" " & " nil beg (point-at-eol)) + (replace-regexp "$" " \\\\\\\\" nil beg (point-at-eol)) (align beg (point)))))) (use-package fasd :config