trunkmaster / nextspace

NeXTSTEP-like desktop environment for Linux
https://trunkmaster.github.io
GNU General Public License v3.0
1.88k stars 69 forks source link

Emacs #246

Closed snunez1 closed 2 years ago

snunez1 commented 4 years ago

Nice project. Have you considered adding emacs to the list of tools/projects?

trunkmaster commented 4 years ago

Thank, you. I don't quite understand what do you mean by "adding emacs". Could you plase explain what exactly you expect?

alexmyczko commented 4 years ago

Maybe Emacs.app? http://aiei.ch/emacs.png

snunez1 commented 4 years ago

An emacs app is what I was referring to. Trying to compile emacs under GNUstep hasn't worked for a long time as far as I am aware. It would make a nice addition to the toolkit.

trunkmaster commented 4 years ago

@snunez1 It would be nice to have Emacs.app for everyday usage but... I've tried current version from master. It is running but almost unusable - randomly crashes, scrollbars buggy, font settings doesn't applied from ~/.emacs, menu flickers on almost any action. It seems GNUstep support needs huge amount of work to make Emacs.app useful. I'd like to have time to do that work, but I don't right now. Any volunteers?

snunez1 commented 4 years ago

It sounds like you have got farther than I. Yesterday I wasn't even able to get it to compile. I've reported it to the GNUstep maintainers. Perhaps we can mark this one as an enhancement or nice-to-have and return to it as time permits.

enzuru commented 4 years ago

Hey all, I'm an Emacs user and I occasionally submit patches to the Emacs project. I was able to get the latest Emacs.app to compile against the latest NEXTSPACE but it involved a couple minor patches of the code and CentOS 7.

It seems quite stable, but I'll report back if that proves otherwise. I am noticing the font problem, but everything else seems fine.

I'm going to work on getting the patch submitted upstream to Emacs first. After I have gotten it merged, I'll write a blog article on how to compile Emacs.app on NEXTSPACE.

And after that, I'm going to prepare two Ansible playbooks. One will convert a minimal CentOS 7 instance into a NEXTSPACE workstation. The second will convert a minimal CentOS7 instance into a NEXTSPACE developer workstation with the latest version and source of NEXTSPACE as well as a brand new Emacs.app.

Emacs.app is probably our best bet for writing serious Objective-C code.

snunez1 commented 4 years ago

Fantastic! Please update this issue when the 'blog comes out so we can follow along...

On Fri, Apr 17, 2020 at 2:05 PM Ahmed Khanzada notifications@github.com wrote:

Hey all, I'm an Emacs user and I occasionally submit patches to the Emacs project. I was able to get the latest Emacs.app to compile against the latest NEXTSPACE but it involved a couple minor patches of the code and CentOS 7.

It seems quite stable, but I'll report back if that proves otherwise. I am noticing the font problem, but everything else seems fine.

I'm going to work on getting the patch submitted upstream to Emacs first. After I have gotten it merged, I'll write a blog article on how to compile Emacs.app on NEXTSPACE.

And after that, I'm going to prepare two Ansible playbooks. One will convert a minimal CentOS 7 instance into a NEXTSPACE workstation. The second will convert a minimal CentOS7 instance into a NEXTSPACE developer workstation with the latest version and source of NEXTSPACE as well as a brand new Emacs.app.

Emacs.app is probably our best bet for writing serious Objective-C code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/trunkmaster/nextspace/issues/246#issuecomment-615060762, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3KJ4BSEHHAN5JZSBZSWJ3RM7WSRANCNFSM4LWH5A2Q .

trunkmaster commented 4 years ago

@enzuru Please build Emacs.app against master branch (now we have up-to-date build instructions in .circleci/config.yml, thank you). It would be great if you create emacs fork so I could create a pull requests. I had numerous issues with my build of Emacs.app (and some ideas too).

enzuru commented 4 years ago

@nextspace I've successfully built the latest Emacs.app against the latest nextspace GNUstep branches. While I do notice crashing (usually when I am closing Emacs, meaning it is not costing me much) and some font issues, Emacs.app is largely usable.

Some Objective-C code was refactored recently in Emacs which caused the latest to break. I just submitted a patch to the emacs-devel mailing list. As soon as the code is merged, I'll write that blog.

Afterwards, we can setup an Emacs branch on GitHub for further improvement.

trunkmaster commented 4 years ago

@enzuru I'm using emacs for development too. Also org-mode is very good. I dream about full-featured Emacs.app, actually. Looking for your emacs fork/branch.

enzuru commented 4 years ago

Blog post here: https://medium.com/@enzuru/compiling-emacs-app-on-nextspace-centos-7-12e0be45f502

Next project is making the NEXTSTEP Ansible scripts for end users.

trunkmaster commented 4 years ago

@enzuru You've mentioned NEXTSTEP several times through your blog post. Is it intentional or just typos?

enzuru commented 4 years ago

@trunkmaster a bit tired and groggy... that was a mistake. Will fix.

trunkmaster commented 4 years ago

@enzuru no problem. It's a proof of correct name I've choosen. ;)

BTW, you don't need to patch CentOS to overcome __unused and __block - it can be #ifdef'ed like my in patch to libdispatch. Look here as an example.

enzuru commented 4 years ago

@trunkmaster I suggest you fork this repo if you want to start making extensive changes to Emacs.app: https://github.com/emacs-mirror/emacs

If you share notes with me, perhaps I can help as well.

enzuru commented 4 years ago

BTW, I just got Xcode-style Cocoa-aware autocompletion working through ccls: https://github.com/MaskRay/ccls

I'll write a blog entry shortly on how to get this setup for Emacs on NEXTSPACE.

trunkmaster commented 4 years ago

Wow! I badly need good autocompletion for Objective-C. I'm not happy with auto-complete, company, irony, yas and their combinations.

Also I think it will be good idea to make good .emacs and emacs.d for NEXTSPACE (and GNUstep of course) development. These files can be put into https://github.com/trunkmaster/nextspace/tree/master/System/etc/skel. It might be a part of some -devel packages. What do you think?

enzuru commented 4 years ago

@trunkmaster every Emacs user already has their own .emacs.d, so I think it would be better to document the process of setting up Emacs.app (or vanilla Emacs) with CCLS along with whatever other elisp libraries we need.

CCLS is editor agnostic, so it's possible that we should document that CCLS is basically required for an Xcode-style experience, and that any editor with a CCLS plugin will do.

How we can start building documentation together is I'll make a first pass using my blog (to get information out there for early adopters) and then you (or me) can go ahead and adapt the appropriate bits to the "official" documentation.

enzuru commented 4 years ago

@trunkmaster blog post instructions here: https://medium.com/@enzuru/setting-up-emacs-as-a-modern-objective-c-ide-ffa57d9e8a75

tsuu32 commented 4 years ago

I also challenged Emacs building with NEXTSPACE 0.85 and Emacs 26.3 (yes, not upstream) in VirtualBox. I replaced /usr/include/unistd.h's __block with__libc_block (emacs source has many #include <unistd.h> so I didn't create source level patch).

And run followings...

sudo yum install gnutls-devel
sudo yum install ncurses-devel
cd emacs-26.3/
CC=clang ./configure --with-ns --without-x
CC=clang make

This can build emacs (!) but running the executable src/emacs cause segmentation fault. Attachment is screenshot of backtrace by gdb src/emacs. emacs-nextspace-bt

If I have time, I'll do it with upstream. Thank you for the very cool project.

trunkmaster commented 4 years ago

@enzuru nice post, thanks. I'll play a little with this.

trunkmaster commented 4 years ago

@tsuu32 You should better compile Emacs agains master branch of NEXTSPACE. I've saw that type of crashes with old GNUstep libraries. NEXTSPACE 0.85 contains quite old ones. The next release will be based on the latest GNUstep libraries.

trunkmaster commented 4 years ago

@enzuru i've played a bit with ccls and can share some thoughts:

  1. It's true - the be best way to install ccls is snap package (it contains Ubuntu version of LLVM). I tried to build it myself, but LLVM shipped with CentOS does not fit ccls - it's segfaults. I'm beginning to think about move to Fedora. ;)
  2. I use gnustep-config --objc-flags output as a content of .ccls file. It works.
  3. I use company-lsp as frontend.

Overall impression - quite fast, functional but not accurate autocompletion solution. I failed to make autocompletion for NSTimer, NSNotificationCenter methods ('lsp' offered me a methods from NSTableView or something like this instead). However it managed to find methods list for NSString. It's strange...

Could you please share your impression or test results of above mentioned?

enzuru commented 4 years ago

@trunkmaster so it appears to me that the autocompletion of class methods are not working. So if I type [NSTimer sch... all it provides only methods for NSObject.

However, if I go ahead and create the timer, then [timer set... pops up appropriate suggestions.

I'll see if I can work with the upstream projects to get this fixed. Might need to wait for the move to Fedora first, as compiling ccls seems a pain on CentOS 7.

trunkmaster commented 4 years ago

@enzuru one clarification: not all classes' class methods affected. For instance, NSString class methods autocompletion works for me.

uchuugaka commented 4 years ago

Any obvious differences in header style?

On Apr 25, 2020, at 8:01, Sergii Stoian notifications@github.com wrote:

 @enzuru one clarification: not all classes' class methods affected. For instance, NSString class methods autocompletion works for me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tsuu32 commented 4 years ago

I installed upstream gnustep and rebuilt emacs. The emacs can run.

nextspace-emacs27-splash nextspace-emacs27

I found some limitations,

...and some redisplay issue.

tsuu32 commented 4 years ago

Alt + x is not M-x. (Alt is recognized Super key?)

I see Wiki https://github.com/trunkmaster/nextspace/wiki/Keyboard and understand it is intended.

trunkmaster commented 4 years ago

@tsuu32 sure. Alt (Command) is reserved for applications purposes. For example, if you run emacs in Terminal Cmd+x is reserved for "Edit->Cut" menu item action.

queernix commented 4 years ago

If there are still issues with Emacs, it might be beneficial to look at the macOS part of Emacs. I don't remember off the top of my head if it requires a separate patch or not, but the Emacs.app port (emacs-app) that I get from macports works very well. I doubt it's using many/any Cocoa-exclusive features that aren't going to be in GNUstep

enzuru commented 3 years ago

@queernix my experience is actually that macOS is the problem, because Emacs.app maintainers make MacOS changes that sometimes breaks GNUstep support, since they are both "nextstep" versions, but with minor and subtle differences. And since there are 100x as many macOS users as GNUstep... it means our builds get broken.