So sorry. I forgot to add that "by the hour" simply means over a period of time--hours, in this case. So, the the friends sat around the fire and talked for hours, toasting food and eating it.
The actual quote to which you refer comes from chapter twelve of Harry Potter and the Sorcerer's Stone by J.K. Rowling. This chapter is entitled "The Mirror of Erised" and is one of the two passages Rowling has cited as one of her favorites in the entire series. The Mirror of Erised, of course, is used to reveal the deepest desires of a character's heart.
The quote reads this way:
They sat by the hour eating anything they could spear on a toasting fork--bread, crumpets, marshmallows--and plotting ways of getting Malfoy expelled, which were fun to talk about even if they wouldn't work.
There is no special meaning to any of the words, but Rowling does create an effective image for us with this quote. Imagine this group of friends, sitting around a roaring fire, plotting and scheming (just wishing, really) about ways to get their classmate and enemy (Malfoy) expelled. That would be rather fun and cozy enough; however, Rowling adds another detail by having them eat.
A toasting fork kind of looks like a pitchfork, only much smaller. It generally has either two or three prongs and looks like an oversized fork with a long handle. It is used for toasting things, such as marshmallows, over an open fire. The marshmallows are poked onto the prongs so they will not fall off when the fork is placed over the flame to roast.
In this case, then, the friends are roasting whatever food they can "spear" with the roasting fork: bread, crumpets (something like English muffins), marshmallows. Once they spear these food items, they toast and eat them. It is a comforting thing to do while sitting around a fire with friends.
Thank you but I just want to ask what does by the hour means in the sentence I mentioned.
J K Rowling is a master weaver of expressions that convey the magicality of everyday occurrences as set in Hogwarts and the world that the three wizards inhabit. This particular sentence, I reckon, speaks to the passage of time (hour) as well as to the trio whiling away time and being 'ordinary', for the lack of a better word, which cumulatively implies the solidifying of their friendship.
I hope this helps!