From c971227873d822def8c2b0db7980ebf7234bd8f6 Mon Sep 17 00:00:00 2001 From: storvik Date: Thu, 1 Feb 2024 17:36:16 +0100 Subject: [PATCH 1/3] Add flutter-args --- README.md | 12 ++++++++++++ flutter.el | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b0c5d9..e525a2c 100644 --- a/README.md +++ b/README.md @@ -98,5 +98,17 @@ put the Flutter SDK in `/Applications/flutter`: (flutter-sdk-path "/Applications/flutter/")) ``` +## .dir-locals.el + +`flutter-args` is used to set default CLI flags passed to `flutter`. +This variable can be set per project using a `.dir-locals.el` file in project root. +The following `.dir-locals.el` sets `flutter-args` to build linux executable and +enables hot reloading on file save using `after-save-hook`. + +``` elisp +((dart-mode . ((flutter-args . "-d linux") + (eval . (add-hook 'after-save-hook 'flutter-run-or-hot-reload nil t))))) +``` + # License GPL-3 diff --git a/flutter.el b/flutter.el index 684e50b..f03ffb8 100644 --- a/flutter.el +++ b/flutter.el @@ -38,6 +38,9 @@ (defvar flutter-sdk-path nil "Path to Flutter SDK.") +(defvar flutter-args nil + "Space-delimited string of CLI flags passed to `flutter`.") + ;;; Key bindings @@ -259,7 +262,9 @@ args." (list (when current-prefix-arg (read-string "Args: ")))) (flutter--with-run-proc - args + (if flutter-args + flutter-args + args) (display-buffer buffer))) (defun flutter--devices () From 317671f9458674983f85241701c94859aa187ba0 Mon Sep 17 00:00:00 2001 From: storvik Date: Thu, 1 Feb 2024 17:55:14 +0100 Subject: [PATCH 2/3] Make flutter-run prefer local args if set This commit makes it possible to run `flutter-run` with `C-u` to specify args, even if `flutter-args` is set. --- flutter.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter.el b/flutter.el index f03ffb8..e51f1e5 100644 --- a/flutter.el +++ b/flutter.el @@ -262,9 +262,9 @@ args." (list (when current-prefix-arg (read-string "Args: ")))) (flutter--with-run-proc - (if flutter-args - flutter-args - args) + (if args + args + flutter-args) (display-buffer buffer))) (defun flutter--devices () From efa8deeff26e18f5bf1b49850db7ad5196c82699 Mon Sep 17 00:00:00 2001 From: storvik Date: Fri, 2 Feb 2024 13:14:03 +0100 Subject: [PATCH 3/3] Change flutter-args to flutter-run-args --- README.md | 12 ------------ flutter.el | 8 +++----- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index e525a2c..8b0c5d9 100644 --- a/README.md +++ b/README.md @@ -98,17 +98,5 @@ put the Flutter SDK in `/Applications/flutter`: (flutter-sdk-path "/Applications/flutter/")) ``` -## .dir-locals.el - -`flutter-args` is used to set default CLI flags passed to `flutter`. -This variable can be set per project using a `.dir-locals.el` file in project root. -The following `.dir-locals.el` sets `flutter-args` to build linux executable and -enables hot reloading on file save using `after-save-hook`. - -``` elisp -((dart-mode . ((flutter-args . "-d linux") - (eval . (add-hook 'after-save-hook 'flutter-run-or-hot-reload nil t))))) -``` - # License GPL-3 diff --git a/flutter.el b/flutter.el index e51f1e5..928cbdf 100644 --- a/flutter.el +++ b/flutter.el @@ -38,8 +38,8 @@ (defvar flutter-sdk-path nil "Path to Flutter SDK.") -(defvar flutter-args nil - "Space-delimited string of CLI flags passed to `flutter`.") +(defvar flutter-run-args nil + "Space-delimited string of CLI flags passed to `flutter-run'.") ;;; Key bindings @@ -262,9 +262,7 @@ args." (list (when current-prefix-arg (read-string "Args: ")))) (flutter--with-run-proc - (if args - args - flutter-args) + (or args flutter-run-args) (display-buffer buffer))) (defun flutter--devices ()