From 3865ad9cda55e2520d808badd4e65c7aaed01e3b Mon Sep 17 00:00:00 2001 From: Ravi R Kiran Date: Mon, 6 Mar 2017 19:03:26 -0800 Subject: Looking back requires two arguments diff --git a/lisp/ravi-init-cpp.el b/lisp/ravi-init-cpp.el index 3244ab9..200d942 100644 --- a/lisp/ravi-init-cpp.el +++ b/lisp/ravi-init-cpp.el @@ -368,7 +368,7 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (defun ravi/add-space-before-paren-c (&rest ignored) (message "Handler invoked") - (when (looking-back "\\b\\(for\\|while\\|if\\|switch\\)(") + (when (looking-back "\\b\\(for\\|while\\|if\\|switch\\)(" nil) (save-excursion (backward-char) (insert-char ?\s) @@ -378,25 +378,25 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (defadvice c-electric-paren (after ravi/add-space-around-parens activate) (unless (c-in-literal) (cond - ((looking-back "([[:space:]]*") + ((looking-back "([[:space:]]*" nil) (progn ;; Open parenthesis was the last command; add a space before it if ;; necessary, and ensure that the point is placed after a space (save-excursion (re-search-backward "([[:space:]]*") (unless (looking-at "(") (message "Logic error; opening paren not found")) - (when (looking-back "\\b\\(for\\|while\\|if\\|switch\\|catch\\)") + (when (looking-back "\\b\\(for\\|while\\|if\\|switch\\|catch\\)" nil) (insert-char ?\s))) (if (and (looking-at " ") (not (looking-at " )"))) (forward-char) (insert-char ?\s)) ) ) - ((looking-back ")[[:space:]]*") + ((looking-back ")[[:space:]]*" nil) ;; Closing parenthesis was the last command; add spaces if necessary (progn ;; Compact empty function calls - (when (looking-back "([[:space:]]+)[[:space:]]*") + (when (looking-back "([[:space:]]+)[[:space:]]*" nil) (save-excursion (re-search-backward ")[[:space:]]*") (delete-horizontal-space) @@ -404,11 +404,11 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named ) ;; Add space before closing parenthesis - (unless (looking-back "()[[:space:]]*") + (unless (looking-back "()[[:space:]]*" nil) (save-excursion (re-search-backward ")[[:space:]]*") (unless (looking-at ")") (message "Logic error; closing paren not found")) - (unless (looking-back " ") (insert-char ?\s))) + (unless (looking-back " " nil) (insert-char ?\s))) ) (let (need-to-add-newline) @@ -416,7 +416,7 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (c-backward-sexp) (c-backward-syntactic-ws) ;; FIXME: do-while loops are not handled correctly - (setq need-to-add-newline (looking-back "\\b\\(for\\|while\\|if\\|switch\\|catch\\)")) + (setq need-to-add-newline (looking-back "\\b\\(for\\|while\\|if\\|switch\\|catch\\)" nil)) ) (when need-to-add-newline (c-newline-and-indent))) ) @@ -426,9 +426,9 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (defadvice c-electric-semi&comma (after ravi/add-space-after-comma activate) (cond - ((looking-back ",") + ((looking-back "," nil) (if (looking-at " [^)]") (forward-char) (insert-char ?\s))) - ((looking-back ") ;[[:space:]\n]*") + ((looking-back ") ;[[:space:]\n]*" nil) (save-excursion (re-search-backward " ;[[:space:]\n]*") (delete-char 1))))) -- cgit v0.10.1