~abcdw/rde-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 2

[PATCH] rde: Add emacs-dmenu command.

Details
Message ID
<20230319120534.28031-1-ngraves@ngraves.fr>
DKIM signature
missing
Download raw message
Patch: +34 -2
---
 src/rde/features/emacs.scm | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
index baa01ca..88465e0 100644
--- a/src/rde/features/emacs.scm
+++ b/src/rde/features/emacs.scm
@@ -327,6 +327,37 @@ environment outside of Guix Home."
                           "--no-splash"
                           (cdr (command-line)))))

  ;; Emacs and emacsclient don't handle stdin properly, in the case they
  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
  (define emacs-dmenu
    (program-file
     "emacs-dmenu"
     #~(begin
         (use-modules
          (ice-9 textual-ports)
          (ice-9 popen))
         (let* ((raw-input
                 (string-drop-right (get-string-all (current-input-port)) 1))
                (port (open-input-pipe
                       (string-append
                        #$emacs-client-create-frame
                        " --eval \""
                        "(progn \
(set-frame-name \\\"dynamic-menu - Emacs Client\\\") \
(let ((vertico-count 10)) \
        (completing-read \\\"Select: \\\" \
                         (split-string \\\"" raw-input "\\\" \
                                       \\\"\n\\\"))))\""
                         " --eval \"(delete-frame (selected-frame))\""
                         " -F "
                         "\"((minibuffer . only) \
                                 (width . 120) \
                                 (height . 11))\"")))
           (selected
            (string-drop (string-drop-right (get-string-all port) 2) 1)))
         (close-port port)
         (format #t "~a\n" selected)))))

  (define emacs-application-launcher
    (emacs-minibuffer-program
     emacs-client-create-frame "application-launcher" "Application Launcher"
@@ -573,7 +604,8 @@ It can contain settings not yet moved to separate features."
       (simple-service 'emacs-set-default-editor
                       home-environment-variables-service-type
                       `(("ALTERNATE_EDITOR" . ,emacs-editor)
                         ("VISUAL" . ,emacs-client-no-wait)))
                         ("VISUAL" . ,emacs-client-no-wait)
                         ("MENU" . ,emacs-dmenu)))
       (when (get-value 'sway config)
         (simple-service
          'emacs-update-environment-variables-on-sway-start
@@ -594,7 +626,7 @@ It can contain settings not yet moved to separate features."
            (make-feature-values
             standalone-minibuffer-height
             emacs
             emacs-editor emacs-client
             emacs-editor emacs-client emacs-dmenu
             emacs-client-create-frame
             emacs-client-no-wait
             emacs-configure-rde-keymaps
-- 
2.39.2

[PATCH v2] rde: Add emacs-dmenu command.

Details
Message ID
<20230721144303.6102-1-ngraves@ngraves.fr>
In-Reply-To
<20230319120534.28031-1-ngraves@ngraves.fr> (view parent)
DKIM signature
missing
Download raw message
Patch: +34 -2
---
 src/rde/features/emacs.scm | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
index b893fb51..98bd132b 100644
--- a/src/rde/features/emacs.scm
+++ b/src/rde/features/emacs.scm
@@ -482,6 +482,37 @@ It can contain settings not yet moved to separate features."
                           "--no-splash"
                           (cdr (command-line)))))

  ;; Emacs and emacsclient don't handle stdin properly, in the case they
  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
  (define emacs-dmenu
    (program-file
     "emacs-dmenu"
     #~(begin
         (use-modules
          (ice-9 textual-ports)
          (ice-9 popen))
         (let* ((raw-input
                 (string-drop-right (get-string-all (current-input-port)) 1))
                (port (open-input-pipe
                       (string-append
                        #$emacs-client-create-frame
                        " --eval \""
                        "(progn \
(set-frame-name \\\"dynamic-menu - Emacs Client\\\") \
(let ((vertico-count 10)) \
        (completing-read \\\"Select: \\\" \
                         (split-string \\\"" raw-input "\\\" \
                                       \\\"\n\\\"))))\""
                         " --eval \"(delete-frame (selected-frame))\""
                         " -F "
                         "\"((minibuffer . only) \
                                 (width . 120) \
                                 (height . 11))\"")))
           (selected
            (string-drop (string-drop-right (get-string-all port) 2) 1)))
         (close-port port)
         (format #t "~a\n" selected)))))

  (define emacs-application-launcher
    (emacs-minibuffer-program
     emacs-client-create-frame "application-launcher" "Application Launcher"
@@ -536,7 +567,8 @@ It can contain settings not yet moved to separate features."
     (simple-service 'emacs-set-default-editor
                     home-environment-variables-service-type
                     `(("ALTERNATE_EDITOR" . ,emacs-editor)
                       ("VISUAL" . ,emacs-client-no-wait)))
                       ("VISUAL" . ,emacs-client-no-wait)
                       ("MENU" . ,emacs-dmenu)))
     (when (get-value 'sway config)
       (simple-service
        'emacs-update-environment-variables-on-sway-start
@@ -557,7 +589,7 @@ It can contain settings not yet moved to separate features."
            (make-feature-values
             standalone-minibuffer-height
             emacs
             emacs-editor emacs-client
             emacs-editor emacs-client emacs-dmenu
             emacs-client-create-frame
             emacs-client-no-wait
             emacs-configure-rde-keymaps
-- 
2.41.0
Details
Message ID
<20230806085508.13140-1-ngraves@ngraves.fr>
In-Reply-To
<20230721144303.6102-1-ngraves@ngraves.fr> (view parent)
DKIM signature
missing
Download raw message
Patch: +35 -2
---
 src/rde/features/emacs.scm | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
index b5cfe30e..95280370 100644
--- a/src/rde/features/emacs.scm
+++ b/src/rde/features/emacs.scm
@@ -481,6 +481,38 @@ It can contain settings not yet moved to separate features."
                           "--no-splash"
                           (cdr (command-line)))))

  ;; Emacs and emacsclient don't handle stdin properly, in the case they
  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
  (define emacs-dmenu
    (program-file
     "emacs-dmenu"
     #~(begin
         (use-modules
          (ice-9 textual-ports)
          (ice-9 popen))
         (let* ((raw-input
                 (string-drop-right (get-string-all (current-input-port)) 1))
                (port (open-input-pipe
                       (format #f
                               "~a --eval \" \
(let* ((vertico-count 10) \
       (after-make-frame-functions '()) \
       (minibuffer-frame (make-frame `((display . ,(getenv \"WAYLAND_DISPLAY\")) \
                                       (name . \"dynamic menu - Emacs Client\") \
                                       (minibuffer . only) \
                                       (width . 120) \
                                       (height . 11))))) \
    (unwind-protect \
       (with-selected-frame minibuffer-frame \
         (completing-read \\\"Select: \\\" \
                         (split-string \\\"~a\\\" \\\"\n\\\"))) \
     (delete-frame minibuffer-frame)))\""
                               #$emacs-client raw-input)))
           (selected
            (string-drop (string-drop-right (get-string-all port) 2) 1)))
         (close-port port)
         (format #t "~a\n" selected)))))

  (define emacs-application-launcher
    (emacs-minibuffer-program
     emacs-client-create-frame "application-launcher" "Application Launcher"
@@ -535,7 +567,8 @@ It can contain settings not yet moved to separate features."
     (simple-service 'emacs-set-default-editor
                     home-environment-variables-service-type
                     `(("ALTERNATE_EDITOR" . ,emacs-editor)
                       ("VISUAL" . ,emacs-client-no-wait)))
                       ("VISUAL" . ,emacs-client-no-wait)
                       ("MENU" . ,emacs-dmenu)))
     (when (get-value 'sway config)
       (simple-service
        'emacs-update-environment-variables-on-sway-start
@@ -556,7 +589,7 @@ It can contain settings not yet moved to separate features."
            (make-feature-values
             standalone-minibuffer-height
             emacs
             emacs-editor emacs-client
             emacs-editor emacs-client emacs-dmenu
             emacs-client-create-frame
             emacs-client-no-wait
             emacs-configure-rde-keymaps
-- 
2.41.0
Details
Message ID
<87tts0n24d.fsf@trop.in>
In-Reply-To
<20230806085508.13140-1-ngraves@ngraves.fr> (view parent)
DKIM signature
missing
Download raw message
On 2023-08-06 10:55, Nicolas Graves wrote:

Hi Nicolas!

> ---
>  src/rde/features/emacs.scm | 37 +++++++++++++++++++++++++++++++++++--
>  1 file changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
> index b5cfe30e..95280370 100644
> --- a/src/rde/features/emacs.scm
> +++ b/src/rde/features/emacs.scm
> @@ -481,6 +481,38 @@ It can contain settings not yet moved to separate features."
>                             "--no-splash"
>                             (cdr (command-line)))))
>  
> +  ;; Emacs and emacsclient don't handle stdin properly, in the case they
> +  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
> +  (define emacs-dmenu
> +    (program-file
> +     "emacs-dmenu"
> +     #~(begin
> +         (use-modules
> +          (ice-9 textual-ports)
> +          (ice-9 popen))
> +         (let* ((raw-input
> +                 (string-drop-right (get-string-all (current-input-port)) 1))

It's not clear what does this string-drop-right do.

> +                (port (open-input-pipe
> +                       (format #f
> +                               "~a --eval \" \
> +(let* ((vertico-count 10) \
> +       (after-make-frame-functions '()) \
> +       (minibuffer-frame (make-frame `((display . ,(getenv \"WAYLAND_DISPLAY\")) \
> +                                       (name . \"dynamic menu - Emacs Client\") \
> +                                       (minibuffer . only) \
> +                                       (width . 120) \
> +                                       (height . 11))))) \
> +    (unwind-protect \
> +       (with-selected-frame minibuffer-frame \
> +         (completing-read \\\"Select: \\\" \
> +                         (split-string \\\"~a\\\" \\\"\n\\\"))) \
> +     (delete-frame minibuffer-frame)))\""
> +                               #$emacs-client raw-input)))
> +           (selected
> +            (string-drop (string-drop-right (get-string-all port) 2) 1)))

The same here.

> +         (close-port port)
> +         (format #t "~a\n" selected)))))
> +
>    (define emacs-application-launcher
>      (emacs-minibuffer-program
>       emacs-client-create-frame "application-launcher" "Application Launcher"
> @@ -535,7 +567,8 @@ It can contain settings not yet moved to separate features."
>       (simple-service 'emacs-set-default-editor
>                       home-environment-variables-service-type
>                       `(("ALTERNATE_EDITOR" . ,emacs-editor)
> -                       ("VISUAL" . ,emacs-client-no-wait)))
> +                       ("VISUAL" . ,emacs-client-no-wait)
> +                       ("MENU" . ,emacs-dmenu)))
>       (when (get-value 'sway config)
>         (simple-service
>          'emacs-update-environment-variables-on-sway-start
> @@ -556,7 +589,7 @@ It can contain settings not yet moved to separate features."
>              (make-feature-values
>               standalone-minibuffer-height
>               emacs
> -             emacs-editor emacs-client
> +             emacs-editor emacs-client emacs-dmenu
>               emacs-client-create-frame
>               emacs-client-no-wait
>               emacs-configure-rde-keymaps

I tried
ls | $MENU

and got:
--8<---------------cut here---------------start------------->8---
/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 21: syntax error: unexpected end of file
Backtrace:
           3 (primitive-load "/gnu/store/z4gfi5ky1gg8jyhggaxr5ghj81v…")
In ice-9/eval.scm:
   293:34  2 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
    159:9  1 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
In unknown file:
           0 (string-drop-right "" 2)

ERROR: In procedure string-drop-right:
Value out of range 0 to< 0: -2
zsh: done       ls | 
zsh: exit 1     $MENU/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 21: syntax error: unexpected end of file
Backtrace:
           3 (primitive-load "/gnu/store/z4gfi5ky1gg8jyhggaxr5ghj81v…")
In ice-9/eval.scm:
   293:34  2 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
    159:9  1 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
In unknown file:
           0 (string-drop-right "" 2)

ERROR: In procedure string-drop-right:
Value out of range 0 to< 0: -2
zsh: done       ls | 
zsh: exit 1     $MENU
--8<---------------cut here---------------end--------------->8---

-- 
Best regards,
Andrew Tropin
Details
Message ID
<87bke5nk7o.fsf@ngraves.fr>
In-Reply-To
<87tts0n24d.fsf@trop.in> (view parent)
DKIM signature
missing
Download raw message
On 2023-09-11 19:47, Andrew Tropin wrote:

> On 2023-08-06 10:55, Nicolas Graves wrote:
>
> Hi Nicolas!
>
>> ---
>>  src/rde/features/emacs.scm | 37 +++++++++++++++++++++++++++++++++++--
>>  1 file changed, 35 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
>> index b5cfe30e..95280370 100644
>> --- a/src/rde/features/emacs.scm
>> +++ b/src/rde/features/emacs.scm
>> @@ -481,6 +481,38 @@ It can contain settings not yet moved to separate features."
>>                             "--no-splash"
>>                             (cdr (command-line)))))
>>
>> +  ;; Emacs and emacsclient don't handle stdin properly, in the case they
>> +  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
>> +  (define emacs-dmenu
>> +    (program-file
>> +     "emacs-dmenu"
>> +     #~(begin
>> +         (use-modules
>> +          (ice-9 textual-ports)
>> +          (ice-9 popen))
>> +         (let* ((raw-input
>> +                 (string-drop-right (get-string-all (current-input-port)) 1))
>
> It's not clear what does this string-drop-right do.

This one drops the trailing \n. It's not always there though (echo -n
will not add it), so I'll add a test to drop it only if it's there.

>
>> +                (port (open-input-pipe
>> +                       (format #f
>> +                               "~a --eval \" \
>> +(let* ((vertico-count 10) \
>> +       (after-make-frame-functions '()) \
>> +       (minibuffer-frame (make-frame `((display . ,(getenv \"WAYLAND_DISPLAY\")) \
>> +                                       (name . \"dynamic menu - Emacs Client\") \
>> +                                       (minibuffer . only) \
>> +                                       (width . 120) \
>> +                                       (height . 11))))) \
>> +    (unwind-protect \
>> +       (with-selected-frame minibuffer-frame \
>> +         (completing-read \\\"Select: \\\" \
>> +                         (split-string \\\"~a\\\" \\\"\n\\\"))) \
>> +     (delete-frame minibuffer-frame)))\""
>> +                               #$emacs-client raw-input)))
>> +           (selected
>> +            (string-drop (string-drop-right (get-string-all port) 2) 1)))
>
> The same here.

The result returned by emacs would be of the following form:
;;; (result "\"3\"\n")

Hence the need to drop both quotes and newline.

>
>> +         (close-port port)
>> +         (format #t "~a\n" selected)))))
>> +
>>    (define emacs-application-launcher
>>      (emacs-minibuffer-program
>>       emacs-client-create-frame "application-launcher" "Application Launcher"
>> @@ -535,7 +567,8 @@ It can contain settings not yet moved to separate features."
>>       (simple-service 'emacs-set-default-editor
>>                       home-environment-variables-service-type
>>                       `(("ALTERNATE_EDITOR" . ,emacs-editor)
>> -                       ("VISUAL" . ,emacs-client-no-wait)))
>> +                       ("VISUAL" . ,emacs-client-no-wait)
>> +                       ("MENU" . ,emacs-dmenu)))
>>       (when (get-value 'sway config)
>>         (simple-service
>>          'emacs-update-environment-variables-on-sway-start
>> @@ -556,7 +589,7 @@ It can contain settings not yet moved to separate features."
>>              (make-feature-values
>>               standalone-minibuffer-height
>>               emacs
>> -             emacs-editor emacs-client
>> +             emacs-editor emacs-client emacs-dmenu
>>               emacs-client-create-frame
>>               emacs-client-no-wait
>>               emacs-configure-rde-keymaps
>
> I tried
> ls | $MENU
>
> and got:
> --8<---------------cut here---------------start------------->8---
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 21: syntax error: unexpected end of file
> Backtrace:
>            3 (primitive-load "/gnu/store/z4gfi5ky1gg8jyhggaxr5ghj81v…")
> In ice-9/eval.scm:
>    293:34  2 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
>     159:9  1 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
> In unknown file:
>            0 (string-drop-right "" 2)
>
> ERROR: In procedure string-drop-right:
> Value out of range 0 to< 0: -2
> zsh: done       ls |
> zsh: exit 1     $MENU/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: -c: line 21: syntax error: unexpected end of file
> Backtrace:
>            3 (primitive-load "/gnu/store/z4gfi5ky1gg8jyhggaxr5ghj81v…")
> In ice-9/eval.scm:
>    293:34  2 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
>     159:9  1 (_ #(#(#<directory (guile-user) 7f6f96518c80> "CHA…") #))
> In unknown file:
>            0 (string-drop-right "" 2)
>
> ERROR: In procedure string-drop-right:
> Value out of range 0 to< 0: -2
> zsh: done       ls |
> zsh: exit 1     $MENU
> --8<---------------cut here---------------end--------------->8---

But the error doesn't come from there. It comes from the backquote /
unquote which doesn't seem to be accepted in this context. I'll resend
the patch with a fixed version. 

--
Best regards,
Nicolas Graves

[PATCH v4] rde: Add emacs-dmenu command.

Details
Message ID
<20230914120205.4878-1-ngraves@ngraves.fr>
In-Reply-To
<20230721144303.6102-1-ngraves@ngraves.fr> (view parent)
DKIM signature
missing
Download raw message
Patch: +44 -2
---
 src/rde/features/emacs.scm | 46 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
index 25d34514..01cb8837 100644
--- a/src/rde/features/emacs.scm
+++ b/src/rde/features/emacs.scm
@@ -477,6 +477,47 @@ It can contain settings not yet moved to separate features."
                           "--no-splash"
                           (cdr (command-line)))))

  ;; Emacs and emacsclient don't handle stdin properly, in the case they
  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
  (define emacs-dmenu
    (program-file
     "emacs-dmenu"
     #~(begin
         (use-modules (ice-9 textual-ports) (ice-9 popen))
         (let* ((raw-input (get-string-all (current-input-port)))
                (len (string-length raw-input))
                (clean-input
                 (if (and (> len 0)
                          (char=? (string-ref raw-input (- len 1)) #\newline))
                     (string-drop-right raw-input 1)
                     raw-input))
                (count (string-count clean-input #\newline))
                (port (open-input-pipe
                       (format #f "~a --eval \"\
(let* ((vertico-count ~a)\
       (after-make-frame-functions '())\
       (minibuffer-frame\
         (make-frame (list (cons 'display (getenv \\\"WAYLAND_DISPLAY\\\"))\
                           '(name . \\\"dynamic menu - Emacs Client\\\")\
                           '(minibuffer . only)\
                           '(width . 120)\
                           '(height . ~a)))))\
     (unwind-protect\
        (with-selected-frame minibuffer-frame\
          (completing-read \\\"Select: \\\"\
                          (split-string \\\"~a\\\" \\\"\n\\\")))\
      (delete-frame minibuffer-frame)))\""
                               #$emacs-client
                               (+ 1 count)
                               (+ 2 count)
                               clean-input)))
                ;; Drop surrounding quotes and newline.
                (selected (string-drop
                           (string-drop-right (get-string-all port) 2)
                           1)))
           (close-port port)
           (format #t "~a\n" selected)))))

  (define emacs-application-launcher
    (emacs-minibuffer-program
     emacs-client "application-launcher" "Application Launcher"
@@ -527,7 +568,8 @@ It can contain settings not yet moved to separate features."
     (simple-service 'emacs-set-default-editor
                     home-environment-variables-service-type
                     `(("ALTERNATE_EDITOR" . ,emacs-editor)
                       ("VISUAL" . ,emacs-client-no-wait)))
                       ("VISUAL" . ,emacs-client-no-wait)
                       ("MENU" . ,emacs-dmenu)))
     (when (get-value 'sway config)
       (simple-service
        'emacs-update-environment-variables-on-sway-start
@@ -544,7 +586,7 @@ It can contain settings not yet moved to separate features."
            (make-feature-values
             standalone-minibuffer-height
             emacs
             emacs-editor emacs-client
             emacs-editor emacs-client emacs-dmenu
             emacs-client-create-frame
             emacs-client-no-wait
             emacs-configure-rde-keymaps
-- 
2.41.0

Re: [PATCH v4] rde: Add emacs-dmenu command.

Details
Message ID
<874jjpxfgw.fsf@trop.in>
In-Reply-To
<20230914120205.4878-1-ngraves@ngraves.fr> (view parent)
DKIM signature
missing
Download raw message
On 2023-09-14 14:02, Nicolas Graves wrote:

> ---
>  src/rde/features/emacs.scm | 46 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 44 insertions(+), 2 deletions(-)
>
> diff --git a/src/rde/features/emacs.scm b/src/rde/features/emacs.scm
> index 25d34514..01cb8837 100644
> --- a/src/rde/features/emacs.scm
> +++ b/src/rde/features/emacs.scm
> @@ -477,6 +477,47 @@ It can contain settings not yet moved to separate features."
>                             "--no-splash"
>                             (cdr (command-line)))))
>  
> +  ;; Emacs and emacsclient don't handle stdin properly, in the case they
> +  ;; should be used as dmenu. This tiny guile+emacs script behaves like dmenu.
> +  (define emacs-dmenu
> +    (program-file
> +     "emacs-dmenu"
> +     #~(begin
> +         (use-modules (ice-9 textual-ports) (ice-9 popen))
> +         (let* ((raw-input (get-string-all (current-input-port)))
> +                (len (string-length raw-input))
> +                (clean-input
> +                 (if (and (> len 0)
> +                          (char=? (string-ref raw-input (- len 1)) #\newline))
> +                     (string-drop-right raw-input 1)
> +                     raw-input))
> +                (count (string-count clean-input #\newline))
> +                (port (open-input-pipe
> +                       (format #f "~a --eval \"\
> +(let* ((vertico-count ~a)\
> +       (after-make-frame-functions '())\
> +       (minibuffer-frame\
> +         (make-frame (list (cons 'display (getenv \\\"WAYLAND_DISPLAY\\\"))\

This line can make a script "wayland"-dependend without making sure that
we are in wayland.  Added a comment about it.

> +                           '(name . \\\"dynamic menu - Emacs Client\\\")\
> +                           '(minibuffer . only)\
> +                           '(width . 120)\
> +                           '(height . ~a)))))\
> +     (unwind-protect\
> +        (with-selected-frame minibuffer-frame\
> +          (completing-read \\\"Select: \\\"\
> +                          (split-string \\\"~a\\\" \\\"\n\\\")))\
> +      (delete-frame minibuffer-frame)))\""
> +                               #$emacs-client
> +                               (+ 1 count)
> +                               (+ 2 count)
> +                               clean-input)))
> +                ;; Drop surrounding quotes and newline.
> +                (selected (string-drop
> +                           (string-drop-right (get-string-all port) 2)
> +                           1)))
> +           (close-port port)
> +           (format #t "~a\n" selected)))))
> +
>    (define emacs-application-launcher
>      (emacs-minibuffer-program
>       emacs-client "application-launcher" "Application Launcher"
> @@ -527,7 +568,8 @@ It can contain settings not yet moved to separate features."
>       (simple-service 'emacs-set-default-editor
>                       home-environment-variables-service-type
>                       `(("ALTERNATE_EDITOR" . ,emacs-editor)
> -                       ("VISUAL" . ,emacs-client-no-wait)))
> +                       ("VISUAL" . ,emacs-client-no-wait)
> +                       ("MENU" . ,emacs-dmenu)))
>       (when (get-value 'sway config)
>         (simple-service
>          'emacs-update-environment-variables-on-sway-start
> @@ -544,7 +586,7 @@ It can contain settings not yet moved to separate features."
>              (make-feature-values
>               standalone-minibuffer-height
>               emacs
> -             emacs-editor emacs-client
> +             emacs-editor emacs-client emacs-dmenu
>               emacs-client-create-frame
>               emacs-client-no-wait
>               emacs-configure-rde-keymaps

Looks much better, applied, lightly tested, pushed.  Thank you for your
work! :)

-- 
Best regards,
Andrew Tropin
Reply to thread Export thread (mbox)