[elpa] externals/phps-mode a6b7363: Improved token-blind indentation around echo and print statements
branch: externals/phps-mode commit a6b7363492b982d1163b29323779b5dcfc663395 Author: Christian Johansson Commit: Christian Johansson Improved token-blind indentation around echo and print statements --- phps-mode-lex-analyzer.el | 36 phps-mode.el| 4 ++-- test/phps-mode-test-lex-analyzer.el | 20 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el index 231a167..4497595 100644 --- a/phps-mode-lex-analyzer.el +++ b/phps-mode-lex-analyzer.el @@ -766,7 +766,7 @@ "Moved imenu from START by DIFF points." (when phps-mode-lex-analyzer--imenu (setq phps-mode-lex-analyzer--imenu -(phps-mode-lex-analyzer--get-moved-imenu phps-mode-lex-analyzer--imenu start diff)) + (phps-mode-lex-analyzer--get-moved-imenu phps-mode-lex-analyzer--imenu start diff)) (phps-mode-lex-analyzer--reset-imenu))) (defun phps-mode-lex-analyzer--move-lines-indent (start-line-number diff) @@ -2087,39 +2087,51 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (when line-starts-with-opening-doc-comment (setq new-indentation (+ new-indentation 1))) - (when line-ends-with-assignment + (when (and + line-ends-with-assignment + (<= bracket-level 0)) (setq new-indentation (+ new-indentation tab-width))) - (when (and line-ends-with-opening-bracket - (< bracket-level 0)) + (when (and + line-ends-with-opening-bracket + (< bracket-level 0)) (setq new-indentation (+ new-indentation tab-width))) (when line-ends-with-terminus ;; Back-trace buffer from previous line -;; Determine if semi-colon ended an assignment or not +;; Determine if semi-colon ended an assignment or bracket-less command or not (forward-line (* -1 move-length)) (end-of-line) (forward-char -1) (let ((not-found t) (is-assignment nil) - (parenthesis-level 0)) + (parenthesis-level 0) + (is-bracket-less-command nil)) (while (and not-found - (search-backward-regexp "\\(;\\|{\\|(\\|)\\|=\\)" nil t)) + (search-backward-regexp "\\(;\\|{\\|(\\|)\\|=\\|echo[\t ]+\\|print[\t ]+\\)" nil t)) (let ((match (buffer-substring-no-properties (match-beginning 0) (match-end 0 (when (string= match ")") (setq parenthesis-level (1- parenthesis-level))) (when (= parenthesis-level 0) (setq is-assignment (string= match "=")) +(setq is-bracket-less-command + (string-match-p + "\\(echo[\t ]+\\|print[\t ]+\\)" + match)) (setq not-found nil)) (when (string= match "(") (setq parenthesis-level (1+ parenthesis-level) ;; If it ended an assignment on a previous line, decrease indentation - (when (and is-assignment - (> bracket-level -1) - (not - (= line-number (line-number-at-pos + (when + (and + (or +(and + is-assignment + (> bracket-level -1)) +is-bracket-less-command) + (not (= line-number (line-number-at-pos ;; NOTE stuff like $var = array(\n4\n);\n ;; will end assignment but also decrease bracket-level (setq new-indentation (- new-indentation tab-width @@ -2175,7 +2187,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL." (string-match-p "^[\t ]*\\([\]})[]\\|\\)" string)) (defun phps-mode-lex-analyzer--string-starts-with-opening-doc-comment-p (string) - "Get bracket count for STRING." + "Does string start with opening doc comment?" (string-match-p "^[\t ]*/\\*\\*" string)) (defun phps-mode-lex-analyzer--string-ends-with-opening-bracket-p (string) diff --git a/phps-mode.el b/phps-mode.el index 7af158c..7e1c941 100644 --- a/phps-mode.el +++ b/phps-mode.el @@ -5,8 +
[elpa] externals/prefixed-core bfd8097: * prefixed-core.el: Add `keymap` functions
branch: externals/prefixed-core commit bfd809767acd4ce696a1b30b08657fa543d2b919 Author: Clemens Commit: Stefan Monnier * prefixed-core.el: Add `keymap` functions --- prefixed-core.el | 22 ++ 1 file changed, 22 insertions(+) diff --git a/prefixed-core.el b/prefixed-core.el index f58349f..edf236e 100644 --- a/prefixed-core.el +++ b/prefixed-core.el @@ -215,5 +215,27 @@ (defalias 'process-start-shell-command #'start-process-shell-command) (defalias 'process-stop #'stop-process) + Keymaps +(defalias 'keymap-make-composed #'make-composed-keymap) +(defalias 'keymap-map-sorted #'map-keymap-sorted) +(defalias 'keymap-copy #'copy-keymap) +(defalias 'keymap-make #'make-keymap) +(defalias 'keymap-make-sparse #'make-sparse-keymap) +(defalias 'keymap-suppress #'suppress-keymap) +(defalias 'keymap-map #'map-keymap) +(defalias 'keymap--map #'map-keymap-internal) +(defalias 'keymap--pop #'internal-pop-keymap) +(defalias 'keymap--push #'internal-push-keymap) +(defalias 'keymap-set-parent #'set-keymap-parent) +(defalias 'keymap-set-transient #'set-transient-map) +(defalias 'keymap-set-temporary-overlay #'set-temporary-overlay-map) +(defalias 'keymap-current-global-map #'current-global-map) +(defalias 'keymap-current-local-map #'current-local-map) +(defalias 'keymap-current-minor-mode-maps #'current-minor-mode-maps) +(defalias 'keymap-current-active-maps #'current-active-maps) +(defalias 'keymap-use-local-map #'use-local-map) +(defalias 'keymap-use-global-map #'use-global-map) +(defalias 'keymap-accessible #'accessible-keymaps) + (provide 'prefixed-core) ;;; prefixed-core.el ends here
[elpa] externals/prefixed-core 7c59349: * prefixed-core.el: Tweak keymap functions
branch: externals/prefixed-core commit 7c59349842977adf3064af2e22488959d13b86cc Author: Stefan Monnier Commit: Stefan Monnier * prefixed-core.el: Tweak keymap functions (keymap-make-dense): Rename from `keymap-make`. (keymap-make): Rename from `keymap-make-sparse`. (keymap-set-temporary-overlay): Remove, it's obsolete anyway. --- prefixed-core.el | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/prefixed-core.el b/prefixed-core.el index edf236e..b83cf33 100644 --- a/prefixed-core.el +++ b/prefixed-core.el @@ -216,26 +216,27 @@ (defalias 'process-stop #'stop-process) Keymaps +(defalias 'keymap-make #'make-sparse-keymap) (defalias 'keymap-make-composed #'make-composed-keymap) -(defalias 'keymap-map-sorted #'map-keymap-sorted) +(defalias 'keymap-make-dense #'make-keymap) (defalias 'keymap-copy #'copy-keymap) -(defalias 'keymap-make #'make-keymap) -(defalias 'keymap-make-sparse #'make-sparse-keymap) (defalias 'keymap-suppress #'suppress-keymap) (defalias 'keymap-map #'map-keymap) +(defalias 'keymap-map-sorted #'map-keymap-sorted) (defalias 'keymap--map #'map-keymap-internal) (defalias 'keymap--pop #'internal-pop-keymap) (defalias 'keymap--push #'internal-push-keymap) (defalias 'keymap-set-parent #'set-keymap-parent) +;; FIXME: Not sure if `set-transient-map' belongs in `keymap'! (defalias 'keymap-set-transient #'set-transient-map) -(defalias 'keymap-set-temporary-overlay #'set-temporary-overlay-map) +(defalias 'keymap-accessible #'accessible-keymaps) ;FIXME: badname +;; FIXME: The ones below get "too long"? (defalias 'keymap-current-global-map #'current-global-map) (defalias 'keymap-current-local-map #'current-local-map) (defalias 'keymap-current-minor-mode-maps #'current-minor-mode-maps) (defalias 'keymap-current-active-maps #'current-active-maps) -(defalias 'keymap-use-local-map #'use-local-map) -(defalias 'keymap-use-global-map #'use-global-map) -(defalias 'keymap-accessible #'accessible-keymaps) +(defalias 'keymap-use-local-map #'use-local-map) ;FIXME: setf +(defalias 'keymap-use-global-map #'use-global-map) ;FIXME: setf (provide 'prefixed-core) ;;; prefixed-core.el ends here