Helm: Builtin support for always opens helm window in bottom position?

Created on 13 May 2018  Â·  18Comments  Â·  Source: emacs-helm/helm

Recent update broken following code:

(defvar spacemacs-helm-display-help-buffer-regexp '("\\*.*Helm.*Help.*\\*"))
(defvar spacemacs-helm-display-buffer-regexp `("\\*.*helm.*\\*"
                                               (display-buffer-in-side-window)
                                               (inhibit-same-window . nil)
                                               (side . bottom)
                                               (window-width . 0.6)
                                               (window-height . 0.4)))

(defun display-helm-at-bottom (buffer)
  (let ((display-buffer-alist (list spacemacs-helm-display-help-buffer-regexp
                                    spacemacs-helm-display-buffer-regexp)))
    (display-buffer buffer)))
(setq helm-display-function 'display-helm-at-bottom)

I have fix this with following change:

-(defun display-helm-at-bottom (buffer)
+(defun display-helm-at-bottom (buffer &optional _resume)

What I wonder is: is there exist a builtin helm-display-function for this?

discuss about this feature please see here

Thanks.

Most helpful comment

Now you have two more options:
helm-default-display-buffer-functions and helm-default-display-buffer-alist, what you want I think is:
(setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

All 18 comments

Billy.Zheng notifications@github.com writes:

Recent update broken following code:

Sorry but this is not an helm issue, and I can't help on this as I am
not aware of how spacemacs uses helm (here's not a spacemacs fan).

--
Thierry

There is a bunch of options in helm to display helm window where you want, please use them.

Now you have two more options:
helm-default-display-buffer-functions and helm-default-display-buffer-alist, what you want I think is:
(setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

Now you have two more options:
helm-default-display-buffer-functions and helm-default-display-buffer-alist, what you want I think is:
(setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

No, it not work.

Following is requirement which i need:

i have two window, one left, one right in one emacs frame

-----------------------------|-----------------------------|
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |----------------------------------------------------------

when i in right window, after i run helm-mini

-----------------------------|-----------------------------|
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |-----------------------------
 |                           |                             |
 |                           |                             |
 |                           |        helm-mini buffer     |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |----------------------------------------------------------

But, what i want is: whatever open many buffer, i always open helm-mini in frame-buttom

-----------------------------|-----------------------------|
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |                           |                             |
 |---------------------------|-----------------------------
 |                                                         |
 |                                                         |
 |              helm-mini buffer
 |                                                         |
 |                                                         |
 |                                                         |
 |----------------------------------------------------------

Following code is worked as expect.

(defvar spacemacs-helm-display-help-buffer-regexp '("\\*.*Helm.*Help.*\\*"))
(defvar spacemacs-helm-display-buffer-regexp `("\\*.*helm.*\\*"
                                               (display-buffer-in-side-window)
                                               (inhibit-same-window . nil)
                                               (side . bottom)
                                               (window-width . 0.6)
                                               (window-height . 0.4)))

(defun display-helm-at-bottom (buffer &optional _resume)
  (let ((display-buffer-alist (list spacemacs-helm-display-help-buffer-regexp
                                    spacemacs-helm-display-buffer-regexp)))
    (display-buffer buffer)))
(setq helm-display-function 'display-helm-at-bottom)

recent changed, broken above code, we have to change to make it worked again.
so, I just want to know, is there exist a builtin solution for this ...

Billy.Zheng notifications@github.com writes:

Now you have two more options:
helm-default-display-buffer-functions and helm-default-display-buffer-alist, what you want I think is:
(setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

No, it not work.

Yes it is working, be sure you have disabled helm-always-two-windows.

--
Thierry

capture d ecran_2018-05-18_06-59-28

be sure you have disabled helm-always-two-windows.

helm-always-two-windows is nil, I am ensure about again, but it is still not worked.

So you have some other settings that make it fail, be sure to start from a minimal config, i.e. emacs-helm.sh

Here from emacs-helm.sh:

capture d ecran_2018-05-18_07-07-49

i try with bare mini config, just following:

(require 'helm-config)

And reboot emacs daemon, run helm-mini, i got following

------------------------|------------------------|
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |    helm mini buffer    |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|                       |                        |
|-------------------------------------------------

all window in the right is full with helm-mini.

i think this config is controller is by:

# in my config, i change this, but, with mini config, no this.
(setq helm-split-window-inside-p t)

I always start emacs with --daemon, i try to start with emacs-helm.sh, but it not work.

╰─ $ 1  ./emacs-helm.sh 
+ test -z ''
+ TEMP=/tmp
+ CONF_FILE=/tmp/helm-cfg.el
+ EMACS=emacs
+ case $1 in
++ emacs -q -batch --eval '(prin1 load-path)'
Loading 00debian-vars...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
+ LOAD_PATH='("/etc/emacs25" "/etc/emacs" "/usr/local/share/emacs/25.2/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/share/emacs25/site-lisp/dictionaries-common" "/usr/share/emacs/site-lisp/autoconf" "/usr/share/emacs/25.2/site-lisp" "/usr/share/emacs/25.2/site-lisp/dictionaries-common" "/usr/share/emacs/site-lisp" "/usr/share/emacs/25.2/lisp" "/usr/share/emacs/25.2/lisp/vc" "/usr/share/emacs/25.2/lisp/url" "/usr/share/emacs/25.2/lisp/textmodes" "/usr/share/emacs/25.2/lisp/progmodes" "/usr/share/emacs/25.2/lisp/play" "/usr/share/emacs/25.2/lisp/org" "/usr/share/emacs/25.2/lisp/nxml" "/usr/share/emacs/25.2/lisp/net" "/usr/share/emacs/25.2/lisp/mh-e" "/usr/share/emacs/25.2/lisp/mail" "/usr/share/emacs/25.2/lisp/leim" "/usr/share/emacs/25.2/lisp/language" "/usr/share/emacs/25.2/lisp/international" "/usr/share/emacs/25.2/lisp/gnus" "/usr/share/emacs/25.2/lisp/eshell" "/usr/share/emacs/25.2/lisp/erc" "/usr/share/emacs/25.2/lisp/emulation" "/usr/share/emacs/25.2/lisp/emacs-lisp" "/usr/share/emacs/25.2/lisp/cedet" "/usr/share/emacs/25.2/lisp/calendar" "/usr/share/emacs/25.2/lisp/calc" "/usr/share/emacs/25.2/lisp/obsolete")'
+ cd .
++ find . -samefile ./emacs-helm.sh -printf %l
+ TRUENAME=
+ '[' '!' -z '' ']'
+ AUTO_FILE=helm-autoloads.el
+ '[' '!' -e helm-autoloads.el ']'
+ cat
+ emacs -Q -l /tmp/helm-cfg.el

** (emacs:19567): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

I got following error message from mini buffer

version-to-list: Invalid version syntax: ‘{{VERSION}}’ (must start with a number)
Mark set [3 times]

Following is my /tmp/helm-cfg.el

(setq initial-scratch-message (concat initial-scratch-message
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;; This Emacs is Powered by `HELM' using\n;; emacs program \"emacs\".\n;; This is a minimal `helm' configuration to discover `helm' or debug it.\n;; You can retrieve this minimal configuration in \"/tmp/helm-cfg.el\".\n;; Some original Emacs commands are replaced by their `helm' counterparts:\n\n;; - `find-file'(C-x C-f)            =>`helm-find-files'\n;; - `occur'(M-s o)                  =>`helm-occur'\n;; - `list-buffers'(C-x C-b)         =>`helm-buffers-list'\n;; - `completion-at-point'(M-tab)    =>`helm-lisp-completion-at-point'[1]\n;; - `dabbrev-expand'(M-/)           =>`helm-dabbrev'\n;; - `execute-extended-command'(M-x) =>`helm-M-x'\n\n
;; Some other Emacs commands are \"helmized\" by `helm-mode'.\n;; [1] Coming with emacs-24.4, `completion-at-point' is \"helmized\" by `helm-mode'\n;; which provides Helm completion in many places like `shell-mode'.\n;; Find context help for most Helm commands with `C-h m'.\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))

(setq load-path (quote ("/etc/emacs25" "/etc/emacs" "/usr/local/share/emacs/25.2/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/share/emacs25/site-lisp/dictionaries-common" "/usr/share/emacs/site-lisp/autoconf" "/usr/share/emacs/25.2/site-lisp" "/usr/share/emacs/25.2/site-lisp/dictionaries-common" "/usr/share/emacs/site-lisp" "/usr/share/emacs/25.2/lisp" "/usr/share/emacs/25.2/lisp/vc" "/usr/share/emacs/25.2/lisp/url" "/usr/share/emacs/25.2/lisp/textmodes" "/usr/share/emacs/25.2/lisp/progmodes" "/usr/share/emacs/25.2/lisp/play" "/usr/share/emacs/25.2/lisp/org" "/usr/share/emacs/25.2/lisp/nxml" "/usr/share/emacs/25.2/lisp/net" "/usr/share/emacs/25.2/lisp/mh-e" "/usr/share/emacs/25.2/lisp/mail" "/usr/share/emacs/25.2/lisp/leim" "/usr/share/emacs/25.2/lisp/language" "/usr/share/emacs/25.2/lisp/international" "/usr/share/emacs/25.2/lisp/gnus" "/usr/share/emacs/25.2/lisp/eshell" "/usr/share/emacs/25.2/lisp/erc" "/usr/share/emacs/25.2/lisp/emulation" "/usr/share/emacs/25.2/lisp/emacs-lisp" "/usr/share/emacs/25.2/lisp/cedet" "/usr/share/emacs/25.2/lisp/calendar" "/usr/share/emacs/25.2/lisp/calc" "/usr/share/emacs/25.2/lisp/obsolete")))
(require 'package)
;; User may be using a non standard `package-user-dir'.
;; Modify `package-directory-list' instead of `package-user-dir'
;; in case the user starts Helm from a non-ELPA installation.
(unless (file-equal-p package-user-dir "~/.emacs.d/elpa")
  (add-to-list 'package-directory-list (directory-file-name
                                        (file-name-directory
                                         (directory-file-name default-directory)))))

(setq package-load-list '((helm-core t) (helm t) (async t) (popup t)))
(package-initialize)
(add-to-list 'load-path (file-name-directory (file-truename "./emacs-helm.sh")))
(setq default-frame-alist '((vertical-scroll-bars . nil)
                            (tool-bar-lines . 0)
                            (menu-bar-lines . 0)
                            (fullscreen . nil)))
(blink-cursor-mode -1)
(require 'helm-config)
(helm-mode 1)
(define-key global-map [remap find-file] 'helm-find-files)
(define-key global-map [remap occur] 'helm-occur)
(define-key global-map [remap list-buffers] 'helm-buffers-list)
(define-key global-map [remap dabbrev-expand] 'helm-dabbrev)
(define-key global-map [remap execute-extended-command] 'helm-M-x)
(unless (boundp 'completion-in-region-function)
  (define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)
  (define-key emacs-lisp-mode-map       [remap completion-at-point] 'helm-lisp-completion-at-point))
(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "/tmp/helm-cfg.el") (delete-file "/tmp/helm-cfg.el"))))

I understood almost all config what means, and i add those config to my personal init script maually as need, but not work like you.

The only thing you have to do is:

1) cd to helm directory
2) run ./emacs-helm.sh

Billy.Zheng notifications@github.com writes:

Following is my /tmp/helm-cfg.el

Why are you showing this??

I understood almost all config what means, and i add those config to
my personal init script maually as need, but not work like you.

NO, DON'T modify script or whatever, just use 1) and 2) and eval:

(setq helm-always-two-windows nil)
(setq helm-display-buffer-default-height 23)
(setq helm-default-display-buffer-functions '(display-buffer-in-side-window))

in scratch buffer.

That's all.

If it still not working, it is you are doing something wrong,
emacs-helm.sh is working fine and out of the box.

--
Thierry

cd helm git directory

$:  gitl
1  * f2b5d9f8 - (HEAD -> master, tag: v2.9.4, origin/master, origin/HEAD) Update *pkg.el files(6 days ago,Thierry Volpiatto)
$: git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

run emacs-helm.sh

$:  ./emacs-helm.sh

Got following error. (maybe caused by my linux distro? (Deepin 15.5)

 ╰─ $ ./emacs-helm.sh
Loading 00debian-vars...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...

** (emacs:8495): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

Following is emacs *Messages* buffer:

For information about GNU Emacs and the GNU system, type C-h C-a.
version-to-list: Invalid version syntax: ‘{{VERSION}}’ (must start with a number)

when i M-x helm-mini, no matched is found.

I have rename my ~/.emacs.d and ~/.emacs to other name, but emacs-helm.sh not work.

Thanks

Billy.Zheng notifications@github.com writes:

origin/HEAD) Update *pkg.el files(6 days ago,Thierry Volpiatto)

This helm version doesn't have helm-default-display-buffer-functions
variable, use the last.

Got following error. (maybe caused by my linux distro? (Deepin 15.5)

Probably, anyway it is not caused by helm itself, I guess you should
have same error with emacs -Q or emacs -q.

```sh
╰─ $ ./emacs-helm.sh
Loading 00debian-vars...

An advice: Always install emacs from sources and compile it yourself (it
is easy), the emacs packages bundled with distributions have always
problems (be sure to uninstall emacs debian
package before installing yourself your new emacs).

--
Thierry

An advice: Always install emacs from sources and compile it yourself (it is easy), the emacs packages bundled with distributions have always problems (be sure to uninstall emacs debian package before installing yourself your new emacs).

Yes, i always do this, but for current deepin, i forget it ...

Probably, anyway it is not caused by helm itself, I guess you should have same error with emacs -Q or emacs -q.

emacs -q or emacs -Q worked with no error.

This helm version doesn't have helm-default-display-buffer-functions variable, use the last.

It worked, Thank you!

Was this page helpful?
0 / 5 - 0 ratings