transient icon indicating copy to clipboard operation
transient copied to clipboard

It is not displayed when Japanese is used in the name of the item

Open akicho8 opened this issue 2 years ago • 2 comments

what behavior you expected

The menu is displayed

what behavior you observed

The menu is not displayed

Probably not English is the cause of failure. Even in Japanese, It works in 1 column. If set it to 2 column, it will fail.

and how we can reproduce the issue.

(transient-define-prefix my-global-chdir ()
  [
   [("l" "ダウンロード" (lambda () (interactive) (dired "~/Downloads")))]
   [("t" "デスクトップ" (lambda () (interactive) (dired "~/Desktop")))]
   ])

After reading the code above M-x my-global-chdir

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument wholenump -3)
  apply(debug (error (wrong-type-argument wholenump -3)))
  transient--exit-and-debug(error (wrong-type-argument wholenump -3))
  make-string(-3 32)
  (insert (make-string (- (nth c cc) (current-column)) 32))
  (if vp (progn (let* ((cell (and t (nth r (nth c columns))))) (if cell (insert cell) nil)) (if (= c (1- cs)) (insert 10) (insert (propertize " " 'display (list 'space ':align-to (list (nth ... cc))))))) (insert (make-string (- (nth c cc) (current-column)) 32)) (let* ((cell (and t (nth r (nth c columns))))) (if cell (insert cell) nil)) (if (= c (1- cs)) (progn (insert 10))))
  (let ((c --dotimes-counter--)) (if vp (progn (let* ((cell (and t (nth r ...)))) (if cell (insert cell) nil)) (if (= c (1- cs)) (insert 10) (insert (propertize " " 'display (list 'space ':align-to (list ...)))))) (insert (make-string (- (nth c cc) (current-column)) 32)) (let* ((cell (and t (nth r (nth c columns))))) (if cell (insert cell) nil)) (if (= c (1- cs)) (progn (insert 10)))))
  (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (if vp (progn (let* ((cell (and t ...))) (if cell (insert cell) nil)) (if (= c (1- cs)) (insert 10) (insert (propertize " " 'display (list ... ... ...))))) (insert (make-string (- (nth c cc) (current-column)) 32)) (let* ((cell (and t (nth r ...)))) (if cell (insert cell) nil)) (if (= c (1- cs)) (progn (insert 10))))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))
  (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (if vp (progn (let* ((cell ...)) (if cell (insert cell) nil)) (if (= c (1- cs)) (insert 10) (insert (propertize " " ... ...)))) (insert (make-string (- (nth c cc) (current-column)) 32)) (let* ((cell (and t ...))) (if cell (insert cell) nil)) (if (= c (1- cs)) (progn (insert 10))))) (setq --dotimes-counter-- (1+ --dotimes-counter--))))
  (let ((r --dotimes-counter--)) (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (if vp (progn (let* (...) (if cell ... nil)) (if (= c ...) (insert 10) (insert ...))) (insert (make-string (- ... ...) 32)) (let* ((cell ...)) (if cell (insert cell) nil)) (if (= c (1- cs)) (progn (insert 10))))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))))
  (while (< --dotimes-counter-- --dotimes-limit--) (let ((r --dotimes-counter--)) (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (if vp (progn (let* ... ...) (if ... ... ...)) (insert (make-string ... 32)) (let* (...) (if cell ... nil)) (if (= c ...) (progn ...)))) (setq --dotimes-counter-- (1+ --dotimes-counter--))))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))
  (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((r --dotimes-counter--)) (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (if vp (progn ... ...) (insert ...) (let* ... ...) (if ... ...))) (setq --dotimes-counter-- (1+ --dotimes-counter--))))) (setq --dotimes-counter-- (1+ --dotimes-counter--))))
  (if transient-force-single-column (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let (...) (let* ... ...)) (setq --dotimes-counter-- (1+ --dotimes-counter--)))) (if (= c (1- cs)) nil (insert 10))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((r --dotimes-counter--)) (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let (...) (if vp ... ... ... ...)) (setq --dotimes-counter-- (1+ --dotimes-counter--))))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))))
  (let* ((columns (mapcar #'(lambda (column) (transient--maybe-pad-keys column group) (let (...) (let* ... ...) (flatten-tree rows))) (eieio-oref group 'suffixes))) (vp (or (eieio-oref transient--prefix 'variable-pitch) transient-align-variable-pitch)) (rs (apply #'max (mapcar #'length columns))) (cs (length columns)) (cw (mapcar #'(lambda (col) (apply #'max (mapcar ... col))) columns)) (cc (transient--seq-reductions-from (apply-partially #'+ (* 3 (if vp (transient--pixel-width " ") 1))) cw 0))) (if transient-force-single-column (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ...) (setq --dotimes-counter-- ...))) (if (= c (1- cs)) nil (insert 10))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((r --dotimes-counter--)) (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ...) (setq --dotimes-counter-- ...)))) (setq --dotimes-counter-- (1+ --dotimes-counter--))))))
  (progn (let* ((columns (mapcar #'(lambda (column) (transient--maybe-pad-keys column group) (let ... ... ...)) (eieio-oref group 'suffixes))) (vp (or (eieio-oref transient--prefix 'variable-pitch) transient-align-variable-pitch)) (rs (apply #'max (mapcar #'length columns))) (cs (length columns)) (cw (mapcar #'(lambda (col) (apply ... ...)) columns)) (cc (transient--seq-reductions-from (apply-partially #'+ (* 3 (if vp ... 1))) cw 0))) (if transient-force-single-column (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((c --dotimes-counter--)) (let (... ...) (while ... ... ...)) (if (= c ...) nil (insert 10))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ((r --dotimes-counter--)) (let (... ...) (while ... ... ...))) (setq --dotimes-counter-- (1+ --dotimes-counter--)))))))
  (closure (transient-resume-mode Man-notify-method t) (group) (progn (let* ((columns (mapcar #'... (eieio-oref group ...))) (vp (or (eieio-oref transient--prefix ...) transient-align-variable-pitch)) (rs (apply #'max (mapcar ... columns))) (cs (length columns)) (cw (mapcar #'... columns)) (cc (transient--seq-reductions-from (apply-partially ... ...) cw 0))) (if transient-force-single-column (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ... ...) (setq --dotimes-counter-- ...))) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ...) (setq --dotimes-counter-- ...)))))))(#<transient-columns transient-columns-1ff923c0d928>)
  apply((closure (transient-resume-mode Man-notify-method t) (group) (progn (let* ((columns (mapcar #'... (eieio-oref group ...))) (vp (or (eieio-oref transient--prefix ...) transient-align-variable-pitch)) (rs (apply #'max (mapcar ... columns))) (cs (length columns)) (cw (mapcar #'... columns)) (cc (transient--seq-reductions-from (apply-partially ... ...) cw 0))) (if transient-force-single-column (let ((--dotimes-limit-- cs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ... ...) (setq --dotimes-counter-- ...))) (let ((--dotimes-limit-- rs) (--dotimes-counter-- 0)) (while (< --dotimes-counter-- --dotimes-limit--) (let ... ...) (setq --dotimes-counter-- ...))))))) #<transient-columns transient-columns-1ff923c0d928>)
  #f(compiled-function (&rest cnm-args) #<bytecode 0x1ff92344e1ed>)(#<transient-columns transient-columns-1ff923c0d928>)
  funcall(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ff92344e1ed>) #<transient-columns transient-columns-1ff923c0d928>)
  (let ((transient--max-group-level (max (eieio-oref group 'level) transient--max-group-level))) (funcall cl--cnm group))
  (progn (let* ((desc (and t (transient-format-description group)))) (if desc (insert desc 10) nil)) (let ((transient--max-group-level (max (eieio-oref group 'level) transient--max-group-level))) (funcall cl--cnm group)))
  (progn (progn (let* ((desc (and t (transient-format-description group)))) (if desc (insert desc 10) nil)) (let ((transient--max-group-level (max (eieio-oref group 'level) transient--max-group-level))) (funcall cl--cnm group))))
  (closure (transient-resume-mode Man-notify-method t) (cl--cnm group) "Insert GROUP's description, if any." (progn (progn (let* ((desc (and t ...))) (if desc (insert desc 10) nil)) (let ((transient--max-group-level (max ... transient--max-group-level))) (funcall cl--cnm group)))))(#f(compiled-function (&rest cnm-args) #<bytecode 0x1ff92344e1ed>) #<transient-columns transient-columns-1ff923c0d928>)
  apply((closure (transient-resume-mode Man-notify-method t) (cl--cnm group) "Insert GROUP's description, if any." (progn (progn (let* ((desc (and t ...))) (if desc (insert desc 10) nil)) (let ((transient--max-group-level (max ... transient--max-group-level))) (funcall cl--cnm group))))) #f(compiled-function (&rest cnm-args) #<bytecode 0x1ff92344e1ed>) #<transient-columns transient-columns-1ff923c0d928>)
  #f(compiled-function (&rest args) #<bytecode 0x1ff923456ce5>)(#<transient-columns transient-columns-1ff923c0d928>)
  apply(#f(compiled-function (&rest args) #<bytecode 0x1ff923456ce5>) #<transient-columns transient-columns-1ff923c0d928> nil)
  transient--insert-group(#<transient-columns transient-columns-1ff923c0d928>)
  (while (setq group (car-safe (prog1 groups (setq groups (cdr groups))))) (transient--insert-group group) (if groups (progn (insert 10))))
  (let ((groups (cl-mapcan #'(lambda (group) (let (...) (and ... ...))) transient--layout)) group) (while (setq group (car-safe (prog1 groups (setq groups (cdr groups))))) (transient--insert-group group) (if groups (progn (insert 10)))))
  transient--insert-groups()
  (save-current-buffer (set-buffer buf) (if transient-enable-popup-navigation (progn (setq focus (or (button-get (point) 'command) (transient--heading-at-point))))) (erase-buffer) (setq window-size-fixed t) (if (and (boundp 'tab-line-format) tab-line-format) (progn (setq tab-line-format nil))) (setq header-line-format nil) (setq mode-line-format (if (eq transient-mode-line-format 'line) nil transient-mode-line-format)) (setq mode-line-buffer-identification (symbol-name (eieio-oref transient--prefix 'command))) (if transient-enable-popup-navigation (set (make-local-variable 'cursor-in-non-selected-windows) 'box) (setq cursor-type nil)) (setq display-line-numbers nil) (setq show-trailing-whitespace nil) (transient--insert-groups) (if (or transient--helpp transient--editp) (progn (transient--insert-help))) (if (and (eq transient-mode-line-format 'line) window-system) (progn (let ((face (let* (...) (if f ... ...)))) (insert (propertize "__" 'face face 'display '(space :height ...))) (insert (propertize "\n" 'face face 'line-height t))))) (if transient-force-fixed-pitch (progn (transient--force-fixed-pitch))))
  (let ((buf (get-buffer-create transient--buffer-name)) (focus nil)) (save-current-buffer (set-buffer buf) (if transient-enable-popup-navigation (progn (setq focus (or (button-get (point) 'command) (transient--heading-at-point))))) (erase-buffer) (setq window-size-fixed t) (if (and (boundp 'tab-line-format) tab-line-format) (progn (setq tab-line-format nil))) (setq header-line-format nil) (setq mode-line-format (if (eq transient-mode-line-format 'line) nil transient-mode-line-format)) (setq mode-line-buffer-identification (symbol-name (eieio-oref transient--prefix 'command))) (if transient-enable-popup-navigation (set (make-local-variable 'cursor-in-non-selected-windows) 'box) (setq cursor-type nil)) (setq display-line-numbers nil) (setq show-trailing-whitespace nil) (transient--insert-groups) (if (or transient--helpp transient--editp) (progn (transient--insert-help))) (if (and (eq transient-mode-line-format 'line) window-system) (progn (let ((face (let* ... ...))) (insert (propertize "__" 'face face 'display '...)) (insert (propertize "\n" 'face face 'line-height t))))) (if transient-force-fixed-pitch (progn (transient--force-fixed-pitch)))) (if (window-live-p transient--window) nil (setq transient--window (display-buffer buf transient-display-buffer-action))) (if (window-live-p transient--window) (progn (let ((save-selected-window--state (internal--before-with-selected-window transient--window))) (save-current-buffer (unwind-protect (progn (select-window ... ...) (goto-char ...) (if transient-enable-popup-navigation ...) (magit--fit-window-to-buffer transient--window)) (internal--after-with-selected-window save-selected-window--state)))))))
  transient--show()
  (if (or (memq this-command transient--scroll-commands) (and (or (memq this-command '(mouse-drag-region mouse-set-region)) (equal (key-description (this-command-keys-vector)) "<mouse-movement>")) (and (eq (current-buffer) (get-buffer transient--buffer-name))))) nil (transient--show))
  (if (or (eq transient-show-popup t) transient--showp) (if (or (memq this-command transient--scroll-commands) (and (or (memq this-command '(mouse-drag-region mouse-set-region)) (equal (key-description (this-command-keys-vector)) "<mouse-movement>")) (and (eq (current-buffer) (get-buffer transient--buffer-name))))) nil (transient--show)) (if (and (numberp transient-show-popup) (not (= 0 transient-show-popup)) (not transient--timer)) (progn (transient--timer-start))) (transient--show-brief))
  transient--redisplay()
  (progn (cond ((not name) (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map) (setq name (eieio-oref transient--prefix 'command)) (setq params (list :scope (eieio-oref transient--prefix 'scope)))) (transient--prefix (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map)) ((not (or layout transient-current-command)) (transient--stack-zap)) (edit (setq transient--editp t))) (transient--init-objects name layout params) (transient--history-init transient--prefix) (setq transient--predicate-map (transient--make-predicate-map)) (setq transient--transient-map (transient--make-transient-map)) (setq transient--redisplay-map (transient--make-redisplay-map)) (setq transient--original-window (selected-window)) (setq transient--original-buffer (current-buffer)) (setq transient--minibuffer-depth (minibuffer-depth)) (transient--redisplay) (transient--init-transient) (transient--suspend-which-key-mode))
  (let ((debugger #'transient--exit-and-debug)) (progn (cond ((not name) (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map) (setq name (eieio-oref transient--prefix 'command)) (setq params (list :scope (eieio-oref transient--prefix 'scope)))) (transient--prefix (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map)) ((not (or layout transient-current-command)) (transient--stack-zap)) (edit (setq transient--editp t))) (transient--init-objects name layout params) (transient--history-init transient--prefix) (setq transient--predicate-map (transient--make-predicate-map)) (setq transient--transient-map (transient--make-transient-map)) (setq transient--redisplay-map (transient--make-redisplay-map)) (setq transient--original-window (selected-window)) (setq transient--original-buffer (current-buffer)) (setq transient--minibuffer-depth (minibuffer-depth)) (transient--redisplay) (transient--init-transient) (transient--suspend-which-key-mode)))
  (condition-case err (let ((debugger #'transient--exit-and-debug)) (progn (cond ((not name) (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map) (setq name (eieio-oref transient--prefix 'command)) (setq params (list :scope (eieio-oref transient--prefix ...)))) (transient--prefix (transient--pop-keymap 'transient--transient-map) (transient--pop-keymap 'transient--redisplay-map)) ((not (or layout transient-current-command)) (transient--stack-zap)) (edit (setq transient--editp t))) (transient--init-objects name layout params) (transient--history-init transient--prefix) (setq transient--predicate-map (transient--make-predicate-map)) (setq transient--transient-map (transient--make-transient-map)) (setq transient--redisplay-map (transient--make-redisplay-map)) (setq transient--original-window (selected-window)) (setq transient--original-buffer (current-buffer)) (setq transient--minibuffer-depth (minibuffer-depth)) (transient--redisplay) (transient--init-transient) (transient--suspend-which-key-mode))) ((debug error) (transient--emergency-exit) (signal (car err) (cdr err))))
  transient-setup(my-global-chdir)
  my-global-chdir()
  funcall-interactively(my-global-chdir)
  call-interactively(my-global-chdir record nil)
  command-execute(my-global-chdir record)
  execute-extended-command(nil "my-global-chdir" nil)
  funcall-interactively(execute-extended-command nil "my-global-chdir" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

magit-version: Magit 20220331.2308 [>= 3.3.0-git], Git 2.36.1, Emacs 27.2, darwin

akicho8 avatar Jun 29 '22 11:06 akicho8

I can trigger the same failure. I was able to get rid of it by specifying that transient should align pixel-wise:

(transient-define-prefix my-global-chdir ()
  :variable-pitch t
  [
   [("l" "ダウンロード" (lambda () (interactive) (dired "/tmp/transient-VBBUTtw/l")))]
   [("t" "デスクトップ" (lambda () (interactive) (dired "/tmp/transient-VBBUTtw/t")))]
   ])

I'm not too familiar with transient's internals, so I'm not sure what transient should do here, though at the very least I guess the transient--insert-group should fall back to 1 or something if the calculated value is lower than that.

Anyway, hopefully :variable-pitch t lets you side step the issue.

kyleam avatar Jun 30 '22 00:06 kyleam

What!? I was surprised that there was such an option. I'm sorry to post without read manual it properly. Anyway, It was very helpful to know that I could use Japanese. Thank you very much.

akicho8 avatar Jun 30 '22 01:06 akicho8