New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest: Add a frontend based child-frame feature of emacs 26 #745

Open
tumashu opened this Issue Dec 5, 2017 · 92 comments

Comments

Projects
None yet
10 participants
@tumashu

tumashu commented Dec 5, 2017

Emacs 26 add child-frame feature, which can be used to show menu. I have tested with the below example,
it is faster than popup.el. so I suggest add a new frontend based this feature

(defvar my-child-frame nil)
(defvar my-child-frame-parameters nil)

(when (frame-live-p my-child-frame)
  (delete-frame my-child-frame))

(defun my-child-frame-menu ()
  (interactive)
  (let* ((string "This is test1
This is test2
this is test3
.....
")
         (position (point))
         (buffer (get-buffer-create " *my-child-frame-menu*"))
         (string-width-height (pos-tip-string-width-height string))
         (string-width (car string-width-height))
         (string-height (cdr string-width-height))
         (x-and-y (pos-tip-compute-pixel-position position)))

    (unless (frame-live-p my-child-frame)
      (setq my-child-frame
            (let ((after-make-frame-functions nil))
              (make-frame
               `(,@my-child-frame-parameters
                 (parent-frame . ,(window-frame))
                 (no-accept-focus . t)
                 (min-width  . t)
                 (min-height . t)
                 (border-width . 0)
                 (internal-border-width . 0)
                 (vertical-scroll-bars . nil)
                 (horizontal-scroll-bars . nil)
                 (left-fringe . 10)
                 (right-fringe . 0)
                 (menu-bar-lines . 0)
                 (tool-bar-lines . 0)
                 (line-spacing . 0)
                 (unsplittable . t)
                 (no-other-frame . t)
                 (undecorated . t)
                 (visibility . nil)
                 (cursor-type . nil)
                 (minibuffer . nil)
                 (width . 50)
                 (height . 2)
                 (no-special-glyphs . t)))))
      (let ((window (frame-root-window my-child-frame)))
        (set-window-parameter window 'mode-line-format 'none)
        (set-window-parameter window 'header-line-format 'none)
        (set-window-buffer window buffer)))

    (dolist (alist `((parent-frame . ,(window-frame))
                     (visibility   . t)
                     (top    .  ,(+ (cdr x-and-y) 10))
                     (left   .  ,(+ (car x-and-y) 10))
                     (width  .  ,(+ string-width 1))
                     (height .  ,(+ string-height 1))))
      (let ((parameter (car alist))
            (value (cdr alist)))
        (set-frame-parameter
         my-child-frame parameter value)))

    (with-current-buffer buffer
      (erase-buffer)
      (insert string)
      (redisplay))))
@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 14, 2017

Member

Could you give an example without dependency on pos-tip?

Member

dgutov commented Dec 14, 2017

Could you give an example without dependency on pos-tip?

@rswgnu

This comment has been minimized.

Show comment
Hide comment
@rswgnu

rswgnu Dec 14, 2017

Yes, please do. Also, this line fails for me as you have already set the parent frame earlier:
(dolist (alist `((parent-frame . ,(window-frame))

Removing the parent-frame property from this list makes it work for me. You should figure out the property to remove the gutter at the left of the window as well since it is not needed.

And try to minimize the number of properties set so we can see the minimal amount of work needed to get what you are trying to show. It would be strange if you had to set so many properties to make a simple undecorated child window.

rswgnu commented Dec 14, 2017

Yes, please do. Also, this line fails for me as you have already set the parent frame earlier:
(dolist (alist `((parent-frame . ,(window-frame))

Removing the parent-frame property from this list makes it work for me. You should figure out the property to remove the gutter at the left of the window as well since it is not needed.

And try to minimize the number of properties set so we can see the minimal amount of work needed to get what you are trying to show. It would be strange if you had to set so many properties to make a simple undecorated child window.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 14, 2017

I will provide a simple example today, please wait a little

tumashu commented Dec 14, 2017

I will provide a simple example today, please wait a little

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 15, 2017

(defvar my-tooltip-child-frame nil)
(defvar my-tooltip-current-frame nil)

(defun my-tooltip-show-with-child-frame (string position)
  (let* ((window-min-height 1)
         (window-min-width 1)
         (frame-resize-pixelwise t)
         (frame (window-frame))
         (buffer (get-buffer-create " *my-child-frame-buffer*"))
         (min-size '(2 . 10))
         x-and-y)
    (unless (and (eq frame my-tooltip-current-frame)
                 (frame-live-p my-tooltip-child-frame))
      (when (frame-live-p my-tooltip-child-frame)
        (delete-frame my-tooltip-child-frame))
      (setq my-tooltip-current-frame frame)
      (setq my-tooltip-child-frame
            (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,frame)
                 (no-accept-focus . t)
                 (min-width  . t)
                 (min-height . t)
                 (border-width . 0)
                 (internal-border-width . 0)
                 (vertical-scroll-bars . nil)
                 (horizontal-scroll-bars . nil)
                 (left-fringe . 10)
                 (right-fringe . 0)
                 (menu-bar-lines . 0)
                 (tool-bar-lines . 0)
                 (line-spacing . 0)
                 (unsplittable . t)
                 (no-other-frame . t)
                 (undecorated . t)
                 (visibility . nil)
                 (cursor-type . nil)
                 (minibuffer . nil)
                 (width . 50)
                 (height . 1)
                 (no-special-glyphs . t)))))
      (set-window-buffer
       (frame-root-window my-tooltip-child-frame) buffer))

    (with-current-buffer buffer
      (setq mode-line-format nil
            header-line-format nil)
      (erase-buffer)
      (insert string))

    (let ((child-frame my-tooltip-child-frame))
      (fit-frame-to-buffer
       child-frame nil (car min-size) nil (cdr min-size))
      (setq x-and-y (my-tooltip-compute-pixel-position
                     position
                     (frame-pixel-width child-frame)
                     (frame-pixel-height child-frame)))
      (set-frame-position child-frame (car x-and-y) (+ (cdr x-and-y) 1))
      (make-frame-visible child-frame))))

(defun my-tooltip-compute-pixel-position (pos pixel-width pixel-height)
  "Return pixel position of POS in WINDOW, which indicates relative
coordinates of bottom left corner of the object, its returned value is
like (X . Y)

If PIXEL-WIDTH and PIXEL-HEIGHT are given, this function regard these
values as the size of a small window located around the POS, for example:
tooltip. These values are used to adjust the small window's location and
let it not disappear by sticking out of the display.

This function is shameless steal from pos-tip."
  (let* ((window (selected-window))
         (frame (window-frame window))
         (xmax (frame-pixel-width frame))
	     (ymax (frame-pixel-height frame))
         (posn (posn-at-point pos window))
         (line (cdr (posn-actual-col-row posn)))
         (line-height
		  (or (window-line-height line window)
			  (and (redisplay t)
				   (window-line-height line window))))
         (x-y (or (posn-x-y posn) '(0 . 0)))
         (x (+ (car (window-inside-pixel-edges window))
	           (car x-y)))
         (y0 (+ (cadr (window-pixel-edges window))
		        (or (nth 2 line-height) (cdr x-y))))
         (y (+ y0 (car line-height))))
    (cons (max 0 (min x (- xmax (or pixel-width 0))))
	      (max 0 (if (> (+ y (or pixel-height 0)) ymax)
		             (- y0 (or pixel-height 0))
                   y)))))

(my-tooltip-show-with-child-frame
 "1. test1
2. test2
3. test3
4. test4"
 (point))

(delete-frame my-tooltip-child-frame)

tumashu commented Dec 15, 2017

(defvar my-tooltip-child-frame nil)
(defvar my-tooltip-current-frame nil)

(defun my-tooltip-show-with-child-frame (string position)
  (let* ((window-min-height 1)
         (window-min-width 1)
         (frame-resize-pixelwise t)
         (frame (window-frame))
         (buffer (get-buffer-create " *my-child-frame-buffer*"))
         (min-size '(2 . 10))
         x-and-y)
    (unless (and (eq frame my-tooltip-current-frame)
                 (frame-live-p my-tooltip-child-frame))
      (when (frame-live-p my-tooltip-child-frame)
        (delete-frame my-tooltip-child-frame))
      (setq my-tooltip-current-frame frame)
      (setq my-tooltip-child-frame
            (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,frame)
                 (no-accept-focus . t)
                 (min-width  . t)
                 (min-height . t)
                 (border-width . 0)
                 (internal-border-width . 0)
                 (vertical-scroll-bars . nil)
                 (horizontal-scroll-bars . nil)
                 (left-fringe . 10)
                 (right-fringe . 0)
                 (menu-bar-lines . 0)
                 (tool-bar-lines . 0)
                 (line-spacing . 0)
                 (unsplittable . t)
                 (no-other-frame . t)
                 (undecorated . t)
                 (visibility . nil)
                 (cursor-type . nil)
                 (minibuffer . nil)
                 (width . 50)
                 (height . 1)
                 (no-special-glyphs . t)))))
      (set-window-buffer
       (frame-root-window my-tooltip-child-frame) buffer))

    (with-current-buffer buffer
      (setq mode-line-format nil
            header-line-format nil)
      (erase-buffer)
      (insert string))

    (let ((child-frame my-tooltip-child-frame))
      (fit-frame-to-buffer
       child-frame nil (car min-size) nil (cdr min-size))
      (setq x-and-y (my-tooltip-compute-pixel-position
                     position
                     (frame-pixel-width child-frame)
                     (frame-pixel-height child-frame)))
      (set-frame-position child-frame (car x-and-y) (+ (cdr x-and-y) 1))
      (make-frame-visible child-frame))))

(defun my-tooltip-compute-pixel-position (pos pixel-width pixel-height)
  "Return pixel position of POS in WINDOW, which indicates relative
coordinates of bottom left corner of the object, its returned value is
like (X . Y)

If PIXEL-WIDTH and PIXEL-HEIGHT are given, this function regard these
values as the size of a small window located around the POS, for example:
tooltip. These values are used to adjust the small window's location and
let it not disappear by sticking out of the display.

This function is shameless steal from pos-tip."
  (let* ((window (selected-window))
         (frame (window-frame window))
         (xmax (frame-pixel-width frame))
	     (ymax (frame-pixel-height frame))
         (posn (posn-at-point pos window))
         (line (cdr (posn-actual-col-row posn)))
         (line-height
		  (or (window-line-height line window)
			  (and (redisplay t)
				   (window-line-height line window))))
         (x-y (or (posn-x-y posn) '(0 . 0)))
         (x (+ (car (window-inside-pixel-edges window))
	           (car x-y)))
         (y0 (+ (cadr (window-pixel-edges window))
		        (or (nth 2 line-height) (cdr x-y))))
         (y (+ y0 (car line-height))))
    (cons (max 0 (min x (- xmax (or pixel-width 0))))
	      (max 0 (if (> (+ y (or pixel-height 0)) ymax)
		             (- y0 (or pixel-height 0))
                   y)))))

(my-tooltip-show-with-child-frame
 "1. test1
2. test2
3. test3
4. test4"
 (point))

(delete-frame my-tooltip-child-frame)

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 15, 2017

Function my-tooltip-compute-pixel-position may complicate, I have ask this problem in emacs-devel,
discuss are welcome :-).
http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00216.html

tumashu commented Dec 15, 2017

Function my-tooltip-compute-pixel-position may complicate, I have ask this problem in emacs-devel,
discuss are welcome :-).
http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00216.html

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 15, 2017

this is an example usecase of child-frame in pyim:

1

tumashu commented Dec 15, 2017

this is an example usecase of child-frame in pyim:

1

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 15, 2017

Member

Cool. That seems to work.

We can't use a "shameless steal from pos-tip", though. It's longer than the allowed limit of code without copyright assignment.

Member

dgutov commented Dec 15, 2017

Cool. That seems to work.

We can't use a "shameless steal from pos-tip", though. It's longer than the allowed limit of code without copyright assignment.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 15, 2017

I just provide an example to tell people that child-frame can be used as frontend :-)

tumashu commented Dec 15, 2017

I just provide an example to tell people that child-frame can be used as frontend :-)

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 15, 2017

Member

That's good. As long as they don't copy-paste your code.

Member

dgutov commented Dec 15, 2017

That's good. As long as they don't copy-paste your code.

@cpitclaudel

This comment has been minimized.

Show comment
Hide comment
@cpitclaudel

cpitclaudel Dec 15, 2017

Contributor

Neat. I ran my own experiment with this a while ago:

;;; company-tooltip.el --- Use a real ppup to show company candidates

;;; Commentary:
;;

;;; Code:

(require 'company)

(defun company-tooltip--frame-params (parent-frame)
  "Compute parameters for `company-tooltip--frame'.
The resulting frame remains live until PARENT-FRAME is deleted."
  `(;; Initial state
    (fullscreen . nil)
    (line-spacing . 0)
    ;; Size
    (min-height . 0)
    (min-width . 0)
    ;; Borders and fringes
    (left-fringe . 0)
    (right-fringe . 0)
    (right-divider-width . 0)
    (bottom-divider-width . 0)
    (border-width . 0)
    (internal-border-width . 0)
    ;; UI components
    (undecorated . t)
    (menu-bar-lines . 0)
    (tool-bar-lines . 0)
    (vertical-scroll-bars . nil)
    (horizontal-scroll-bars . nil)
    ;; Buffers
    (minibuffer . nil)
    (unsplittable . t)
    ;; Appearance
    (cursor-type . nil)
    (background-color . ,(face-attribute 'company-tooltip :background))
    ;; Behavior
    (override-redirect . t)
    (delete-before . ,parent-frame)
    (no-focus-on-map . t)
    (skip-taskbar . t)
    (no-other-frame . t)
    (no-accept-focus . t)
    (z-group . above)))

(defvar company-tooltip--frame nil)
(defvar company-tooltip--buffer nil)

(defun company-tooltip--adjust-frame (x y width height)
  "Move company tooltip to X, Y and resize to WIDTH, HEIGHT."
  (set-frame-position company-tooltip--frame x y)
  (set-frame-width company-tooltip--frame width)
  (set-frame-height company-tooltip--frame height))

(defun company-tooltip--ensure-frame (x y width height)
  "Create or return the company tooltip frame.
X, Y, WIDTH, HEIGHT: see `company-tooltip--adjust-frame'."
  (unless (frame-live-p company-tooltip--frame)
    (setq company-tooltip--frame (make-frame `((top . ,y)
                                (left . ,x)
                                (width . ,width)
                                (height . ,height)
                                ,@(company-tooltip--frame-params (selected-frame))))))
  (company-tooltip--adjust-frame x y width height)
  (make-frame-visible company-tooltip--frame)
  (raise-frame company-tooltip--frame))

(defvar company-tooltip--map
  (let ((map (make-keymap)))
    ;; FIXME this doesn't cause mouse events to be ignored
    (define-key map [t] 'ignore)
    map))

(define-derived-mode company-tooltip--mode fundamental-mode "tooltip"
  "Major mode for company tooltip frames."
  (setq-local overriding-local-map company-tooltip--map)
  (setq-local truncate-lines t)
  (setq-local mode-line-format nil)
  (setq-local cursor-type nil)
  (setq-local cursor-in-non-selected-windows nil)
  (setq-local show-trailing-whitespace nil)
  (setq-local buffer-display-table (make-display-table))
  (set-display-table-slot buffer-display-table 0 []))

(defun company-tooltip--ensure-buffer ()
  "Create or return the company tooltip buffer."
  (unless (buffer-live-p company-tooltip--buffer)
    (with-current-buffer (get-buffer-create " *company-tooltip*")
      (company-tooltip--mode)
      (setq company-tooltip--buffer (current-buffer)))))

(defun company-tooltip--set-buffer ()
  "Set buffer of company tooltip frame."
  (company-tooltip--ensure-buffer)
  (set-window-buffer (frame-root-window company-tooltip--frame) company-tooltip--buffer))

(defun company-tooltip--posn-x-y (position)
  "Return X and Y coordinates of bottom-left corner of POSITION."
  (let* ((point-x-y (posn-x-y position))
         (window (posn-window position))
         (win-edges (window-edges window nil t t))
         (win-x-y (cons (nth 0 win-edges) (nth 1 win-edges)))
         (frame-x-y (cons (frame-parameter (selected-frame) 'top)
                          (frame-parameter (selected-frame) 'left))))
    (cons (+ (car point-x-y) (car win-x-y))
          (+ (cdr point-x-y) (cdr win-x-y)
             (line-pixel-height) (window-header-line-height window)))))

(defun company-tooltip--update-1 (width height contents)
  "Update position, WIDTH, HEIGHT, CONTENTS, and visibility of tooltip frame."
  (let* ((x-y (company-tooltip--posn-x-y (save-excursion
                            (backward-char (length company-prefix))
                            (posn-at-point)))))
    (company-tooltip--ensure-frame (car x-y) (cdr x-y) width (abs height))
    (company-tooltip--set-buffer)
    (with-current-buffer company-tooltip--buffer
      (erase-buffer)
      (insert contents))))

(defun company-tooltip--height ()
  "Compute height of pseudo tooltip."
  (min company-tooltip-limit company-candidates-length))

(defun company-tooltip--update ()
  "Update contents of company tooltip."
  (let* ((height (company-tooltip--height))
         (lines (company--create-lines company-selection height))
         (contents (mapconcat #'identity lines "\n")))
    (company-tooltip--update-1 (+ 0 (string-width (car lines))) height contents)))

(defun company-tooltip-show ()
  "Show company tooltip at point."
  (company-tooltip--update))

(defun company-tooltip-hide ()
  "Hide company tooltip."
  (message "Hiding!")
  (when (frame-live-p company-tooltip--frame)
    (make-frame-invisible company-tooltip--frame)))

(defun company-tooltip-kill ()
  "Kill company-tooltip's frame and buffer."
  (when (frame-live-p company-tooltip--frame)
    (delete-frame company-tooltip--frame)
    (setq company-tooltip--frame nil))
  (when (bufferp company-tooltip--buffer)
    (kill-buffer company-tooltip--buffer)
    (setq company-tooltip--buffer nil)))

(defun company-tooltip-frontend (command)
  "`company-mode' frontend using a real X tooltip.
COMMAND: See `company-frontends'."
  (cl-case command
    (pre-command nil)
    (show (company-tooltip-show))
    (hide (company-tooltip-hide))
    (update (company-tooltip--update))
    (post-command (company-tooltip--update))))

(defun company-tooltip-enable ()
  "Replace `company-pseudo-tooltip-frontend' with `company-tooltip-frontend'."
  (kill-local-variable 'company-frontends)
  (setq-local company-frontends (remove 'company-pseudo-tooltip-frontend
                                        (remove 'company-pseudo-tooltip-unless-just-one-frontend
                                                company-frontends)))
  (add-to-list 'company-frontends 'company-tooltip-frontend))

(provide 'company-tooltip)
;;; company-tooltip.el ends here

That code is all new / mine

Contributor

cpitclaudel commented Dec 15, 2017

Neat. I ran my own experiment with this a while ago:

;;; company-tooltip.el --- Use a real ppup to show company candidates

;;; Commentary:
;;

;;; Code:

(require 'company)

(defun company-tooltip--frame-params (parent-frame)
  "Compute parameters for `company-tooltip--frame'.
The resulting frame remains live until PARENT-FRAME is deleted."
  `(;; Initial state
    (fullscreen . nil)
    (line-spacing . 0)
    ;; Size
    (min-height . 0)
    (min-width . 0)
    ;; Borders and fringes
    (left-fringe . 0)
    (right-fringe . 0)
    (right-divider-width . 0)
    (bottom-divider-width . 0)
    (border-width . 0)
    (internal-border-width . 0)
    ;; UI components
    (undecorated . t)
    (menu-bar-lines . 0)
    (tool-bar-lines . 0)
    (vertical-scroll-bars . nil)
    (horizontal-scroll-bars . nil)
    ;; Buffers
    (minibuffer . nil)
    (unsplittable . t)
    ;; Appearance
    (cursor-type . nil)
    (background-color . ,(face-attribute 'company-tooltip :background))
    ;; Behavior
    (override-redirect . t)
    (delete-before . ,parent-frame)
    (no-focus-on-map . t)
    (skip-taskbar . t)
    (no-other-frame . t)
    (no-accept-focus . t)
    (z-group . above)))

(defvar company-tooltip--frame nil)
(defvar company-tooltip--buffer nil)

(defun company-tooltip--adjust-frame (x y width height)
  "Move company tooltip to X, Y and resize to WIDTH, HEIGHT."
  (set-frame-position company-tooltip--frame x y)
  (set-frame-width company-tooltip--frame width)
  (set-frame-height company-tooltip--frame height))

(defun company-tooltip--ensure-frame (x y width height)
  "Create or return the company tooltip frame.
X, Y, WIDTH, HEIGHT: see `company-tooltip--adjust-frame'."
  (unless (frame-live-p company-tooltip--frame)
    (setq company-tooltip--frame (make-frame `((top . ,y)
                                (left . ,x)
                                (width . ,width)
                                (height . ,height)
                                ,@(company-tooltip--frame-params (selected-frame))))))
  (company-tooltip--adjust-frame x y width height)
  (make-frame-visible company-tooltip--frame)
  (raise-frame company-tooltip--frame))

(defvar company-tooltip--map
  (let ((map (make-keymap)))
    ;; FIXME this doesn't cause mouse events to be ignored
    (define-key map [t] 'ignore)
    map))

(define-derived-mode company-tooltip--mode fundamental-mode "tooltip"
  "Major mode for company tooltip frames."
  (setq-local overriding-local-map company-tooltip--map)
  (setq-local truncate-lines t)
  (setq-local mode-line-format nil)
  (setq-local cursor-type nil)
  (setq-local cursor-in-non-selected-windows nil)
  (setq-local show-trailing-whitespace nil)
  (setq-local buffer-display-table (make-display-table))
  (set-display-table-slot buffer-display-table 0 []))

(defun company-tooltip--ensure-buffer ()
  "Create or return the company tooltip buffer."
  (unless (buffer-live-p company-tooltip--buffer)
    (with-current-buffer (get-buffer-create " *company-tooltip*")
      (company-tooltip--mode)
      (setq company-tooltip--buffer (current-buffer)))))

(defun company-tooltip--set-buffer ()
  "Set buffer of company tooltip frame."
  (company-tooltip--ensure-buffer)
  (set-window-buffer (frame-root-window company-tooltip--frame) company-tooltip--buffer))

(defun company-tooltip--posn-x-y (position)
  "Return X and Y coordinates of bottom-left corner of POSITION."
  (let* ((point-x-y (posn-x-y position))
         (window (posn-window position))
         (win-edges (window-edges window nil t t))
         (win-x-y (cons (nth 0 win-edges) (nth 1 win-edges)))
         (frame-x-y (cons (frame-parameter (selected-frame) 'top)
                          (frame-parameter (selected-frame) 'left))))
    (cons (+ (car point-x-y) (car win-x-y))
          (+ (cdr point-x-y) (cdr win-x-y)
             (line-pixel-height) (window-header-line-height window)))))

(defun company-tooltip--update-1 (width height contents)
  "Update position, WIDTH, HEIGHT, CONTENTS, and visibility of tooltip frame."
  (let* ((x-y (company-tooltip--posn-x-y (save-excursion
                            (backward-char (length company-prefix))
                            (posn-at-point)))))
    (company-tooltip--ensure-frame (car x-y) (cdr x-y) width (abs height))
    (company-tooltip--set-buffer)
    (with-current-buffer company-tooltip--buffer
      (erase-buffer)
      (insert contents))))

(defun company-tooltip--height ()
  "Compute height of pseudo tooltip."
  (min company-tooltip-limit company-candidates-length))

(defun company-tooltip--update ()
  "Update contents of company tooltip."
  (let* ((height (company-tooltip--height))
         (lines (company--create-lines company-selection height))
         (contents (mapconcat #'identity lines "\n")))
    (company-tooltip--update-1 (+ 0 (string-width (car lines))) height contents)))

(defun company-tooltip-show ()
  "Show company tooltip at point."
  (company-tooltip--update))

(defun company-tooltip-hide ()
  "Hide company tooltip."
  (message "Hiding!")
  (when (frame-live-p company-tooltip--frame)
    (make-frame-invisible company-tooltip--frame)))

(defun company-tooltip-kill ()
  "Kill company-tooltip's frame and buffer."
  (when (frame-live-p company-tooltip--frame)
    (delete-frame company-tooltip--frame)
    (setq company-tooltip--frame nil))
  (when (bufferp company-tooltip--buffer)
    (kill-buffer company-tooltip--buffer)
    (setq company-tooltip--buffer nil)))

(defun company-tooltip-frontend (command)
  "`company-mode' frontend using a real X tooltip.
COMMAND: See `company-frontends'."
  (cl-case command
    (pre-command nil)
    (show (company-tooltip-show))
    (hide (company-tooltip-hide))
    (update (company-tooltip--update))
    (post-command (company-tooltip--update))))

(defun company-tooltip-enable ()
  "Replace `company-pseudo-tooltip-frontend' with `company-tooltip-frontend'."
  (kill-local-variable 'company-frontends)
  (setq-local company-frontends (remove 'company-pseudo-tooltip-frontend
                                        (remove 'company-pseudo-tooltip-unless-just-one-frontend
                                                company-frontends)))
  (add-to-list 'company-frontends 'company-tooltip-frontend))

(provide 'company-tooltip)
;;; company-tooltip.el ends here

That code is all new / mine

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu commented Dec 15, 2017

cool

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 16, 2017

I have tested this company-tooltip, but it tooooo slow ........

tumashu commented Dec 16, 2017

I have tested this company-tooltip, but it tooooo slow ........

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 16, 2017

Member

Clement, is this experiment supposed to be functional?

It's quite slow here, and positioning has problems (they might be HiDPI related, though). Here's a video demonstration, it's real-time: https://sendvid.com/w9lwkwgd

Sorry about the red lines and the cropping: Kazam has HiDPI issues of its own.

Member

dgutov commented Dec 16, 2017

Clement, is this experiment supposed to be functional?

It's quite slow here, and positioning has problems (they might be HiDPI related, though). Here's a video demonstration, it's real-time: https://sendvid.com/w9lwkwgd

Sorry about the red lines and the cropping: Kazam has HiDPI issues of its own.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 17, 2017

Ah, company-tootip seem to not use child-frame. try below example

I have create a temp package used to test, when I have new idea, I will update it.
until it can be used as a basic of PR of company.

its code come from @cpitclaudel and me (@tumashu), all we have assigned copyright

https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

tumashu commented Dec 17, 2017

Ah, company-tootip seem to not use child-frame. try below example

I have create a temp package used to test, when I have new idea, I will update it.
until it can be used as a basic of PR of company.

its code come from @cpitclaudel and me (@tumashu), all we have assigned copyright

https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

@cpitclaudel

This comment has been minimized.

Show comment
Hide comment
@cpitclaudel

cpitclaudel Dec 17, 2017

Contributor

Clement, is this experiment supposed to be functional?

Roughly; at least, it works OK on my machine.
I haven't looked at performance too much. This was the example I used to request features from Martin on Emacs-devel a year ago.

Contributor

cpitclaudel commented Dec 17, 2017

Clement, is this experiment supposed to be functional?

Roughly; at least, it works OK on my machine.
I haven't looked at performance too much. This was the example I used to request features from Martin on Emacs-devel a year ago.

@MaskRay

This comment has been minimized.

Show comment
Hide comment
@MaskRay

MaskRay Dec 30, 2017

Neat. Do you plan to make company-childframe.el a PR?

MaskRay commented Dec 30, 2017

Neat. Do you plan to make company-childframe.el a PR?

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 30, 2017

Member

@tumashu

Ah, company-tootip seem to not use child-frame. try below example

This one is pretty fast, though not without its problems. (HiDPI) positioning among them.

Member

dgutov commented Dec 30, 2017

@tumashu

Ah, company-tootip seem to not use child-frame. try below example

This one is pretty fast, though not without its problems. (HiDPI) positioning among them.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Dec 30, 2017

@MaskRay The above example's code is not mine, it come from company-tooltip.el and pos-tip.el, which
may not suit for create a PR.

tumashu commented Dec 30, 2017

@MaskRay The above example's code is not mine, it come from company-tooltip.el and pos-tip.el, which
may not suit for create a PR.

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Dec 30, 2017

Member

Using company-tooltip.el is fine because Clement has assigned copyright already. pos-tip, on the other hand, is not.

Member

dgutov commented Dec 30, 2017

Using company-tooltip.el is fine because Clement has assigned copyright already. pos-tip, on the other hand, is not.

@seagle0128

This comment has been minimized.

Show comment
Hide comment
@seagle0128

seagle0128 Jan 3, 2018

Seems childframe is better than popup, but it seems not stable enough for now.
There is a compatibility issue with child-frame and deskop-save-mode. I got this error after restarting Emacs.

set-frame-parameter: Invalid specification of ‘parent-frame’

seagle0128 commented Jan 3, 2018

Seems childframe is better than popup, but it seems not stable enough for now.
There is a compatibility issue with child-frame and deskop-save-mode. I got this error after restarting Emacs.

set-frame-parameter: Invalid specification of ‘parent-frame’
@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 3, 2018

Member

Please report any problems like that with M-x report-emacs-bug, so that we can use child frames starting with some Emacs release.

Member

dgutov commented Jan 3, 2018

Please report any problems like that with M-x report-emacs-bug, so that we can use child frames starting with some Emacs release.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 7, 2018

@dgutov the below function is code by myself, which use Eli's suggestion, this function
can be used by company, for I have assigned copyright when I hack org-mode

From: Eli Zaretskii <eliz@gnu.org>
Subject: Re: How to create a small child-frame which only show two lines
To: tumashu <tumashu@163.com>
CC: rudalics@gmx.at, emacs-devel@gnu.org
Date: Mon, 11 Dec 2017 23:29:28 +0800
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Reply-to: Eli Zaretskii <eliz@gnu.org>

> Date: Mon, 11 Dec 2017 16:29:16 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> by the way, does emacs has a function, which can get the point's left-bottom pixel position,  if not,
> is it possible to add it to emacs?

Doesn't vertical-motion fit the bill?  If not, why not?

https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

tumashu commented Jan 7, 2018

@dgutov the below function is code by myself, which use Eli's suggestion, this function
can be used by company, for I have assigned copyright when I hack org-mode

From: Eli Zaretskii <eliz@gnu.org>
Subject: Re: How to create a small child-frame which only show two lines
To: tumashu <tumashu@163.com>
CC: rudalics@gmx.at, emacs-devel@gnu.org
Date: Mon, 11 Dec 2017 23:29:28 +0800
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Reply-to: Eli Zaretskii <eliz@gnu.org>

> Date: Mon, 11 Dec 2017 16:29:16 +0800 (CST)
> From: tumashu  <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> 
> by the way, does emacs has a function, which can get the point's left-bottom pixel position,  if not,
> is it possible to add it to emacs?

Doesn't vertical-motion fit the bill?  If not, why not?

https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

@terlar

This comment has been minimized.

Show comment
Hide comment
@terlar

terlar Jan 7, 2018

Contributor

When the tool-tip is displayed below with this one, it is slightly off, it overlaps even if I have (setq line-spacing 0.2), if I decrease that to 0 it overlaps half the line.

Another heads-up for the child-frame display in general is that company-quickhelp doesn't seem to work together, it just doesn't display anything.

Contributor

terlar commented Jan 7, 2018

When the tool-tip is displayed below with this one, it is slightly off, it overlaps even if I have (setq line-spacing 0.2), if I decrease that to 0 it overlaps half the line.

Another heads-up for the child-frame display in general is that company-quickhelp doesn't seem to work together, it just doesn't display anything.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu commented Jan 7, 2018

Try new version of company-childframe.el @terlar and tell me the result

https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

@terlar

This comment has been minimized.

Show comment
Hide comment
@terlar

terlar Jan 7, 2018

Contributor

No difference as far as I can tell.

It looks like this:
2018-01-07-185041_1167x599_scrot

Compared to the pos-tip based one:
2018-01-07-185946_973x383_scrot

Contributor

terlar commented Jan 7, 2018

No difference as far as I can tell.

It looks like this:
2018-01-07-185041_1167x599_scrot

Compared to the pos-tip based one:
2018-01-07-185946_973x383_scrot

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 7, 2018

can you provide the screenshot when (setq line-spacing 1.1) ? @terlar

tumashu commented Jan 7, 2018

can you provide the screenshot when (setq line-spacing 1.1) ? @terlar

@terlar

This comment has been minimized.

Show comment
Hide comment
@terlar

terlar Jan 7, 2018

Contributor

As I suspected it works, but it is a bit excessive line spacing as you can see:
2018-01-07-195425_1385x985_scrot

Hope this helps, let me know if I should run some more tests.

Contributor

terlar commented Jan 7, 2018

As I suspected it works, but it is a bit excessive line spacing as you can see:
2018-01-07-195425_1385x985_scrot

Hope this helps, let me know if I should run some more tests.

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 7, 2018

Contributor

FWIW, the positioning does not work at all on macOS. I have two monitors (both hiDPI).

Also, I saw an error trigger at some point in

      (fit-frame-to-buffer
       child-frame nil (car min-size) nil (cdr min-size))

Though I can no longer repro that. Something about terminal-live-p

Contributor

aaronjensen commented Jan 7, 2018

FWIW, the positioning does not work at all on macOS. I have two monitors (both hiDPI).

Also, I saw an error trigger at some point in

      (fit-frame-to-buffer
       child-frame nil (car min-size) nil (cdr min-size))

Though I can no longer repro that. Something about terminal-live-p

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 8, 2018

@terlar I have tested in linux and window, seem to no problem:

qq 20180108085210

I change my font and test again, no problem too:

qq 20180108085210

If you use mac, maybe it is posn-at-point's bug in mac, which can not get the proper top-left pixel
position.

tumashu commented Jan 8, 2018

@terlar I have tested in linux and window, seem to no problem:

qq 20180108085210

I change my font and test again, no problem too:

qq 20180108085210

If you use mac, maybe it is posn-at-point's bug in mac, which can not get the proper top-left pixel
position.

@fuxialexander

This comment has been minimized.

Show comment
Hide comment
@fuxialexander

fuxialexander Jan 10, 2018

@dgutov Which version of Emacs are you using? I think there are some difference between Emacs 26 and the HEAD. The HEAD after patching works well for me (the patch was already pushed to Emacs 26 but seems not on HEAD yet).

I mean this patch in this issue

If you are talking about the Linux version, please check whether in your config (make-frame-visible child-frame) is at the end of (defun company-childframe--update-1)

fuxialexander commented Jan 10, 2018

@dgutov Which version of Emacs are you using? I think there are some difference between Emacs 26 and the HEAD. The HEAD after patching works well for me (the patch was already pushed to Emacs 26 but seems not on HEAD yet).

I mean this patch in this issue

If you are talking about the Linux version, please check whether in your config (make-frame-visible child-frame) is at the end of (defun company-childframe--update-1)

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 10, 2018

@dgutov Please test the newest code and (setq company-tooltip-minimum-width 45)

tumashu commented Jan 10, 2018

@dgutov Please test the newest code and (setq company-tooltip-minimum-width 45)

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 10, 2018

Member

Which version of Emacs are you using?

The latest emacs-26 with the scaling patch.

If you are talking about the Linux version, please check whether in your config (make-frame-visible child-frame) is at the end of (defun company-childframe--update-1)

Yes, I'm on GNU/Linux, and yes, it's there. I'm very careful to use the latest code every time.

Member

dgutov commented Jan 10, 2018

Which version of Emacs are you using?

The latest emacs-26 with the scaling patch.

If you are talking about the Linux version, please check whether in your config (make-frame-visible child-frame) is at the end of (defun company-childframe--update-1)

Yes, I'm on GNU/Linux, and yes, it's there. I'm very careful to use the latest code every time.

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 10, 2018

Member

Please test the newest code and (setq company-tooltip-minimum-width 45)

No change.

Member

dgutov commented Jan 10, 2018

Please test the newest code and (setq company-tooltip-minimum-width 45)

No change.

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 10, 2018

Member

Here's a screencast: https://send.firefox.com/download/e18a363327/#ciIkNFtg47kmIUg4tXtYJg (will expire after 24 hours or 20 downloads).

Member

dgutov commented Jan 10, 2018

Here's a screencast: https://send.firefox.com/download/e18a363327/#ciIkNFtg47kmIUg4tXtYJg (will expire after 24 hours or 20 downloads).

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 11, 2018

@dgutov
It is the reason:
1

Could you record two screencasts of the below code?
1.

(let ((test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10)))))
      (pos (posn-x-y (posn-at-point (point) (selected-window)))))
  (set-frame-position test (car pos) (cdr pos)))
(let ((buffer (get-buffer-create "*test*"))
      (test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10)))))
      (pos (posn-x-y (posn-at-point (point) (selected-window)))))
  (set-window-buffer (frame-root-window test) buffer)
  (set-frame-position test (car pos) (cdr pos))
  (with-current-buffer buffer
    (erase-buffer)
    (insert "--------------------
--------------------
--------------"))
  (fit-frame-to-buffer test))

tumashu commented Jan 11, 2018

@dgutov
It is the reason:
1

Could you record two screencasts of the below code?
1.

(let ((test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10)))))
      (pos (posn-x-y (posn-at-point (point) (selected-window)))))
  (set-frame-position test (car pos) (cdr pos)))
(let ((buffer (get-buffer-create "*test*"))
      (test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10)))))
      (pos (posn-x-y (posn-at-point (point) (selected-window)))))
  (set-window-buffer (frame-root-window test) buffer)
  (set-frame-position test (car pos) (cdr pos))
  (with-current-buffer buffer
    (erase-buffer)
    (insert "--------------------
--------------------
--------------"))
  (fit-frame-to-buffer test))

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 11, 2018

Contributor

@tumashu I just got a child frame stuck. I had it open when I C-c C-c from an org capture buffer. The buffer closed and the child frame was left floating where it was.

Contributor

aaronjensen commented Jan 11, 2018

@tumashu I just got a child frame stuck. I had it open when I C-c C-c from an org capture buffer. The buffer closed and the child frame was left floating where it was.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 11, 2018

@aaronjensen (kill-frame company-childframe-child-frame)

tumashu commented Jan 11, 2018

@aaronjensen (kill-frame company-childframe-child-frame)

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 11, 2018

Contributor

@tumashu I was able to kill it by just triggering it again in another buffer. I was just passing it on as a bug.

Contributor

aaronjensen commented Jan 11, 2018

@tumashu I was able to kill it by just triggering it again in another buffer. I was just passing it on as a bug.

@dgutov

This comment has been minimized.

Show comment
Hide comment
@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@dgutov Seem to no problem like above

tumashu commented Jan 12, 2018

@dgutov Seem to no problem like above

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen A snapshot or screencase is better.

tumashu commented Jan 12, 2018

@aaronjensen A snapshot or screencase is better.

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 12, 2018

Member

Seem to no problem like above

Indeed.

Member

dgutov commented Jan 12, 2018

Seem to no problem like above

Indeed.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@dgutov I have use another method to get position, you can try the newest code again, maybe the old method tragger some unexpect things.

tumashu commented Jan 12, 2018

@dgutov I have use another method to get position, you can try the newest code again, maybe the old method tragger some unexpect things.

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

sticky

@tumashu this is it sticking after the current window is closed

Contributor

aaronjensen commented Jan 12, 2018

sticky

@tumashu this is it sticking after the current window is closed

@dgutov

This comment has been minimized.

Show comment
Hide comment
@dgutov

dgutov Jan 12, 2018

Member

@tumashu Alas, no change here.

Member

dgutov commented Jan 12, 2018

@tumashu Alas, no change here.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen Fixed, rerun company-childframe-enable.

tumashu commented Jan 12, 2018

@aaronjensen Fixed, rerun company-childframe-enable.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu commented Jan 12, 2018

@dgutov ...

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

@tumashu that version is broken for me

Company: An error occurred in auto-begin
Company: frontend company-childframe-frontend error "Invalid specification of ‘parent-frame’" on command show

Also, is it possible to make company-childframe-enable not prompt for confirmation unless run interactively? Or some var I can set to bypass it. I've been setting it up manually to avoid that.

Contributor

aaronjensen commented Jan 12, 2018

@tumashu that version is broken for me

Company: An error occurred in auto-begin
Company: frontend company-childframe-frontend error "Invalid specification of ‘parent-frame’" on command show

Also, is it possible to make company-childframe-enable not prompt for confirmation unless run interactively? Or some var I can set to bypass it. I've been setting it up manually to avoid that.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen Fixed.

(let ((test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10))))))
  (set-frame-parameter test 'parent-frame (window-frame)))

Please test the above code and send me the backtrack.

tumashu commented Jan 12, 2018

@aaronjensen Fixed.

(let ((test (let ((after-make-frame-functions nil))
              (make-frame
               `((parent-frame . ,(window-frame))
                 (width . 10)
                 (height . 10))))))
  (set-frame-parameter test 'parent-frame (window-frame)))

Please test the above code and send me the backtrack.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen update and config like the below:

(setq company-childframe-force-enable t)

tumashu commented Jan 12, 2018

@aaronjensen update and config like the below:

(setq company-childframe-force-enable t)
@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

@tumashu

Debugger entered--Lisp error: (error "Invalid specification of ‘parent-frame’")
  modify-frame-parameters(#<frame Emacs 0x114d8b960> ((parent-frame . #<frame *scratch* 0x106815a30>)))
  set-frame-parameter(#<frame Emacs 0x114d8b960> parent-frame #<frame *scratch* 0x106815a30>)
  (let ((test (let ((after-make-frame-functions nil)) (make-frame (cons (cons 'parent-frame (window-frame)) '((width . 10) (height . 10))))))) (set-frame-parameter test 'parent-frame (window-frame)))
  eval((let ((test (let ((after-make-frame-functions nil)) (make-frame (cons (cons 'parent-frame (window-frame)) '((width . 10) (height . 10))))))) (set-frame-parameter test 'parent-frame (window-frame))) nil)
  elisp--eval-last-sexp(nil)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>)(nil)
  #f(compiled-function (&rest _it) #<bytecode 0x413d1275>)()
  eval-sexp-fu-flash-doit-simple(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>))
  eval-sexp-fu-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>))
  esf-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>) #f(compiled-function (&rest args2) #<bytecode 0x45362dfd>))
  ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>) nil)
  apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>) nil)
  eval-last-sexp(nil)
  eros-eval-last-sexp(nil)
  funcall-interactively(eros-eval-last-sexp nil)
  call-interactively(eros-eval-last-sexp nil nil)
  command-execute(eros-eval-last-sexp)
Contributor

aaronjensen commented Jan 12, 2018

@tumashu

Debugger entered--Lisp error: (error "Invalid specification of ‘parent-frame’")
  modify-frame-parameters(#<frame Emacs 0x114d8b960> ((parent-frame . #<frame *scratch* 0x106815a30>)))
  set-frame-parameter(#<frame Emacs 0x114d8b960> parent-frame #<frame *scratch* 0x106815a30>)
  (let ((test (let ((after-make-frame-functions nil)) (make-frame (cons (cons 'parent-frame (window-frame)) '((width . 10) (height . 10))))))) (set-frame-parameter test 'parent-frame (window-frame)))
  eval((let ((test (let ((after-make-frame-functions nil)) (make-frame (cons (cons 'parent-frame (window-frame)) '((width . 10) (height . 10))))))) (set-frame-parameter test 'parent-frame (window-frame))) nil)
  elisp--eval-last-sexp(nil)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>)(nil)
  #f(compiled-function (&rest _it) #<bytecode 0x413d1275>)()
  eval-sexp-fu-flash-doit-simple(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>))
  eval-sexp-fu-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>))
  esf-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x413d1275>) #f(compiled-function (&rest args2) #<bytecode 0x45362dbd>) #f(compiled-function (&rest args2) #<bytecode 0x45362ddd>) #f(compiled-function (&rest args2) #<bytecode 0x45362dfd>))
  ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>) nil)
  apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400d4227>) nil)
  eval-last-sexp(nil)
  eros-eval-last-sexp(nil)
  funcall-interactively(eros-eval-last-sexp nil)
  call-interactively(eros-eval-last-sexp nil nil)
  command-execute(eros-eval-last-sexp)
@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen emacs-26 git version > 20180109 ?

tumashu commented Jan 12, 2018

@aaronjensen emacs-26 git version > 20180109 ?

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

I thought so, yes. Just rebuilt emacs-26 branch just in case and same error.

By the way, new version only works in the first buffer that I open. The child-frame doesn't show in any other buffer.

Contributor

aaronjensen commented Jan 12, 2018

I thought so, yes. Just rebuilt emacs-26 branch just in case and same error.

By the way, new version only works in the first buffer that I open. The child-frame doesn't show in any other buffer.

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

Though if I run (company-childframe-enable) in that buffer it works for it.

Contributor

aaronjensen commented Jan 12, 2018

Though if I run (company-childframe-enable) in that buffer it works for it.

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

@aaronjensen company-childframe-enable only active on current buffer.

tumashu commented Jan 12, 2018

@aaronjensen company-childframe-enable only active on current buffer.

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

ahhh. Ok, I switched from a manual setup that enabled it globally.

Contributor

aaronjensen commented Jan 12, 2018

ahhh. Ok, I switched from a manual setup that enabled it globally.

@aaronjensen

This comment has been minimized.

Show comment
Hide comment
@aaronjensen

aaronjensen Jan 12, 2018

Contributor

btw, that error could have to do with https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30019 maybe?

Contributor

aaronjensen commented Jan 12, 2018

btw, that error could have to do with https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30019 maybe?

@tumashu

This comment has been minimized.

Show comment
Hide comment
@tumashu

tumashu Jan 12, 2018

This seem to tooooooooooooooooo long, so I suggest to discuss in https://github.com/tumashu/company-childframe/ 's issue page.

tumashu commented Jan 12, 2018

This seem to tooooooooooooooooo long, so I suggest to discuss in https://github.com/tumashu/company-childframe/ 's issue page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment