Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Better approach for emacsclient #388

@mmahmoudian

Description

@mmahmoudian

The following information from the README is suboptimal:

In addition to the above, configure initial-buffer-choice to show Dashboard in frames created with emacsclient -c as follows:

(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))

This is suboptimal because the first time after emacs --bg-daemon that a frame is created, it will not properly load the dashboard with all the graphics:

image

and the user have to reload the config to get it fixed. This is most probably because the initial-buffer-choice is run before any frame exists, and therefore everything is in text-only mode.

A better way would be to have

(add-hook 'server-after-make-frame-hook (lambda()
    (switch-to-buffer dashboard-buffer-name)
    (dashboard-mode)
    (dashboard-insert-startupify-lists)
    (dashboard-refresh-buffer)))

which uses a proper hook and also does not disturb the emacsclient --tty --create-frame. The content of the lambda is inspired from #236 (comment)

I suggest removing this section from README (or move it to some other section) and instead extend the dashboard-setup-startup-hook function to contain the hook above as well.

If you agree with this suggestion, I can create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions