Not working on MacOS #13

Open
opened 2021-11-05 00:48:07 +00:00 by Jimmysit0 · 8 comments
Jimmysit0 commented 2021-11-05 00:48:07 +00:00 (Migrated from github.com)

I know that screenshot depends on x-export-frames, which I'm not sure if works in MacOS, but since there is a MacOS icon on the readme, I expect so. When running on MacOS I get the following: screenshot--process: Symbol’s function definition is void: x-export-frames

I know that screenshot depends on x-export-frames, which I'm not sure if works in MacOS, but since there is a MacOS icon on the readme, I expect so. When running on MacOS I get the following: `screenshot--process: Symbol’s function definition is void: x-export-frames`
tecosaur commented 2021-11-05 02:47:26 +00:00 (Migrated from github.com)

Your Emacs 27+ needs to be built with Cairo, can you check whether this is the case?

Your Emacs 27+ needs to be built with Cairo, can you check whether this is the case?
shaunsingh commented 2021-11-05 16:18:38 +00:00 (Migrated from github.com)

Emacs built on macOS doesn't use Cairo/harfbuzz by default, it uses coretext and macOS apis instead:

see: https://github.com/d12frosted/homebrew-emacs-plus/pull/371, then https://github.com/d12frosted/homebrew-emacs-plus/pull/373. You can still build it with cairo/harfbuzz with the patches done in the PR, its just that none of the 3 major ports (emacs-plus, emacs-mac, and the "official" ns port) have an easy way to compile with harfbuzz/cairo

Is it possible to support macOS without harfbuzz/cairo as well?

Emacs built on macOS doesn't use Cairo/harfbuzz by default, it uses coretext and macOS apis instead: see: https://github.com/d12frosted/homebrew-emacs-plus/pull/371, then https://github.com/d12frosted/homebrew-emacs-plus/pull/373. You can still build it with cairo/harfbuzz with the patches done in the PR, its just that none of the 3 major ports (emacs-plus, emacs-mac, and the "official" ns port) have an easy way to compile with harfbuzz/cairo Is it possible to support macOS without harfbuzz/cairo as well?
tecosaur commented 2021-11-05 16:21:43 +00:00 (Migrated from github.com)

Basically, I just need (x-export-frames frame 'png) to work with a posframe. If that can work on Mac, screenshot can work on Mac.

Basically, I just need `(x-export-frames frame 'png)` to work with a posframe. If that can work on Mac, *screenshot* can work on Mac.
Jimmysit0 commented 2021-11-05 16:23:32 +00:00 (Migrated from github.com)

I think that can be specified in the readme or at least somewhere in this repo, since as @shaunsingh mentioned Emacs on macOS doesn't use Cairo by default.

I think that can be specified in the readme or at least somewhere in this repo, since as @shaunsingh mentioned Emacs on macOS doesn't use Cairo by default.
DaniruKun commented 2021-11-29 22:16:55 +00:00 (Migrated from github.com)

I also have an issue when calling any screenshot command on macOS Monterey, but a bit different:

cl-no-applicable-method: No applicable method: clone, nil, :prototype, nil, :level, 4 [3 times]
I also have an issue when calling any `screenshot` command on macOS Monterey, but a bit different: ``` cl-no-applicable-method: No applicable method: clone, nil, :prototype, nil, :level, 4 [3 times] ```
bryce-carson commented 2021-12-06 09:17:13 +00:00 (Migrated from github.com)

I get a void function error as well. Additionally, I must run posframe-delete-all to remove the posframe that displays upon execution of screenshot.

I get a void function error as well. Additionally, I must run `posframe-delete-all` to remove the posframe that displays upon execution of `screenshot`.
tecosaur commented 2022-10-18 02:38:18 +00:00 (Migrated from github.com)

@DaniruKun @bryce-carson a bunch of changes have been made recently, if you could re-test and see if anything has changed that would be good.

@DaniruKun @bryce-carson a bunch of changes have been made recently, if you could re-test and see if anything has changed that would be good.
suliveevil commented 2023-01-03 07:42:23 +00:00 (Migrated from github.com)
Debugger entered--Lisp error: (void-function x-export-frames)
  (x-export-frames frame 'png)
  (insert (x-export-frames frame 'png))
  (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png)))
  (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0)))
  (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (save-current-buffer (set-buffer screenshot--buffer) (set (make-local-variable 'display-line-numbers) screenshot-line-numbers-p) (if screenshot-text-only-p (progn (set (make-local-variable 'display-line-numbers-offset) (if screenshot-relative-line-numbers-p 0 (1- screenshot--first-line-number))))) (font-lock-ensure (point-min) (point-max)) (redraw-frame frame) (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (let* (before-make-frame-hook delete-frame-functions (width (max screenshot-min-width (min screenshot-max-width (screenshot--max-line-length screenshot--buffer)))) (height (screenshot--displayed-lines screenshot--buffer)) (frame (posframe-show screenshot--buffer :position (point-min) :internal-border-width screenshot-border-width :min-width width :width width :max-width width :min-height height :height height :max-height height :lines-truncate screenshot-truncate-lines-p :poshandler #'posframe-poshandler-point-bottom-left-corner :hidehandler #'posframe-hide))) (save-current-buffer (set-buffer screenshot--buffer) (set (make-local-variable 'display-line-numbers) screenshot-line-numbers-p) (if screenshot-text-only-p (progn (set (make-local-variable 'display-line-numbers-offset) (if screenshot-relative-line-numbers-p 0 (1- screenshot--first-line-number))))) (font-lock-ensure (point-min) (point-max)) (redraw-frame frame) (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame ...))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (posframe-hide screenshot--buffer))
  screenshot--process()
  screenshot-save(nil)
  funcall-interactively(screenshot-save nil)
  call-interactively(screenshot-save nil nil)
  command-execute(screenshot-save)

Couldn't use on macOS 13.1, didn't do any config, just loaded screenshot.el then M-x screenshot

GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin22.2.0, NS appkit-2299.30
Version 13.1 (Build 22C65)) of 2023-01-01

brew install d12frosted/emacs-plus/emacs-plus@30 --with-dbus --with-debug --with-mailutils --with-no-frame-refocus --with-xwidgets

```emacs-lisp Debugger entered--Lisp error: (void-function x-export-frames) (x-export-frames frame 'png) (insert (x-export-frames frame 'png)) (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))) (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (save-current-buffer (set-buffer screenshot--buffer) (set (make-local-variable 'display-line-numbers) screenshot-line-numbers-p) (if screenshot-text-only-p (progn (set (make-local-variable 'display-line-numbers-offset) (if screenshot-relative-line-numbers-p 0 (1- screenshot--first-line-number))))) (font-lock-ensure (point-min) (point-max)) (redraw-frame frame) (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame 'png))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (let* (before-make-frame-hook delete-frame-functions (width (max screenshot-min-width (min screenshot-max-width (screenshot--max-line-length screenshot--buffer)))) (height (screenshot--displayed-lines screenshot--buffer)) (frame (posframe-show screenshot--buffer :position (point-min) :internal-border-width screenshot-border-width :min-width width :width width :max-width width :min-height height :height height :max-height height :lines-truncate screenshot-truncate-lines-p :poshandler #'posframe-poshandler-point-bottom-left-corner :hidehandler #'posframe-hide))) (save-current-buffer (set-buffer screenshot--buffer) (set (make-local-variable 'display-line-numbers) screenshot-line-numbers-p) (if screenshot-text-only-p (progn (set (make-local-variable 'display-line-numbers-offset) (if screenshot-relative-line-numbers-p 0 (1- screenshot--first-line-number))))) (font-lock-ensure (point-min) (point-max)) (redraw-frame frame) (let ((temp-file screenshot--tmp-file) (temp-buffer (generate-new-buffer " *temp file*" t))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert (x-export-frames frame ...))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (posframe-hide screenshot--buffer)) screenshot--process() screenshot-save(nil) funcall-interactively(screenshot-save nil) call-interactively(screenshot-save nil nil) command-execute(screenshot-save) ``` Couldn't use on macOS 13.1, didn't do any config, just loaded screenshot.el then M-x screenshot GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin22.2.0, NS appkit-2299.30 Version 13.1 (Build 22C65)) of 2023-01-01 brew install d12frosted/emacs-plus/emacs-plus@30 --with-dbus --with-debug --with-mailutils --with-no-frame-refocus --with-xwidgets
Sign in to join this conversation.
No description provided.