branch: elpa/tuareg commit 1e80bcd4654d547ad02c30eb88a6e51b055c8fd2 Author: Christophe Troestler <christophe.troest...@umons.ac.be> Commit: Christophe Troestler <christophe.troest...@umons.ac.be>
Remove TABs --- .dir-locals.el | 1 + ocamldebug.el | 72 +++++++++++++++++++++---------------------- tuareg-opam.el | 30 +++++++++--------- tuareg.el | 96 +++++++++++++++++++++++++++++----------------------------- 4 files changed, 100 insertions(+), 99 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..002211c --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1 @@ +((emacs-lisp-mode . ((indent-tabs-mode . nil)))) diff --git a/ocamldebug.el b/ocamldebug.el index 82faef8..3bf9e27 100644 --- a/ocamldebug.el +++ b/ocamldebug.el @@ -283,47 +283,47 @@ buffer, then try to obtain the time from context around point." (save-selected-window (select-window (get-buffer-window ocamldebug-current-buffer)) (save-excursion - (if (re-search-backward "^Time : [0-9]+ - pc : [0-9]+ " - nil t (- 1 ntime)) - (ocamldebug-goto nil) - (error "I don't have %d times in my history" - (- 1 ntime)))))))) + (if (re-search-backward "^Time : [0-9]+ - pc : [0-9]+ " + nil t (- 1 ntime)) + (ocamldebug-goto nil) + (error "I don't have %d times in my history" + (- 1 ntime)))))))) ((eq (current-buffer) ocamldebug-current-buffer) (let ((time (cond - ((eobp) 0) - ((save-excursion - (beginning-of-line 1) - (looking-at "^Time : \\([0-9]+\\) - pc : [0-9]+ ")) - (string-to-number (match-string 1))) - ((string-to-number (ocamldebug-format-command "%e")))))) + ((eobp) 0) + ((save-excursion + (beginning-of-line 1) + (looking-at "^Time : \\([0-9]+\\) - pc : [0-9]+ ")) + (string-to-number (match-string 1))) + ((string-to-number (ocamldebug-format-command "%e")))))) (ocamldebug-call "goto" nil time))) (t (let ((module (ocamldebug-module-name (buffer-file-name))) - (ocamldebug-goto-position (int-to-string (1- (point)))) - ocamldebug-goto-output address) + (ocamldebug-goto-position (int-to-string (1- (point)))) + ocamldebug-goto-output address) ;; Get a list of all events in the current module (with-current-buffer ocamldebug-current-buffer - (let* ((proc (get-buffer-process (current-buffer))) - (ocamldebug-filter-function #'ocamldebug-goto-filter)) - (ocamldebug-call-1 (concat "info events " module)) - (while (not (and ocamldebug-goto-output - (zerop (length ocamldebug-filter-accumulator)))) - (accept-process-output proc)) - (setq address (unless (eq ocamldebug-goto-output 'fail) - (re-search-backward - (concat "^Time : \\([0-9]+\\) - pc : " - ocamldebug-goto-output - " - module " - module "$") + (let* ((proc (get-buffer-process (current-buffer))) + (ocamldebug-filter-function #'ocamldebug-goto-filter)) + (ocamldebug-call-1 (concat "info events " module)) + (while (not (and ocamldebug-goto-output + (zerop (length ocamldebug-filter-accumulator)))) + (accept-process-output proc)) + (setq address (unless (eq ocamldebug-goto-output 'fail) + (re-search-backward + (concat "^Time : \\([0-9]+\\) - pc : " + ocamldebug-goto-output + " - module " + module "$") nil t) - (match-string 1))))) + (match-string 1))))) (if address (ocamldebug-call "goto" nil (string-to-number address)) - (error "No time at %s at %s" module ocamldebug-goto-position)))))) + (error "No time at %s at %s" module ocamldebug-goto-position)))))) (defun ocamldebug-delete-filter (string) (setq ocamldebug-filter-accumulator - (concat ocamldebug-filter-accumulator string)) + (concat ocamldebug-filter-accumulator string)) (when (string-match (concat "\\(\n\\|\\`\\)[ \t]*\\([0-9]+\\)[ \t]+[0-9]+[ \t]*in " (regexp-quote ocamldebug-delete-file) @@ -331,16 +331,16 @@ buffer, then try to obtain the time from context around point." ocamldebug-delete-position "\n") ocamldebug-filter-accumulator) (setq ocamldebug-delete-output - (match-string 2 ocamldebug-filter-accumulator)) + (match-string 2 ocamldebug-filter-accumulator)) (setq ocamldebug-filter-accumulator - (substring ocamldebug-filter-accumulator (1- (match-end 0))))) + (substring ocamldebug-filter-accumulator (1- (match-end 0))))) (when (string-match comint-prompt-regexp ocamldebug-filter-accumulator) (setq ocamldebug-delete-output (or ocamldebug-delete-output 'fail)) (setq ocamldebug-filter-accumulator "")) (if (string-match "\n\\(.*\\)\\'" ocamldebug-filter-accumulator) (setq ocamldebug-filter-accumulator - (match-string 1 ocamldebug-filter-accumulator))) + (match-string 1 ocamldebug-filter-accumulator))) "") @@ -361,11 +361,11 @@ around point." (arg (let ((narg (ocamldebug-numeric-arg arg))) (if (> narg 0) (ocamldebug-call "delete" nil narg) - (with-current-buffer ocamldebug-current-buffer - (if (re-search-backward "^Breakpoint [0-9]+ at [0-9]+ : file " - nil t (- 1 narg)) - (ocamldebug-delete nil) - (error "I don't have %d breakpoints in my history" + (with-current-buffer ocamldebug-current-buffer + (if (re-search-backward "^Breakpoint [0-9]+ at [0-9]+ : file " + nil t (- 1 narg)) + (ocamldebug-delete nil) + (error "I don't have %d breakpoints in my history" (- 1 narg))))))) ((eq (current-buffer) ocamldebug-current-buffer) (let* ((bpline "^Breakpoint \\([0-9]+\\) at [0-9]+ : file ") diff --git a/tuareg-opam.el b/tuareg-opam.el index 0904845..658e9f3 100644 --- a/tuareg-opam.el +++ b/tuareg-opam.el @@ -43,8 +43,8 @@ (when (file-directory-p "~/.opam") (let ((c (directory-files "~/.opam" t "[0-9]+\\.[0-9]+\\.[0-9]+"))) (if (file-directory-p "~/.opam/system") - (cons "~/.opam/system" c) - c))) + (cons "~/.opam/system" c) + c))) "The list of OPAM directories for the installed compilers.") (defvar tuareg-opam @@ -334,10 +334,10 @@ form (n v) where n is the name of the environment variable and v its value (both being strings). If opam is not found or the switch is not installed, `nil' is returned." (let* ((switch (if switch (concat " --switch " switch))) - (get-env (concat tuareg-opam " env --sexp" switch)) - (opam-env (tuareg--shell-command-to-string get-env))) + (get-env (concat tuareg-opam " env --sexp" switch)) + (opam-env (tuareg--shell-command-to-string get-env))) (if opam-env - (car (read-from-string opam-env))))) + (car (read-from-string opam-env))))) (defcustom tuareg-opam-insinuate nil "By default, Tuareg will use the environment that Emacs was @@ -370,13 +370,13 @@ error message as a string)." (defun tuareg-opam-installed-compilers () (let* ((cmd1 (concat tuareg-opam " switch list -i -s")) (cmd2 (concat tuareg-opam " switch list -s")); opam2 - (cpl (or (tuareg--shell-command-to-string cmd1) + (cpl (or (tuareg--shell-command-to-string cmd1) (tuareg--shell-command-to-string cmd2)))) (if cpl (split-string cpl "[ \f\t\n\r\v]+" t) '()))) (defun tuareg-opam-current-compiler () (let* ((cmd (concat tuareg-opam " switch show -s")) - (cpl (tuareg--shell-command-to-string cmd))) + (cpl (tuareg--shell-command-to-string cmd))) (when cpl (replace-regexp-in-string "[ \t\n]*" "" cpl)))) @@ -385,17 +385,17 @@ error message as a string)." "Update the environment to follow current OPAM switch configuration." (interactive (let* ((compl (tuareg-opam-installed-compilers)) - (current (tuareg-opam-current-compiler)) - (default (if current current "current")) - (prompt (format "opam switch (default: %s): " default))) + (current (tuareg-opam-current-compiler)) + (default (if current current "current")) + (prompt (format "opam switch (default: %s): " default))) (list (completing-read prompt compl)))) (let* ((switch (if (string= switch "") nil switch)) - (env (tuareg-opam-config-env switch))) + (env (tuareg-opam-config-env switch))) (if env - (dolist (v env) - (setenv (car v) (cadr v)) - (when (string= (car v) "PATH") - (setq exec-path (split-string (cadr v) path-separator)))) + (dolist (v env) + (setenv (car v) (cadr v)) + (when (string= (car v) "PATH") + (setq exec-path (split-string (cadr v) path-separator)))) (message "Switch %s does not exist (or opam not found)" switch)))) ;; OPAM compilation diff --git a/tuareg.el b/tuareg.el index 6e8494c..d041c5b 100644 --- a/tuareg.el +++ b/tuareg.el @@ -691,7 +691,7 @@ Regexp match data 0 points to the chars." (buffer-substring (point) (progn (skip-chars-forward "a-z_") (point)))))) - (when (search-forward (concat "|" id "}") end 'move) + (when (search-forward (concat "|" id "}") end 'move) (put-text-property (1- (point)) (point) 'syntax-table (string-to-syntax "|"))))) (c (error "Unexpected char '%c' starting delimited string" c)))))) @@ -902,9 +902,9 @@ for the interactive mode." (let* ((id tuareg--id-re) (lid tuareg--lid-re) (uid tuareg--uid-re) - (attr-id1 "\\<[A-Za-z_][A-Za-z0-9_']*\\>") - (attr-id (concat attr-id1 "\\(?:\\." attr-id1 "\\)*")) - (maybe-infix-extension (concat "\\(?:%" attr-id "\\)?")); at most 1 + (attr-id1 "\\<[A-Za-z_][A-Za-z0-9_']*\\>") + (attr-id (concat attr-id1 "\\(?:\\." attr-id1 "\\)*")) + (maybe-infix-extension (concat "\\(?:%" attr-id "\\)?")); at most 1 ;; Matches braces balanced on max 3 levels. (balanced-braces (let ((b "\\(?:[^()]\\|(") @@ -927,15 +927,15 @@ for the interactive mode." "\\|~\\(?:[!$%&*+-./:<=>?@^|~]+" end-op "\\|[a-z][a-zA-Z0-9]*[: ]\\)" "\\|(" braces e))) - (balanced-brackets + (balanced-brackets (let ((b "\\(?:[^][]\\|\\[") (e "\\]\\)*")) (concat b b b "[^][]*" e e e))) - (maybe-infix-attribute - (concat "\\(?:\\[@" attr-id balanced-brackets "\\]\\)*")) - (maybe-infix-ext+attr - (concat maybe-infix-extension maybe-infix-attribute)) - ;; FIXME: module paths with functor applications + (maybe-infix-attribute + (concat "\\(?:\\[@" attr-id balanced-brackets "\\]\\)*")) + (maybe-infix-ext+attr + (concat maybe-infix-extension maybe-infix-attribute)) + ;; FIXME: module paths with functor applications (module-path (concat uid "\\(?:\\." uid "\\)*")) (typeconstr (concat "\\(?:" module-path "\\.\\)?" lid)) (extended-module-name @@ -962,8 +962,8 @@ for the interactive mode." (let-binding-g4 ; 4 groups (concat "\\_<\\(?:\\(let\\_>" binding-operator-char "?\\)" "\\(" maybe-infix-ext+attr - "\\)\\(?: +\\(" (if (tuareg-editing-ls3) let-ls3 "rec\\_>") - "\\)\\)?\\|\\(and\\_>" binding-operator-char "?\\)\\)")) + "\\)\\(?: +\\(" (if (tuareg-editing-ls3) let-ls3 "rec\\_>") + "\\)\\)?\\|\\(and\\_>" binding-operator-char "?\\)\\)")) ;; group for possible class param (gclass-gparams (concat "\\(\\_<class\\(?: +type\\)?\\(?: +virtual\\)?\\_>\\)" @@ -975,9 +975,9 @@ for the interactive mode." ;; cppo (,(concat "^ *#" (regexp-opt '("define" "undef" "if" "ifdef" "ifndef" - "else" "elif" "endif" "include" - "warning" "error" "ext" "endext") - 'symbols)) + "else" "elif" "endif" "include" + "warning" "error" "ext" "endext") + 'symbols)) . font-lock-preprocessor-face) ;; Directives ,@(if interactive-p @@ -1001,7 +1001,7 @@ for the interactive mode." (,(concat "[^;];\\(" maybe-infix-extension "\\)") 1 tuareg-font-lock-infix-extension-node-face) (,(concat "\\_<\\(function\\)\\_>\\(" maybe-infix-ext+attr "\\)" - tuareg--whitespace-re "\\(" lid "\\)?") + tuareg--whitespace-re "\\(" lid "\\)?") (1 font-lock-keyword-face) (2 tuareg-font-lock-infix-extension-node-face keep) (3 font-lock-variable-name-face nil t)) @@ -1027,18 +1027,18 @@ for the interactive mode." ;; First class modules. In these contexts, "val" and "module" ;; are not considered as "governing" (main structure of the code). (,(concat "( *\\(module\\) +\\(" module-path "\\) *\\(?:: *\\(" - balanced-braces-no-string "\\)\\)?)") + balanced-braces-no-string "\\)\\)?)") (1 font-lock-keyword-face) (2 tuareg-font-lock-module-face) (3 tuareg-font-lock-module-face keep t)) (,(concat "( *\\(val\\) +\\(" balanced-braces-no-end-operator "\\): +\\(" - balanced-braces-no-string "\\))") + balanced-braces-no-string "\\))") (1 font-lock-keyword-face) (2 tuareg-font-lock-module-face) (3 tuareg-font-lock-module-face)) (,(concat "\\_<\\(module\\)\\(" maybe-infix-ext+attr "\\)" - "\\(\\(?: +type\\)?\\(?: +rec\\)?\\)\\>\\(?: *\\(" + "\\(\\(?: +type\\)?\\(?: +rec\\)?\\)\\>\\(?: *\\(" uid "\\)\\)?") (1 tuareg-font-lock-governing-face) (2 tuareg-font-lock-infix-extension-node-face) @@ -1069,10 +1069,10 @@ for the interactive mode." (3 tuareg-font-lock-module-face keep t)) ;; "!", "mutable", "virtual" treated as governing keywords (,(concat "\\<\\(\\(?:val\\(" maybe-infix-ext+attr "\\)" - (if (tuareg-editing-ls3) "\\|reset\\|do") + (if (tuareg-editing-ls3) "\\|reset\\|do") "\\)!? +\\(?:mutable\\(?: +virtual\\)?\\_>" "\\|virtual\\(?: +mutable\\)?\\_>\\)" - "\\|val!\\(" maybe-infix-ext+attr "\\)\\)" + "\\|val!\\(" maybe-infix-ext+attr "\\)\\)" "\\(?: *\\(" lid "\\)\\)?") (2 tuareg-font-lock-infix-extension-node-face keep t) (3 tuareg-font-lock-infix-extension-node-face keep t) @@ -1080,7 +1080,7 @@ for the interactive mode." (4 font-lock-variable-name-face nil t)) ;; "val" without "!", "mutable" or "virtual" (,(concat "\\_<\\(val\\)\\_>\\(" maybe-infix-ext+attr "\\)" - "\\(?: +\\(" lid "\\)\\)?") + "\\(?: +\\(" lid "\\)\\)?") (1 tuareg-font-lock-governing-face keep) (2 tuareg-font-lock-infix-extension-node-face keep) (3 font-lock-function-name-face keep t)) @@ -1214,10 +1214,10 @@ for the interactive mode." (,(concat "`" id) . tuareg-font-lock-constructor-face) (,(regexp-opt '("failwith" "failwithf" "exit" "at_exit" "invalid_arg" "parser" "raise" "raise_notrace" "ref" "ignore" - "Match_failure" "Assert_failure" "Invalid_argument" - "Failure" "Not_found" "Out_of_memory" "Stack_overflow" - "Sys_error" "End_of_file" "Division_by_zero" - "Sys_blocked_io" "Undefined_recursive_module") + "Match_failure" "Assert_failure" "Invalid_argument" + "Failure" "Not_found" "Out_of_memory" "Stack_overflow" + "Sys_error" "End_of_file" "Division_by_zero" + "Sys_blocked_io" "Undefined_recursive_module") 'symbols) . font-lock-builtin-face) ("\\[[ \t]*\\]" . tuareg-font-lock-constructor-face) ; [] @@ -1576,7 +1576,7 @@ For use on `electric-indent-functions'." (insert (car inners))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; SMIE +;;; SMIE ;; TODO: ;; - Obey tuareg-*-indent customization variables. @@ -1799,12 +1799,12 @@ For use on `electric-indent-functions'." (setq tok (tuareg-smie--backward-token)) (if (not (zerop (length tok))) (not (member tok tokens)) - (unless (bobp) - (condition-case err - (progn (backward-sexp) t) - (scan-error - (setq tok (buffer-substring (nth 3 err) (1+ (nth 3 err)))) - nil)))))) + (unless (bobp) + (condition-case err + (progn (backward-sexp) t) + (scan-error + (setq tok (buffer-substring (nth 3 err) (1+ (nth 3 err)))) + nil)))))) tok)) (defun tuareg-smie--search-forward (tokens) @@ -1813,12 +1813,12 @@ For use on `electric-indent-functions'." (setq tok (tuareg-smie--forward-token)) (if (not (zerop (length tok))) (not (member tok tokens)) - (unless (eobp) - (condition-case err - (progn (forward-sexp) t) - (scan-error - (setq tok (buffer-substring (nth 2 err) (nth 3 err))) - nil)))))) + (unless (eobp) + (condition-case err + (progn (forward-sexp) t) + (scan-error + (setq tok (buffer-substring (nth 2 err) (nth 3 err))) + nil)))))) tok)) (defun tuareg-skip-blank-and-comments () @@ -2039,7 +2039,7 @@ Return values can be "val" "method" "=" ":=" "if" "then" "else" "->" ";" )) (nearest (tuareg-smie--search-backward telltale))) - (cond ;Issue #7 + (cond ;Issue #7 ((and (member nearest '("type" "module")) (member (tuareg-smie--backward-token) '("with" "and"))) "c=") (t ":="))))) @@ -2090,7 +2090,7 @@ Return values can be (while (progn (setq nearest (tuareg-smie--search-backward '("with" "|" "fun" "function" "functor" - "type" ":" "of"))) + "type" ":" "of"))) (and (equal nearest ":") (tuareg-smie--label-colon-p)))) (if (member nearest '("with" "|" "fun" "function" "functor")) @@ -2145,10 +2145,10 @@ Return values can be tok))) ((equal tok "exception") (let ((back-tok (save-excursion (tuareg-smie--backward-token)))) - (cond - ((member back-tok '("|" "with")) "exception-case") - ((equal back-tok "let") "exception-let") - (t tok)))) + (cond + ((member back-tok '("|" "with")) "exception-case") + ((equal back-tok "let") "exception-let") + (t tok)))) ((string-match-p "\\`[[:alpha:]_].*\\.\\'" tok) (forward-char (1- (length tok))) ".") (t tok)))) @@ -2249,9 +2249,9 @@ Return values can be (save-excursion (smie-backward-sexp 'halfsexp) (cons 'column (smie-indent-virtual)))))) - ((and tuareg-match-patterns-aligned - (equal token "|-or") (smie-rule-parent-p "|")) - (smie-rule-parent)) + ((and tuareg-match-patterns-aligned + (equal token "|-or") (smie-rule-parent-p "|")) + (smie-rule-parent)) ;; If we're looking at the first class-field-spec ;; in a "object(type)...end", don't rely on the default behavior which ;; will treat (type) as a previous element with which to align.