[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 6d834c1 312/405: Added support for (comment-r
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 6d834c1 312/405: Added support for (comment-region) and (uncomment-region) |
Date: |
Sat, 13 Jul 2019 10:00:39 -0400 (EDT) |
branch: externals/phps-mode
commit 6d834c1cd6809377a5691519ec95e3257ee765f5
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added support for (comment-region) and (uncomment-region)
---
phps-mode-functions.el | 7 +++++++
phps-mode-test-functions.el | 31 ++++++++++++++++++++++++++++++-
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 3f0fb68..ba1ab50 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -807,6 +807,13 @@
(set (make-local-variable 'phps-mode-functions-imenu) nil)
(set (make-local-variable 'phps-mode-functions-processed-buffer) nil)
+ ;; Make (comment-region) work
+ (set (make-local-variable 'comment-start) "/* ")
+ (set (make-local-variable 'comment-end) " */")
+
+ ;; TODO Make (uncomment-region) work
+ ;; TODO Make selecting region and clicking ' wrap region in single quotes
+
;; Support for change detection
(add-hook 'after-change-functions #'phps-mode-functions-after-change))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 0cca066..7388a45 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -777,6 +777,33 @@
)
+(defun phps-mode-test-functions-quote-region ()
+ "Test double quotes, single quotes, curly bracket, square bracket, round
bracket, back-quotes on regions."
+
+
+ ;; TODO Implement this
+
+ )
+
+(defun phps-mode-test-functions-comment-uncomment-region ()
+ "Test (comment-region) and (uncomment-region)."
+
+ (phps-mode-test-with-buffer
+ "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements
myInterface {\n public function myFunctionA($myArg = null) {}\n protected
function myFunctionB($myArg = 'abc') {}\n}\n"
+ "Comment object-oriented file with bracket-less namespace, class that
extends and implements and functions with optional arguments"
+ (comment-region (point-min) (point-max))
+ (let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
+ (should (equal buffer-contents "/* <?php */\n/* namespace myNamespace;
*/\n/* class myClass extends myAbstract implements myInterface { */\n/*
public function myFunctionA($myArg = null) {} */\n/* protected function
myFunctionB($myArg = 'abc') {} */\n/* } */\n"))))
+
+ (phps-mode-test-with-buffer
+ "/* <?php */\n/* namespace myNamespace; */\n/* class myClass extends
myAbstract implements myInterface { */\n/* public function
myFunctionA($myArg = null) {} */\n/* protected function myFunctionB($myArg
= 'abc') {} */\n/* } */\n"
+ "Uncomment object-oriented file with bracket-less namespace, class that
extends and implements and functions with optional arguments"
+ (uncomment-region (point-min) (point-max))
+ (let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
+ (should (equal buffer-contents "<?php\nnamespace myNamespace;\nclass
myClass extends myAbstract implements myInterface {\n public function
myFunctionA($myArg = null) {}\n protected function myFunctionB($myArg =
'abc') {}\n}\n"))))
+
+ )
+
(defun phps-mode-test-functions ()
"Run test for functions."
;; (setq debug-on-error t)
@@ -790,7 +817,9 @@
(phps-mode-test-functions-get-lines-indent)
(phps-mode-test-functions-get-lines-indent-psr-2)
(phps-mode-test-functions-indent-line)
- (phps-mode-test-functions-imenu))
+ (phps-mode-test-functions-imenu)
+ (phps-mode-test-functions-comment-uncomment-region)
+ (phps-mode-test-functions-quote-region))
(phps-mode-test-functions)
- [elpa] externals/phps-mode f3766db 310/405: Fixed byte-compilation in lexer and integration-tests, (continued)
- [elpa] externals/phps-mode f3766db 310/405: Fixed byte-compilation in lexer and integration-tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2ec6f6d 306/405: Fixed some compilation warnings, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f2fe751 302/405: More work on trying to get PSR-2 indentation working, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8eb3dc0 311/405: Fixed byte-compilation issue in lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f77edf8 308/405: Updated compile command to ignore that files that doesn't compile, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5d5ec06 313/405: Started on test for automatic quotations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e755e1 303/405: Fixed indentation for argument assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a852669 320/405: Fix bug in syntax colouring, added debug outputs for incremental lexer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad94b0b 319/405: Removed some fixed TODO itemsc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2427c7e 318/405: Improved README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6d834c1 312/405: Added support for (comment-region) and (uncomment-region),
Stefan Monnier <=
- [elpa] externals/phps-mode b1d2820 309/405: Fixed issue with indentation of square bracket arrays in assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3bc2411 317/405: Moved syntax-table tests to own file, using local electric-pair-mode in PHPs buffers, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2b8a16 335/405: Passes new test for concatenated string inside function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b4e416a 336/405: (comment-region) tests working with custom function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ad53b6c 330/405: Fixed warning when expected integer was nil, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c8c5b62 337/405: Made custom functions for (comment-region) and (uncomment-region), Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e22fdb 323/405: Added failing incremental indentation test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a45b39a 339/405: Added two failing indentation tests for concatenated equal assignment and double arrow multi-line array declaration, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3e1ff06 332/405: Added integration-tests for syntax colouring and update goals, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ced201d 322/405: Updated syntax colouring for namespace, class, function and constant names, Stefan Monnier, 2019/07/13