English teaching resources
I used to be an English teacher. During that time, I made a number of texts, tasks, questions, oral assignments, essay tasks and so forth about different topics within the competence aims of the subject. I thought it might be useful to share these so other English teachers can save some time by reusing them. I have divided the resources into topics to make it easier to find relevant materials. I am in the process of preparing the files, creating the links to the files and creating the links for relevant kahoots and quizlets. For now, only the section about the USA is finished, but I will fill in the rest over time.
I share these teaching materials in Open Document Format (.odt) since an open standard ensures that these will always be possible to open and use. MS Word and Google Docs can open and save in Open Document Format. I use the Liberation fonts since they are freely licensed fonts with the same metrics as some of Microsoft's fonts. (The Microsoft Fonts come with draconian license terms, so I cannot use those.) If you use Windows and don't have the Liberation fonts, you can get them by installing LibreOffice. LibreOffice always renders ODF well, but Word sometimes struggles, so if the documents look strange, use LibreOffice.
As everything on this blog that isn't code, I share these resources under the terms of the Creative Commons Attribution ShareAlike-license. That means you can freely use, modify and distribute your modifications as long as I am attributed and you share under the same license. The point of the ShareAlike part of these terms is to force people that use works shared under a free culture license that give people the right to freely use, modify and distribute those works to not incorporate those works into their own works without also sharing on the same terms with others. This is called a copyleft license.
Language and grammar
Links to files with a short description:
A_and_an.odt
Grammar task about a and an.Adjectives_and_adverbs.pdf
- Explanations of how to use adjectives and adverbs.Alias_template.odt
- A template to make "cards" to play alias from. A game of alias can be a fun way to work with vocabulary for a text before reading it. Divide the class into groups. Place the cards with words face down. The oldest player has the first turn. During a turn, the player chooses a card and flips it. If they can explain what the word means in English in a way that is understandable to the other players, they get the card. If not, they have to place it face down again at the same place. Then the next player has their turn. When all the cards are gone, the players count their cards and the one with the most cards is the winner.The American Dream grammar.odt
A grammar task related to a simple text about the American Dream.The American Government to be.odt
A hard task where one should decide whether to use am is or are. What makes this hard is sometimes that the real subject of the rather formal sentences might be hard to spot and sometimes that you could debate whether the subject is plural or singular since it could be thought of as either one issue or a number of separate issues. I used this for students that finished the easier concord tasks fast to give them something a bit harder to think about.Capitalisation_and_puctuation_exercise.odt
Some questions where the answers are checked with capitalisation and punctuation in mind. I used this with a group preparing for upper secondary school that struggled to use capitalisation and punctuation correctly.Capitalisation and punctuation.pdf
In reality, different schools and universities promote different uses of punctuation and capitalisation, and unlike Norwegian where there are official rules from the Norwegian language council, there are no official rules in English. To make it easier for students to write with decent punctuation and capitalisation, I codified the rules I use for my own punctuation and capitalisation which is based on common practices in British English.Checklist_essays.odt
A checklist to work through after writing an essay to avoid mistakes and improve the text before handing it in. The first page is for people aiming for a decent grade and the last page is for people aiming at a higher grade. Some students thought the full list was too long and hard, so I divided it.Checklist_oral_presentations.odt
A checklist to make certain a presentation is well prepared.Common_mistakes_in_essays.pdf
A presentation where I go through some common mistakes. I made this for a group aiming for a passing grade and explained each slide slowly. In hindsight, I would have divided this up further and worked with one topic at at a time, but this was early in my teaching carreer, so don't judge this too harshly.Common_mistakes_in_essays_task.odt
A task with a text with some of the common mistakes from the presentaiton above in it that the students should work on correcting. There is also a correct version of the text on the next page. This is quite nice as a group task.Concord.odt
This is the document I use as a template when explaining concord. I show the first page on a screen and ask the students to help me fill in the form on the first page one column at the time by telling me what to write. They suggest the two last verbs. Then I ask if they can see any pattern. After they have spotted the pattern, or if not, I reveal the next page and then the last one. In the end, I save the document with their verbs and upload it to the learning platform so they can review later.Conjugation_of_nouns_explanation_and_exercise.odt
Explanation of conjugation of nouns and tasks to work with.Conjugations_of_nouns_translation.odt
Some senteces for students to translate from Norwegian into English to work on conjugations of nouns. The sentences are of low quality with some stupid ones which we usually have a laught at, but the point is the conjugations. I usually show this document on a screen and the students write the English translations in a document and hand it in.Dictionary_exercise.odt
Tasks on using dictionaries. If you use a dictionary program like Ordnett Plus or IntoWords (CD-ORD), then maybe the first part doesn't fit very well since there are more than one dictionary within the program.Film_review.odt
Describes how to write a film review in an easy and straight-forward way.Formal_vs_informal_language.odt
A comparison of informal and formal language. Also a bit about the passive voice in the end.Linking_words.odt
The two first pages give examples of use of linking words. I would show this on the screen while explaining what they mean and how to use them from the top down. Then I would have the students work on tasks about linking words from the book (not certain if these tasks match Skills 2020, Tracks 2013 or Target 2020) and afterwards go through the tasks in plenum with the students giving their solutions. Then I would reveal my solutions on the last page, read through them and make certain to tell the students that there are always many correct ways to use linking words.UK_and_US_English.odt
A simplified and shortened version of a text about American and British English.
Kahoots:
Quizlets:
Vocational English
Fits more than one study line
Advertisement_for_student's_firms.odt
Task to make an advertisment for student firms. I used this on the construction study line after the students had made student firms and come up with the products they wante to produce, but the task is general enough to fit any study line where they work with student firms.documentation-task.odt
A task that fits any technically inclined study line that use manuals in English in their work.Future_life_presentation.odt
An oral presentation task about the student's future plans and dreams for their work and life. I made this for use with a group that had second year students from the interior decorator and industrial production classes, so there are some words in the vocabulary table related to those study lines.
The health care study line (Helse)
Links to files with a short description:
Kahoots:
Quizlets:
The construction study line (Bygg)
Links to files with a short description:
Carpentry_tools.odt
A list of tool names in Norwegian and English with pictures.Vocational_essay_task_BA.odt
Essay tasks for the construction study line.FYR_BA.odt
Vocational presentation tasks incorporating both the English subject and vocational study line subjects. (FYR)
Kahoots:
Quizlets:
The technology and industrial production study line (TIP)
Links to files with a short description:
Kahoots:
Quizlets:
The haridresser, flower decorator, interior decorator and photography study line (FBIE)
Links to files with a short description:
Easily_confused_words.odt
A list of some words that are easily confused including some words used especially often on the FBIE study line like dyed and hair.
Kahoots:
Quizlets:
The electrical and computer technology study line (Elektro)
Links to files with a short description:
Kahoots:
Quizlets:
The information technology and media production study line (IM)
Links to files with a short description:
Kahoots:
Quizlets:
The English-speaking world
In general or about English speaking countries except the USA and the UK
Links to files with a short description:
English_speaking_countries_written_task.odt
Three tasks with different levels of difficulty about the English speaking countries. I made this for a class of students preparing to go on upper secondary school. (Kombiklasse)Essay_task_NZ_and_the_Maori.odt
Three essay tasks about New Zealand, the Maori and the Whale Rider film I made for a class of students preparing for upper secondary school (Kombiklasse).From_Empire_to_Commonwealth.odt
A simplified version of the text From British Empire to Commonwealth with vocabulary on the next page that I made for use with a class prepering for upper secondary school. (Kombiklasse)Sports in English speaking countries.odt
I made this for students at the athletic study line.Group task on native peoples.odt
Four groups work on the Aboriginals of Australia, the Maori in New Zealand, The Native Americans and the Zulus in South Africa and make a presentation for the class. This task is hard and I would use this in stronger classes after having a look at some basic facts about the different countries, before going deeper into one or two indigenous peoples and their countries. (There was a competence aim related to indigenous peoples in the past. Now, there is one about the culture of English-speaking countries around the world where Native Peoples would fit.)
Kahoots:
Quizlets:
The United Kingdom of Great Britian and Northern Ireland
Links to files with a short description:
UK_news.odt
An easy task I used with a group of students in a preparation class for upper secondary school about news from the UK.British_Government_simplified.odt
A simplified and shortened version of a text about the British government with a vocabulary list and some simple questions. I made this for my adult students since the original text was too difficult.
Kahoots:
Quizlets:
The United States of America
Here are links to files with a short description:
12 years a slave and slavery.pdf
Some information about slavery in the USA and some questions about the film 12 years a slave.The American Dream and poetry.odt
Tasks related to the American Dream, with poems by Langston Hughes and Emily Dickinson as well as references to a poem by Ralp Waldo Emerson in the Tracks book. (You can easily edit this part out if you use another book or copy the relevant pages.)The American Government to be.odt
A hard task where one should decide whether to use am is or are. What makes this hard is sometimes that the real subject of the rather formal sentences might be hard to spot and sometimes that you could debate whether the subject is plural or singular since it could be thought of as either one issue or a number of separate issues. I used this for students that finished the easier concord tasks fast to give them something a bit harder to think about.The American Government short version Targets 2015.odt
This is a shorter and somewhat simplified version of the long and hard text from Targets 2015.American Lista tasks.odt
These are tasks related to American immigration from Lista and how American culture influenced Lista after many of the immigrants returned. Lista is part of Farsund and many teachers and students at my school are from Lista. Lista is known as the place in Norway where American culture has had the most influence and people from Lista are often in the national news in Norway debating political events in the USA. A lot of people have relatives and friends in the USA and many people here have dual citizenship.Arnold Schwarzenegger and the American Dream simplified.odt
This is my simplified version of a text where Arnold Schwarzenegger shares his dream growing up about achieving success as a body builder and moving to America.Black Friday.odt
This is an easy text about Black Friday with vocabulary.Essay task USA 1KOA.odt
Essay tasks related to texts and a film (Bury my heart at wounded knee) we had worked with about Native Americans, the gun culture in the USA and a harder task about comparing and contrasting the USA and the UK.Facts about the USA translation task.odt
This task is about singular and plural nouns and concord at the same time as it is about facts about the USA. Words are included to make this easier for students with a limited vocabulary.Group task on native peoples.odt
Four groups work on the Aboriginals of Australia, the Maori in New Zealand, The Native Americans and the Zulus in South Africa and make a presentation for the class. This task is hard and I would use this in stronger classes after having a look at some basic facts about the different countries, before going deeper into one or two indigenous peoples and their countries. (There was a competence aim related to indigenous peoples in the past. Now, there is one about the culture of English-speaking countries around the world where Native Peoples would fit.)Halloween
An easy text with vocabulary on the last page about the American Halloween traditions.Langston Hughes I too.odt
The poem with a short introductory text and some questions to work with. I found a video on youtube where Hughes reads the poem that is referenced in the introductory text.Oral assignment a state in the USA.odt
The students would present in front of the class and listening to all the presentations would give the students a better understanding about how large, geographically and culturally diverse and interesting the USA is.Oral assignment a state in the USA simplified.odt
A simpler version of the task above.Oral presentation US company.odt
The USA has many famous companies and brands and this task is about those.Oral presentation indigenous people.odt
I gave the students different Native American tribes, Canadian First Nations as well as some other Indigenous Peoples from English-speaking countries when I used this task. It is often easy to generalise about Native Americans and Canadian First Nations and not realise that the many different peoples have very different cultures, but this task highlights those differences.Oral presentation about the USA.odt
These tasks were for grown-up students. We had worked a lot with American politics and the tasks reflect that there had just been an election, so I think these were from 2020 or possibly 2016.Poster state in the USA.odt
I handed out large A2 posters and the students planned what to write based on the questions in the task and then made posters that we hung in the classroom.Presentation American news.odt
A presentation task based on a current American news story I made for the immigrant class. I picked a few credible sources of journalism to avoid getting fake news and conspiracy theories from alt-right outlets.Presidential election group task.odt
A task I made before the 2020 election where the students would work in groups and cover one policy area for each group and find out what the candidates wanted to do within that area, make a table and present their findings to the rest of the class afterwards.Questions for Bury My Heart at Wounded Knee.odt
It is a good idea to read through the questions before watching the film to know to look for these things and then work on answering these questions in writing afterwards.Questions for Crash.odt
Same as above.Questions for Fargo.odt
A small group of students that needed some extra help to pass did not want to watch a typical school film about the USA, so we watched Fargo instead. These questions were a basis for further investigations more than questions the students should already be able to answer.Repetition questions for chapter2 North America.odt
These questions relate to the book Tracks 2013.Repetition questions about the USA.odt
These are central questions relating to the USA, but you may want to edit out the question about who will enter the White House in January 2017…Repetition questions about the USA.odt
I made this for students at the health care study line.Sports in English speacking countries.odt
I made this for students at the athletic study line.Tasks about Henry Ford.odt
When I taught the technical and inustrial production study line, we worked with the industrial revolution in the UK and on industrial production in the USA and this was part of the latter. I think I found a text on a Henry Ford Museum or maybe from the Ford company that these questions and tasks were related to.Thanksgiving.odt
The American Dream grammar.odt
A grammar task related to a simple text about the American Dream.The Hate U Give Discussion.odt
Some questions for discussion after watching the film The Hate U Give.The Pursuit of Happyness questions.odt
Questions with vocabulary for the film The Pursuit of Happiness which we used as part of working with the American Dream.There is no frigate like a book task.odt
Some words to look up before or after reading with the Poem by Emily Dickinson.US Settlement and Immigration simplified.odt
My simplified version of a text in the book Stunt with questions and vocabulary.Alias Detroit and Silicon Valley.odt
This is a vocabulary for the text in Tracks 2013 in the form of squares to use to play Alias with.
Kahoots:
Quizlets:
Other
Short_presentation_of_yourself.odt
An oral presentation task about yourself. I used this with an adult class so everyone got to know each other a little and to assess the level of the students early in the year to adjust my plans according to their skills.Bad_and_good_presentations.pdf
A short presentation that hightlights the differences between a bad and a good presentation. I used this as a reminder later in the year. We ususally worked more on making good presentations before the first presentation.English_day_Billy_Elliot.odt
Tasks for an English day (fagdag) where we watched the film Billy Elliot first and then the students chose between two tasks. We used this on the HO study line, but it could probably be used on any study line.Extra_essay_tasks.odt
Extra tasks I made for a student that could not participate on the original essay writing session. One task is about New Zealand and the Maori and another task is about the student's dreams for the future. The second task is a bit on the easy side.
Emacs on Windows
I use Emacs as my text editor. At work, I use a laptop with Windows 11. I use org-present in class for interactive presentations where I can run code blocks and get the results, and write things into the presentation while presenting. Since I sometimes have pictures in my presentations and org-present changes font faces and sizes, I need to use GUI Emacs. There are two ways to get GUI Emacs on Windows. The first is through WSL2 with the graphical features Microsoft calls WSLg.
Unfortunately, the Wayland stack is implemented in a non-standard way in WSLg that doesn't currently work properly. There are two bugs related to Wayland-native programs: the first bug makes Wayland native programs use XWayland instead of Wayland. The community found a fix for that bug in 2023 and told Microsoft about it in a GitHub Issues thread where a representative for Microsoft said they applied the fix to the codebase, but so far, Microsoft has not released that fix. You can fix it yourself if you like. However, there is another bug that makes Wayland windows unresponsive after locking the screen and unlocking it again. This is the show-stopper for WSLg for me. (There is also a similar bug for X windows where the windows disappear after screen locking, but if you open a new X window, you can alt-tab to the original window and use it.)
With WSLg not working properly, I have opted to instead use native Emacs on Windows. I gradually discovered how to get the necessary external packages and how to configure Emacs on Windows to get as similar an experience as possible to the one I have on GNU/Linux. I wrote blog posts as I discovered these things, but I think it is more useful to have all the information in one post, rather than in separate blog posts, so I have deleted those older post and replaced them with this post instead.
I originally kept a separate Emacs configuration for Windows that I forked from my normal config, but since I always wanted to get things to work as similarly as possible on both OSes and I found it hard to keep the common parts in sync, I chose to integrate the two configs back into one with a few if and when-statements when needed. You can find it here.
People use Emacs in different ways, so you may find that you need something I don't, but I hope this blog post can give you a starting point. (It is also useful for me in case I need to set things up again.) Some other good starting points are Using Emacs on Windows 11: An Installation Guide by Dr. Peter Prevos on his LucidManager website and Properly Installing Emacs on Windows, Properly Setting up Emacsclient on Windows, Printing Directly from Emacs on Windows and Getting spelling to work in Emacs on Windows by Dr. Raoul Comninos on the EmacsElements website and YouTube channel. I have used their ideas in my setup when appropriate.
Installation of Emacs on Windows
I use the Windows installer from a nearby mirror of GNU.org as recommended on the Emacs website. After running the installer, I place runemacs.exe on my taskbar and in my startmenu. It is a good idea to use runemacs instead of emacs since emacs opens an additional Windows terminal window before opening the Emacs frame, which runemacs does not. On GNU/Linux, I launch an Emacs server process (also called Emacs daemon) with my window manager which also opens an Emacs frame on my first virtual desktop, but on Windows, I have thus far launched Emacs by hitting Windows+1 since I have runemacs.exe as my leftmost taskbar item. If you would like to use an Emacs server process launched by Windows at startup and just open a frame when you need it, then have a look at Properly Setting up Emacsclient on Windows by Raoul Comninos.
Installation of tools that interact with Emacs
Emacs needs external programs for some of its functionality. Below is a table that shows useful programs I use on Windows to get the functionality I need or want from Emacs. More details can be found in the relevant sections below.
Package | What it does | Where to get it |
---|---|---|
chocolatey | For installation of (free) software | https://chocolatey.org/install Use Individual install. |
Hack | Free programming font I use as default. | https://github.com/source-foundry/Hack-windows-installer |
Liberation | Free fonts I use for variable-pitch. | Chocolatey or LibreOffice |
imagemagick | For showing pictures | Chocolatey |
Pandoc | Converts file formats | Chocolatey |
Texlive | Export of files from org | Install miktex with Chocolatey |
mupdf | Opens PDFs in doc-view-mode | Chocolatey |
unoconv | Opens MS365 and ODF in doc-view-mode | https://www.libreoffice.org/download/download-libreoffice/ |
git | For version control. | https://git-scm.com/downloads |
hunspell | Spell checking program. | https://sourceforge.net/projects/ezwinports/hunspell-1.3.2-3-w32.bin.zip/download |
nb_NO.aff , nb_NO.dic |
Norwegian Bokmål dictionary for hunspell. | https://www.libreoffice.org/download/download-libreoffice/ |
Node.js and npm | Use NPM to install LSP servers. | https://nodejs.org/en/download |
Python | Use Pip to install LSP servers. | Chocolatey |
LSP servers | Completions, error detection, linting. | pip and/or npm |
Setup of environment variables
Emacs looks for a .emacs.d
directory or a .config/emacs/
directory or a .emacs
file in $HOME
. To set $HOME
, press the Windows key, write environment and you should see the Edit Environment Variables
program (Rediger systemmiljøvariabler
if you use Norwegian Bokmål). Set the User variables for HOME
to wherever you want it. I also found that it was useful for git to set LANG
and LC_ALL
since git and other programs compiled with MSYS2 respects the text encoding from those. I did this as part of my trial and error process to find ways around git's default conversion of text encoding and line endings, but I am not certain it is necessary after setting the system locale to UTF-8 and/or setting Git Bash's text encoding in the GUI (see the dealing with text-encoding section for more on this).

Dealing with text-encoding
Windows uses UTF-16 under the hood, but on the surface it uses different text encodings depending on your locale. (GNU/Linux, BSD and MacOS use UTF-8.) Windows uses CR and LF to end lines while GNU/Linux, BSD and MacOS X use LF. (Mac OS < 10 used CR.) There are different strategies to deal with this:
- Use the locale's encoding on Windows and have git convert line endings and text encoding on pull and push.
- Use UTF-8 and Unix line endings for every buffer and file inside Emacs, but configure Emacs to work with yanking (pasting) and killing (cutting) to and from the clipboard in Windows locale's text encoding. Tell git to not convert files and line endings.
- Set Windows 11 to use UTF-8, set Emacs to use UTF-8 and Unix line endings and tell git to use UTF-8 and not convert line endings.
If you do 1, then you don't have to configure git, because that is its default behaviour on Windows. The disadvantage is that your repos will have files with a mix of text encodings if you edit them on different platforms. If you do 2, then you have files with only UTF-8 and Unix line ending in your repos, but you have to configure Emacs to convert text when yanking and killing to/from the system clipboard. You have to configure git not to convert CRLF to LF or the text encoding.
Below is how you configure yanking and killing to work to and from iso-latin-1 which is the common text encoding for Windows in Northern Europe and North America. If not on Windows, I set it to utf-8 so I can use the same configuration on GNU/Linux.
(if (eq system-type 'windows-nt)
(set-clipboard-coding-system 'iso-latin-1)
(set-clipboard-coding-system 'utf-8))
My strategy
I use the third strategy now. Windows 11 has a beta feature where you can choose to use UTF-8. You can set it up by following the step-by-step instruction from geekrewind.com. You still have to configure git not to convert CR LF to LF and vise versa on push and pull, but you don't have to configure Emacs to do anything when yanking and killing. To configure git to use UTF, I set the user environment variables LANG
and LC_ALL
since git and other programs compiled with MSYS2 respects the text encoding from those. In addition, I opened Git Bash, right-clicked the window title, selected Options…, selected Text, chose nb_NO
and UTF-8
(you may want something else than nb_NO
which is Norwegian Bokmål) since I read somewhere that git uses the settings set in Git Bash. I am not certain if you need to do both, but I did and it works. In my .gitconfig
in my $HOME
, I made a section called [core]
and on the next line wrote autocrlf = false
. This means that git will not convert line endings on push and pull from Unix (LF) to Windows (CRLF).
I still have configuration to always use UTF-8 and Unix line endings inside Emacs and save every file as UTF-8 with Unix line endings. This is useful for getting rid of other encodings in previously made files. (In case I want that other encoding, for example for files I want to use under emulation of older systems, I can omit saving and they would still be in their original encoding.) I hope Microsoft will make UTF-8 and Unix line endings standard in Windows 12. The only small problem I have seen since switching to UTF-8 is that a few Norwegian glyphs in HP's notification about driver updates don't display properly. Otherwise, I have had no problems. Below is the configuration I use to set Emacs to use UTF-8 and Unix line endings and write every file with UTF-8 and Unix line endings.
(prefer-coding-system 'utf-8-unix) (set-default-coding-systems 'utf-8-unix) (set-language-environment 'utf-8) (setq-default coding-system-for-write 'utf-8-unix) (setq-default buffer-file-coding-system 'utf-8-unix)
Spell checking
I used to use aspell with aspell-en and aspell-no or nb depending on whether the distro ships both Nynorsk and Bokmål in the same package or have separate packages (nb = Norwegian Bokmål, nn = Norwegian Nynorsk). I did not find aspell-no or nb on chocolatey or msys2 and I had the same problem with the hunspell package available for Windows which comes with British and American English which I sometimes use, but not Norwegian Bokmål.
For a while, I turned off spelling on Windows, but I recently looked into it again and found that I could copy over the .dic and .aff files I get with LibreOffice since it uses hunspell as well and you get the dictionaries and localisation for your locale when the LibreOffice installer is run on Windows. To use the dictionaries from LibreOffice, go to C:\Program Files\LibreOffice\share\extensions\dict-no\
and copy the files nb_NO.aff
and nb_NO.dic
. If you use another language, have a look in the extensions folders to find the folder with your relevant dictionaries. Go to the share\hunspell
directory under where you installed hunspell. I use C:\Program Files\Hunspell\share\hunspell\
and paste the files there.
In addition I have taken the settings suggested by Getting spelling to work in Emacs on Windows and modified them slightly for my use. I now also use hunspell on GNU/Linux.
(use-package flyspell :hook ((prog-mode . flyspell-prog-mode) (text-mode . flyspell-mode)) :init (when (eq system-type 'windows-nt) (setq ispell-program-name "C:/Program Files/Hunspell/bin/hunspell.exe")) (setq ispell-dictionary "nb_NO") (setq ispell-dictionary-alist '(("nb_NO" ":alpha" "[^[:alpha:]]" "[']" nil ("-d" "nb_NO") nil utf-8))) (setq hunspell-default-dict "nb_NO"))
Dictionary lookup
On my GNU/Linux systems, I install a dictd server and some dictionaries so I don't need to be connected to the internet to use dictionary-lookup-definition. Since there is no dictd server package for Windows, I first tried to use dict.org to look up words. When I tried dictionary-lookup-definition, Emacs just froze. It did not use a lot of CPU, but it just did not respond do anything, including C-g. I had to kill it with the three-finger salute (Ctrl-Alt-Delete). Maybe the relevant ports are blocked by my network at work, so it might work for you even if it did not for me. Below, you see my configuration for dictionary mode. I check if I am on GNU/Linux and otherwise, don't load it since I cannot get it to work at work.
(use-package dictionary :if (eq system-type 'gnu/linux) :config (setq dictionary-server "localhost"))
Viewing MS365 and Open Document Format documents
Emacs can show .xlsx, .docx, .pptx, .odt, .odp and other MS365 (Formerly Microsoft Office) and LibreOffice (Open Document Format) files in doc-view-mode. It is very practical to go directly from dired to doc-view-mode in stead of waiting for LibreOffice or MS365 to start. To show these files it needs a python script called unoconv that comes with LibreOffice. You also need to set the path to that script to get it to work.
Pandoc and LaTex for export and import from Org mode
I use pandoc with Emacs and also ox-pandoc to be able to export from Org mode to .docx format. Upper Secondary schools in Norway use MS365, so it is useful to be able to write .docx documents occasionally. I use LaTex a lot for export of PDFs from org files I have used with org-present in class. Both pandoc and LaTex can be installed with Chocolatey, but notice that I had to use miktex to get LaTex via Chocolatey.
Eshell and PowerShell in Shell mode
Eshell is really nice and it works almost as well on Windows as it does on GNU/Linux. It has become my goto shell. The difference between the platforms shows when using "graphical", ie TUI CLI programs, where ansi-term is used to output the output from those programs when on GNU/Linux. There is a difference between a graphical terminal emulator and the shell that runs in it and Eshell is just a shell.
Sometimes I need to use PowerShell to configure WSL2 or Hyper-V or something else that needs to use PowerShell. Since I like to have as few windows open as possible since Windows ironically is terrible at handling windows, it makes more sense to use PowerShell in shell mode and stay within Emacs instead of launching a new PowerShell window. (Some people think window snapping solves the inefficiencies of a floating window manager or desktop environment, but it doesn't since you have to do it manually with a keyboard shortcut or even more inefficiently by mousing around and dragging the windows to the edges. A tiling WM does it automatically which saves time and interruptions.)
By default, you get cmd.exe
in Shell mode on Windows. I had some trouble finding good documentation of how to set it up with PowerShell. Some people suggest just setting PowerShell to explicit-shell-file-name
, but that only partially worked since it gave me an error that PowerShell was invoked with a wrong argument. A lot of people pointed to someone on the Microsoft blogs that set up PowerShell in Shell mode, but in a way that removed the prompt. He had made an Elisp workaround to get the prompt back, but it seemed like there should be an easier way. The trouble is that comint mode, the mode shell mode is built on, sends -i
by default to the shells it interacts with as an argument. I tried a couple of things and it turns out the solution is really simple.
(use-package shell :config (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) (add-to-list 'comint-output-filter-functions 'ansi-color-process-output) (add-hook 'comint-output-filter-functions 'comint-osc-process-output) (add-hook 'shell-mode-hook (lambda() (company-mode 0))) (when (eq system-type 'windows-nt) (setq explicit-shell-file-name "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe") (setq explicit-powershell.exe-args '(""))) (when (eq system-type 'gnu/linux) (setq explicit-shell-file-name "/bin/bash") (setq system-uses-terminfo t) (setq comint-terminfo-terminal "xterm")))
In the code block above, if on Windows, I tell Emacs to run PowerShell and give it the arguments ""
(ie, nothing) which remove the default -i
argument, but adds nothing else. And now I have PowerShell in Shell mode. The rest of the configuration turns off company since the shells have their own tab-completion and turns on ansi-colours which both Bash and PowerShell can work with. If you prefer to use PowerShell 7 instead, use the path to it instead of the path to the built-in Windows PowerShell.
Language Server Protocol servers
LSP is a standard Microsoft made for adding language support to VSCode that is now also used by other editors like NeoVim and Emacs. In Emacs, you just have to have the LSP servers you want installed, the correct paths configured and eglot, company and eldoc, if turned on, makes use of them in the mode for the associated programming or markup language. I tend not to like documentation constantly popping up with eldoc-mode, but use completions and warnings from eglot and company. Below is a table of the LSP servers I use and how to install them on Windows.
Language | LSP-server names | install with | Comment |
---|---|---|---|
Python | python-lsp-server (pylsp) | pip or npm i -g | FOSS, flake8 is an optional dependency |
Bash / Shell | shellcheck, bash-language-server | npm i -g | FOSS |
JavaScript, TS, JSX | typescript-language-server, typescript | npm i -g | Microsoft, LSP depends on typescript |
CSS | vscode-css-languageserver-bin | npm i -g | Microsoft |
HTML | vscode-html-languageserver-bin | npm i -g | Microsoft |
JSON | vscode-json-languageserver | npm i -g | Microsoft |
The Microsoft LSP servers give you the same completions, documentation and warnings as in VSCode. You can find more LSP servers at https://langserver.org/.
In addition, you have to turn eglot on in the relevant modes. I turn it on for all programming modes.
(use-package eglot :hook (prog-mode . eglot-ensure))
Python Shell
Python mode in Emacs on GNU/Linux works out of the box with no setup if you have Python installed on your system. However, on Windows, Python mode does not work even if Python is installed. It does not help to add the directory Python is in to the exec-path or add it to the $PATH environment variable either. After trying those two things, I looked for a useful variable to set the path to the python executable and tried a couple of promising ones before finding the correct solution. In the code below, I set the docstring-style to Django which I prefer over the default pep-257 and then check if on Windows and if so, set the path to the shell to where I have python installed.
(setq python-fill-docstring-style 'django) (when (eq system-type 'windows-nt) (setq python-shell-interpreter "c:/Python312/python.exe"))
Paths that need adding
For Emacs to integrate with external packages on Windows, the exec path needs to include the file path to those packages. Below is my extra configuration for adding exec-paths in Windows. You may have placed the programs you have installed manually, like Hunspell, in other places, so adjust accordingly. You may also do this with customize, but I want to have it as part of my config since sometimes I let the custom-vars file where I keep the changes from customize drift a little bit away from the upstream emacs_config
repo on some machines.
(when (eq system-type 'windows-nt) (custom-set-variables '(exec-path '("c:/texlive/2024/bin/windows" "C:/Program Files/ImageMagick-7.1.1-Q16-HDRI" "C:/Python312/Scripts/" "C:/Python312/" "C:/ProgramData/chocolatey/lib/findutils/tools/install/bin/" "C:/WINDOWS/system32" "C:/WINDOWS" "C:/WINDOWS/System32/Wbem" "C:/WINDOWS/System32/WindowsPowerShell/v1.0/" "C:/WINDOWS/System32/OpenSSH/" "C:/Program Files/dotnet/" "C:/Program Files/Git/cmd" "C:/Program Files/nodejs/" "C:/ProgramData/chocolatey/bin" "C:/ProgramData/chocolatey/lib/mpv/" "C:/ProgramData/chocolatey/lib/mupdf" "C:/Program Files/Cerence_For_Lingit//common" "C:/Program Files/MiKTeX/miktex/bin/x64/" "C:/Users/AFK01217/AppData/Local/Microsoft/WindowsApps" "C:/Users/AFK01217/AppData/Local/Programs/Microsoft VS Code/bin" "C:/Users/AFK01217/AppData/Roaming/npm" "C:/Program Files/Hunspell/bin" "C:/Users/AFK01217/AppData/Local/Pandoc/" "C:/Python312" "." "c:/Strawberry/perl/bin/")) '(image-load-path '("c:/Program Files/Emacs/emacs-30.1/share/emacs/30.1/etc/images/" data-directory load-path "c:/python312/"))) )
Skype and Microsoft
Skype was brilliant. It was end to end encrypted when voice, video or text chatting with another Skype user and you could send SMS and call phones with cheap rates from it. Then Microsoft bought it and removed the encryption. Skype was still good for calling cheaply from one country to another. Back in 2009, I bought a Skype feature phone with a "3 Vänner" subscription. At the time I lived in Malmö in Sweden, spent my days at the Danish Royal Academy of Music in Copenhagen, worked evenings and nights at Kone elevators outside Copenhagen and freelanced as a baroque cellist mainly in Jutland and Southern Sweden with the occasional gig in Norway. Skype and the Skype-phone was brilliant to call friends, colleagues and family anywhere with my own phone number from anywhere I was at cheap rates. Most of my fellow musicians also used Skype, so I also chatted in text, voice and video a lot. My parents started using Skype as well, so I could video chat with them from wherever I was as well.
Gradually, Microsoft did numerous overhauls of the user interface and every time, it got worse. The amount of bots and scams also skyrocketed under Microsoft's ownership. Microsoft also used the Skype name for their incompatible Link product which became Skype for business. Over time, the superior technology from Skype was incorporated into Skype for business and Teams. My use of Skype decreased with the Microsoftification of the once brilliant Nordic instant messenger, phone and video chat program.
A few weeks ago, I found out Microsoft is going to kill Skype and instead try to get consumers to use Teams even if Teams is for internal business communication and not very well suited for individual users. Skype will stop working on May 5th 2025. My personal Microsoft account only exists because of Skype, so I am now in the process of exporting all my data from Skype and afterwards, I will delete my Microsoft account. If you have a Skype/Microsoft account, it might be a good idea to export your data before it is to late, and if you don't need that account for anything else, you may as well delete it.
I have been curious about the free software decentralised platform Matrix for a while, so I think I will see if I can find a Matrix server that is open for new users or set one up myself. I have tried the Matrix app Element in the past, and it was rather good. There is also an Emacs package called ement.el that seemed good when David Wilson of SystemCrafters had a look at it a while back in one of his live streams. Maybe this is the push I need to start seriously looking into Matrix again.
Use the Python Shell or REPL from VSCode
Today, one of my students asked how to use the Python shell from VSCode. It is possible to do manually by navigating to the directory of the python file you are working with, writing python and pressing return to enter the shell, then write import filename
(without .py extension) and then you may interact with the code. If you import this way, you have to use filename.function() or filename.variable to interact with the code. The other way is to specify what you want to import, for example, from oblig23 import alder
. It is doable, but as I wrote in an earlier blog post, the Python shell integration in other IDEs and text editors are much more convenient to work with since you don't have to manually load the python shell from another shell inside a terminal.
So I used some time today to look into if there is better integration with the Python Shell hidden somewhere in VSCode or the Python Extension. After a rather long looking around, I concluded that there isn't. (Later on, I found out that if you don't mind using another implementation of Python than CPython, there is an ability to use a Jupyter kernel interactively.) There is, however, a slightly more convenient way to do this with the python interpreter in a terminal than first entering the shell and then importing. If you write python -i filename
(with .py) when you are in the directory where the file is (or write the full path if you are not), you get the python shell with all the classes, functions and variables defined in the file imported. If you change the code, then you have to save and import again, either by leaving the shell and using python -i filename
again or by staying in the shell and writing from x import y
.
Why I replace Bash scripts with Elisp functions
Lately, I have spent some time replacing my Bash scripts with Emacs Lisp functions inside my Emacs configuration. I like programming and I haven't really gotten deeper into Elisp, so one reason was just to learn more Elisp and have some fun. Another reason is that replacing the Bash Shell scripts with Elisp functions removes the need to clone down an extra repository when I install a new system to get things up and running. It simplifies my installscripts a little.
Another advantage of having useful functionality inside my Emacs config is that whatever window manager or maybe even operating system I use, I can still use my functions from inside Emacs. Bash Shell scripts only run on GNU/Linux and POSIX Shell scripts only run on POSIX systems. But Emacs functions can be run inside Emacs on every platform it is available for without any external configuration. I might have to change my settings for wallpaper-command and wallpaper-command-args if I use another window manger, desktop environment or operating system, but most things will just work no matter where I am. Having the functionality in Emacs makes it easier if I ever were to change window manager from Sway as well.
The scripts I was able to replace with Emacs functions this weekend was my radio stream script, my two tv scripts for watching the latest news or satire broadcast from NRK, and my two wallpaper setting scripts, one that goes to the next file in a folder and sets it as the wallpaper so I can cycle through (and also around again when I get to the end) and another one that picks a random wallpaper from within the same folder. During the weekdays I was able to make a script to update my homepage and copy a youtube RSS feed link from a yewtu.be URL in primary selection. It was a lot of fun to dive into Elisp even if it took a lot of time since I was constantly searching for functions I could use for my purposes, both within Emacs and online.
I can still launch my scripts with keyboard shortcuts from my Sway config with emacsclient -e '(functionname)'. I start an Emacs server when I launch Sway, so I can always rely on having Emacs running. For the scripts that need user interaction in an Emacs frame, I can add -r to either reuse an open frame or make a new one.