texts: Customize text after task in custom org-agenda view

texts:
I've been writing my own custom org-agenda views lately, and I've had good luck playing around with org-agenda-prefix-format for customizing the format for my different tasks. I occasionally would like to include extra information, typically via my own added property tags.  However, while I've been adding this extra information /before/ the task of interest, I'd prefer to include it /after/ the task.

For example, I currently display calendar events as:

Serenity:    18:00-19:00
              Location: Jaynestown
              Scheduled: TODO Help the Mudders

However, I'd like for this information to appear in the following order:

Serenity:    18:00-19:00
              Scheduled: TODO Help the Mudders
              Location: Jaynestown

Notice that this cannot be done with org-agenda-prefix-format since some of the added text occurs after TODO Help the Mudders.

===

Edit: Here's the code I used to generate the above:

(defun gs/org-agenda-add-location-string ()
  "Gets the value of the LOCATION property"
  (let ((loc (org-entry-get (point) "LOCATION")))
    (if (> (length loc) 0)
    (concat "\n" (make-string 15 ?\s) "Location: " loc
        "\n" (make-string 15 ?\s))
      "")))

And then use this custom function as follows (within org-agenda-custom-commands):

(org-agenda-prefix-format '((agenda . "  %-12:c%?-12t %(gs/org-agenda-add-location-string)% s") ...


texts:
My system is debian wheezy, I tried to do the following

(global-set-key (kbd "S-<backspace>") 'evil-shift-left-line)
(global-set-key (kbd "<S-backspace>") 'evil-shift-left-line)
(define-key global-map [S-backspace] 'evil-shift-left-line)

What I want is in evil insert mode, I can delete one tab width forward instead of press backspace 4 times.
The keybinding works on my laptop, but doen't work on my desktop. I check the binding for evil-shift-left-line, it has changed but doesn't work, and help on "shift-backspace" only shows "backspace". However, shift do has effect on "backspace", "shift-backspace" delete the previous word instead of character.

When I insert "shift-backspace" after "C-q", it has the same notation "^?" as "backspace" on my desktop, while on my laptop the former is "^@".

Any ideas on why it doesn't work on my desktop?
Thank you for your help!

This question may be related to this one:
Shift+Up isn't recognized by Emacs in a terminal


texts: Org-mode external links not working when exported to HTML

texts:
I have 2 .org files:

// a.org contains the anchor
<<my_anchor>>

// b.org contains the link to my_anchor
[[file:a.org::my_anchor][My Link]]

When I click on the link in org-mode, it links correctly to the position of my_anchor in a.org. But when I export these 2 files to HTML, what I expect is:

// b.html
My Link

What I got is:

// b.html
My Link

I wonder how to correctly write an external link so that it works both in org-mode and in exported HTML.


texts: how to append arbitrary string to yasnippet placeholder field

texts:
I would like to know how to append a default string to a placeholder.

For example, I currently have:

# -*- mode: snippet -*-
# name: render template
# key: rt
# group: Flask
# contributor: Jon Rostran
# --
render_template("${0:index.html}")

But I would like for rt to expand to render_template("|.html") where the | is my cursor position after expansion.


texts: I usually work on files which are updated in the file system via version control. What's a quick way to reload a file without having to C-x C-f the file again and getting asked if I want to reload it?


texts: How can I split paragraph into one-line-per-sentence but still keep it wrapped visually?

texts:
This is similar to Editing files with one-sentence-per-line (in function as well as motive), but I wish to have a full, flowing paragraph rather than visual breaks at every sentence.

I would like to have a minor mode that, when active, will visually join lines from the same paragraph (not separated by \n\n or paragraph-separate or ...) and then activate behavior (perhaps derived from visual-line-mode) that will wrap the line without actually inserting \n.

Does such a mode exist?  If not, how would I go about the process of altering a paragraph's display properties to achieve the result?  (After all, this is the crux of such a mode and one could be developed from the snippet.)


texts:
I'm using GNU Emacs on Windows, and I am unable to use magit-push to push my local changes to a remote repository. This happens with remote repositories regardless of if they are accessed with SSH or HTTPS. What do I need to do to make magit-push work on Windows as seamlessly (or at least nearly so) as it does on my Linux machines?

All I see in the *Messages* buffer is

Running c:/Program Files (x86)/Git/bin/git.exe push -v origin master:refs/heads/master

The same shows in the *magit-process* buffer, more or less. Nothing more useful. I am able to git push from the command line, but it does ask for my ssh key's password. Might that be the problem? I've tried loading the key with Pageant (PuTTY's key agent), but that didn't seem to make a difference.

If it's helpful, I have Cygwin installed, and would be happy with a solution that involved forcing Emacs to use Cygwin's executables.


texts: Ido mode - autocomplete in interactively mode

texts:
windows 10, emacs 26,1, ido mode

I use ido mode.

Suppose I start some command

M-x magit

Then TAB

The possible completions are many and fill the screen:

I need to continue typing and press TAB to select desire command.
But... it's very slow.

Is  it a more interactive way? like fly filter commands' name in ido mode. Something similar to helm only I don't like helm.


texts: color specific days in different background in org agenda

texts:
a weird question. I want to be able to color specific days in different background in the Org-agenda buffer (created with org-agenda-list). I want it to be lets say every Monday and Wednesday. The aim is to get a nice visual queue to not schedule meeting during theses days so i can focus on actual work :). Ideally i would like the day header and all the time slots to get a different background on these specific days.
any clue if that's possible?


texts:
When I execute

emacs --batch --script=/home/jim/test.el --no-site-file --file=testing

I get:

Cannot open load file: no such file or directory, /home/jim/--script=/home/jim/test.el

While emacs --help shows --script in its list of options, executing just
emacs --script=test junk
gives an error saying --script is not recognised.
Is there an alternative?

I'm using Emacs version 24.5.1.
Thanks
What is happening here?


texts: How to insert the current date into a file using abbrev or similar?

texts:
I'd like to replicate something in emacs that I do in AutoHotkey all the time:

type td
have that string be replaced with the current date

I'm trying to do this with Emacs abbrevs but I'm running into an Invalid function: error.

I've also tried using a builtin function, but I get the same Invalid function error.  I've done a bunch of research but no avail.

Here's the code I have currently in my .emacs:

(defun insert-current-iso-date ()
    "..."
    (format-time-string "%Y-%m-%d"))

(define-abbrev-table 'global-abbrev-table
  '(("td" "" (insert-current-iso-date))))


texts: Is there a way to save tramp targets and then incrementally filter them with Helm?

texts:
Say I want to open new connections to superlongusername1@superlongdomain1.org, superlongusername2@superlongdomain2.org and superlongusername3@superlongdomain3.org frequently, but I don't want to type each one every time. It would be nice if the target was saved the on the first successful connection and then presented to me as an option for ever connection thereafter which then could be incrementally filtered with Helm.

By analogy, it would be very similar to helm-recentf but instead of the file names they would be tramp targets.


texts: How to adjust height of echo area if function signature contains non-ascii characters?

texts: While working on a PureScript project, I have noticed that function signatures provided by company-mode get cropped if they contain non-ascii characters. How can I increase the minimal height of the echo area while working on *.purs files so that the function signature is completely shown?


texts: Org-Mode with Scimax changing #+LATEX_CLASS

texts:
I installed scimax on both linux and mac osx. And I am having the same issue for both.  I start the emacs by executing the ./scimax script then I open example/cmu-qualifier.org file and try to export it by pressing C-c C-e j o. Finally, I expect to see an article with columns like in a scientific paper but what I see is a common export of org-mode to pdf.

Should I change the #+LATEX_CLASS: article to something else ?

B.R.


texts: Automating git rebase and solve conflict

texts:
I have a script can solve some conflict on certain file.
How can I automate the work flow to do the following?

Run git rebase
If has conflict, run script try to solve it.
Then run git rebase --continue


texts: org agenda stop strike-through repeated tasks in weekly agenda

texts:
I noticed that when I mark a repeatable task as DONE on the weekly agenda it disappears from the current day, but it shows us strike-through in the following days. How to set faces to have repeatable tasks shows as normal in the following days?

EDIT: Sample data file below. After running agenda you will notice that task 6 is shown in following days strike-through.
#+STARTUP: overview
#+CATEGORY: Tasks
#+ARCHIVE: ../archive/tasks_archive.org::

* Repeatable
:PROPERTIES:
:CATEGORY: Repeat
:ID:       DD079D5C-9BAD-4525-AB40-9C8F67227387
:END:
** TODO [#B] task 5
:PROPERTIES:
:CREATED: [2020-08-04 Tue]
:STYLE: habit
:ID:       769A16A9-6BA1-4FCC-BAB4-F200F8337948
:LAST_REPEAT: [2020-08-06 Thu 06:51]
:END:
:LOGBOOK:
- State "DONE"       from "TODO"       [2020-08-06 Thu 06:51]
:END:
** TODO [#D] task 6
SCHEDULED: <2020-08-10 Mon .+1d>
:PROPERTIES:
:CREATED: [2020-07-30 Thu]
:STYLE: habit
:LAST_REPEAT: [2020-08-07 Fri 08:26]
:ID:       A666ED14-6497-487F-9E97-A27B67A20A66
:END:
:LOGBOOK:
- State "DONE"       from "TODO"       [2020-08-07 Fri 08:26]
- State "DONE"       from "TODO"       [2020-08-06 Thu 10:51]
- State "DONE"       from "TODO"       [2020-08-05 Wed 09:24]
- State "DONE"       from "TODO"       [2020-08-04 Tue 09:47]
- State "DONE"       from "TODO"       [2020-08-03 Mon 09:39]
- State "DONE"       from "TODO"       [2020-08-02 Sun 11:35]
- State "DONE"       from "TODO"       [2020-08-01 Sat 07:31]
- State "DONE"       from "TODO"       [2020-07-31 Fri 11:24]
- State "DONE"       from "TODO"       [2020-07-30 Thu 10:51]
:END:
** TODO [#C] task 7
SCHEDULED: <2020-08-04 Tue 21:30 .+1d>
:PROPERTIES:
:CREATED: [2020-08-04 Tue]
:STYLE: habit
:ID:       DB420A04-B67E-4110-BEA1-9F8613ED8293
:END:

** TODO [#A] task 8
SCHEDULED: <2020-08-06 Thu .+1d>

Agenda config:
(setq org-agenda-custom-commands
  '(("d" "Coprehensive agenda"
      ((agenda ""
          ((org-agenda-skip-function
             '(or
                (org-agenda-skip-entry-if 'todo '("WAITING"))
                ))
            (org-agenda-cmp-user-defined 'jarfar/org-agenda-cmp-user-defined-birthday)
            (org-agenda-sorting-strategy '(time-up habit-down todo-state-down priority-down deadline-up scheduled-up effort-down alpha-up))
            (org-agenda-remove-tags nil)
            (ps-number-of-columns 2)
            (ps-landscape-mode 1)
            (org-agenda-files (append org-agenda-files `(,my/org-events-file-path)))))
        )
       )))


texts: Preserving the space immediately after an org heading when deleting trailing whitespace

texts:
I use a hook to delete trailing whitespace on saving files:

(use-package emacs
  :hook (before-save . delete-trailing-whitespace))

This works well in 99% of cases. However, if I am trying to create a presentation using an org-file then the above command will also delete the required whitespace immediately following the org header which begins with an asterisk. Therefore, the headings will not be properly exported when trying to create the presentation.

E.g. this works:

*[space]
Praesent augue.  Aliquam erat volutpat.  Nunc eleifend leo vitae magna.  In id erat non orci commodo lobortis.  Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.  Sed diam.  Praesent fermentum tempor tellus.  Nullam tempus.

This does not:

*
Praesent augue.  Aliquam erat volutpat.  Nunc eleifend leo vitae magna.  In id erat non orci commodo lobortis.  Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus.  Sed diam.  Praesent fermentum tempor tellus.  Nullam tempus.  Mauris ac felis vel velit tristique

How could I add an exception to the hook so that org-headings are unaffected.


texts: Company backend for words inside the buffer

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL
Compiled from EmacsW64.

Company, using the latest version of Company  from MELPA

Windows 7 x64 bit.

Situation:

Propably I'm missing something. I couldn't figure it out with Google. After reorganizing my .emacs.d, I noticed I don't get any completion from buffers.

For example, I'm typing in the buffer foobarsentence.

And then start a new line below that, and typing fooba, I expected to get company completion suggestion that shows foobarsentecene, and I just need to press tab or RET.

But I see nothing. I couldn't find any company backend that's responsible for words-in-buffer completion. Anyone knows which company backend I mean?


texts:
I'm trying to create a basic spacemacs layer. But there's an error loading it, thus its constituent packages. Checked this SO question, but it doesn't seem to apply.

Any idea of I'm missing? I'm sure it's some small config.

A) Directory structure

$ tree .spacemacs.d/
.spacemacs.d/
├── init.el -> ~/Projects/configurations/profiles/core/etc/spacemacs
└── layers
    └── sunra
        └── packages.el

B) In init.el, configurations of the dotspacemacs-configuration-layers and dotspacemacs-configuration-layer-path

(defun dotspacemacs/layers ()
  (setq-default
   dotspacemacs-distribution 'spacemacs
   dotspacemacs-configuration-layer-path '("~/.spacemacs.d/layers/")
   dotspacemacs-configuration-layers
   '(sunra
     html
     ...

C) Contents in layers/sunra/packages.el

(defconst sunra-packages
      '(free-keys))

D) When I check my Messages buffer, I see this

Loading /Users/timothyw/.emacs.d/core/core-load-paths.el (source)...done
Loading /Users/timothyw/.spacemacs...done
(Spacemacs) Error in dotspacemacs/user-init: Symbol’s function definition is void: use-package

Setting the font...
(Spacemacs) Warning: Duplicated layer sunra detected in directory "/Users/timothyw/.spacemacs.d/layers/sunra", replacing old directory "/Users/timothyw/.spacemacs.d/layers/sunra/" with new directory.
Loading /Users/timothyw/.spacemacs.d/layers/sunra/packages.el (source)...done
Loading /Users/timothyw/.emacs.d/layers/+lang/html/packages.el (source)...done
...
(Spacemacs) Warning: package free-keys not initialized in layer sunra, you may consider removing this package from the package list or use the :toggle keyword instead of a `when' form.


texts: how to use link path to set the background face?

texts:
I would like to use a custom link, i.e. [[h:blue][blue highlighted text]], to create highlighted text. The background color of the highlighted text is specified by the path. I have

(org-link-set-parameters
 "h"
 :export (lambda (path desc backend)
       (cond
    ((eq 'html backend)
     (format "%s" path (or desc ""))
     )))
 ;:face `(:foreground ,(lambda (path) (format "%s" path)))
 :face '(:background "yellow")
 )

The export works as expected, but I need to hard-code the background face to make any sort of highlighting. How can I fix this statement?

 :face `(:foreground ,(lambda (path) (format "%s" path)))

so the path can specify the color in emacs?


texts: How to toggle sort "on-the-fly" in org-agenda-view?

texts:
I am aware that org-agenda-sorting-strategy allows one to define view(s) with desired sort preferences. However, I'm wondering if there is a more "on-the-fly" method for sorting in org-agenda.
For example, I open my agenda in day view. Suppose I want to sort the list of TODOs by priority. Then, I want to sort by tags. The analogy in a non-Emacs environment is to click on the column heading of a table-view. For example, in macOS Finder (or Windows Explorer), one can click on Name or Date or Kind to sort the list of files in various ways.
I am imagining a sort toggle key, much like the one we have for filter using /.
org-sort-entries and org-sort-list work on subtrees and lists. Is there something equivalent within org-agenda?


texts: How to prevent magit with ivy from selecting an author email address?

texts: I have a git repository containing commits with 3 of my email addresses. When I try to view the log and filter by author (-A) and then enter a few letters of my last name, I see a list of the 3 email addresses from all commits that match those letters, and I'm forced to select one. I actually just want the 3 letters in the author search that will match all THREE of my email addresses. How I can break out of ivy's autocompletion here, and just use the 3 letters I've entered?


texts:
I apologize for the vague post as I do not know how to debug emacs that well. I will provide as much detail as I can and will update it as questions are asked.

Problem

So prior to updating some of the fonts on my system org mode showed up properly on my system with org-bullets. Here is an example of what it looked like

 ◉ Heading 1
   ◎ Sub Heading 1
     blah blah
   ◎ Sub Heading 2
     foo bar

But for some reason after some changes all the sub heading bullets disappeared. An example is bellow for what I see. All heading are still bold but you will notice that the bullet "o" is gone.

 ◉ Heading 1
     Sub Heading 1
     blah blah
     Sub Heading 2
     foo bar

Debug

Some of the information that I think may help with this issue.

 org-bullets-bullet-list
 ("◉" "◎" "⚫" "○" "►" "◇")


texts:
I have a large set of tagged tasks in an org file and I want to shift all their dates by one week. Dates could be scheduled, deadlines, or plain dates. What is the easiest way to do this?

I attempted this using bulk actions via the agenda tag view, but I get a warning message about bulk actions not supporting tag views when I attempt to apply my custom org-agenda-date-later 7 function. I don't know how to do this in agenda without a tag view.

Update 2017-06-19:
I have not solved this yet, but I made some headway. You can shift a date three days relative to its current value using ++3d in the date prompt. Agenda bulk actions does not work with this because it relies on org-read-date to prompt for a new date that will be applied to ALL selected items, meaning there is no chance of the currents dates of each item to be considered. So first, that must be fixed, which will require calculating a new date per selected item. Next, bulk actions need to be added to search results. I will try to take care of these one-by-one, but will take awhile.


texts:
When I scroll up or down, Emacs automatically recenters the current position of point. I tried to disable this behavior by adding the following code to my configuration:

(setq scroll-margin 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01
      auto-hscroll-mode nil
      scroll-step 1)

Unfortunately, it doesn't work. I really tried all variables I can find.

NB: I am using AUCTeX and emacsclient.


texts: Conditional True color (24 bit color) support for iTerm2 and Terminal.app in OSX with Fish shell

texts:
I'd like to try and get to a similar setup that I have with N/Vim in OSX, whereby Truecolor support is enabled in iTerm2 (which supports 24bit colors) but disabled in the native Terminal app (which doesn't support it). This is simply for flexibility - sometimes I forget to use iTerm, and sometimes I'm on a machine that is using my dotfiles, but isn't using iTerm.

I've checked that my terminal is rendering the truecolor palette by running this script which outputs the following in Iterm2

and as expected, outputs the following in Terminal.app:

I'm running fish shell version 2.5, and $TERM is set to xterm-256color inside of iTerm2 and also echos this in the terminal. This means if I run tput colors it outputs 256, but from reading around on the web, I don't think it ever outputs anything higher than this though.

In Vim I achieve this with the following line of code in my .vimrc file:

if has("nvim") && terminal_program == "iTerm.app"
  " has true colour support and is nvim
  set termguicolors
  let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  colorscheme base16-materia
elseif terminal_program == "iTerm.app"
  " has true colour support but is using std vim
  set termguicolors
  colorscheme NeoSolarized
else
  set termguicolors
  colorscheme solarized
endif

which lets me have a different colourscheme for nvim and distinguishes between iTerm app and the standard Terminal app.

I know that the latest version of emacs supports True color, so I installed this by running:

brew install emacs --HEAD --use-git-head --with-cocoa

emacs --version
GNU Emacs 26.0.50
... etc ...

and opening it in the cocoa windowed mode shows the additional colours when I run list-colors-display

but doing the same in the terminal with emacs -nw only renders the standard 256, and also looks weird:

And running emacs with a non-standard TERM as the commit message mentions doesn't seem to work:

env TERM=xterm-24bit emacs -nw
emacs: Cannot open terminfo database file

The result is also the same with if I set $fish_term24bit to 1 in my fish.config via set -g fish_term24bit 1. So what am I missing to get the True color support working in iTerm2, before I even write the conditional code?

** edit 1 **

So further digging has thrown up the following links that could be useful:

Github mirror of link 3
Bugzilla discussion

both of which mentions requiring a custom setb24/setf24 terminfo capability to be present, as shown in the example and pasted again below.

@example
$ cat terminfo-24bit.src

# Use colon separators.
xterm-24bit|xterm with 24-bit direct color mode,
   use=xterm-256color,
   setb24=\E[48:2:%p1%@{65536@}%/%d:%p1%@{256@}%/%@{255@}%&%d:%p1%@{255@}%&%dm,
   setf24=\E[38:2:%p1%@{65536@}%/%d:%p1%@{256@}%/%@{255@}%&%d:%p1%@{255@}%&%dm,
# Use semicolon separators.
xterm-24bits|xterm with 24-bit direct color mode,
   use=xterm-256color,
   setb24=\E[48;2;%p1%@{65536@}%/%d;%p1%@{256@}%/%@{255@}%&%d;%p1%@{255@}%&%dm,
   setf24=\E[38;2;%p1%@{65536@}%/%d;%p1%@{256@}%/%@{255@}%&%d;%p1%@{255@}%&%dm,

$ tic -x -o ~/.terminfo terminfo-24bit.src

TERM=xterm-24bit emacs -nw
@end example

As directed, I put this into a file called terminfo-24bit.src and ran the specified tic command, which generated the directory .terminfo in my home dir. However, now when I run emacs I get colour sequences everywhere, which leads me to believe emacs has entered 24bit colour mode, but iTerm2 isn't interpreting these correctly...


texts:
Assuming that I have TODO entries, most of which I have set the EFFORT property in a standard way (i.e. one of "0:15 0:30 1:00 2:00 3:00 4:00"), is there a way to schedule these tasks automatically over the coming days - say starting now or starting tomorrow - assuming also that there is some way of setting, say "no more than 6 hours per day"? (to leave time for other smaller tasks)
Ideally the order of the tasks in time would be the same as they would be listed in an agenda.
The reason I want this is that I would like to be able to tell someone "Yes, I can do that for you but not until Thurs 6 Nov", for example.
RETHINK:
If I put an effort against a single TODO, can I automatically schedule that task AFTER all the existing scheduled tasks - again assuming that no more than 6 hours of scheduled work will get done on one day?
UPDATE:
What I want is to schedule tasks manually, on days, with an easy way of knowing what is already scheduled on a day before I hit enter.
It is possible, when using C-c C-s to see the other tasks scheduled on a day before I press enter? This way I can schedule tasks on days that are not already full. Not automatic like my original idea, but 90% of what I want. Ideally the display of the day would update as I use the arrows to move around the calendar.


texts: Elisp function to get path to file link target

texts:
With the cursor on a file link, I'd like to set up an org-capture template which inserts the template into the target of the link.

I guess I add something like

(setq org-capture-templates
   '(("m" "Topic"
       entry
       (file (get-path-to-link-target-at-point))
       "\n* Topic %?")))

to my init.el in order to achieve what I'm looking for. But I'm not able to code such a function get-path-to-link-target-at-point. So how do I get the file path of a link target at my cursor location?


texts: How to stop Emacs from deleting trailing whitespace?

texts:
By default, Emacs quietly deletes trailing whitespaces once the user moves on to the next line. To reproduce the issue in plain Emacs, do this:

Start plain Emacs: emacs --no-init-file --no-site-file
Insert trailing tabs or spaces on the first line (e.g. five spaces).
Press enter to go to the second line.
Now go back to the first line. The spaces we inserted in step 2 have all disappeared!

This is not good. I want to preserve the trailing whitespace I have typed. Default Emacs seems to make it impossible for me to enter trailing whitespace.

Questions:

What is the cause or rationale for this default behavior?
How can I preserve the trailing whitespace I have entered?


texts: Problems installing packages via elpa that require cl-lib-1.0

texts:
I'm having problems installing package from (m)elpa which require cl-lib-1.0.

My emacs version is 24.3, hence I have a builtin copy of cl-lib-1.0, however, the only version available via elpa is 0.5. Unfortunately the dependency resolution does not seem to understand that my builtin cl-lib is more recent (and adequate), hence it installs cl-lib in v0.5.

The packages in question are shift-text and stripe-buffer available on melpa.

I'm using a function for batch install of all packages, you can find the relevant code here.

A working (workaround) solution is to uninstall cl-lib-0.5 via list-packages and then manually install the package(s) in question. [Therefore I think the actual culprit is my batch install routine?] However, I'd like to continue using my batch installation procedure, hence the question

  How do you tell package.el that a certain package is already installed in a given version?

Edit: Btw, this problem has surfaced previously, however, the discussion in this github issue does not properly solve it.


texts: Dired: Insert/Moved to this subir for all subdirs?

texts:
windows 10, emacs 25.1, dired+

In dired mode if I want to open subfolder in the same folder as parent folder I press i

Here example:

OK. It's work fine.

But if folder has many subfolder I need to press i for every subfolder. It's work but it very slow.

Question: Is it possible to open ALL subfolders in the one buffer by press only one key?


texts:
How to make the commands next-buffer and previous-buffer ignoring buffer that does not display files?
The problem is when I am on the last buffer of the list I have for example the *completion* and *Message* buffers to jump before going to the next file in the buffer list.
I looked research engines, emacswiki and emacs manual but didn't find something relevant.


texts:
f.e. I want to compare 2 pair of files
file1 vs file11
file2 vs file22
For now I run the bash for, loop over 2 file pairs and run emacs 2 times. But it is not so convenient because I can not go back.
Is it possible to run emacs with a list of file pairs which will open several ediff sessions where I'll be able to switch between them?


texts: How to turn off electric indentation only for TTCN-3 major mode

texts:
I did some research and I've found few similar questions, but not a single one is able to help me.

Well, recently I've started using TTCN-3 major mode and I've found its indentation style awful. I've checked all available c-styles and there is no hope aswell.

I would like to turn off this whole smart indentations that are triggered for example by indent-for-tab-command or ending line with semicolon.

As far as I know, due to this:

(require 'cc-mode)                      ; ttcn-3-mode inherits from cc-mode

major mode TTCN-3 uses electric-indent-mode. I am trying to turn this off only for TTCN-3 but my wonderful lisp craft is not working:

(add-hook 'ttcn3-mode-hook (lambda () (electric-indent-mode -1)))

Could someone please tell me how to do this properly ?

Btw. Should I add hook after or before load function in my .emacs file ?


texts:
As the title suggests, I want to rename several tags only in agenda files.

So, a tag1 will become tag11, taga1 will become someothertag, etc.

I can do it with C-a m tag1 * B + tag11 RET C-a m tag1 * B - tag1 RET

But that is too cumbersome, especially, if you have to do it for several tags.

Any other quicker methods?


texts:
Would you consider something like this a bad practice?

(defun cycle-list (ls &optional backward?)
  "Given any list, returns the next element each time it is called."
  (let* ((last-pos (- (length ls) 1))
         (maybe-counter (gethash ls cycle-list-counter))
         (cal-counter (if maybe-counter
                          (if backward?
                              (- maybe-counter 1)
                            (+ maybe-counter 1))
                        0))
         (counter (cond ((> cal-counter last-pos) 0)
                        ((< cal-counter 0) last-pos)
                        (t cal-counter))))
    (puthash ls counter cycle-list-counter)
    (nth counter ls)))

I wrote it because it is pretty handy, e.g. I used it to write another function which cycle between themes.

Surely, it shouldn't be used with simple lists, such as '(1 2 3), or in place of (do-list ...).
But also, say we add one more theme to (custom-available-themes), now the previous hash-key is left unused.

I suppose in this particular case of theme cycling, there is probably a way to deal with this but: I want to know if the function (cycle-list ...) itself to you seems bizarre.


texts: When in ansi-term, i can't use M-x, the keyboard shortcut doesn't do anything. Does anyone know how to fix this?


texts: How to increse the number of undo steps stored by emacs?

texts:
Looking into undo, there are variables: undo-limit, undo-strong-limit, undo-outer-limit.

While I can blindly set these to a big number and hope for the best.Whats a good rule of thumb for setting these values that matches it to an approximate memory usage?


texts: How to postpone (skip) an org-mode repeated task by a cycle or two?

texts:
I have a repeating task which repeats every four weeks, e.g.

** TODO wash car
SCHEDULED: <2015-05-18 Wed ++4w>

I would like to be able to postpone this task by, say, two 4 weeks cycles starting today, by calling a lisp function.

From what I have researched so far, I could write something in the order of

(org-schedule
 (org-table-time-seconds-to-string
  (+
   (org-time-string-to-seconds (org-get-scheduled-time))
   (* 2 4 7 24 3600))))

to have the SCHEDULED: date shifted by 8 weeks forward.

How could this be automated to shift the date by the amount specified in the repeater string, e.g. 4w?

On a side note, I am not sure about the correctness of the (org-table-time-seconds-to-string) function use, it is here just to illustrate the idea.


texts: How to get absolute file names, to use with `cd`?

texts:
I have this function:

;; needs work in case of spaces in filenames
(cl-defun filename-from-buffer (&key get-ext get-abs)
  "Returns the absolute name, with or without extension,
   of the file that is open in the current buffer."
  (let ((filename (buffer-name))
        (absname (buffer-file-name)))
    (cond
     ((and get-ext get-abs) absname )
     (get-abs (file-name-sans-extension absname ))
     (get-ext filename)
     (t (file-name-sans-extension filename)))))

You can test it with something like this,

(global-set-key
 (kbd "C-l t")
 (lambda () (interactive)
   (insert (filename-from-buffer :get-ext t :get-abs t))
   ;; /Nuskha/With Space/file.ext
   (insert "\n")
   (insert (filename-from-buffer))
   ;; file
   (insert "\n")
   (insert (filename-from-buffer :get-ext t))
   ;; file.ext
   (insert "\n")
   (insert (filename-from-buffer :get-abs t))))
   ;; /Nuskha/With Space/file

It works fine, but when there are spaces in the name, as shown in the comments above, the names are not such that you could take them verbatim and use with the cd command.

$ cd /Nuskha/With Space/file
bash: cd: too many arguments

I want a function that returns something like this /Nuskha/With\ Space/file. How could this be done?


texts: Is there a way to resize margins when exporting PDF in org-mode?

texts:
I want to export my org document as a PDF, but its margins are way too big. I would like to re-size them as I wish. I am using

#+LaTeX_CLASS: report

I do not know if there is a way. Any help?


texts: orgmode - define multiple line code as macro

texts:
How can I convert below code into a macro?
#+REVEAL_HTML:

[[./sample.png]]
#+REVEAL_HTML:

I try it as below but doesn't work:
#+MACRO: mymacro #+REVEAL_HTML:
$3#+REVEAL_HTML:

Call it as:
{{{mymacro(50%,50%,[[./sample.png]])}}}


texts:
Is it possible to see mypy types in emacs?  I would like a command that does something like show the type of what's under point (presumably getting that information from the mypy cache for speed?).  Or alternatively, I might be happy with a UI like lsp-mode's (perhaps using lsp-mode itself) that shows the type immediately when point is over something, without needing to run a command.
Would be interested to know also if there is an easy way to set things up in spacemacs, but this question is primarily about the generic emacs issue.


texts:
I've been using shell-pop recently, and it's nice how I can pop to default-directory in term immediately. For the times I'd rather use a dedicated terminal, is it possible to create an equivalent for OSX's Terminal.app?

What I want is to call one function in emacs and launch Terminal.app cd'd automatically to default-directory.


texts: calc: how to specify radix while yanking

texts:
I know I can yank into the stack in calc using C-y.  However, it seems that calc automatically assumes that I'm yanking in a base-10 number.  If I try to specify a radix (like 16# for hex) before yanking and then pressing C-y I get the error message [Bad format] from (calcDigit-nondigit).

If I actually prefix my killed text with 16# then it works, but that's a little tedious.  Is there any way to tell calc "hey, I'm about to yank a number of base n"?

Concrete examples:

(1) yank a hex number with hex set as calc's default radix (doesn't work)

Kill the following text: deadbeef
Switch to a calc buffer
Make hex the default radix with d 6
Hit C-y

(2) yank a hex number, with radix prefix typed into calc minibuffer (doesn't work)

Kill the following text: deadbeef
Switch to a calc buffer
Tell calc that we're about to enter a hex number by typing 16#
Hit C-y

(3) yank a hex number along with the necessary calc radix prefix (works)

Kill the following text: 16#deadbeef
Switch to a calc buffer
Hit C-y

(3) works, but I'd like to get either (1) or (2) working.  If (3) is the only option I guess I'll write my own function to prepend my last kill with a calc radix prefix...


texts: Emacs hangs/crashes when opening files with special unicode characters, does not crash with -nw

texts:
I'm using Arch Linux, i3wm and emacs 27.1, and I'm having an issue where emacs hangs when opening certain files, but I can't seem to find a pattern as to which files cause the hang.
When emacs hangs, I can't interact with it in any way. C-g does nothing, I have to kill it using xkill. htop shows that emacs -Q is running at 99% CPU usage.
So far in my testing, it hangs when I open my picom.conf file and my i3 config file, both of which are in a .dotfiles directory and symlinked to my .config directory. Other files in my .dotfiles directory open with no issue. I tried copying picom.conf to my home directory, still causes the freeze. I tried renaming the copy of picom.conf to just textfile thinking maybe it was having issues with the .conf suffix, but still freezes.
When I run emacs in the terminal, the freeze doesn't happen, the window opens just fine.
So far, any file that causes the freeze does so 100% of the time that I try to open it, any file that doesn't cause the freeze doesn't do so 100% of the time that I try to open it.
What are my next steps in troubleshooting this issue?
EDIT: I've narrowed the issue down a little bit thanks to some help from a reddit user. It looks like the crash is happening in files with special (unicode?) characters. My picom.conf file has a japanese character, and my i3 configuration file has font awesome icons embedded. Vim opens these fine, terminal emacs opens them fine, but GUI emacs crashes. Removing the offending characters makes it so that I can open the files in GUI emacs without crashing, but unfortunately, those characters serve an important purpose in my i3 config.
I don't think this is intended behavior, but I can't seem to find examples of my exact issue.


texts: Auto-completion in Auctex automatically introduces dollar signs

texts:
My auto-completion all of a sudden changed its behavior, and I have no clue why. When I auto-complete a mathematical expression, like \subseteq, say, it will introduce dollar signs in front and at the end. However, it only does this, if I am in math-mode. To illustrate:

\subse TAB

gives

\subseteq

and

$\subse TAB

gives

$$\subseteq$

which renders the auto completion completely useless, as everytime I have to delete the dollar signs.

Similarly,

$\int_{0}^{\inf TAB}$

gives

$\int_{0}^{$\infty$}$

Please find below the corresponding section from my .emacs file. I don't know any lisp.

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
;; AucTex setup
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(require 'auto-complete-auctex)
;; Stop completion
(define-key ac-complete-mode-map "\M-/" 'ac-stop)
;; Now you can stop completion by pressing M-/.
;; Completion by TAB
;; -----------------
(define-key ac-complete-mode-map "\t" 'ac-complete)
(define-key ac-complete-mode-map "\r" nil)
;; Do What I Mean mode
;; -------------------
;; If DWIM (Do What I Mean) mode is enabled,
;; the following features is available:
;;
;; a. TAB (ac-expand) behave as completion (ac-complete)
;;    when only one candidate is left
;; b. TAB (ac-expand) behave as completion (ac-complete)
;;    after you select candidate
;; c. Disapear automatically when you
;;    complete a candidate.
(setq ac-dwim t)
(setq ac-ignore-case nil) ; prevent autocomplete from changing capitalization


texts: Long pause during Emacs startup, prior to init file running

texts:
Inexperienced programmer here - When I open Emacs (24.5) on Mac Mavericks 10.9, I am getting a delay between the Emacs GUI opening and the init file being loaded. There is a white screen, which appears to do nothing for ~7 seconds.

Could this be a result of something in my init file (which otherwise loads without error), or must it originate from something in my PATH or .bash_profile?

I have an alias set to open emacs from the Terminal:

alias="open /Path/To/Emacs-x86_64-10_9"

Any other ideas what this might be our how I can debug the pause?

EDIT1

Here is the output of etc/hosts, @phils having pointed out it may be the cause.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
#127.0.0.1      localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost


texts: Choose individual startup visibility of org-mode's source blocks

texts:
In org-mode, how could one specify the visibility state of individual SRC_BLOCKs when a file is opened?

org-mode provides the variable org-hide-block-startup to specify if all source blocks are shown or hidden when a file is opened. How could I specify, instead, the initial state of individual source blocks when a file is opened?

The visibility state of headings can be manually chosen using the VISIBILITY property. It is not obvious, however, if there is something similar for source blocks.


texts: How to change the buffer name in emacs to any given string? Useful if one has many shell buffers for various specific tasks and is merely seeing their order of creation.


texts: Why does Shift-right says it is bound to right?

texts:
I tried to check what function shift-right is bound to which extends the region right by a character by default. But C-h k says:

<right> (translated from <S-right>) runs the command right-char (found
in global-map), which is an interactive compiled Lisp function in
‘bindings.el’.

If S-right does something else than simple right then why does it say it is bound to right?


texts: Linking to c++ libraries in babel code block

texts:
The title says it all, and I've included the relevant sections of my file below.  I'm  trying to create a src block that uses some functionality of the boost libraries, the first src block sets up the compiler, including the libraries to link to.  The second src block is just a test function, but it quits with a linker error.

#+begin_src elisp :exports results
   (setq org-babel-C++-compiler
       (concat "g++ -std=c++0x"
               " -lboost_system -lboost_filesystem"
               " -I"
               (expand-file-name ".")
       )
   )
#+end_src

#+begin_src C++ :exports both :includes (list "\"boost/filesystem.hpp\"" "<stdio.h>")
 printf("testing\n");
#+end_src

The error:

  /tmp/ccvz9bRM.o: In function __static_initialization_and_destruction_0(int, int)':
  C-src-2374gem.cpp:(.text+0x51): undefined reference toboost::system::generic_category()'
  C-src-2374gem.cpp:(.text+0x5d): undefined reference to boost::system::generic_category()'
  C-src-2374gem.cpp:(.text+0x69): undefined reference toboost::system::system_category()'
  collect2: error: ld returned 1 exit status
  /bin/bash: /tmp/babel-2374l5F/C-bin-2374tos: No such file or directory


texts: Generating a single byte-compiled file from more sources

texts:
I have a relatively large elisp file which starts becoming hard to maintain and I am going to split it into smaller files.

However, for my use case, it would be still convenient to have a single byte-compiled file (because I use it on other systems and it is simpler to copy a single file).

Of course, I could concatenate all source files into a single foo.el file and compile the latter.
Before going this way, I would like to know if there is already a function along the lines of:

(byte-compile-directory foo-dir foo)

generating a single foo.elc from sources in foo-dir.


texts: Magit, how to use system's ssh agent and don't ask for password

texts:
I've googled and read the FAQ and Wiki for Magit, but still unable to figure this out, all I find are answers about Windows...

How can I configure Magit to use my running ssh-agent session and don't ask for my password when doing a push.

I'm running linux, and have the ssh-agent startup with my terminal and unlock my key then, which allows me to do git push, etc. without having me enter the password each time.

Env:
Arch Linux
Emacs 24.4

ssh-agent with keys added, to unlock on first terminal opened.

EDIT: I meant using passphrase, you know for the ssh key, et al.
And I'm pushing to Bitbucket, but I do believe the key problem is that Magit is not talking/recognizing my ssh-agent.
Maybe there's some config to set, to tell it that I'm running it??


texts: What would be the simplest way to add a "Copy to clipboard" button to html-exported source blocks in an org-mode file?

texts:
I am writing documentation for an API in org-mode, and exporting to HTML. I would like the exported HTML source blocks to have an associated button that copies the code to the clipboard, achieving something like the following:

I suspect that I'll need to fiddle with the HTML export code, but I'm not sure where to start, exactly.
For the required JS part, I'm thinking of doing something along the lines described here: https://stackoverflow.com/a/30810322/885262 and defining one button per source block, and associating the block's contents to its event listener, so that when the button is clicked, the code is copied to the clipboard.


texts: helm-projectile find file doesn't ignore some files

texts:
I'm using helm-projectile in spacemacs. I want helm-projectile to ignore all the files in .stack-work directory when running helm-projectile-find-file.

I added .stack-work in projectile-globally-ignored-directories variable:

But the result of helm-projectile-find-file still contains following:

All files in .stack-work were successfully ignored, except those 4 files. I cannot figure out why that 4 files are still showing up, while others don't.

I also tried to create.projectile in the root directory of the project with the following contents:

-/.stack-work

The result was, helm-projectile-grep seems to ignore .stack-work with .projectile. But there was no difference in helm-projectile-find-file; it still shows up that 4 files.

Why are that 4 files are showing up in the result? What should I do in order to completely ignore files in .stack-work?


texts: Make the most recently open currently open buffer on top of the Buffers list with helm-mini

texts:
It seems helm-mini places the currently open buffer on the bottom of the Buffers list.

For example, suppose I have a two splits and test.txt is open in one of them. Sometimes I want to open test.txt in the current split, and when I do helm-mini, the test.txt is on the bottom of the list (even though it is the most recently opened one), which makes selecting that file inconvenient.

I was wondering if there is any way to put it on the top of the list - or at least in the order of recency. It seems like helm-mini sorts buffers in the most recent order, except the currently visible one in one of the splits.


texts:
I'd like to schedule events in a conference with the respective room numbers.

Basically, instead of:

SCHEDULED: <2017-04-24 Mon 13:45>

I'd have

SCHEDULED: <2017-04-24 Mon 13:45 Room ABC>

What is the best way to do that, i.e., include locations? Should I use a custom property?


texts: Why doesn't url-copy-file download these files?

texts:
I discovered this issue while trying to install all-the-icons.

One step of installation involves using url-copy-file to install fonts. After running the install script, the font files are found in the correct place but are all empty. I verified that the script was not part of the problem by evaluating the url-copy-file expression myself with the proper values:

(url-copy-file "https://github.com/domtronn/all-the-icons.el/blob/master/fonts/all-the-icons.ttf?raw=true" "/home/me/.local/share/fonts/all-the-icons.ttf" t)

A file was created in my local filesytem in the correct place, but it was empty. I tried wgetting the file manually from github, and the download was successful.

Why doesn't url-copy-file work on my system? I am using arch linux, but in the issue logged on all-the-icons github repo, I see that other users with this problem are using FreeBSD. I'm not sure if this is relevant.


texts: How to search in multiple files with Emacs without grep?

texts:
There is a folder with many sub-folders, files and I would like to search for a given piece of text in all of these files with Emacs on a Windows 10 machine. (I know about M-x grep, but it does not work in Windows environment.)

Is there any way to start such recursive search from within Emacs on Windows 10 without installing additional software or extensions?

(The question marked as a "possible duplicate" is different. My question is about searching in files' contents. The another question is about searching for files.)


texts: Use `defun` font-locking for other keywords

texts: I'm using the tco.el package, which provides tail-call optimisation for functions in elisp that call themselves in tail-position. The way such functions are identified is by using defun-tco instead of defun. But this means tail-call optimised functions no longer are styled like functions in terms of font-locking. How do I specify that defun-tco should be styled like defun?


texts: changes in commits are not shown any more

texts:
when commiting in magit it used to open a diff window where I could see the changes I'm commiting right now. For some reason this window doesn't open any more on some repos. I must have disabled this behaviour somehow. Unfortunately I don't know how I did this or how to undo this.
Can someone help me out here?


texts: save-excursion does not work with `org-sort-entries`

texts:
Say we have a org buffer with content:

* top-level heading
some text $          # $ denote cursor
** heading 3
** heading 2
** heading 1
** heading 0

Now evaluate (save-excursion (org-sort-entries nil ?a)).  The cursor goes to the beginning of top-level heading, rather than stays put at $ as I would expect.

Why does save-excursion does not work under this situation?

Updated: Even with (save-excursion (save-restriction (org-sort-entries nil ?a))), the cursor still moves.


texts: How to schedule todo in org for every even day, and similar for every odd day?

texts:
I would like to schedule a todo item every Monday, Wednesday, Friday.

I followed this one:
Org-mode schedule 1 event for multiple days?

and get something like this:

* stuff to do
SCHEDULED: <Monday 4/5/2020 +1w><Wed 6/5/2020 +1w><Fri 8/5/2020 +1w>

This doesnt show up on my agenda.  So I think the way I write it down is wrong.  Could anyone give some pointers?


texts:
Unfortunately, I'm stuck on Windows.
I have a network folder under this PC. Is there a way to navigate into it with dired without mounting it as another drive?


texts: Is there a way to increase speed of scrolling when holding down C-n/C-p/C-f/C-b?

texts: Title is basically the question.  If I hold down C-n, C-p, etc., for a second or two, the speed at which it scrolls is too slow for my liking.  Is there a way to make it scroll faster if I hold one of the combinations?


texts: How to make emacs show correct hex color on background?

texts:
The way I run emacs:

TERM=xterm-256color emacs -nw <my_file>

I am trying to have background on dracula-theme (https://github.com/dracula/dracula-theme).

I have added following line into .emacs:

(add-to-list 'default-frame-alist '(background-color . "#282a36"))

Expected color:

but some blue color show up instead:

I have also installed the draculate them but similiar problem occurs.

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)

Possible bug: https://github.com/dracula/emacs/issues/32


texts:
Using my prelude-based emacs install full-screen on my laptop, I normally have 2 vertical windows side-by-side. If I invoke helm-mini, it normally takes up half of one vertical window, so about a quarter of my laptop screen. However when it's showing the full path of recent files, these trail off the right edge of the helm window, hiding the useful file name:

I know I can hit C-t a few times to move the helm window around, and hopefully get a winder window that can hopefully show the file name, but that's cumbersome.
Is there a setting or feature that will help here? Maybe truncating the left side of the line, not the right? Or wrapping the line around? Or something else?


texts: Can't run Python shell in Emacs 24.4 due to a space in the path

texts:
When I try to start a Python shell in Emacs 24.4.1 running on Windows, I get an error "invalid argument" when Emacs tries to spawn the process. This is occurring because Python is installed under c:\Program Files (x86), which of course has those nasty embedded spaces. When I try to run Python from Emacs, it gets the path right in the prompt, but then the call fails because the spaces cause the command to look like there are multiple arguments. I can manually add quotes around the path in the mini-buffer prompt, but that's obviously not a solution. Oddly enough, Emacs 23.2.1 on the same machine has no problem with invoking Python.

I'd prefer not to change the location of Python if I don't have to.


texts: Org-capture - placing entry in user-specified subheading

texts:
I am trying to create a capture-template which will prompt the user to define a subheading so that it can place the capture as a level 3 heading under the appropriate level 2 heading within an org file.  For example:

* Classes
 ** CLASSNAME1
 *** SOME ENTRY
 ** CLASSNAME2
 *** SOME ENTRY

I want to be able to specify in the mini buffer whether a capture will be added as a level 3 heading to one of the two level 2 headings CLASSNAME1 or CLASSNAME2.

I have found somewhat similar questions posted about this but none have actually solved my issue.

My template is currently as follows:

("c" "Class" entry
      (file+olp "~/gtd/tickler.org" "Classes" org-get-classname)
      "* %^{Class Type}\nSCHEDULED: %^{Class time1}T-%^{Class time2}T\n:LOCATION: %^{Location}\n")

(The level 1 heading * Classes is within the file: ~/gtd/tickler.org)

My org-get-classname function looks like:

(defun org-get-classname ()
  (setq subheading-name (read-string "Enter subheading: "))
  (subheading-name))

I am simply trying to prompt the user for the name of the level 2 heading with org-get-classname and then use that to add the capture as a level 3 heading.

Currently, when trying to use this capture-template I am told:

Wrong type argument: stringp, org-get-classname

I have been playing around with file+function as well but have not found any success with that either.

This is my first week trying out emacs so I am very new at this point, and I do not have prior experience with elisp so any advice would be appreciated.


texts: How does package.el handle changes in macros when updating?

texts:
Let's assume there is a package P containing two files,

  P/base.el
  P/utils.el

, where the base.el file requires utils.el at runtime and utils.el contains a macro M. Upon first installation of P, package.el downloads, extracts and compiles it.

Now assume the package maintainer updated P to P' and in the process modified M to M'.  The package user now attempts to update his package via package-list. Since P is a useful package, it is also loaded.  Again package.el downloads and extracts P'.  But I don't see how the code from the updated macro M' gets into the compiled file P'/base.el, since the feature utils.el is already provided, so, I assume, and the compiler is happy to use the old definition M.

The question I have about this is simply whether this is a correct analysis ?


texts: How can I paste my password when pushing?

texts:
Instead of memorizing all of my passwords, I use a password manager to store them for me. Currently, since I use Magit for most Git purposes, I need to go through several steps in order to push:

P P RET
C-g
M-x term RET RET
git push RET
Copy my password from my password manager
C-c C-j C-y RET

And then afterward, I seem to have a still-running process from Magit's failed push, in addition to the Term mode buffer I created, to deal with.

Is there a less laborious way to enter my password when pushing with Magit?

Edit: ... oh. Well, this is embarrassing. You can apparently just hit C-y directly when Magit asks for your password. I thought I tried that before, but apparently not.

However, it seems that passwords entered this way are not stored in Git's credential cache, so I now need to enter my password every time I push. Is this a bug?


texts: Exporting and Tangling simultaneously in org mode

texts:
I am writing a literate program in Org mode, and exporting the literate document to html file after tangling.

However, after making any change to the Org file, I often have to do the export (Using C-c C-e h h) and tangling (C-c C-v t) separately. This gets
tedious when making lots of local changes to see the effect on the code's run.

Is there a way to add a command to emacs via Elisp, to do both simultaneously. I'd like to bind this action to the simultaneous key-pressesAlt+F2


texts:
I use following preamble in org file to export my regular documents. I want to add logo to right header, but for some reason, the \includegraphics command is not getting exported.

Here is the code

#+OPTIONS: num:nil; p:t
    #+OPTIONS: toc:nil
    #+LATEX_HEADER:\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
    #+LATEX_HEADER:\geometry{a4paper} % or letterpaper (US) or a5paper or....
    #+LATEX_HEADER:\usepackage{graphicx} % support the \includegraphics command and options
    #+LATEX_HEADER:\usepackage{fancyhdr, lastpage}
    #+LATEX_HEADER:\usepackage{fontspec,xltxtra}
    #+LATEX_HEADER:\usepackage{polyglossia}
    #+LATEX_HEADER:\usepackage[Latin,Devanagari]{ucharclasses}
    #+LATEX_HEADER:\setlength{\parindent}{0pt}
    #+LATEX_HEADER:\fancyhead{}
    #+LATEX_HEADER:\headsep= .51 cm
    #+LATEX_HEADER:\headheight= 1.5 cm
    #+LATEX_HEADER:\fancyhead[L] {{\huge \bfseries My hospital,} \\ 4th floor, My Building \\ My City square, City  }
    #+LATEX_HEADER:\fancyfoot [L]{{\Large \bfseries Dr My Name} \\{\small  MD (Med), DNB(Med), DM (Specialty)}\\ Reg No 123 }
    #+LATEX_HEADER:\fancyfoot [R]{{\Large \bfseries Dr Other Name}\\{ \small MBBS DOMS} \\  Reg No  0001}
    #+LATEX_HEADER:\renewcommand{\headrulewidth}{0pt}
    #+LATEX_HEADER:\fancyhead[R]{\includegraphics[scale=0.15]{c:/gl.jpg}}
    #+LATEX_HEADER:\pagestyle{fancy}
    #+LATEX_HEADER: \setmainfont{Halant}

Kindly help

In short, how can I use \rhead{\includegraphics[width=1cm]{example-image-a}} in org mode


texts: How to refactor elisp programs using pattern matching on sexps with replacement?

texts:
I'm looking for functionality that can do source-to-source transformation of elisp programs given a set of rewriting rules. For example, given a rule like:

(set (make-local-variable (quote ?var) ?value)) =>
   (setq-local ?var ?value)

It will find all occurrences of the pattern and replace it with replacement. A welcome feature would be to do minimum amount of changes.

Edit: I found this http://www.informatik.uni-bremen.de/st/lehre/Arte-fakt/Seminar/papers/06/Formal/pattern-language-for-refactoring.pdf sadly no implementation.


texts: Swap text before and after "=" in properties file

texts:
Windows 10, Emacs 25.1

Suppose I have properties file:

1=10

2=BS.30

3=BS.20A

Before "=" are numbers, but after "=" has any text(without spaces)

I want to swap text before and after "=".

So the result must be:

10=1

BS.30=2

BS.20A=3

Is it possible?


texts: Enable Follow mode for helm-org-in-buffer-headings

texts:
I want to enable helm-follow-mode for helm-org-in-buffer-headings. This is what I have so far:

(add-hook 'helm-after-initialize-hook
            ((lambda () (helm-attrset
                         'follow 1 helm-org-in-buffer-headings))))

But not working yet. Any ideas?


texts:
I am working with a simple major mode. The format has one single line comment delimiter, i.e., %. However, I get strange results when running fill-paragraph on a comment. Specifically, the result I see when running fill-paragraph on the first line of the following comment

% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

is

% 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
%  1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
%  27

Observe how the next line is indented by one more space. I expect fill-paragraph to not change the comment at all. If I were to run fill-paragraph again on the second line of this resultant comment the third line is preceded, following the %, by yet another space.

I am looking for a way to change the major mode such that this "cascading" behavior no longer occurs when fill-paragraph is called on a comment.

UPDATE 1

I have verified that the issue is related to the particular major mode I am using. Specifically, I started emacs using emacs -Q, loaded the major mode manually, and then enabled the major mode. After doing this, the "cascading" behavior was exhibited again.

The major mode I am using can be found here: https://github.com/abella-prover/abella/blob/master/emacs/abella.el

UPDATE 2

Following @JeanPierre's comment regarding emacs 25. I have confirmed that this behavior does not occur in emacs 25 but DOES occur in emacs 26.


texts: Is it possible to use `org-ref` in LaTeX mode?

texts:
I love using org-ref in my org files, and then export them to PDF (or even LaTeX). However, I have a lot of LaTeX manuscript which I don't want to translate into org, and I could use an org-ref-like way of managing the references within these files.

Question

Is is possible? And How?


texts:
In the Wolfram language, special characters such as ∂, ∫ and ζ can be displayed nicely in Mathematica and in the source, appear as \[PartialD], \[Integral] and \[Zeta].  In wolfram mode, the special characters are supported through font locking, but otherwise the syntax table does not account for them which is the cause of some bugs since ] is marked as a delimiter (and was reported a while ago).

I wanted to create a pull-request to amend the syntax-table so that \[ and ] are matched delimiters; however, it seems like the syntax table can only allow a single character at a time to be defined, and multiple character sequences are only possible for comments.  So is it possible have \[ and ] be matched delimiters?

I also tried looking for a way to tell emacs to treat \[...] as a single "unit" so that the ] at the end doesn't cause new issues; but to be honest I don't really know how to do that.

PS:  As far as I know, the elided text inside \[...] always consists of the set [A-Za-z0-9].


texts: org-html-publish-to-html Tries To Edit .org Files

texts:
I like to automatically publish my org files using a cron job once an hour. I therefore run a cron job that executes the following script:

;;; Load everything ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'org)
(org-babel-load-file
 (expand-file-name "emacs-init.org"
                   user-emacs-directory))

;;; Publish ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(org-publish-project "org-notes")

Please note that my org-notes project uses the org-html-publish-to-html publishing function.

However, if this job runs while I'm visiting an unsaved file in another Emacs instance the script hangs with a message like this:

...foo.org locked by tom@pam... (pid 12320): (s, q, p, ?)?

Based on the Emacs interlocking help page it looks like I should get an error like this is I try to edit a file that contains unsaved edits that were made by another Emacs instance. However, I don't see why org-publish-project would try to edit any org files. It was my impression that it just read the org files from the disk and then converted them into HTML.

Why would org-html-publish-to-html actually try to edit an org file?


texts: Is there a standard/recommended syntax for defining a keyboard binding?

texts:
I have seen all of the following for defining a keyboard binding.  All of these work (at least on MS Windows). I don't know if there is another way to do the same thing.
I am wondering if there is a standard or recommended way to define a keyboard binding and if it is recommended to avoid some of these.

(global-set-key "\M-r" 'some-command)
(global-set-key [(meta r)] 'some-command)
(global-set-key [?\M-r] 'some-command)
(global-set-key (kbd "M-r") 'some-command)


texts: C-x C-f causes python shell to start in python-mode

texts:
I normally use C-x C-f to counsel-find-file by every time I try using it in python-mode, it starts up the Python Shell in a buffer. I've tried investigating whether there is a hotkey conflict using "C-h b", but all that comes up when I search through "C-h b" for "C-x C-f" is:

C-x C-f        counsel-find-file
C-x C-k C-f    kmacro-set-format
C-x 4 C-f      find-file-other-window
C-x 5 C-f      find-file-other-frame

Can anyone help me figure out why C-x C-f is starting up the Python shell in python mode?


texts:
Given a major mode package foo and foo-x that extends foo, with feature x is there a recommended way to configure them with use-package (assuming :defer t and :ensure t for all?

nested use-package
(use-package foo
    :config
    (use-package foo-x
        :ensure t))

requite
(use-package foo
   :config
   (require 'foo-x))

(use-package foo-x)

after:
(use-package foo)

(use-package foo-x
    :after foo)

hook
(use-package foo)

(use-package foo-x
    :hook foo)

Or some other different way. What are the pros an cons of each?


texts:
In my emacs setup, I currently have two key bindings: C-C c i for command1 and C-c c j for command2. command1 outputs some text in the minibuffer while command2 insert the same text in the current buffer.

I am wondering if there's a way to bind command1 to C-c c (so my output appears in messages), but then if j is pressed after that, command2 is executed (inserting the same text in the buffer).


texts: org babel bash blocks - effectively writing non bash code

texts:
Something I often do (and I'm hoping other folks do too)
is write a script and run it through a interpreter.

Since I try to use org mode and org babel for scripting and
literate programming, I end up with

#+BEGIN_SRC sh :results output replace
cat << EOF | psql
SELECT id,name FROM CUSTOMERS ORDER BY id;
EOF
#+END_SRC

All I have to do is C-c C-c and I have immediate results.

Sometimes it's a snippet of ruby code - piped to the 'bundle exec rails console' command, similar technique as above psql example.

My problem is, it hard to write anything substantial inside the "heredoc" block above because

emacs thinks I'm writing bash, when I'm writing sql
emacs thinks I'm writing bash, when I'm writing ruby

This means I loose syntax coloring, smart indentation, etc of the ruby/sql mode.
In -nw mode (prelude) bash "herodocs" have a really low-contrast color, making the code I'm writing really hard to see.

I'm guessing a lot of people write code blocks in org mode that are eventually piped to an interpreter for quick feedback based development.
So whats the best way to go about doing this?


texts: How to add marker based folding to origami without affecting the default behavior

texts:
I am looking to activate vim style marker folding using origami without losing the default functionality. I know I can activate the marker options like so:

(add-hook 'prog-mode-hook
          (lambda () (setq-local origami-fold-style 'triple-braces)))

but then the default behavior is overwritten.

In case it matters: I am using Spacemacs.


texts: Start spacemacs with specific layout open

texts: I have a custom layout, which I can open with SPC l o f. Is there a way to start Emacs with a flag that would automatically load it at startup? I tried this way: emacs --eval '(persp-switch "Asd")' but it yields an error: Wrong type argument: hash-table-p, nil. I've also tried with "Default" with the same result.


texts: Does typing TAB key provide a fixed length blank?

texts:
In Fundamental mode, I type a tab following typing each number, but it seems the separator between the numbers are not the same length. I was wondering why?

1  22   333     444


texts: How to define a function that calls two commands where the first one requires an arguments

texts:
I use emms to play music in emacs and I have this function to add a music directory and shuffle it.

(defun my-emms-command()
  "Run `emms-add-directory' and `emms-shuffle' in sequence."
  (interactive)
  (emms-add-directory)
   (emms-shuffle))

(global-set-key (kbd "s-m a") 'my-emms-command)

But calling on this command returns "wrong number of argumets"

How do I fix this?


texts:
Just upgraded to Sierra, and if I try to copy or paste text, nothing goes through. Has anyone else experienced this problem? Any way to debug the prolem?

Apparently Sierra also broke copy/paste in Tmux, which relies on pbcopy and pbpaste.

This is with Emacs (25.1.1), which I always install with brew:

brew install emacs --with-cocoa --with-gnutls --with-glib --with-librsvg --with-imagemagick


texts:
I need to have non-ASCII chars highlighted in my latex-mode buffers. So I added this lines in my .emacs:

(add-hook 'LaTeX-mode-hook
          '(lambda () (highlight-regexp "[^[:ascii:]]" 'custom-invalid)))
(add-hook 'latex-mode-hook
          '(lambda () (highlight-regexp "[^[:ascii:]]" 'custom-invalid)))
(add-hook 'tex-mode-hook
          '(lambda () (highlight-regexp "[^[:ascii:]]" 'custom-invalid)))

that produce something like:

Now, some scripts of mine do reset regexp higlights (I need to do that) with the code:

(when (bound-and-true-p hi-lock-mode)
    (hi-lock-mode -1))

My question is: what's the best way to keep this regexp highlighted in my buffer? I'd prefer something that works only in latex-mode. I figured out to use something like a change hook.


texts:
So I've been searching around for this particular problem and apparently I found no solutions.

There are posts on reddit about this:
https://www.reddit.com/r/emacs/comments/3scsak/incredibly_slow_comint_eg_shell_compile_output_on/.

But still no solution.  The problem is simple: emacs shell is really bad when you run codes that display lots of text in the shell.

I run fluids simulations and the difference between running the code via emacs' shell and VS code's shell is like day and night. This is what I get running the same test case (1D so not very intensive)

VS code embedded shell: 10 seconds.
Emacs shell: more than 1 minute and still running....

Anyone experiences issue when compiling, running code that outputs lots of text? I need to see the outputs as the code runs.


texts: nov-mode returns binary buffer and "File mode specification error: (error Invalid version syntax: ‘’ (must start with a number))"

texts:
When opening an epub file with Nov-mode I get a binary buffer in fundamental mode and an error message File mode specification error: (error Invalid version syntax: ‘’ (must start with a number)). This issue happens in ALL my epub files and was not present when I installed nov-mode from MELPA for the first time (something must have changed in a recent version). Here's a stack trace of the error when I use a org-link to access an epub file.
Debugger entered--Lisp error: (error "Invalid version syntax: ‘’ (must start with a number)")
  signal(error ("Invalid version syntax: ‘’ (must start with a number)"))
  error("Invalid version syntax: `%s' (must start with a number)" "")
  version-to-list("")
  version<("" "9.0")
  byte-code("\301\010\302\"\203\024\0\303\304\305\"\210\306\307\310\"\210\202\034\0\311\304\312\305\313\310%\210\301\207" [org-version version< "9.0" org-add-link-type "nov" nov-org-link-follow add-hook org-store-link-functions nov-org-link-store org-link-set-parameters :follow :store] 6)
  nov-mode()
  set-auto-mode-0(nov-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer my_ebookfile.epub> "/home/pathfiletothefile/my_ebookfile.epub" nil nil "/home/pathfiletothefile/my_ebookfile.epub" (30673310 66306))
  find-file-noselect("/home/pathfiletothefile/my_ebookfile.epub" nil nil nil)
  find-file-other-window("/home/pathfiletothefile/my_ebookfile.epub")
  org-open-file("/home/pathfiletothefile/my_ebookfile.epub" nil)
  apply(org-open-file "/home/pathfiletothefile/my_ebookfile.epub" nil nil)
  org-link-open-as-file("/home/pathfiletothefile/my_ebookfile.epub" nil)
  org-link-open((link (:type "file" :path "/home/pathfiletothefile/my_ebookfile.epub" :format bracket :raw-link "/home/pathfiletothefile/my_ebookfile.epub" :application nil :search-option nil :begin 2077938 :end 2078198 :contents-begin 2078097 :contents-end 2078196 :post-blank 0 :parent (paragraph (:begin 2077938 :end 2078199 :contents-begin 2077938 :contents-end 2078199 :post-blank 0 :post-affiliated 2077938 :parent (item (:bullet "- " :begin 2077927 :end 2078199 :contents-begin 2077938 :contents-end 2078199 :checkbox on :counter nil :structure (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :pre-blank 0 :post-blank 0 :post-affiliated 2077927 :tag nil :parent (plain-list ...))))))) nil)
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  call-interactively(org-open-at-point nil nil)
  command-execute(org-open-at-point)

This is my configuration of the mode
(use-package nov
  :ensure t
  :mode ("\\.epub\\'" . nov-mode)
  )

and I am using version 20201207.3 on emacs 26.3. There are similar threads here and here but none deals with an invalid version syntax error. I can provide an epub file if necessary, but as I said, this happens in ALL the files in my library. Thank you in advance for any help.


texts: Auctex hook causes an error when set with use-package :hook versus add-hook?

texts:
According to the use-package documentation these two are the same:
(use-package ace-jump-mode
  :hook (prog-mode . ace-jump-mode))

(use-package ace-jump-mode
  :commands ace-jump-mode
  :init
  (add-hook 'prog-mode-hook #'ace-jump-mode))

I have the following in my configs:
(use-package auctex
  :ensure t
  :after latex
  :init
  [snip]
  (add-hook
   'TeX-after-compilation-finished-functions
   #'TeX-revert-document-buffer)
  :hook
  ;; (TeX-after-compilation-finished-functions . TeX-revert-document-buffer) ; Causes errors?
  [snip]

If I take out the add-hook way and uncomments the :hook way then I get the following errors each time I compile a latex document followed by a subsequent pdf buffer revert:
error in process sentinel: image-display-size: Invalid image specification: nil
error in process sentinel: Invalid image specification: nil

Note that when I define the hooks using add-hook, that does not produce the errors.
Could someone tell what's going on?


texts: Org Mode link to open directory in Dired

texts:
I'd like to have a link like

[[file:~/projects][Projects]]

open directly in Dired rather than Finder (I'm on a Mac), which is what it does now.  Is there a way?  (Of course there's a way.  It's Emacs.)


texts: Inline Images not displaying under org-mode

texts:
I was trying to use org-mode to organize my notes as usual and produce some reports, but can't get images to display inline. This used to work in the past, but doesn't seem to work anymore, any tips what I'm doing wrong?
I have a png in the current *.org document folder called audit.png which I linked by adding a link [[file:audit.png][audit image]] but it simply doesn't show up.
When I do C-c C-x C-v to display the image inline it says there aren't any.
This is my emacs version:

And these are my variables controlling the image search (with values below):
image-file-name-extensions
; => ("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm" ...)

image-file-name-regexps
; => nil

If I open the link with C-c C-o I can see the image within emacs though which confuses me even more.
This would help me a lot in work. Thank you for you attention.


texts: How to make 'term' close the buffer when the process exits?

texts:
When I press Ctrl-D in a 'term', the buffer stays open with the text "Process terminal finished".
How can I make this buffer close instead of staying open with this text displayed?

Note, this is similar to this question: How to automatically kill a shell buffer when the shell process exits however the solution there didn't work for 'term'.


texts: Magit continues despite pre-commit hook failing

texts:
I have a pre-commit hook in git that returns nonzero on some "fatal" QA checks.
When using git commit on the command line, git bails out. However, when trying the very same commit in Magit, Magit continues on presenting the commit message buffer.
I would like Magit to bail like git does.
I don't have anything related to Magit in my init file beyond (use-package magit).
Magit version: Magit 20201110.1643, Git 2.26.2, Emacs 27.1, gnu/linux
Magit  process buffer ($):
  1 git … commit --signoff
pre-commit running in /home/titan/repos/gentoo
Running repoman for: app-office/gnucash
      digest.unused                 3
       /home/titan/repos/gentoo/app-office/gnucash::gnucash-3.8b.tar.bz2
       /home/titan/repos/gentoo/app-office/gnucash::gnucash-4.0.tar.bz2
       /home/titan/repos/gentoo/app-office/gnucash::gnucash-4.1.tar.bz2
    Non-Fatal QA errors found
pre-commit done in /home/titan/repos/gentoo
hint: Waiting for your editor to close the file...
Waiting for Emacs...

I've programmed the script to consider unused digest items to be an error. So, the script returns 1.
Edit: Well, I've done nothing...and now it works as expected. Something must have gotten stuck.


texts: magit options when dealing with a failed git-am

texts:
I'm not sure if I'm missing something or if this is a missing feature but occasionally when I attempt to apply a patch from my mail box git completely fails to apply it.

This isn't a case of resolving merge conflicts rather than having to apply the patch by hand. magit helpfully provides a link to the failed patch but there doesn't seem to be an obvious way to launch into ediff from here.

I end up going into the patch, running M-x diff-mode and manually applying the patch (after having to convince it of the root path for files). Am I missing something here? Or is dealing with failed to apply patches too tricky to programaticaly aid?


texts: How to change font size only for the buffer *Org Export Dispatcher*?

texts:
I'm using emacs with a large font, however I do not need the font to be too large on certain buffers and/or modes. For example, when I use neotree I use a different font and a smaller size, I do that like this:

(add-hook 'neotree-mode-hook '(lambda ()
                              (setq buffer-face-mode-face '(:family "Hack" :height 130 :width semi-condensed))
                              (buffer-face-mode)))

I want to achieve the same thing but for the org export dispatch ui, that is, the buffer that appears when exporting an Org file (by using org-export-dispatch). While this window is active I can not use the describe-mode or see the major-mode so I don't know for which mode I should apply the settings.

I've tried this with no effect:

(defun my-buffer-face-mode-fixed ()
   (interactive)
   (setq buffer-face-mode-face '(:family "Hack" :height 130 :width semi-condensed))
   (buffer-face-mode))

(add-hook 'org-export-before-parsing-hook 'my-buffer-face-mode-fixed)

As well as:

(add-hook 'org-export-stack-mode-hook 'my-buffer-face-mode-fixed)

It doesn't work.

What I was thinking was somehow set the font face for a buffer with a specific name, in that case the question is how to change the font face for the *Org Export Dispatcher* buffer?

While looking about how to change the font on a per name basis I found this on the emacswiki:

 (set-specifier (face-background (get-face 'default)) "blue"
                (get-buffer "*scratch*"))

However the set-specifier function is only available in XEmacs, how can I achieve the same thing in GNU Emacs 26.1?


texts: `url-inhibit-uncompression` is ineffective; emulating curl with url.el

texts:
Consider the following:

(let ((url-inhibit-uncompression t))
  (switch-to-buffer
   (url-retrieve-synchronously
    "http://api.stackexchange.com/2.2/filter/create")))

I would expect to get something that looks mostly like garbage as the content (gzipped response), but instead I get a 'reasonable' JSON object (formatted for sanity):

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Credentials: false
X-Content-Type-Options: nosniff
Date: Sat, 01 Nov 2014 03:19:40 GMT
Content-Length: 1903

{
  "quota_remaining": 178,
  "quota_max": 300,
  "has_more": false,
  "items": [
    {
      "filter": "default",
      "filter_type": "safe",
      "included_fields": [
        ".backoff",
        ".error_id",
        ".error_message",
        .................
        "write_permission.min_seconds_between_actions",
        "write_permission.object_type",
        "write_permission.user_id"
      ]
    }
  ]
}

Why is url-inhibit-uncompression not doing anything here?  Spoiler alert: It's not used anywhere in the source (that I can find).  How can I force output similar to curl without using curl (i.e. compressed and without headers)?


texts: Prevent term from asking me which shell to use

texts:
I want to use /bin/bash as default shell for term avoiding it to ask me every time.
Is this possible?


texts: Manage JSON (comments) with org literate programming and tangle

texts:
I would like to manage a JSON config file with added comments on some key-value-pairs and explain options. Since it is not possible to comment in JSON, I thought about using org-mode literate programming and tangle to manage the file.
Questions are:

there is no specific JSON code block, because JSON is not really a language. Which language block should I use instead?
Can I tangle code parts to one single JSON file? Does tangleing insert characters like return between two blocks?
is there a smarter way to manage / comment JSON files in a literate kind of way?


texts: Exporting tables to html with fixed header when scrolling

texts:
I have a rather tall table (200-300 lines) being exported to html.  It would be nice to have the header visible at all times when scrolling to the lower entries.

So far no googling has turned up a builtin solution, although this shows how it can be done in general using only css.


texts: highlight-regexp: what's the variable in which they are stored?

texts:
I need to write a macro, with-temp-highlight-regexps, that evaluates BODY and than restores the previous highlighted regexps (created with the highlight-regexp function). I thought I could do it by let-binding the variable in which this kind of highlights are stored. I read the hi-lock.el file but I'm not so skilled to find the info I need.

Any suggestion?

EDIT. I tried this approach following phils' suggestion:

(defun my-temp-highlights ()
   (interactive)

   (highlight-regexp "STRING 1")

   (let ((hi-lock-interactive-patterns hi-lock-interactive-patterns))
     (highlight-regexp "STRING 2")

     (read-string "\"RETURN\" TO QUIT"))
   )

Running this function should keep STRING 1 highlighted but the STRING 2 highlighting should turn off, keeping the highlight only until RETURN. The strange behaviour (for me) of this function is that the STRING 2 highlight is non turned off when I run hi-lock-mode.

(I know I coud use unhilight-regexp but it is not what I'm searching for.)

EDIT 2. I also the following code to understand what happens:

(defun my-temp-highlights ()
   (interactive)

   (highlight-regexp "STRING 1")
   (princ hi-lock-interactive-patterns)
   (sit-for 5)

   (let ((BACKUP_VAR hi-lock-interactive-patterns))
     (highlight-regexp "STRING 2")
     (princ hi-lock-interactive-patterns)
     (sit-for 5)
     (read-string "ENTER TO QUIT")
     (setq hi-lock-interactive-patterns BACKUP_VAR))

   (princ hi-lock-interactive-patterns)
   (sit-for 5)

     )

But I'm not able to figure out why the second regexp (STRING 2) keeps to be highlighted when the hi-lock-interactive-patterns value is restored. (And why hi-lock-mode turn off does NOT effect it's higlighting).


texts: Helm: helm-find-files: how find files recursive?

texts:
Windows 10, Emacs 25.1

If I want to find file in Helm I use command helm-find-files.
Suppose I want to find in current folder all files with extenstion *.gradle.

Here result:

OK. It's work.

But now I want to find all files with extension *.gradle not only in current folder, but also in all subfolders (recursive). How I can do this by command helm-find-files?


texts: How to efficiently insert citations into LaTeX document with helm-bibtex?

texts:
I'm having a heck of a time optimizing my desired \cite behavior when writing LaTeX source in emacs using helm-bibtex. I made a C-c [ key-binding to get helm-bibtex going when I want to insert a citation:
(autoload 'helm-bibtex "helm-bibtex" "" t)
(global-set-key (kbd "C-c [") 'helm-bibtex-with-local-bibliography)

What I want then is once I press C-c [, I want to start typing the name of a bib key, and when the entry is highlighted, I want to press Enter and it should insert the block \cite{mykey} into the text.
However the current process is so inefficient, I have to do C-c [, start typing until entry is highlighted, press F3, and then it asks me which kind of citation command I want where cite is the default, then it asks for "prenotes", then "postnotes", then FINALLY it inserts the cite block.
How do I get the behavior described first where I just press enter and it inserts cite block, instead of having to press a function key and Enter 3 times?


texts:
How can I get a graph back in my org-babel results for R code?

#+BEGIN_SRC R :results output latex
boxplot(islands)
#+END_SRC

Islands is a baked in dataset for R.

Do you do it with

#+resname:

and org-auto-load-images = T in your .emacs?

resname example


texts: UnicodeEncodeError executing python in Emacs - not in Terminal

texts:
I have a python file which defines a function and calls it.

def remove_whitespace(input_file, output_file):
    with open(input_file) as f:
        f.readlines()
        # do something

If I execute this file in Emacs (version 24.5.1), I recieve the error:

UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 1798: ordinal not in range(128)

I followed the error message and found many known issues relating to encoding. I altered my function to try filtering out anything outside of the ascii range 0-128 (leaving standard-ish only characters). I got the same error messages. So python is unable to read the file in the first place it seems. I should've recognised that sooner.

I then used the codecs module to open the file:

import codecs
with codecs.open(my_file, encoding="utf-8") as f:
    # do something

... but still received the same error.

Just out of curiousity, I exectued the file from terminal with the following:

python3 remove_whitespace.py

which worked! No errors, the output file was as expected.

I looked into elpy's congig with M-x elpy-config and saw that the shell-interpreter-arguments contains an additional -i flag. This simply puts the shell into interactive mode after executing the script, so I assume cannot affect anything.

I then preformed one last test - executing the file from an Emacs terminal: eshell. This gave me the same error as before, which again points the blame to Emacs itself (and less so at elpy!)

Can anybody shed light onto this Emacs/Elpy issue? Where is Emacs assuming/enforcing some encoding? I am not printing those non-ascii characters within my function, so didn't imagine Emacs even tries to interpret them itself.


texts: Can't build org autoloads -- Cannot open load file: cl-lib

texts:
Because of ongoing difficulties with configuring org-mode, I am trying to run org-mode using the development source code repo rather than through the emacs package. I tried the simplest thing I could see, namely running uncompiled .el files, but this requires autoloads to be built, so I tried to build the autoloads. I am unable to build them, getting the following error. How can I fix this?

org 9.1.4, Emacs 25.1.1 on Mac OS X.

make autoloads
======================================================
= Invoke "make help" for a synopsis of make targets. =
= Created a default local.mk template.               =
= Setting "oldorg" as the default target.            =
= Please adapt local.mk to your local setup!         =
======================================================
Loading /Users/lyn_headley/extern/org-mode/lisp/org-compat.el (source)...
Cannot open load file: cl-lib
make: [local.mk] Error 255 (ignored)
/Library/Developer/CommandLineTools/usr/bin/make -C lisp autoloads
rm -f org-version.el org-loaddefs.el org-version.elc org-loaddefs.elc org-install.elc
org-version: 9.1.4 (release_9.1.4)
Loading /Users/lyn_headley/extern/org-mode/lisp/org-compat.el (source)...
Cannot open load file: cl-lib
make[1]: *** [org-version.el] Error 255
make: *** [autoloads] Error 2


texts: EmacsForMacOSX build 27.2-2 cannot be opened on mac M1

texts:
This question is about Emacs 27.2-2 from https://emacsformacosx.com/ on Mac M1. From the release notes1 M1 support should be added since 27.2-1. However, on latest stable version I was getting an error "This application will not run on your computer. Sorry!". How could I get it run on Mac M1? What was the condition that could throw this error? Thanks.
1 Refer to the 2021-03-26 update at https://emacsformacosx.com/about and also https://emacsformacosx.com/download/emacs-builds/Emacs-27.2-2.changes


texts: Is there a command for tidying trailing parentheses?

texts:
When editing lisp code, I often end up with trailing parentheses scattered around (assuming | is point):

(defun example-function ()
  (let ((x (+ 1 1)))
    (when x
      (message x)|
      )
    ))

Are there any convenience commands for fixing this? Either in core Emacs, paredit/smartparens, or other packages?

I know I can press ) and paredit-close-round will fix the next parenthesis, but I want to fix all of them in one command.


texts: Help required wrt. lsp-mode with gopls on Windows natively without WSL

texts:
I am currently running Emacs 27.1 on Windows 10. I am using lsp-mode with gopls with Go installed natively (without WSL). I am running into issues setting it up. Specifically, I am running into: https://github.com/emacs-lsp/lsp-mode/issues/2268
Could anyone currently running gopls on Windows Emacs have it working? Could you share your config and how to make it working on my local?


texts:
I want to center my screen after calling flyspell-goto-next-error. If you have a "direct" solution please let me know, but I encounter the following issue more often:

I'm looking to hook to the invocation of a function, so that I can call my own function afterwards (or before). In this case, I would hook to flyspell-goto-next-error and execute the command to center my screen. Is this possible?

One possible solution is to write my own function that first calls flyspell-goto-next-error, and then performs the screen centering. However, that would require rebinding all instances where this function is called, which is not ideal.


texts: Dired heading directory with text-properties to jump to parent directories

texts:
Speedbar has a nice feature wherein the directory heading at the top of a files/directory buffer contains various text properties for the user to jump to any of the parent directories by placing the cursor on the corresponding name and pressing the enter key.  I took it one step further and placed a text property at point-min to jump to root.

Q:   Is there an existing modification for dired-mode that accomplishes the same thing?  If not, then this thread can be used to create such a new feature.

GOAL -- dired-mode:  For example, the heading directory in dired-mode is:  /Users/HOME/data/emacs/lisp

Placing the cursor at point-min and pressing enter will open a dired buffer at /
Placing the cursor anywhere on the word Users and pressing enter will open a dired buffer at /Users
Placing the cursor anywhere on the word HOME and pressing enter will open a dired buffer at /Users/HOME.
Placing the cursor anywhere on the word data and pressing enter will open a dired buffer at /Users/HOME/data.
Placing the cursor anywhere on the word emacs and pressing enter will open a dired buffer at /Users/HOME/data/emacs.


texts:
My aim is to write dynamic reports which will be generated using a base skeleton file and snippets that correspond to and parametrise the particular issues. These issues are all content-wise similar and can be represented using exactly the same logical structure. The Emacs' org-mode seemed like a perfect solution given the power which comes with org-babel. My question is if there exist an Org Mode Way (tm) to deal with this problem. I will lay out my current approach below, but I hope someone has a less cumbersome solution.

The structure of my org dynamic report as follows,

skeleton.org:

include1.org
include2.org
...

body

where include org files (plugged in using #+INCLUDE:) mostly contain #+MACRO macroname macro definitions and :PROPERTY: blocks.

I was originally intending to use {{{macroname}}} substitutions and to read in the parameters into the skeleton and generate the report. However, while #+MACRO: definitions work within many elements of org-mode, their major drawback is that one cannot substitute them into :var varname=value #+HEADER declarations, or #+CALL source block calls. This is why :PROPERTY: blocks seemed like a right way to go. A property value can be read into a :var with a simple elisp-to-var assignment :var=(org-get-entry nil "prop-name" t).

Unfortunately, as i found out, org-get-entry function works only for properties local to the file and current heading (and its sub-elements with third argument non-nil). This means it will not scan the files I have #+INCLUDE-ed.

My solution to this limitation was to write an elisp function to open a file, search the property entries under a particular heading and return what was found:

(defun tk-org-get-prop (heading prop)
  "Finds a property somewhere under a heading in the current buffer."
  (car (org-map-entries `(org-entry-get nil ,prop t)
                        heading)))

(defun tk-org-get-prop-file (filename heading prop)
  "Finds a property somewhere under a heading in the file."
  (with-current-buffer (find-file-noselect filename)
    (tk-org-get-prop heading prop)))

I can now assign property values under a specific heading in a specific file with :var somevar=(tk-org-get-prop-file "input1.org" ".*property_heading.*" "property_name") .

The aforementioned approach allows me to extract parameters from various input files and substitute them into the skeleton, but it feels hacky and it seems like there has to be a more elegant way to do that.

Ideally, I would like something like dynamic blocks (#+BEGIN :par1 val1 :par2 val2 ... #+END syntax), but generating org code instead of returning a value of some custom-written elisp writer function.


texts:
I wanted to be able to ssh into my google cloud instances with spacemacs. I found:
 https://github.com/dustinfreeman/dustinfreeman.emacs.d/blob/master/init.el#L50

which is based off of:
https://qiita.com/tanatana/items/218b19808f2428b125fe

I added

(require 'tramp)
(add-to-list 'tramp-methods
             '("gcssh"
               (tramp-login-program        "gcloud compute ssh")
               (tramp-login-args           (("%h")))
               (tramp-async-args           (("-q")))
               (tramp-remote-shell         "/bin/sh")
               (tramp-remote-shell-args    ("-c"))
               (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
                                            ("-o" "UserKnownHostsFile=/dev/null")
                                            ("-o" "StrictHostKeyChecking=no")))
               (tramp-default-port         22)))

in my .spacemacs file under the dotspacemacs/user-init function. However, if I spc f f and then type /gcssh: I get the following error in the *debug tramp* buffer.

  backtrace()
  tramp-error(nil user-error "Not a Tramp file name: \"%s\"" "/gcssh:")
  apply(tramp-error nil user-error "Not a Tramp file name: \"%s\"" "/gcssh:")
  tramp-dissect-file-name("/gcssh:")
  helm-ff--create-tramp-name("/gcssh:")
  helm-ff-update-when-only-one-matched()
  run-hooks(helm-after-update-hook)
  helm-log-run-hook(helm-after-update-hook)
  #[0 "\301\206\006\0\303 \304\001\236\204\031\0\211\203\025\0\305\001\306\"\210\307\310!\210\210\300\203N\0\311\312\300\"\210\313 \203I\0\314\313 !r\315\316\317\320\321\005!\322\"\323$\216\324\001@\325\"\210\326\300\301\"\210*\210\202N\0\326\300\301\"\210\327\211\022\207" [nil nil helm--force-updating-p helm-get-current-source candidates-process helm-display-mode-line force helm-log-run-hook helm-after-update-hook helm-log "Update preselect candidate %s" helm-window internal--before-with-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord helm-preselect nil] 7]()
  helm-update()
  helm-check-new-input("/gcssh:")
  helm-check-minibuffer-input()
  #[0 "\010\206\005\0\011?\205 \0\302 r\303\304\305\306\307\005!\310\"\311$\216\312 \210\313 *\262\001\207" [helm-in-persistent-action helm-suspend-update-flag internal--before-save-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-save-selected-window] 2 helm-check-minibuffer-input helm-print-error-messages] 7]()
  apply(#[0 "\010\206\005\0\011?\205 \0\302 r\303\304\305\306\307\005!\310\"\311$\216\312 \210\313 *\262\001\207" [helm-in-persistent-action helm-suspend-update-flag internal--before-save-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-save-selected-window] 2 helm-check-minibuffer-input helm-print-error-messages] 7] nil)
  timer-event-handler([t 0 0 10000 repeat #[0 "\010\206\005\0\011?\205 \0\302 r\303\304\305\306\307\005!\310\"\311$\216\312 \210\313 *\262\001\207" [helm-in-persistent-action helm-suspend-update-flag internal--before-save-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-save-selected-window] 2 helm-check-minibuffer-input helm-print-error-messages] 7] nil idle 0])

Additionally, I tried to use org-babel to connect but nothing happens.

Any ideas, would be greatly appreciated. All the online postings made me believe that it was straight forward. So maybe there is something I'm missing as I am new to emacs,spacemacs, and tramp.


texts:
We can center text with M-x center-region and M-o M-s.  Is there something similar for right-alignment?

Example before:

Item 0: value                                                       |
Item 100: value                                                     |
Item 30: value                                                      |

after:

                                                       Item 0: value|
                                                     Item 100: value|
                                                      Item 30: value|
                                                       fill-column  ^

What's easiest way to right-align text?