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