branch: externals/csharp-mode commit ee9125d87374203cd9af480964419ea55122a41c Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Fix looking-back warnings. Based on feedback in this exchange with cc-mode maintainer: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23053 This closes https://github.com/josteink/csharp-mode/issues/48 --- csharp-mode.el | 66 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/csharp-mode.el b/csharp-mode.el index ed181e7..84eacb1 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -446,7 +446,7 @@ to work properly with code that includes attributes. ((and (looking-back (concat "\\<new[ \t\n\f\v\r]+" "\\(?:[A-Za-z_][[:alnum:]]*\\.\\)*" - "[A-Za-z_][[:alnum:]]*[\ t\n\f\v\r]*")) + "[A-Za-z_][[:alnum:]]*[\ t\n\f\v\r]*") nil) (looking-at "[ \t\n\f\v\r]*{")) t) @@ -1727,9 +1727,9 @@ This is a helper fn for `csharp-move-back-to-beginning-of-defun' and (if need-to-backup (setq found (csharp-move-back-to-beginning-of-block))) (if found - (setq done (and (looking-back must-match) + (setq done (and (looking-back must-match nil) (or (not must-not-match) - (not (looking-back must-not-match)))) + (not (looking-back must-not-match nil)))) need-to-backup t) (setq done t))) found)) @@ -1755,8 +1755,8 @@ See also, `csharp-move-fwd-to-end-of-defun'. ;; if the user is asking to move back, then obviously ;; he wants to move back to a *prior* defun. (if (and (looking-at "{") - (looking-back (csharp--regexp 'func-start)) - (not (looking-back (csharp--regexp 'namespace-start)))) + (looking-back (csharp--regexp 'func-start) nil) + (not (looking-back (csharp--regexp 'namespace-start) nil))) (forward-char -1)) ;; now do the real work @@ -1773,9 +1773,9 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (not (looking-back (csharp--regexp 'class-start))) - (not (looking-back (csharp--regexp 'namespace-start))) - (looking-back (csharp--regexp 'func-start)))))) + (not (looking-back (csharp--regexp 'class-start) nil)) + (not (looking-back (csharp--regexp 'namespace-start) nil)) + (looking-back (csharp--regexp 'func-start) nil))))) (defun csharp--on-ctor-close-curly-p () "return t when point is on the close-curly of a constructor." @@ -1783,7 +1783,7 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (looking-back (csharp--regexp 'ctor-start)))))) + (looking-back (csharp--regexp 'ctor-start) nil))))) (defun csharp--on-class-close-curly-p () "return t when point is on the close-curly of a class or struct." @@ -1791,8 +1791,8 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (not (looking-back (csharp--regexp 'namespace-start))) - (looking-back (csharp--regexp 'class-start)))))) + (not (looking-back (csharp--regexp 'namespace-start) nil)) + (looking-back (csharp--regexp 'class-start) nil))))) (defun csharp--on-intf-close-curly-p () "return t when point is on the close-curly of an interface." @@ -1800,7 +1800,7 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (looking-back (csharp--regexp 'intf-start)))))) + (looking-back (csharp--regexp 'intf-start) nil))))) (defun csharp--on-enum-close-curly-p () "return t when point is on the close-curly of an enum." @@ -1808,7 +1808,7 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (looking-back (csharp--regexp 'enum-start)))))) + (looking-back (csharp--regexp 'enum-start) nil))))) (defun csharp--on-namespace-close-curly-p () "return t when point is on the close-curly of a namespace." @@ -1816,56 +1816,56 @@ See also, `csharp-move-fwd-to-end-of-defun'. (save-excursion (and (progn (forward-char) (forward-sexp -1) t) - (looking-back (csharp--regexp 'namespace-start)))))) + (looking-back (csharp--regexp 'namespace-start) nil))))) (defun csharp--on-defun-open-curly-p () "return t when point is on the open-curly of a method." (and (looking-at "{") - (not (looking-back (csharp--regexp 'class-start))) - (not (looking-back (csharp--regexp 'namespace-start))) - (looking-back (csharp--regexp 'func-start)))) + (not (looking-back (csharp--regexp 'class-start) nil)) + (not (looking-back (csharp--regexp 'namespace-start) nil)) + (looking-back (csharp--regexp 'func-start) nil))) (defun csharp--on-class-open-curly-p () "return t when point is on the open-curly of a class." (and (looking-at "{") - (not (looking-back (csharp--regexp 'namespace-start))) - (looking-back (csharp--regexp 'class-start)))) + (not (looking-back (csharp--regexp 'namespace-start) nil)) + (looking-back (csharp--regexp 'class-start) nil))) (defun csharp--on-genclass-open-curly-p () "return t when point is on the open-curly of a generic class." (and (looking-at "{") - (looking-back (csharp--regexp 'genclass-start)))) + (looking-back (csharp--regexp 'genclass-start) nil))) (defun csharp--on-namespace-open-curly-p () "return t when point is on the open-curly of a namespace." (and (looking-at "{") - (looking-back (csharp--regexp 'namespace-start)))) + (looking-back (csharp--regexp 'namespace-start) nil))) (defun csharp--on-ctor-open-curly-p () "return t when point is on the open-curly of a ctor." (and (looking-at "{") - (looking-back (csharp--regexp 'ctor-start)))) + (looking-back (csharp--regexp 'ctor-start) nil))) (defun csharp--on-intf-open-curly-p () "return t when point is on the open-curly of a interface." (and (looking-at "{") - (looking-back (csharp--regexp 'intf-start)))) + (looking-back (csharp--regexp 'intf-start) nil))) (defun csharp--on-prop-open-curly-p () "return t when point is on the open-curly of a property." (and (looking-at "{") - (not (looking-back (csharp--regexp 'class-start))) - (looking-back (csharp--regexp 'prop-start)))) + (not (looking-back (csharp--regexp 'class-start) nil)) + (looking-back (csharp--regexp 'prop-start) nil))) (defun csharp--on-indexer-open-curly-p () "return t when point is on the open-curly of a C# indexer." (and (looking-at "{") - (looking-back (csharp--regexp 'indexer-start)))) + (looking-back (csharp--regexp 'indexer-start) nil))) (defun csharp--on-enum-open-curly-p () "return t when point is on the open-curly of a interface." (and (looking-at "{") - (looking-back (csharp--regexp 'enum-start)))) + (looking-back (csharp--regexp 'enum-start) nil))) @@ -1915,7 +1915,7 @@ See also, `csharp-move-back-to-beginning-of-defun'. ;; case 4: we're at the bottom of a fn now (possibly ;; after just calling csharp-move-fwd-to-end-of-defun. - ((and (looking-back "}") + ((and (looking-back "}" nil) (save-excursion (forward-sexp -1) (csharp--on-defun-open-curly-p))) @@ -1955,8 +1955,8 @@ See also, `csharp-move-fwd-to-end-of-defun'. ;; if the user is asking to move back, then obviously ;; he wants to move back to a *prior* defun. (if (and (looking-at "{") - (looking-back (csharp--regexp 'class-start)) - (not (looking-back (csharp--regexp 'namespace-start)))) + (looking-back (csharp--regexp 'class-start) nil) + (not (looking-back (csharp--regexp 'namespace-start) nil))) (forward-char -1)) ;; now do the real work @@ -2007,7 +2007,7 @@ to the beginning of the prior namespace. ;; if the user is asking to move back, then obviously ;; he wants to move back to a *prior* defun. (if (and (looking-at "{") - (looking-back (csharp--regexp 'namespace-start))) + (looking-back (csharp--regexp 'namespace-start) nil)) (forward-char -1)) ;; now do the real work @@ -2428,11 +2428,11 @@ more open-curlies are found. (cond ;; case 1: open curly for an array initializer - ((looking-back "\\[\\][ \t\n\r]*") + ((looking-back "\\[\\][ \t\n\r]*" nil) (forward-sexp 1)) ;; case 2: just jumped over a string - ((looking-back "\"") + ((looking-back "\"" nil) (forward-char 1)) ;; case 3: at the head of a block of using statements