12

There is a good collection of tools for Emacs Lisp testing: evm - Emacs Version Manager. Cask - project management tool for Emacs that helps automate the package development cycle; development, dependencies, testing, building, packaging and more. ert-runner - tool for Emacs projects tested using Ert. ecukes - testing framework for integration testing. ...


11

You can use C-h P (describe-package). After entering a package name, the attributes (including version) of the package will be listed in the *Help* buffer. Besides, you can also view the version of a package from Package Menu (M-x list-packages).


11

At the cost of an extra top-level symbol binding, there's a very neat solution which avoids repeating the define-derived-mode form: (defalias 'my-fancy-parent-mode (if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode)) (define-derived-mode my-fancy-mode my-fancy-parent-mode ...) Works fine in any Emacs >= 23. I came up with this for haml-mode a ...


10

Elisp is an interpreted language. You can put version-specific code in your .emacs, but protect it by testing at load time that it's operating on the correct version. (if (is-new-feature-available) (shiny-new-feature) (old-less-nifty-feature)) This code will work in all versions because (shiny-new-feature) is only evaluated when (is-new-feature-...


6

(Community wiki. Please add yours!) If there's a function, added in a newer Emacs version, that you'd like to use, check whether it's defined with fboundp, and define a compatibility function if it's not defined. It's considered a bad idea to give the compatibility function the same name as the real function, as other Elisp code may be using the same ...


5

Using emacs-version with the various version* functions is sane, yes. version= version< version<= (These are convenience wrappers which use the version-list functionality behind the scenes.) By way of example, the following is the code Tim ended up using: (if (version< emacs-version "24.4") (dolist (i '("php" "php3" "php5" "php7" "php-5" "...


5

Do this, instead, starting with Emacs 26: (gethash "EURO SIGN" (ucs-names)) In other words, use something like this: (if (> emacs-major-version 25) (gethash "EURO SIGN" (ucs-names)) (cdr (assoc-string "EURO SIGN" (ucs-names) t))) Unfortunately, for people trying to provide backward-compatibility, they made an incompatible change in ucs-names, ...


3

tl;dr: Use if and your own init function: (if (fboundp 'prog-mode) (define-derived-mode your-cool-mode prog-mode "Cool" "Docstring" (your-cool--init)) (define-derived-mode your-cool-mode nil "Cool" "Docstring" (your-cool--init))) Then do all the mode's initialization in your-cool-init. Longer explanation: The problem is that the ...


3

Put the byte-compiled files for different Emacs versions in different directories. Make your load-path conditional on the Emacs version you are running, so that you load the appropriate byte-compiled libraries.


2

Well, the solution to this problem was a very simple one. The issue was that the encoding used for putting manpages (and maybe other things) into buffers in 25.1.1 was unsuitable for pcmpl-args because it used special characters for quotation marks, hyphens, etc. These special characters are used by default in man-db, but older versions of Emacs forced ...


2

As amitp said in the comments, the window-system variable is 'mac on the Mac Port. Also, as pointed out by xuchunyang, emacs-version yields special output and mac-carbon-version-string is bound. These things alone should be enough for one to detect whether you're using the Emacs Mac Port, even in a terminal frame.


2

Packages aside, note that M-x find-library will take you to the source code for a given library name. Assuming the author has assigned a version, you will typically find that information specified in the comments at the top of the file.


1

If you update packages in Emacs 26 you can use the same .emacs.d directory from Emacs 27.


1

I was in a similar situation few weeks ago, I wanted to have a fresh emacs instance but still wanted the old emacs around if I needed. I made a folder called ~/newhome and when starting emacs I told emacs the home dir is that, HOME=/Users/administrator/newhome emacs example.txt Remember to create a .emacs.d in the newhmoe directory too.


1

I ended with: (defun my--get-char (name) "Get character by Unicode `name'." (cond ((>= 26 emacs-major-version) (gethash name (ucs-names))) ((>= 23 emacs-major-version) (cdr (assoc-string name (ucs-names)))) (t (error "Emacs version is too old and lacks Unicode support...")))) (when (>= emacs-major-version 23) (define-key ...


1

I loaded up MELPA and see sage-shell-mode listed. I don't know if this will solve the problem, but I've run into problems before with multiple package archives loading. Here is a function I use to clear the list of packages and add MELPA. Don't forget to refresh the package list after this: (defun my-package-load-melpa-only () "Load package manager with ...


1

Install Emacs 24.5 in your $HOME. Multiple versions of Emacs can co-exist. Run below command line in shell, ./configure --prefix=$HOME/myemacs/24.4 --without-x-toolkit --without-x --without-xpm --without-png --without-gif --without-tiff --without-jpeg --without-rsvg --without-xft --without-xaw3d --without-xim --without-xpm --without-dbus --without-makeinfo ...


Only top voted, non community-wiki answers of a minimum length are eligible