branch: elpa/gnuplot
commit 3f0e094296cd76423b11443e861f7372a78ce332
Merge: 5fdef54 402d487
Author: Naoya Yamashita <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #48 from conao3/feature
    
    Support indent with tab in gnuplot script
---
 gnuplot.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnuplot.el b/gnuplot.el
index aef46ed..ba943c5 100644
--- a/gnuplot.el
+++ b/gnuplot.el
@@ -2565,7 +2565,7 @@ Add additional indentation for continuation lines."
               (gnuplot-beginning-of-continuation)
               (back-to-indentation)
               (re-search-forward "\\S-+\\s-+" (point-at-eol) 'end-at-limit)
-              (setq indent (- (point) (point-at-bol))))
+              (setq indent (current-column)))
 
           ;; Not a continuation line; indent according to block
           ;; nesting depth
@@ -2586,8 +2586,8 @@ Add additional indentation for continuation lines."
       (indent-line-to indent))
 
     ;; Move point after indentation when at beginning of line
-    (let ((point-at-indent (+ (point-at-bol) indent)))
-      (when (< (point) point-at-indent) (goto-char point-at-indent)))))
+    (when (< (current-column) indent)
+      (move-to-column indent))))
 
 (defun gnuplot-electric-insert (BRACE)
   "Adjust indentation on inserting a close BRACE.
@@ -2988,7 +2988,9 @@ positions and COMPLETIONS is a list."
   (if gnuplot-keywords-pending          ; <HW>
       (gnuplot-setup-info-look))
   (let* ((end (point))
-         (beg (unwind-protect (save-excursion (backward-sexp 1) (point))))
+         (beg (condition-case _err
+                  (save-excursion (backward-sexp 1) (point))
+                (point)))
          (patt (buffer-substring beg end))
          (pattern (if (string-match "\\([^ \t]*\\)\\s-+$" patt)
                       (match-string 1 patt) patt))

Reply via email to