[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/drupal-mode 7d29d72a62 155/308: Added function to wrap str
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/drupal-mode 7d29d72a62 155/308: Added function to wrap string in t(). |
Date: |
Tue, 25 Jan 2022 10:59:41 -0500 (EST) |
branch: elpa/drupal-mode
commit 7d29d72a620727415215261fe5c3fd0a6831ff3b
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>
Added function to wrap string in t().
Bound to `C-c C-v C-t`.
Fixes #15.
---
drupal-mode.el | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drupal-mode.el b/drupal-mode.el
index c08a2108ce..b783da3424 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -195,6 +195,7 @@ Include path to the executable if it is not in your $PATH."
(define-key map [(control c) (control v) (control h)] #'drupal-insert-hook)
(define-key map [(control c) (control v) (control f)]
#'drupal-insert-function)
(define-key map [(control c) (control v) (control m)] #'drupal-module-name)
+ (define-key map [(control c) (control v) (control t)]
#'drupal-wrap-string-in-t-function)
(define-key map [(control a)] #'drupal-mode-beginning-of-line)
map)
"Keymap for `drupal-mode'")
@@ -421,6 +422,18 @@ buffer."
(find-file-other-window dd)
(auto-revert-tail-mode 1)))))
+(defun drupal-wrap-string-in-t-function ()
+ "If point is inside a string wrap the string in the t() function."
+ (interactive)
+ (when (eq (get-text-property (point) 'face) 'font-lock-string-face)
+ (save-excursion
+ (atomic-change-group
+ (search-backward-regexp "\\(\"\\|'\\)")
+ (insert "t(")
+ (forward-char)
+ (search-forward-regexp "\\(\"\\|'\\)")
+ (insert ")")))))
+
(defvar drupal-form-id-history nil
- [nongnu] elpa/drupal-mode 7682fe81f5 079/308: Fixed argument tip when no window-system., (continued)
- [nongnu] elpa/drupal-mode 7682fe81f5 079/308: Fixed argument tip when no window-system., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode cb918eb5f1 076/308: Defined defvars earlier in file to avoid using free variables., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 194db27ee9 091/308: Added skeleton position at end of skeleton., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 929af1cefc 097/308: Autoload `drupal-search-url' as safe-local-variable., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 9ea0f27c0e 098/308: Made `drupal-module-name' insert module name when called interactively., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 6c76c15e7c 100/308: Added auto-insert skeleton for .install files., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode fe8717b47c 106/308: Added `css-indent-offset'., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode bd83268c5d 131/308: Add custom checker for checking CSS/JS files with phpcs., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 889fc24427 145/308: Use setq., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 2517b39f42 154/308: Added a simple `drupal-tail-drupal-debug-txt` function., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 7d29d72a62 155/308: Added function to wrap string in t().,
ELPA Syncer <=
- [nongnu] elpa/drupal-mode a08207b0c9 161/308: Merge branch 'release/0.3.1', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 8f5a7568b0 159/308: Fixed `drupal-search-documentation` for PHP keywords., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 72ceba6089 174/308: Merge pull request #39 from xendk/develop, ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 46ad71de46 170/308: Used `default-directory` as fallback if `buffer-file-name` us not set., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode f1985b5ca5 181/308: Merge branch 'release/0.4.0', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 230e579786 185/308: Removed flymake-phpcs from `drush-make-mode' files., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 03b7e28b8d 192/308: Fixed bad indentation., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode 1a73416e78 190/308: Fixed flymake when real file is in a symlinked dir., ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode da97264d7e 195/308: Merge branch 'release/0.4.1', ELPA Syncer, 2022/01/25
- [nongnu] elpa/drupal-mode bef3447608 198/308: Add menu items for function & hook templates, ELPA Syncer, 2022/01/25