File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ Include path to the executable if it is not in your $PATH."
195195 (define-key map [(control c) (control v) (control h)] #'drupal-insert-hook )
196196 (define-key map [(control c) (control v) (control f)] #'drupal-insert-function )
197197 (define-key map [(control c) (control v) (control m)] #'drupal-module-name )
198+ (define-key map [(control c) (control v) (control t )] #'drupal-wrap-string-in-t-function )
198199 (define-key map [(control a)] #'drupal-mode-beginning-of-line )
199200 map)
200201 " Keymap for `drupal-mode' " )
@@ -421,6 +422,18 @@ buffer."
421422 (find-file-other-window dd)
422423 (auto-revert-tail-mode 1 )))))
423424
425+ (defun drupal-wrap-string-in-t-function ()
426+ " If point is inside a string wrap the string in the t() function."
427+ (interactive )
428+ (when (eq (get-text-property (point ) 'face ) 'font-lock-string-face )
429+ (save-excursion
430+ (atomic-change-group
431+ (search-backward-regexp " \\ (\" \\ |'\\ )" )
432+ (insert " t(" )
433+ (forward-char )
434+ (search-forward-regexp " \\ (\" \\ |'\\ )" )
435+ (insert " )" )))))
436+
424437
425438
426439(defvar drupal-form-id-history nil
You can’t perform that action at this time.
0 commit comments