ecb-home / ecb

ECB Main Repository
Other
54 stars 11 forks source link

Minibuffer completion does not work with ECB #10

Open rocher opened 9 years ago

rocher commented 9 years ago

Hi,

With latest Emacs version (25.0.50, git master branch) minibuffer completion does not work once ECB has been activated. Please visit this bug report for complete details. I can also reproduce it. I could spend some time to try to fix it, if someone gives me a hint of what might be causing it.

Best regards, Francesc

rocher commented 9 years ago

After looking at this problem for a while, I've seen that, once ecb has been activated, both minibuffer and Completions buffers are displayed on the same window: (active-minibuffer-window) == (get-buffer-window "Completions" 0) == #<window 4 on Completions>

Don't know if this is correct and, therefore, it should work fine. Anyway I'd like to have separate windows for these buffers, any suggestion on how to get it?

procoder317 commented 9 years ago

@rocher @alexott @ware there is a temporary fix for this issue use the link I provide here and put the first set of answers instructions into .emacs file of your emacs init to make it work. So the alternate solution is to always load and display the minibuffer in another frame. solution link "http://emacs.stackexchange.com/questions/1074/how-to-display-the-content-of-minibuffer-in-the-middle-of-the-emacs-frame"

this solution worked for me in emacs 24 latest release for ecb and in general and it works on fly

procoder317 commented 9 years ago

here's the code that we need to be put into .emacs to make it work Note it works great on a linux terminal . I have not tested the GTK windows It worked for me below is the code:

;;sepetate frame fo minibuffer so it appears consistantly (defvar endless/popup-frame-parameters '((name . "MINIBUFFER") (minibuffer . only) (height . 1) ;; Ajust this one to your preference. (top . 200)) "Parameters for the minibuffer popup frame.")

(defvar endless/minibuffer-frame (let ((mf (make-frame endless/popup-frame-parameters))) (iconify-frame mf) mf) "Frame holding the extra minibuffer.")

(defvar endless/minibuffer-window (car (window-list endless/minibuffer-frame t)) "")

;;path the minbuffer frame (defmacro with-popup-minibuffer (&rest body) "Execute BODY using a popup minibuffer." (let ((frame-symbol (make-symbol "selected-frame"))) `(let* ((,frame-symbol (selected-frame))) (unwind-protect (progn (make-frame-visible endless/minibuffer-frame) (when (fboundp 'point-screen-height) (set-frame-parameter endless/minibuffer-frame 'top (point-screen-height))) (select-frame-set-input-focus endless/minibuffer-frame 'norecord) ,@body) (select-frame-set-input-focus ,frame-symbol)))))

(defun use-popup-minibuffer (function) "Rebind FUNCTION so that it uses a popup minibuffer." (let* ((back-symb (intern (format "endless/backup-%s" function))) (func-symb (intern (format "endless/%s-with-popup-minibuffer" function))) (defs (progn (defvar ,back-symb (symbol-function ',function)) (defun ,func-symb (&rest rest) ,(format "Call%s' with a poupup minibuffer." function) ,@(list (interactive-form function)) (with-popup-minibuffer (apply ,back-symb rest)))))) (message "%s" defs) (when (and (boundp back-symb) (eval back-symb)) (error "`%s' already defined! Can't override twice" back-symb)) (eval defs) (setf (symbol-function function) func-symb)))

;;; Try at own risk. (use-popup-minibuffer 'read-from-minibuffer) ;;; This will revert the effect. ;; (setf (symbol-function #'read-from-minibuffer) endless/backup-read-from-minibuffer) ;; (setq endless/backup-read-from-minibuffer nil)

;;;positioning the mini buffer (defun point-screen-height () (* (/ (face-attribute 'default :height) 10) 2 (- (line-number-at-pos (point)) (line-number-at-pos (window-start)))))

ware commented 8 years ago

Thanks @procoder317. I'll take a closer look at this. Does anyone know if this only affects 25.0.50.1 or should it be reproducible on 24.5?

Shinmera commented 8 years ago

It still behaves correctly on 24.5 and breaks with 25.0

This is a real pain too because it essentially renders Emacs close to unusable while ECB is active hitting tab all the time is much too ingrained in my hands.

root42 commented 7 years ago

Having the same problem. Just upgraded to Emacs 25 on OS X and this is really annoying to the point that I disable ECB. Any news on a fix?

ware commented 7 years ago

Where are you getting it from for OS X? MacPorts hasn't it yet. Regardless, I'll take a look this weekend.

root42 commented 7 years ago

I always use the version from emacsformacosx.com (yes, that's a thing)

ware commented 7 years ago

Thanks. I'll test against that this weekend.

wolfgangwayland7 commented 7 years ago

No dice, with all of the above fix's for version 25. I'm addicted to ecb so I'll have to trash version 25 for now ... and go back to 24.5 Bummer because ver->25 is very nice..

ware commented 7 years ago

Bummer. Ok. I'll try and make some time during the evenings this week.

Ryan

On Nov 23, 2016 7:35 AM, "wolfgang wayland" notifications@github.com wrote:

No dice, with all of the above fix's for version 25. I'm addicted to ecb so I'll have to trash version 25 for now ... and go back to 24.5 Bummer because ver->25 is very nice..

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ecb-home/ecb/issues/10#issuecomment-262548419, or mute the thread https://github.com/notifications/unsubscribe-auth/ABM08MNOM_LV5McSXnZjoOCW3QrKbJmGks5rBF1IgaJpZM4FhbUk .

toto-42 commented 7 years ago

I think ECB chokes on the Emacs 25 version of 'minibuffer-completion-help' from "minibuffer.el".

Version 25 of 'minibuffer-completion-help' now calls 'display-buffer-at-bottom' which appears not to be adapted to the ECB layout. As a workaround I wrote an advice for 'display-buffer-at-bottom', which overrides this defun in the ECB frame and calls 'display-buffer-use-some-window' instead. A call to 'display-buffer-use-some-window' in other frames will call the unmodified defun. Completion buffer now takes up the whole main window, but selecting a completion works for me now.

Toto

(defun display-buffer-at-bottom--display-buffer-at-bottom-around (orig-fun &rest args) "Bugfix for ECB: cannot use display-buffer-at-bottom', call display-buffer-use-some-window' instead in ECB frame." (if (and ecb-minor-mode (equal (selected-frame) ecb-frame)) (apply 'display-buffer-use-some-window args) (apply orig-fun args))) (advice-add 'display-buffer-at-bottom :around #'display-buffer-at-bottom--display-buffer-at-bottom-around)

renatgalimov commented 7 years ago

Hi, guys. Is it possible to reuse ECB compilation window to display completions?

xaverm commented 7 years ago

I'm not sure if anyone is still hooked onto this old issue? But, just in case, with version 25.2.1, and unless ECB has been started at least once, the aforementioned workaround breaks my mini-buffer completion totally, producing only error messages, namely Symbol’s value as variable is void: ecb-minor-mode. I've put the workaround directly into my init.el. For me, and even though the docs say one should not set this variable directly, a fix was to prepend the workaround with (setq ecb-minor-mode nil), making the variable non-void when Emacs starts up.

toto-42 commented 7 years ago

Hi,

still works for me on GNU Emacs 25.2.2, ECB 2.40, Debian Unstable packages.

Since you wrote that the error only occurs when starting ECB for the first time, I think your configuration is at fault. I can reproduce the

Symbol’s value as variable is void: ecb-minor-mode

error message when I run "emacs -Q" and just evaluate the workaround in the scratch buffer.

But setting up ECB as explained in the documentation with

(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
(require 'ecb-autoloads)

before evaluating the workaround still works for me.

xaverm commented 7 years ago

Hi, this is strange. I'm using ECB 2.50 from melpa and indeed I have a problem with ECB's setup. It was unclear to me that this might hamper your solution. The problem is, that when I use a vanilla Emacs, actually even with a completely empty .emacs.d directory and than evaluated the following region in the scratch buffer:

(add-to-list 'load-path "path/to/ecb-20170728.1221")
(require 'ecb-autoloads)

it leads to the message eval-region: Required feature ‘ecb-autoloads’ was not provided However, if I check ls -al path/to/ecb-20170728.1221/ecb-autoloads.* it returns path/to/ecb-20170728.1221/ecb-autoloads.el So ecb-autoloads.el exists, but I cannot require it. I have no clue as to why? That is also the reason, why I removed it from my setup. It does not prevent me from starting and using ECB in any way - except for the problem I posted here with your workaround. So now I tried

(add-to-list 'load-path "path/to/ecb-20170728.1221")
(require 'ecb)

which is also an option in ECB's setup guideline. This does not lead to an error message. And indeed, now ecb-minor-mode is non-void. But with this, I've loaded all of ECB even if I don't need it. Do you have any suggestion what might cause the issue with ecb-autoloads?

renewagner commented 6 years ago

@toto-42 Thanks for the workaround! However, I'm also seeing the error @xaverm reported. If I replace the offending ecb-minor-mode occurrence with (boundp 'ecb-minor-mode) it works both before and after ECB is started.

flajann2 commented 6 years ago

@toto-42 Your workaround was a life saver. Many thanks.

anguslee commented 5 years ago

Is there a formal code patch to resolve this issue? It seems to me all discussions here result in temporary fixes only.

jogama commented 4 years ago

Minibuffer completion also does not work for me with ecb anymore.

Emacs is 25.2.2 on Ubuntu 18.04.3 LTS.

The workaround works for me. Still, I second @anguslee's question. If someone wanted to look into this issue, what files in the ecb source would one start looking at?

JherekCarnelian commented 3 years ago

The @toto-42 workaround still helped me a lot - thank you very much !! (LinuxMint 20 (Ulyana) Xfce, Emacs 26.3 and 27.1) https://github.com/ecb-home/ecb/issues/10#issuecomment-265729402 I just eval'ed the code from there in a scratch buffer each time after ecb is activated - I'm sure, there would be a better way, but anyway, it works for me