Fork me on GitHub
#emacs
<
2022-09-09
>
Steven Katz21:09:46

I've added smart parens to emacs, but it does not seem to do anything. I think my emacs knowlage is too weak to understand what I need to do. Any help appreciated

ag22:09:20

it's always a good idea to run M-x describe-package and learn a bit about it. Usually, package authors put some instructions in the description or the home page

Steven Katz22:09:53

Yup, read that and it took me to the wiki, which was not very helpful.

ag22:09:50

How is it not helpful? There's "Getting started section" that answers your question and even more

Steven Katz22:09:02

maybe we are looking at different doc...i did the things in getting started, (which btw give no context about what file to add things to) and still it does not work. Is there a trouble shooting section I am missing?

Steven Katz22:09:46

here are the instaructins i followed:

You can also install this as a package with M-x package-install smartparens. This package is available in melpa repository.

If you've installed smartparens as a package, you don't need to require it, as there is an autoload on smartparens-global-mode.

Steven Katz21:09:47

I installed it with: M-x package-install smartparens BTW it complained about not being able to find dash, so I ended up installing that afterward as well (though the doc indicated it should have installed automatically)

lukasz21:09:41

Have you enabled smartparens-mode ?

lukasz21:09:11

(I don't use smartparens, but usually package installation is not enough, you need to instruct emacs to load the package, activate major/minor modes etc)

Steven Katz22:09:14

my init.el file:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "") t)
(package-initialize)

;; actually turn on smart parens
(smartparens-global-mode t)
(require 'smartparens-config)

; smart parentheses
(show-smartparens-mode 1)

lukasz22:09:30

weird, no errors when starting Emacs?

Steven Katz22:09:25

none that I could see, i'm on a mac and starting it with an icon on the dock...is there a file to look in to see errors?

Steven Katz22:09:29

when i open a .clj file it show as major mode clojure with no minor mode listed

ag22:09:33

try M-x describe-mode

Steven Katz22:09:36

I see a lot of stuff about clojure, nothing about smartpar

Steven Katz22:09:59

is it possible that my init.el is not being executed?

ag22:09:08

Check for the section: "Global minor modes enabled"

ag22:09:32

> is it possible that my init.el is not being executed? It could be. You can either start emacs from command line with --debug-init flag, or place elisp snippet like (message "Hello") and see if it shows in *Messages* buffer

Steven Katz22:09:03

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Blink-Cursor Electric-Indent File-Name-Shadow Font-Lock Global-Eldoc
Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Show-Paren Tool-Bar
Tooltip Transient-Mark

Steven Katz22:09:54

startng from the commandline didn't print out any errors in the terminal, it just started

Steven Katz22:09:14

opps forgot the flag...hold on

ag22:09:44

If you're new to Emacs, have you considered trying one of the "distros"? Prelude, Doom, Spacemacs? It might be a lot simpler. Things like smartparens, version-control, completion frameworks could be daunting to configure from scratch. Doom for example, makes it very easy to add and remove things like that, without getting bogged down

Steven Katz22:09:02

no diference with the flag

Steven Katz22:09:33

Seem like adding support for clojure and a parens helper should not require me to adopt and entirely different distro...i had hoped to make emacs my default for all languages (well maybe not java)

ag22:09:24

Well, without a starter kit, I gotta be honest, it's going to be a bumpy road. You should consider a starter kit, at least in the beginning. Once you learn the basics, you can always make a decision to build your own config from scratch.

lukasz22:09:14

I just use use-package no distros required

lukasz22:09:29

regarding errors - check *Messages* buffer, sometimes package log stuff there

Steven Katz22:09:39

@U0JEFEZH6 can you elborate on that? (use-packae)?

Steven Katz22:09:47

messages only has a single line about getting help

Steven Katz22:09:33

~/.emacs.d/init.el

Steven Katz22:09:46

also have: ~/.emacs

Steven Katz22:09:03

should I prefer one over the other?

ag22:09:17

you missed the dot in the first one

ag22:09:33

check the page I shared above

Steven Katz22:09:49

this is whats in .emacs

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(dash smartparens cider clojure-mode)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Steven Katz22:09:23

So if i read that page correctly, only one of these files will be used and my config for SP is in the wrong place

ag22:09:50

That seems to be the case

Steven Katz22:09:12

Success, moving .emacs to .emacs.sav has allowed SP to start working...Thanks!!!

Steven Katz22:09:00

This is still odd to me as my .emacs file (whgich has some config in it about clojure and sp) would seem to be needed, clearly i need to merge the two into one file, but I'm wondering if they are inconflict in some way

ag22:09:48

Those settings are related to https://www.gnu.org/software/emacs/manual/html_node/elisp/Applying-Customizations.html and M-x describe-variable custom-file

ag23:09:07

@U040K4L8BFU IMO you should still give Prelude or Doom a try. Learning Emacs from scratch, starting with a blank page like that could be a daunting endeavor. I understand that your inner hacker may refuse to choose that path, but using a starter kit can help you learn more and much faster. I just don't want yet another person to try really hard and still give up. Emacs has way too much stuff, not only built-in features and packages but an entire world. The dull looks and seemingly uncomplicated interface of vanilla Emacs without extensions could be very deceiving.

ag23:09:50

Look at this "example config" just for smartparens alone: https://github.com/Fuco1/.emacs.d/blob/master/files/smartparens.el

ag23:09:31

Alternatively, you can use Emacs profile switcher https://github.com/plexus/chemacs2 Yes, it may sound weid, but Emacs doesn't have an easy way to run multiple configs on the same machine. With that profile switcher you can have e.g., Prelude based config and vanilla config. You can use one to learn, and another to build your own, extend and borrow ideas.

Steven Katz23:09:48

Thanks! I’ll start looking at different distros (and do more background reading)