all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rahul Martim Juliato <rahuljuliato@gmail.com>
To: Zhengyi Fu <i@fuzy.me>
Cc: Rahul Martim Juliato <rahuljuliato@gmail.com>,  help-gnu-emacs@gnu.org
Subject: Re: Some help with icomplete
Date: Tue, 16 Apr 2024 11:18:36 -0300	[thread overview]
Message-ID: <87plup8k77.fsf@gmail.com> (raw)
In-Reply-To: <87cyqpycjz.fsf@fuzy.me> (Zhengyi Fu's message of "Tue, 16 Apr 2024 15:46:56 +0800")

Zhengyi Fu <i@fuzy.me> writes:

> Rahul Martim Juliato <rahuljuliato@gmail.com> writes:
>
>> Thing is, the list always starts on the next line (that is ok) but on
>> the first column. So it is very strange to M-TAB with the cursor on
>> column 50 and get a list on column 0. If I were using plain
>> `icomplete-mode' (no vertical), it would complete horizontally from the
>> place my cursor is at the moment.
>>
>> Can anyone elucidate me on how to make it work the way I'd like to?
>
> If you compile Emacs from source, you can try this patch:
>
> Index: emacs/lisp/icomplete.el
> ===================================================================
> --- emacs.orig/lisp/icomplete.el
> +++ emacs/lisp/icomplete.el
> @@ -913,6 +913,16 @@ icomplete--render-vertical
>                   ((> (length scroll-above) (length scroll-below)) nsections)
>                   (t (min (ceiling nsections 2) (length scroll-above))))
>             lines))
> +    (when icomplete--in-region-buffer
> +      (let ((column
> +	     (with-current-buffer icomplete--in-region-buffer
> +	       (save-excursion
> +		 (goto-char (car completion-in-region--data))
> +		 (current-column)))))
> +	(dolist (l lines)
> +	  (add-text-properties
> +           0 1 `(display ,(concat (make-string column ?\s) (substring l 0 1)))
> +           l))))
>      ;; At long last, render final string return value.  This may still
>      ;; kick out lines at the end.
>      (concat " \n"

Thank you Zhengyi!

This worked like a charm!

Is this already suggested as a patch to Emacs core?

Even if optional, I believe Emacs would greatly benefit from it.


Rahul M. Juliato



  parent reply	other threads:[~2024-04-16 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 17:30 Some help with icomplete Rahul Martim Juliato
2024-04-16  7:46 ` Zhengyi Fu
2024-04-16 12:40   ` Eli Zaretskii
2024-04-16 14:18   ` Rahul Martim Juliato [this message]
2024-04-17  4:57     ` Zhengyi Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plup8k77.fsf@gmail.com \
    --to=rahuljuliato@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=i@fuzy.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.