Is it possible to add a note with emacs buffers? - emacs

While working on a project, or while browsing code I often open many buffers in emacs. There are often a lot of things that I am seeing in many windows. When the stack in my mind deepens I often forget what particular thing I was looking in some buffer/file which I opened 15-30 mins back. Is there a way where I can add a small note to these buffers when I open them, so I can always go back to them.
Thanks.

I would recommend looking into org mode's agenda feature.
From within the currently open buffer, you can file away a note to review later. You can set deadlines, TODO / WAITING labels, and most importantly, provide a hyperlink that will take you back to the exact location in the buffer you filed the note from. And you can recall the list of stored links from anywhere with a simple keystroke.

An alternative to using Org mode is to set Emacs bookmarks to keep track of places you have been and take notes about them.
You can add a note (an "annotation") to any bookmark when you create it (see option bookmark-use-annotations) or later (see C-x r l), and you can edit such annotations anytime.
With Bookmark+ you can even use temporary bookmarks, which don't get saved, and you can tag bookmarks with any number of tags you invent.
Both annotations and Bookmark+ tags are free-form text. You can search for the text in either annotations or tags across any set of bookmarks. It is easy to organize bookmarks in various ways, including switching among different sets.

Related

VSCode Find / Replace History

New to VSCode and notice there's not a dropdown history of previous find/replace strings. I am also striking out on finding this functionality via extensions.
Most every editor I've ever used has had this, so I find its absence conspicuous.
I see exact and similar feature requests on github, but alas it could never get the required 20+ votes in time before it was closed. I was prepared to open another feature request, but the directions when opening a new feature request state
<!-- Please search existing issues to avoid creating duplicates. -->
so I'm uncertain of the protocol. Does this only mean active tickets?
The closed feature request garnered 9 votes, so there was some interest.
The up/down cursor prompt only works per session and hence, only if you have already done a search. I too use a regular expression routinely from session to session, so I have to open up a notepad file that has my patterns then copy them to the search/replace window. Royal pain.
And I agree, there should be a drop-down.
Use the up and down arrows. There is placeholder text to mention this - see the gif - but it is easy to miss. Not as nice as a dropdown though as you have to cycle through recent entiries.

Refresh org-agenda org-mode

I'm a new user of org-mode and thoroughly enjoying and seeing the benefits it can bring. However, I often want to update my agenda file (it's satisfying). This will read like a 1st world problem, but the only way I've found of refreshing it is by going forward and then backwards in time. Is there a simpler way that I'm missing?
Have you tried typing "r" (no quotes) in agenda mode? See here for the options you have http://orgmode.org/manual/Agenda-commands.html The orgmode manual is big, but you can search within it by adding site:orgmode.org in your online search.

Project switching in emacs

I would like to associate sets of buffers/files in emacs with different projects, and switch from one to other. This would involve closing all the buffers associated with the present project and open the files corresponding to the switched-to-project. I tried setting up desktops using bookmarks+ as suggested in https://emacs.stackexchange.com/questions/315/using-desktop-for-basic-project-management but all buffers remain open. I also tried setting up workgroups using workgroups2 (https://github.com/pashinin/workgroups2), but had similar issues. Is there an existing emacs package that could be used for this?
There is an excellent package called Projectile that does exactly what you describe and more.
Alternative suggestion
I recommend that you don't look to emacs to manage buffers, frames, and editor state separately across projects.
Instead, use a desktop manager and create separate desktops for each project. This works well because not only can you have separate emacs instances (that you can be sure are truly separated), but you can also have separate web browsers open to documentation or other project-specific applications that collectively get swapped in and out when you switch between projects.
You say, "I tried setting up desktops using bookmarks+ as suggested in using-desktop-for-basic-project-management but all buffers remain open.".
I guess you mean that switching to a desktop does not kill buffers that existed before the switch. Not by itself, it doesn't. How can it guess which such pre-existing buffers you want killed?
Clearly you do not want to kill all buffers that existed prior to the desktop switch.
To get the behavior it seems you want, you would need to somehow decide, and specify, which such buffers you would like killed. You could, for example, choose to kill all that have a certain mode (perhaps using desktop-buffer-mode-handlers).
With Bookmark+ you can have bookmarks that do more than one thing. In particular, here, you could create a sequence bookmark that chains together (1) a function bookmark that kills all of the buffers you want to kill and (2) a desktop bookmark.
Or you can perhaps make use of desktop-after-read-hook or desktop-buffer-mode-handlers to do some cleanup.
(But it sounds like you have not really thought through exactly what behavior you want with respect to buffers that you do not want to "remain open", so that you can specify it clearly. If you can specify it then you can probably implement it fairly easily, using either desktop hooks or bookmarks or both. Just a guess.)

How should I provide help for a related set of functions?

I built tfs.el to allow developers to do TFS things (checkout, checkin, etc) from within emacs.
There are 13 interactive commands in the tfs package, like tfs/checkout, tfs/rename, tfs/diff, and so on, and I'd like to be able to provide help on all of them in a single place. An overview of all the available functions.
What's the "emacs way" of doing that? I thought of defining an additional function, like tfs/help , that would invoke describe-function-1 on each of the tfs functions, and then present all that in a TFS-Help buffer.
Is there a better way?
Well, there are many "Emacs way"s.
The most polished would be to write an info page, see the page "Info for Experts", which basically says to use Texinfo and convert that into an info page. You can be as verbose as you want there, and the user can search, use hyperlinks, etc. The user can easily get there via C-h F tfs/checkout.
Another way some folks seem to do it is to write short documentation strings for each of the commands, ending with "see documentation for tfs-mode for details" and put all the common documentation in the docstring for tfs-mode.
Another way some packages document things is with a big comment at the top of the tfs.el file.
Take your pick, they all have trade-offs.
You can use
(describe-bindings "\C-xv")
You have multiple, related commands. So far, I guess, they are related only by their names.
Two possibilities come to mind:
Create a mode for this stuff. Document everything in the doc string of the command that turns the mode on/off. It could be a major mode or a minor mode. If a minor mode it could be buffer-local or global.
Create a group (defgroup) for this stuff and document everything in its doc string.
The basic idea is to somehow actually relate these commands: bundle them together in some way, so you can document them together as the doc for the bundle.
Offhand, without knowing more, my guess is that you might want to create a global minor mode.

PowerBuilder IDE Customization for SCC

Our PowerBuilder application is fairly large and has many objects in several PBLs for organizing our code. We often have 10 or more datawindows on one window, and these datawindows may be spread across two or three PBLs. For version control, we use exclusive check-out to avoid merge conflicts.
The situation is that when you right-click on a datawindow object from the Window painter you get a context-menu with options like "Script" and "Properties" and "Modify Datawindow...". We'd like to add one for "Check-out..." to avoid having to hunt for the datawindow in several PBLs.
Any ideas on how to do this, or something similar, would be greatly appreciated.
I think the best you can do is to create a temporary library at the top of your library list, locate your datawindows by jumping to them via "Modify Datawindow...", then saving them into your temporary library, and finally using the tools in your source control system to locate them by name and lock them.
One other trick that I use is to uncheck the tick box in the source control options that clears down the .srd etc files, then using your operating system's find tools to search on file name for these (since Powerbuilder still doesn't support searching for objects by name...). Of course if you don't have many objects, and if your objects don't have many references, you could always use Powerbuilder's search... but who do you know in the that fortunate position?!!
I think you've hit on a problem that a lot of people run into, which runs right through a loophole in PB that lets you start editing a DataWindow without warning you to check it out. Unfortunately, to the best of my knowledge there is no way to hook into the context menu.
However, you can hook into toolbar items. If that was the way I wanted to go, and I had plenty of time to spare, I'd write an app that I would launch from the toolbar, and here's what it would do:
Find the PowerBuilder window with APIs
Find the current sheet in PB
Get the object name out of the title
Get the current application (registry or PB.INI, depending on the version of PB, and may involve getting the workspace first, then the current target)
Get the library list (PB.INI or target file)
Do a LibraryExport() on the object that's open
Find all DataWindow controls (this may involve looking at ancestors to determine control types)
Identify dataobjects for these controls (again, you may need to look at ancestors)
Use LibraryDirectory() to get a list of all objects in all PBLs
Find the dataobjects' PBLs
Throw up a window listing the dataobjects and their PBLs
OTOH, if I had PBL Peeper (and, yes, this is biased advice), I'd
Launch the "PBL Peeper (Browse current application)" icon on my desktop (OK, that's a lie; I'd already have PBL Peeper open and would just switch to the Browse page)
Ctrl-Q (for QuickFind) and start typing the name of the object (if you pause, it will find a partial match on what you've typed)
Hit [Enter] once to accept QuickFind's selection
Hit [Enter] again to expand the object
Find the DataWindow control in question and RMB on it
Select "Go to Default DataWindow"
If it doesn't show the library and name in the microhelp (it's been a long time since I've released a version, and I can't keep track of what's in the released version), find the Up toolbar item to go up to the PBL
I know this doesn't achieve a checkout, but it does "avoid having to hunt for the datawindow in several PBLs". And, you can probably achieve this faster than my first suggestion.
Good luck,
Terry
The way I do it is to right-click and choose Modify DataWindow. When the painter opens you can just read the PBL from the title of the painter. Then close the DataWindow painter so PB will let you check out the DataWindow. For the more general case of locating an arbitrary user object, use Terry's PBL Peeper method.
You could separate the organization of PBLs used for development from those used for deployment.
As long as the PBL names don't conflict between the two views into the source code. The PBG files registered in source control won't clobber each other.
The downside is that when new objects are added or deleted, you will need to update both locations.
I would create a datawindow only PBL with all the related objects and put them in the same target. When I worked with that sub-system or report i could then check out all the objects in the same library.