Emacs tips and tricks

Forum rules
Share your brain ;)
User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Thu Nov 19, 2015 11:00 am

I'll just drop this here and go hide: https://github.com/iqbalansari/emacs-emojify

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Wed Nov 25, 2015 8:10 pm

Since this has been getting a lot of attention lately, this is what I did:

Code: Select all

sudo apt-get install gnutls-bin ca-certificates

Code: Select all

(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
      `(("gnu"   . "https://elpa.gnu.org/packages/")
        ("melpa" . "https://melpa.org/packages/")))
(package-initialize)

Code: Select all

;; Verify secure connections
(setq gnutls-verify-error t
      tls-checktrust t)

(unless (gnutls-available-p)
  (run-with-idle-timer
   2 nil
   (lambda ()
     (lwarn 'emacs
            :warning
            "GNUTLS is missing!  Certificate validation _not_ configured"))))

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Emacs tips and tricks

Unread post by franksinistra » Wed Nov 25, 2015 8:38 pm

^ I almost forgot to tell anyone this. If anyone (other than me and both rocking pids' awesome kermacs and frequently stealing gekko's tricks now and then.) read this, the above tricks won't work in kermacs... simply because there isn't a gnutls package :) . I haven't tried the usual 'make DESTDIR=/$kermacs' thingie so not sure it'll work.
rice no more.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: Emacs tips and tricks

Unread post by pidsley » Wed Nov 25, 2015 9:39 pm

^ dammit. I thought I added gnutls. It appears to be switched on in the buildroot config. Let me check emacs.

(edit) yep -- it's an emacs switch. Try rebuilding emacs. I can't seem to switch it on, but I may be missing some -dev libs or something else random.

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Emacs tips and tricks

Unread post by franksinistra » Wed Nov 25, 2015 10:19 pm

^ ahhhh thanks for correcting me, Pids! my bad. Yeah i'll re-investigate it (and probably re-build it) later, will try to get some sleep first. :)
rice no more.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: Emacs tips and tricks

Unread post by pidsley » Wed Nov 25, 2015 10:54 pm

^ I could be completely wrong. It looks like libgnutls.so is in kermacs, but that doesn't mean it works. Let me know what you find out.

(this is what happens when I build something I can't test properly)

(edit) I finally got emacs to build --with-gnutls (I was missing some dev libs, as I suspected) and installed on Kermacs. I also had to copy over some libs from a working Debian install. Now that I know what's missing, I might be able to add those libs to buildroot, but I probably won't. You guys should be able to use the make install method.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Thu Nov 26, 2015 9:26 am

^ I'll try that.
I forgot to mention I did that on my usual Lacipecsenye, sorry.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Tue Dec 01, 2015 3:27 pm

https://github.com/webframp/sicp-info

The Wizard Book converted to info format, for all your Emacs pleasure. Install it from MELPA, then C-h i and you're set to wonderland.

Image

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Emacs tips and tricks

Unread post by franksinistra » Tue Dec 01, 2015 11:55 pm

^ Greatttt!

Now for you Clojurists, recent development of figwheel and CIDER allowed you to run cljs-repl inside Emacs (meaning you don't need to do separate lein figwheel process on the terminal and cider-connect in Emacs)

The code below is the approved way of using it (put it on your .emacs) from https://github.com/bhauman/lein-figwhee ... thin-NRepl :

Code: Select all

(defun cider-figwheel-repl ()
  (interactive)
  (save-some-buffers)
  (with-current-buffer (cider-current-repl-buffer)
    (goto-char (point-max))
    (insert "(require 'figwheel-sidecar.repl-api)
             (figwheel-sidecar.repl-api/start-figwheel!) ; idempotent
             (figwheel-sidecar.repl-api/cljs-repl)")
    (cider-repl-return)))

(global-set-key (kbd "C-c C-f") 'cider-figwheel-repl)
You have to adjust your project.clj file (the figwheel wiki example is somewhat unclear). Here's my example project.clj file:

https://gist.github.com/franksn/7bd25bb7b75018d83f6b

You also need to insert a few lines in your .lein/profiles.clj file (look at the code below), especially if you don't want to force others to use cider. Don't forget to remove the same section in your project.clj file:

Code: Select all

{ :repl {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}
note: You shouldn't put the :repl option inside the :user option (as suggested by cider wiki). It's guaranteed to make your leiningen process slower, as it'll load cider everytime you run any leiningen task.


For a less cluttered (minimal) way of developing things in Clojure, you might be interested in https://github.com/boot-clj/boot
rice no more.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Wed Dec 02, 2015 9:23 am

^ Thanks frank. I still have to learn how to do things in ClojureScript, but fighweel is truly cool.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Wed Dec 09, 2015 2:28 pm


machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Emacs tips and tricks

Unread post by machinebacon » Wed Dec 09, 2015 5:06 pm

^ works perfectly, thank you!
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Fri Dec 18, 2015 3:51 pm


User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Wed Dec 30, 2015 10:39 am

I find myself often in need of translations from Italian to English, sometimes viceversa too. I loathe Google Translator, because I prefer a good old dictionary explaining more about the word I am looking for, especially the different use cases.

So I came up with this solution:

Code: Select all

;;;###autoload
(defun custom--wordreference (languages &optional word)
  "Use given LANGUAGES to translate WORD or prompted text with WordReference."
  (browse-url
   (concat
    "http://www.wordreference.com/" languages "/"
    (if (stringp word)
        (downcase word)
      (downcase (read-string "WordReference: "))))))

;;;###autoload
(defun custom--wordreference-at-point (languages)
  "Use `custom--wordreference' with LANGUAGES to translate word at point."
  (custom--wordreference languages
                         (substring-no-properties
                          (thing-at-point 'word))))

(defun custom-wordreference-iten ()
  "Use `custom--wordreference' to translate IT>EN."
  (interactive)
  (custom--wordreference "iten"))

(defun custom-wordreference-enit ()
  "Use `custom--wordreference' to translate EN>IT."
  (interactive)
  (custom--wordreference "enit"))

(defun custom-wordreference-iten-at-point ()
  "Use `custom--wordreference-at-point' to translate IT>EN."
  (interactive)
  (custom--wordreference-at-point "iten"))

(defun custom-wordreference-enit-at-point ()
  "Use `custom--wordreference-at-point' to translate EN>IT."
  (interactive)
  (custom--wordreference-at-point "enit"))
It would be better to parse the search result from WordReference right into an Emacs buffer, but I'm not that good. You can change the languages and use whatever combination WordReference offers.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Emacs tips and tricks

Unread post by machinebacon » Thu Dec 31, 2015 4:22 am

A good idea to use WordReference, is there a reason you don't like to use offline dictionaries, like dictd+dictionary, and then use dictionary.el, as in http://www.emacswiki.org/emacs/DictMode or lookup.el

Probably because you can access more than one dict (direction) using separate functions.

Just asking, because I often use Emacs on my Eeepc without an internet connection alive. I use dictionary and word definition lookup through small wrappers.
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Thu Dec 31, 2015 10:23 am

I use WordNet when I need an offline dictionary, using the great wordnut package:

Code: Select all

(use-package wordnut ; Interface to WordNet
  :ensure t
  :bind (("C-c a L d" . wordnut-search)
         ("C-c a L D" . wordnut-lookup-current-word)))
I have to check if your solution goes well with translations. If so, I'll definitely go with an offline solution.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Emacs tips and tricks

Unread post by machinebacon » Thu Dec 31, 2015 2:13 pm

Let me know how it goes, I have not tried to integrate it as module, but it should work quite easily (IMO). "dict -d <dictionary>" allows for more than one dictionary installed, and it is really, really quick.
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Tue Jan 05, 2016 5:09 pm

https://github.com/lujun9972/el-start-menu

Another step on the path to Emacs OS?

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: Emacs tips and tricks

Unread post by GekkoP » Sat Jan 23, 2016 10:45 am

Emacs will come with xwidget support, but you can try it right about now: http://emacsninja.com/posts/on-transcen ... rders.html

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Emacs tips and tricks

Unread post by machinebacon » Wed Jan 27, 2016 5:27 am

^ looks promising, I really really want to have webkit in Emacs without deepin/lazycat's bloat on top :D
..gnutella..

Post Reply